VirtualBox

Changeset 32448 in vbox


Ignore:
Timestamp:
Sep 13, 2010 2:24:06 PM (14 years ago)
Author:
vboxsync
Message:

Main-OVF: make manifest file creation optional

Location:
trunk/src/VBox
Files:
9 edited

Legend:

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

    r31976 r32448  
    342342        RTPrintf("VBoxManage export           <machines> --output|-o <ovf>\n"
    343343                 "                            [--legacy09]\n"
     344                 "                            [--manifest]\n"
    344345                 "                            [--vsys <number of virtual system>]\n"
    345346                 "                                    [--product <product name>]\n"
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageImport.cpp

    r30681 r32448  
    726726        { "--output",             'o', RTGETOPT_REQ_STRING },
    727727        { "--legacy09",           'l', RTGETOPT_REQ_NOTHING },
     728        { "--manifest",           'm', RTGETOPT_REQ_NOTHING },
    728729        { "--vsys",               's', RTGETOPT_REQ_UINT32 },
    729730        { "--product",            'p', RTGETOPT_REQ_STRING },
     
    742743    Utf8Str strOutputFile;
    743744    Utf8Str strOvfFormat("ovf-1.0"); // the default export version
     745    bool fManifest = false; // the default
    744746    std::list< ComPtr<IMachine> > llMachines;
    745747
     
    771773                case 'l':   // --legacy09
    772774                     strOvfFormat = "ovf-0.9";
     775                break;
     776
     777                case 'm':   // --manifest
     778                     fManifest = true;
    773779                break;
    774780
     
    950956        else
    951957            pszAbsFilePath = RTPathAbsDup(strOutputFile.c_str());
    952         CHECK_ERROR_BREAK(pAppliance, Write(Bstr(strOvfFormat), Bstr(pszAbsFilePath), progress.asOutParam()));
     958        CHECK_ERROR_BREAK(pAppliance, Write(Bstr(strOvfFormat), fManifest, Bstr(pszAbsFilePath), progress.asOutParam()));
    953959        RTStrFree(pszAbsFilePath);
    954960
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIExportApplianceWzd.cpp

    r31676 r32448  
    530530    if (fi.suffix().toLower() == "ovf")
    531531    {
    532         files << fi.baseName() + ".mf";
     532        if (m_pSelectManifest->isChecked())
     533            files << fi.baseName() + ".mf";
    533534        CVirtualSystemDescriptionVector vsds = appliance->GetVirtualSystemDescriptions();
    534535        for (int i = 0; i < vsds.size(); ++ i)
     
    600601    /* Write the appliance */
    601602    const QString version = m_pSelectOVF09->isChecked() ? "ovf-0.9" : "ovf-1.0";
    602     CProgress progress = appliance.Write(version, uri());
     603    CProgress progress = appliance.Write(version, m_pSelectManifest->isChecked() /* fManifest */, uri());
    603604    bool fResult = appliance.isOk();
    604605    if (fResult)
  • trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIExportApplianceWzdPage4.ui

    r28800 r32448  
    22<ui version="4.0">
    33 <comment>
    4  VBox frontends: Qt4 GUI ("VirtualBox"):
     4 VBox frontends: Qt4 GUI (&quot;VirtualBox&quot;):
    55
    66     Copyright (C) 2009-2010 Oracle Corporation
     
    1010     you can redistribute it and/or modify it under the terms of the GNU
    1111     General Public License (GPL) as published by the Free Software
    12      Foundation, in version 2 as it comes in the "COPYING" file of the
     12     Foundation, in version 2 as it comes in the &quot;COPYING&quot; file of the
    1313     VirtualBox OSE distribution. VirtualBox OSE is distributed in the
    1414     hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
     
    3030   </sizepolicy>
    3131  </property>
    32   <layout class="QVBoxLayout" name="m_pLayout1">
    33    <property name="bottomMargin" >
    34     <number>0</number>
    35    </property>
     32  <layout class="QVBoxLayout" name="verticalLayout">
    3633   <item>
    3734    <widget class="QILabel" name="m_pPage4Text1">
     
    140137   </item>
    141138   <item>
     139    <widget class="QCheckBox" name="m_pSelectManifest">
     140     <property name="toolTip">
     141      <string>Create a Manifest file for automatic data integrity checks on import.</string>
     142     </property>
     143     <property name="text">
     144      <string>Write &amp;Manifest file</string>
     145     </property>
     146    </widget>
     147   </item>
     148   <item>
    142149    <spacer name="m_pSpacer1">
     150     <property name="orientation">
     151      <enum>Qt::Vertical</enum>
     152     </property>
    143153     <property name="sizeHint" stdset="0">
    144154      <size>
    145        <width>0</width>
    146        <height>174</height>
     155       <width>579</width>
     156       <height>144</height>
    147157      </size>
    148158     </property>
  • trunk/src/VBox/Main/ApplianceImpl.cpp

    r31677 r32448  
    825825        }
    826826        case ImportFileWithManifest:
    827         case WriteFile:
    828827        {
    829828            ++cOperations;          // another one for creating the manifest
     
    832831            m->ulWeightForManifestOperation = m->ulTotalDisksMB / 10;
    833832            ulTotalOperationsWeight += m->ulWeightForManifestOperation;
     833            if (fOVA)
     834            {
     835                // Another operation for packing
     836                ++cOperations;
     837
     838                // assume that packing the files into the archive has the same weight than creating all files in the ovf exporting step
     839                ulTotalOperationsWeight += m->ulTotalDisksMB;
     840            }
     841            break;
     842        }
     843        case WriteFile:
     844        {
     845            // assume that creating the manifest will take 10% of the time it takes to export the disks
     846            if (m->fManifest)
     847            {
     848                ++cOperations;          // another one for creating the manifest
     849
     850                m->ulWeightForManifestOperation = m->ulTotalDisksMB / 10;
     851                ulTotalOperationsWeight += m->ulWeightForManifestOperation;
     852            }
    834853            if (fOVA)
    835854            {
  • trunk/src/VBox/Main/ApplianceImplExport.cpp

    r32064 r32448  
    552552 * @return
    553553 */
    554 STDMETHODIMP Appliance::Write(IN_BSTR format, IN_BSTR path, IProgress **aProgress)
     554STDMETHODIMP Appliance::Write(IN_BSTR format, BOOL fManifest, IN_BSTR path, IProgress **aProgress)
    555555{
    556556    if (!path) return E_POINTER;
     
    573573                        tr("Appliance file must have .ovf or .ova extension"));
    574574
     575    m->fManifest = !!fManifest;
    575576    Utf8Str strFormat(format);
    576577    OVFFormat ovfF;
     
    16171618        writer.write(pTask->locInfo.strPath.c_str(), false /*fSafe*/);
    16181619
    1619         // Create & write the manifest file
    1620         Utf8Str strMfFile = manifestFileName(pTask->locInfo.strPath.c_str());
    1621         const char *pcszManifestFileOnly = RTPathFilename(strMfFile.c_str());
    1622         pTask->pProgress->SetNextOperation(BstrFmt(tr("Creating manifest file '%s'"), pcszManifestFileOnly),
    1623                                            m->ulWeightForManifestOperation);     // operation's weight, as set up with the IProgress originally);
    1624 
    1625         const char** ppManifestFiles = (const char**)RTMemAlloc(sizeof(char*)*diskList.size() + 1);
    1626         ppManifestFiles[0] = pTask->locInfo.strPath.c_str();
    1627         list<Utf8Str>::const_iterator it1;
    1628         size_t i = 1;
    1629         for (it1 = diskList.begin();
    1630              it1 != diskList.end();
    1631              ++it1, ++i)
    1632             ppManifestFiles[i] = (*it1).c_str();
    1633         int vrc = RTManifestWriteFiles(strMfFile.c_str(), ppManifestFiles, diskList.size()+1, NULL, NULL);
    1634         RTMemFree(ppManifestFiles);
    1635         if (RT_FAILURE(vrc))
    1636             throw setError(VBOX_E_FILE_ERROR,
    1637                            tr("Could not create manifest file '%s' (%Rrc)"),
    1638                            pcszManifestFileOnly, vrc);
     1620        if (m->fManifest)
     1621        {
     1622            // Create & write the manifest file
     1623            Utf8Str strMfFile = manifestFileName(pTask->locInfo.strPath.c_str());
     1624            const char *pcszManifestFileOnly = RTPathFilename(strMfFile.c_str());
     1625            pTask->pProgress->SetNextOperation(BstrFmt(tr("Creating manifest file '%s'"), pcszManifestFileOnly),
     1626                                               m->ulWeightForManifestOperation);     // operation's weight, as set up with the IProgress originally);
     1627
     1628            const char** ppManifestFiles = (const char**)RTMemAlloc(sizeof(char*)*diskList.size() + 1);
     1629            ppManifestFiles[0] = pTask->locInfo.strPath.c_str();
     1630            list<Utf8Str>::const_iterator it1;
     1631            size_t i = 1;
     1632            for (it1 = diskList.begin();
     1633                 it1 != diskList.end();
     1634                 ++it1, ++i)
     1635                ppManifestFiles[i] = (*it1).c_str();
     1636            int vrc = RTManifestWriteFiles(strMfFile.c_str(), ppManifestFiles, diskList.size()+1, NULL, NULL);
     1637            RTMemFree(ppManifestFiles);
     1638            if (RT_FAILURE(vrc))
     1639                throw setError(VBOX_E_FILE_ERROR,
     1640                               tr("Could not create manifest file '%s' (%Rrc)"),
     1641                               pcszManifestFileOnly, vrc);
     1642        }
    16391643    }
    16401644    catch (iprt::Error &x)  // includes all XML exceptions
     
    17201724            throw setError(VBOX_E_FILE_ERROR,
    17211725                           tr("Cannot find source file '%s' (%Rrc)"), strTmpOvf.c_str(), vrc);
     1726        ULONG ulWeight = m->ulWeightForXmlOperation;
    17221727        /* Add the OVF file */
    17231728        filesList.push_back(strTmpOvf); /* Use 1% of the total for the OVF file upload */
    1724         Utf8Str strMfFile = manifestFileName(strTmpOvf);
    1725         filesList.push_back(strMfFile); /* Use 1% of the total for the manifest file upload */
    1726 
    1727         ULONG ulWeight = 2 * m->ulWeightForXmlOperation;
     1729        /* Add the manifest file */
     1730        if (m->fManifest)
     1731        {
     1732            Utf8Str strMfFile = manifestFileName(strTmpOvf);
     1733            filesList.push_back(strMfFile); /* Use 1% of the total for the manifest file upload */
     1734            ulWeight += m->ulWeightForXmlOperation;
     1735        }
     1736
    17281737        /* Now add every disks of every virtual system */
    17291738        list< ComObjPtr<VirtualSystemDescription> >::const_iterator it;
     
    17531762            }
    17541763        }
     1764        ulWeight = m->ulTotalDisksMB;
    17551765        paFiles = (const char**)RTMemAlloc(sizeof(char*) * filesList.size());
    17561766        int i = 0;
     
    18741884        /* Add the OVF file */
    18751885        filesList.push_back(pair<Utf8Str, ULONG>(strTmpOvf, m->ulWeightForXmlOperation)); /* Use 1% of the total for the OVF file upload */
    1876         Utf8Str strMfFile = manifestFileName(strTmpOvf);
    1877         filesList.push_back(pair<Utf8Str, ULONG>(strMfFile , m->ulWeightForXmlOperation)); /* Use 1% of the total for the manifest file upload */
     1886        /* Add the manifest file */
     1887        if (m->fManifest)
     1888        {
     1889            Utf8Str strMfFile = manifestFileName(strTmpOvf);
     1890            filesList.push_back(pair<Utf8Str, ULONG>(strMfFile , m->ulWeightForXmlOperation)); /* Use 1% of the total for the manifest file upload */
     1891        }
    18781892
    18791893        /* Now add every disks of every virtual system */
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r32398 r32448  
    23912391  <interface
    23922392     name="IAppliance" extends="$unknown"
    2393      uuid="fb61a4fc-57e7-48d6-859b-71f37d484cf2"
     2393     uuid="7b148032-4124-4f46-b56a-b48ac1273f5a"
    23942394     wsmap="managed"
    23952395     >
     
    26212621        </desc>
    26222622      </param>
     2623      <param name="manifest" type="boolean" dir="in">
     2624        <desc>
     2625            Indicate if the optional manifest file (.mf) should be written. The manifest file
     2626            is used for integrity checks prior import.
     2627        </desc>
     2628      </param>
    26232629      <param name="path" type="wstring" dir="in">
    26242630          <desc>
     
    26272633          </desc>
    26282634      </param>
    2629       <param name="aProgress" type="IProgress" dir="return">
     2635      <param name="progress" type="IProgress" dir="return">
    26302636        <desc>Progress object to track the operation completion.</desc>
    26312637      </param>
     
    26332639
    26342640    <method name="getWarnings">
    2635         <desc>Returns textual warnings which occured during execution of <link to="#interpret" />.</desc>
     2641        <desc>Returns textual warnings which occurred during execution of <link to="#interpret" />.</desc>
    26362642
    26372643        <param name="aWarnings" type="wstring" dir="return" safearray="yes">
  • trunk/src/VBox/Main/include/ApplianceImpl.h

    r31676 r32448  
    9393    /* Export methods */
    9494    STDMETHOD(CreateVFSExplorer)(IN_BSTR aURI, IVFSExplorer **aExplorer);
    95     STDMETHOD(Write)(IN_BSTR format, IN_BSTR path, IProgress **aProgress);
     95    STDMETHOD(Write)(IN_BSTR format, BOOL fManifest, IN_BSTR path, IProgress **aProgress);
    9696
    9797    STDMETHOD(GetWarnings)(ComSafeArrayOut(BSTR, aWarnings));
  • trunk/src/VBox/Main/include/ApplianceImplPrivate.h

    r31676 r32448  
    4848
    4949    Data()
    50       : state(ApplianceIdle),
    51         pReader(NULL)
     50      : state(ApplianceIdle)
     51      , fManifest(true)
     52      , pReader(NULL)
    5253    {
    5354    }
     
    6566
    6667    LocationInfo        locInfo;        // location info for the currently processed OVF
     68    bool                fManifest;      // Create a manifest file on export
    6769
    6870    ovf::OVFReader      *pReader;
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