VirtualBox

Changeset 67208 in vbox for trunk


Ignore:
Timestamp:
Jun 1, 2017 1:32:35 PM (7 years ago)
Author:
vboxsync
Message:

Main,VBoxManage: More OPC hacking. Seems to be working now.

Location:
trunk/src/VBox
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageAppliance.cpp

    r67194 r67208  
    943943    { "--ovf10",                '1', RTGETOPT_REQ_NOTHING },
    944944    { "--ovf20",                '2', RTGETOPT_REQ_NOTHING },
    945     { "--opc",                  'c', RTGETOPT_REQ_STRING },
     945    { "--opc10",                'c', RTGETOPT_REQ_NOTHING },
    946946    { "--manifest",             'm', RTGETOPT_REQ_NOTHING },    // obsoleted by --options
    947947    { "--iso",                  'I', RTGETOPT_REQ_NOTHING },    // obsoleted by --options
     
    10071007
    10081008                case 'c':   // --opc
    1009                     strOvfFormat = "opc";
     1009                    strOvfFormat = "opc-1.0";
    10101010                    break;
    10111011
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r67194 r67208  
    926926        RTStrmPrintf(pStrm,
    927927                           "%s export %s          <machines> --output|-o <name>.<ovf/ova/tar.gz>\n"
    928                      "                            [--legacy09|--ovf09|--ovf10|--ovf20|--opc]\n"
     928                     "                            [--legacy09|--ovf09|--ovf10|--ovf20|--opc10]\n"
    929929                     "                            [--manifest]\n"
    930930                     "                            [--iso]\n"
  • trunk/src/VBox/Main/Makefile.kmk

    r67203 r67208  
    374374        $(if $(VBOX_WITH_NEW_USB_CODE_ON_DARWIN),VBOX_WITH_NEW_USB_CODE_ON_DARWIN,)
    375375endif
    376 if defined(VBOX_WITH_NEW_TAR_CREATOR) #|| "$(USERNAME)" == "bird" # temporary
     376if defined(VBOX_WITH_NEW_TAR_CREATOR) || "$(USERNAME)" == "bird" # temporary
    377377 VBoxSVC_DEFS += VBOX_WITH_NEW_TAR_CREATOR
    378378endif
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r67195 r67208  
    33763376        <desc>
    33773377            Output format, as a string. Currently supported formats are "ovf-0.9", "ovf-1.0",
    3378             "ovf-2.0" and "opc"; future versions of VirtualBox may support additional formats.
    3379             The "opc" format is for creating tarballs for the Oracle Public Cloud.
     3378            "ovf-2.0" and "opc-1.0"; future versions of VirtualBox may support additional formats.
     3379            The "opc-1.0" format is for creating tarballs for the Oracle Public Cloud.
    33803380        </desc>
    33813381      </param>
     
    33863386          <desc>
    33873387              Name of appliance file to create.  There are certain restrictions with regard
    3388               to the file name suffix.  If the format parameter is "opc" a <tt>.tar.gz</tt>
     3388              to the file name suffix.  If the format parameter is "opc-1.0" a <tt>.tar.gz</tt>
    33893389              suffix is required.  Otherwise the suffix must either be <tt>.ovf</tt> or
    33903390              <tt>.ova</tt>, depending on whether the appliance is distributed as a set of
  • trunk/src/VBox/Main/include/ApplianceImpl.h

    r67193 r67208  
    221221    HRESULT i_writeFSOPC(TaskOVF *pTask, AutoWriteLockBase& writeLock);
    222222#ifdef VBOX_WITH_NEW_TAR_CREATOR
    223     HRESULT i_writeFSImpl(TaskOVF *pTask, AutoWriteLockBase &writeLock, RTVFSFSSTREAM hVfsFssDst,
    224                           bool fOvfFile = true, bool fStreamOptimizedVmdk = true);
     223    HRESULT i_writeFSImpl(TaskOVF *pTask, AutoWriteLockBase &writeLock, RTVFSFSSTREAM hVfsFssDst);
    225224    HRESULT i_writeBufferToFile(RTVFSFSSTREAM hVfsFssDst, const char *pszFilename, const void *pvContent, size_t cbContent);
    226225#else
  • trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp

    r67203 r67208  
    354354
    355355                Utf8Str strName = Utf8Str(locInfo.strPath).stripPath().stripSuffix();
     356                if (locInfo.strPath.endsWith(".tar.gz", Utf8Str::CaseSensitive))
     357                    strName.stripSuffix();
    356358                strTargetImageName = Utf8StrFmt("%s-disk%.3d.vmdk", strName.c_str(), ++pAppliance->m->cDisks);
    357359                if (strTargetImageName.length() > RTTAR_NAME_MAX)
     
    681683    else if (aFormat == "ovf-2.0")
    682684        ovfF = ovf::OVFVersion_2_0;
    683     else if (aFormat == "opc")
     685    else if (aFormat == "opc-1.0")
    684686        ovfF = ovf::OVFVersion_unknown;
    685687    else
     
    23272329                                                   pDiskEntry->ulSizeMB);     // operation's weight, as set up
    23282330                                                                              // with the IProgress originally
    2329                 ///*
    2330                 // * We threat the harddisks are raw images, but since they typically
    2331                 // * require a lot more setup and configuration compares to ISOs, we
    2332                 // * don't bother trying sharing code here (yet).
    2333                 // */
    2334                 //if (pDiskEntry->type == VirtualSystemDescriptionType_HardDiskImage)
    2335                     hrc = ptrSourceDisk->i_addRawToFss(strInsideName.c_str(), m->m_pSecretKeyStore, hVfsFssTar /*, pProgress2*/);
    2336                 //else if (pDiskEntry->type == VirtualSystemDescriptionType_CDROM)
    2337                 //{
    2338                 //    /* Open the source image and cast it to a VFS base object. */
    2339                 //    RTVFSFILE hVfsSrcFile;
    2340                 //    vrc = RTVfsFileOpenNormal(strSrcFilePath.c_str(),
    2341                 //                              RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE,
    2342                 //                              &hVfsSrcFile);
    2343                 //    if (RT_FAILURE(vrc))
    2344                 //        throw setErrorBoth(VBOX_E_FILE_ERROR, vrc,
    2345                 //                           tr("Could not create or open file '%s' (%Rrc)"), strSrcFilePath.c_str(), vrc);
    2346                 //
    2347                 //    RTVFSOBJ hVfsSrc = RTVfsObjFromFile(hVfsSrcFile);
    2348                 //    RTVfsFileRelease(hVfsSrcFile);
    2349                 //    AssertStmt(hVfsSrc != NIL_RTVFSOBJ, throw VERR_INTERNAL_ERROR);
    2350                 //
    2351                 //    /* Add it to the output stream.  This will pull in all the data from the object. */
    2352                 //    vrc = RTVfsFsStrmAdd(hVfsFssTar, strInsideName.c_str(), hVfsSrc, 0 /*fFlags*/);
    2353                 //    RTVfsObjRelease(hVfsSrc);
    2354                 //    if (RT_FAILURE(vrc))
    2355                 //        throw setErrorBoth(VBOX_E_FILE_ERROR, vrc,  tr("Error during copy CD/DVD image '%s' (%Rrc)"),
    2356                 //                           strSrcFilePath.c_str(), vrc);
    2357                 //}
    2358                 //else
    2359                 //    AssertFailedStmt(throw E_UNEXPECTED);
     2331                hrc = ptrSourceDisk->i_addRawToFss(strInsideName.c_str(), m->m_pSecretKeyStore, hVfsFssTar /*, pProgress2*/);
    23602332                if (FAILED(hrc))
    23612333                    throw hrc;
     
    24072379
    24082380#ifdef VBOX_WITH_NEW_TAR_CREATOR
    2409 HRESULT Appliance::i_writeFSImpl(TaskOVF *pTask, AutoWriteLockBase &writeLock, RTVFSFSSTREAM hVfsFssDst,
    2410                                  bool fOvfFile /*= true*/, bool fStreamOptimizedVmdk /*= true*/)
     2381HRESULT Appliance::i_writeFSImpl(TaskOVF *pTask, AutoWriteLockBase &writeLock, RTVFSFSSTREAM hVfsFssDst)
    24112382#else
    24122383HRESULT Appliance::i_writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVDINTERFACEIO pIfIo, PSHASTORAGE pStorage)
     
    24462417                       pTask->enFormat != ovf::OVFVersion_unknown ? pTask->enFormat : ovf::OVFVersion_2_0);
    24472418
    2448 #ifdef VBOX_WITH_NEW_TAR_CREATOR
    2449             if (fOvfFile)
    2450 #endif
    24512419            {
    24522420                void *pvBuf = NULL;
     
    25792547#ifdef VBOX_WITH_NEW_TAR_CREATOR
    25802548                    /* For compressed VMDK fun, we let i_exportFile produce the image bytes. */
    2581                     if (fStreamOptimizedVmdk)
    2582                     {
    2583                         RTVFSIOSTREAM hVfsIosDst;
    2584                         vrc = RTVfsFsStrmPushFile(hVfsFssDst, strTargetFilePath.c_str(), UINT64_MAX,
    2585                                                   NULL /*paObjInfo*/, 0 /*cObjInfo*/, RTVFSFSSTRM_PUSH_F_STREAM, &hVfsIosDst);
    2586                         if (RT_FAILURE(vrc))
    2587                             throw setErrorVrc(vrc, tr("RTVfsFsStrmPushFile failed for '%s' (%Rrc)"), strTargetFilePath.c_str(), vrc);
    2588                         hVfsIosDst = i_manifestSetupDigestCalculationForGivenIoStream(hVfsIosDst, strTargetFilePath.c_str(),
    2589                                                                                       false /*fRead*/);
    2590                         if (hVfsIosDst == NIL_RTVFSIOSTREAM)
    2591                             throw setError(E_FAIL, "i_manifestSetupDigestCalculationForGivenIoStream(%s)", strTargetFilePath.c_str());
    2592 
    2593                         rc = pSourceDisk->i_exportFile(strTargetFilePath.c_str(),
    2594                                                        format,
    2595                                                        MediumVariant_VmdkStreamOptimized,
    2596                                                        m->m_pSecretKeyStore,
    2597                                                        hVfsIosDst,
    2598                                                        pProgress2);
    2599                         RTVfsIoStrmRelease(hVfsIosDst);
    2600                         if (FAILED(rc)) throw rc;
    2601                     }
    2602                     /* When creating sparse raw images, the tar creator stream pulls the data
    2603                        out of the disk image.  It will scan for empty space first, then copy
    2604                        the non-empty segments into the tar stream. */
    2605                     else
    2606                     {
    2607                         throw E_NOTIMPL;
    2608                     }
     2549                    RTVFSIOSTREAM hVfsIosDst;
     2550                    vrc = RTVfsFsStrmPushFile(hVfsFssDst, strTargetFilePath.c_str(), UINT64_MAX,
     2551                                              NULL /*paObjInfo*/, 0 /*cObjInfo*/, RTVFSFSSTRM_PUSH_F_STREAM, &hVfsIosDst);
     2552                    if (RT_FAILURE(vrc))
     2553                        throw setErrorVrc(vrc, tr("RTVfsFsStrmPushFile failed for '%s' (%Rrc)"), strTargetFilePath.c_str(), vrc);
     2554                    hVfsIosDst = i_manifestSetupDigestCalculationForGivenIoStream(hVfsIosDst, strTargetFilePath.c_str(),
     2555                                                                                  false /*fRead*/);
     2556                    if (hVfsIosDst == NIL_RTVFSIOSTREAM)
     2557                        throw setError(E_FAIL, "i_manifestSetupDigestCalculationForGivenIoStream(%s)", strTargetFilePath.c_str());
     2558
     2559                    rc = pSourceDisk->i_exportFile(strTargetFilePath.c_str(),
     2560                                                   format,
     2561                                                   MediumVariant_VmdkStreamOptimized,
     2562                                                   m->m_pSecretKeyStore,
     2563                                                   hVfsIosDst,
     2564                                                   pProgress2);
     2565                    RTVfsIoStrmRelease(hVfsIosDst);
     2566                    if (FAILED(rc)) throw rc;
    26092567#else
    26102568                    rc = pSourceDisk->i_exportFile(strTargetFilePath.c_str(),
     
    26302588
    26312589#ifdef VBOX_WITH_NEW_TAR_CREATOR
    2632                     /* Open the source image and cast it to a VFS base object. */
    2633                     RTVFSFILE hVfsSrcFile;
    2634                     vrc = RTVfsFileOpenNormal(strSrcFilePath.c_str(),
    2635                                               RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE,
    2636                                               &hVfsSrcFile);
    2637                     if (RT_FAILURE(vrc))
    2638                         throw setErrorBoth(VBOX_E_FILE_ERROR, vrc,
    2639                                            tr("Could not create or open file '%s' (%Rrc)"), strSrcFilePath.c_str(), vrc);
    2640 
    2641                     RTVFSOBJ hVfsSrc = RTVfsObjFromFile(hVfsSrcFile);
    2642                     RTVfsFileRelease(hVfsSrcFile);
    2643                     AssertStmt(hVfsSrc != NIL_RTVFSOBJ, throw VERR_INTERNAL_ERROR);
    2644 
    2645                     /* Add it to the output stream.  This will pull in all the data from the object. */
    2646                     vrc = RTVfsFsStrmAdd(hVfsFssDst, strTargetFilePath.c_str(), hVfsSrc, 0 /*fFlags*/);
    2647                     RTVfsObjRelease(hVfsSrc);
    2648                     if (RT_FAILURE(vrc))
    2649                         throw setErrorBoth(VBOX_E_FILE_ERROR, vrc,  tr("Error during copy CD/DVD image '%s' (%Rrc)"),
    2650                                            strSrcFilePath.c_str(), vrc);
     2590                    rc = pSourceDisk->i_addRawToFss(strTargetFilePath.c_str(), m->m_pSecretKeyStore, hVfsFssDst /*, pProgress2*/);
     2591                    if (FAILED(rc)) throw rc;
    26512592#else
    26522593                    /* Read the ISO file and add one to OVA/OVF package */
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