VirtualBox

Changeset 67190 in vbox for trunk


Ignore:
Timestamp:
Jun 1, 2017 7:42:17 AM (7 years ago)
Author:
vboxsync
Message:

Main: ApplianceImplExport.cpp: Got VBOX_WITH_NEW_TAR_CREATOR mostly done and working.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp

    r67184 r67190  
    19941994
    19951995#ifdef VBOX_WITH_NEW_TAR_CREATOR
    1996     HRESULT hrc = E_NOTIMPL;
    1997     AssertFailed();
    1998     RT_NOREF(pTask, writeLock);
    1999 
    2000     /** @todo need a FSS creator wrapper around a directory here.   */
     1996    /*
     1997     * Create write-to-dir file system stream for the target directory.
     1998     * This unifies the disk access with the TAR based OVA variant.
     1999     */
     2000    HRESULT         hrc;
     2001    int             vrc;
     2002    RTVFSFSSTREAM   hVfsFss2Dir = NIL_RTVFSFSSTREAM;
     2003    try
     2004    {
     2005        Utf8Str strTargetDir(pTask->locInfo.strPath);
     2006        strTargetDir.stripFilename();
     2007        vrc = RTVfsFsStrmToNormalDir(strTargetDir.c_str(), 0 /*fFlags*/, &hVfsFss2Dir);
     2008        if (RT_SUCCESS(vrc))
     2009            hrc = S_OK;
     2010        else
     2011            hrc = setErrorVrc(vrc, tr("Failed to open directory '%s' (%Rrc)"), strTargetDir.c_str(), vrc);
     2012    }
     2013    catch (std::bad_alloc)
     2014    {
     2015        hrc = E_OUTOFMEMORY;
     2016    }
     2017    if (SUCCEEDED(hrc))
     2018    {
     2019        /*
     2020         * Join i_writeFSOVA.  On failure, delete (undo) anything we might
     2021         * have written to the disk before failing.
     2022         */
     2023        hrc = i_writeFSImpl(pTask, writeLock, hVfsFss2Dir);
     2024        if (FAILED(hrc))
     2025            RTVfsFsStrmToDirUndo(hVfsFss2Dir);
     2026        RTVfsFsStrmRelease(hVfsFss2Dir);
     2027    }
    20012028
    20022029    LogFlowFuncLeave();
     
    20682095    if (RT_SUCCESS(vrc))
    20692096    {
    2070         /** @todo which format does the standard dicate here actually?
     2097        /** @todo which format does the standard dictate here actually?
    20712098         *  GNU or USTAR/POSIX? */
    20722099        RTVFSFSSTREAM hVfsFssTar;
     
    21812208            /* Construct the OVF name. */
    21822209            Utf8Str strOvfFile(pTask->locInfo.strPath);
     2210#ifdef VBOX_WITH_NEW_TAR_CREATOR
     2211            strOvfFile.stripPath().stripSuffix().append(".ovf");
     2212#else
    21832213            strOvfFile.stripSuffix().append(".ovf");
     2214#endif
    21842215
    21852216            /* Render a valid ovf document into a memory buffer. */
     
    22832314            const Utf8Str &strTargetFileNameOnly = pDiskEntry->strOvf;
    22842315            // target path needs to be composed from where the output OVF is
     2316#ifdef VBOX_WITH_NEW_TAR_CREATOR
     2317            const Utf8Str &strTargetFilePath = strTargetFileNameOnly;
     2318#else
    22852319            Utf8Str strTargetFilePath(pTask->locInfo.strPath);
    22862320            strTargetFilePath.stripFilename()
    22872321                .append("/")
    22882322                .append(strTargetFileNameOnly);
     2323#endif
    22892324
    22902325            // The exporting requests a lock on the media tree. So leave our lock temporary.
     
    25002535                {
    25012536                    RTVFSOBJ hVfsObjManifest = RTVfsObjFromIoStream(hVfsIosManifest);
    2502                     vrc = RTVfsFsStrmAdd(hVfsFssDst, strMfFilePath.c_str(), hVfsObjManifest, 0 /*fFlags*/);
     2537                    vrc = RTVfsFsStrmAdd(hVfsFssDst, strMfFileName.c_str(), hVfsObjManifest, 0 /*fFlags*/);
    25032538                    if (RT_SUCCESS(vrc))
    25042539                        rc = S_OK;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette