VirtualBox

Changeset 46290 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
May 27, 2013 3:26:15 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
86035
Message:

Main/ApplianceImplExport.cpp: rearrange handling of appliance description lists, always allow the user to override (especially important for the description of a VM, as it defaults to the VM description which some people might not want to export)
Frontends/VBoxManage: finally implement changing the VM description from command line, and also add a way to provide a VM description on export

File:
1 edited

Legend:

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

    r46169 r46290  
    995995
    996996    std::list<VirtualSystemDescriptionEntry*> llName = vsdescThis->findByType(VirtualSystemDescriptionType_Name);
    997     if (llName.size() != 1)
    998         throw setError(VBOX_E_NOT_SUPPORTED,
    999                         tr("Missing VM name"));
    1000     Utf8Str &strVMName = llName.front()->strVboxCurrent;
     997    if (!llName.size())
     998        throw setError(VBOX_E_NOT_SUPPORTED, tr("Missing VM name"));
     999    Utf8Str &strVMName = llName.back()->strVboxCurrent;
    10011000    pelmVirtualSystem->setAttribute("ovf:id", strVMName);
    10021001
     
    10071006    std::list<VirtualSystemDescriptionEntry*> llVendorUrl = vsdescThis->findByType(VirtualSystemDescriptionType_VendorUrl);
    10081007    std::list<VirtualSystemDescriptionEntry*> llVersion = vsdescThis->findByType(VirtualSystemDescriptionType_Version);
    1009     bool fProduct = llProduct.size() && !llProduct.front()->strVboxCurrent.isEmpty();
    1010     bool fProductUrl = llProductUrl.size() && !llProductUrl.front()->strVboxCurrent.isEmpty();
    1011     bool fVendor = llVendor.size() && !llVendor.front()->strVboxCurrent.isEmpty();
    1012     bool fVendorUrl = llVendorUrl.size() && !llVendorUrl.front()->strVboxCurrent.isEmpty();
    1013     bool fVersion = llVersion.size() && !llVersion.front()->strVboxCurrent.isEmpty();
     1008    bool fProduct = llProduct.size() && !llProduct.back()->strVboxCurrent.isEmpty();
     1009    bool fProductUrl = llProductUrl.size() && !llProductUrl.back()->strVboxCurrent.isEmpty();
     1010    bool fVendor = llVendor.size() && !llVendor.back()->strVboxCurrent.isEmpty();
     1011    bool fVendorUrl = llVendorUrl.size() && !llVendorUrl.back()->strVboxCurrent.isEmpty();
     1012    bool fVersion = llVersion.size() && !llVersion.back()->strVboxCurrent.isEmpty();
    10141013    if (fProduct ||
    10151014        fProductUrl ||
     
    10381037        pelmAnnotationSection->createChild("Info")->addContent("Meta-information about the installed software");
    10391038        if (fProduct)
    1040             pelmAnnotationSection->createChild("Product")->addContent(llProduct.front()->strVboxCurrent);
     1039            pelmAnnotationSection->createChild("Product")->addContent(llProduct.back()->strVboxCurrent);
    10411040        if (fVendor)
    1042             pelmAnnotationSection->createChild("Vendor")->addContent(llVendor.front()->strVboxCurrent);
     1041            pelmAnnotationSection->createChild("Vendor")->addContent(llVendor.back()->strVboxCurrent);
    10431042        if (fVersion)
    1044             pelmAnnotationSection->createChild("Version")->addContent(llVersion.front()->strVboxCurrent);
     1043            pelmAnnotationSection->createChild("Version")->addContent(llVersion.back()->strVboxCurrent);
    10451044        if (fProductUrl)
    1046             pelmAnnotationSection->createChild("ProductUrl")->addContent(llProductUrl.front()->strVboxCurrent);
     1045            pelmAnnotationSection->createChild("ProductUrl")->addContent(llProductUrl.back()->strVboxCurrent);
    10471046        if (fVendorUrl)
    1048             pelmAnnotationSection->createChild("VendorUrl")->addContent(llVendorUrl.front()->strVboxCurrent);
     1047            pelmAnnotationSection->createChild("VendorUrl")->addContent(llVendorUrl.back()->strVboxCurrent);
    10491048    }
    10501049
     
    10521051    std::list<VirtualSystemDescriptionEntry*> llDescription = vsdescThis->findByType(VirtualSystemDescriptionType_Description);
    10531052    if (llDescription.size() &&
    1054         !llDescription.front()->strVboxCurrent.isEmpty())
     1053        !llDescription.back()->strVboxCurrent.isEmpty())
    10551054    {
    10561055        /*  <Section ovf:required="false" xsi:type="ovf:AnnotationSection_Type">
     
    10691068
    10701069        pelmAnnotationSection->createChild("Info")->addContent("A human-readable annotation");
    1071         pelmAnnotationSection->createChild("Annotation")->addContent(llDescription.front()->strVboxCurrent);
     1070        pelmAnnotationSection->createChild("Annotation")->addContent(llDescription.back()->strVboxCurrent);
    10721071    }
    10731072
     
    10751074    std::list<VirtualSystemDescriptionEntry*> llLicense = vsdescThis->findByType(VirtualSystemDescriptionType_License);
    10761075    if (llLicense.size() &&
    1077         !llLicense.front()->strVboxCurrent.isEmpty())
     1076        !llLicense.back()->strVboxCurrent.isEmpty())
    10781077    {
    10791078        /* <EulaSection>
     
    10911090
    10921091        pelmEulaSection->createChild("Info")->addContent("License agreement for the virtual system");
    1093         pelmEulaSection->createChild("License")->addContent(llLicense.front()->strVboxCurrent);
     1092        pelmEulaSection->createChild("License")->addContent(llLicense.back()->strVboxCurrent);
    10941093    }
    10951094
    10961095    // operating system
    10971096    std::list<VirtualSystemDescriptionEntry*> llOS = vsdescThis->findByType(VirtualSystemDescriptionType_OS);
    1098     if (llOS.size() != 1)
    1099         throw setError(VBOX_E_NOT_SUPPORTED,
    1100                         tr("Missing OS type"));
     1097    if (!llOS.size())
     1098        throw setError(VBOX_E_NOT_SUPPORTED, tr("Missing OS type"));
    11011099    /*  <OperatingSystemSection ovf:id="82">
    11021100            <Info>Guest Operating System</Info>
    11031101            <Description>Linux 2.6.x</Description>
    11041102        </OperatingSystemSection> */
    1105     VirtualSystemDescriptionEntry *pvsdeOS = llOS.front();
     1103    VirtualSystemDescriptionEntry *pvsdeOS = llOS.back();
    11061104    xml::ElementNode *pelmOperatingSystemSection;
    11071105    if (enFormat == ovf::OVFVersion_0_9)
     
    19591957                if (pDiskEntry->type == VirtualSystemDescriptionType_HardDiskImage)
    19601958                {
    1961                     rc = pSourceDisk->exportFile(strTargetFilePath.c_str(), 
    1962                                                  format, 
    1963                                                  MediumVariant_VmdkStreamOptimized, 
     1959                    rc = pSourceDisk->exportFile(strTargetFilePath.c_str(),
     1960                                                 format,
     1961                                                 MediumVariant_VmdkStreamOptimized,
    19641962                                                 pIfIo,
    1965                                                  pStorage, 
     1963                                                 pStorage,
    19661964                                                 pProgress2);
    19671965                    if (FAILED(rc)) throw rc;
     
    19721970                    rc = pSourceDisk->exportFile(strTargetFilePath.c_str(),
    19731971                                                 formatTemp,
    1974                                                  MediumVariant_Standard, 
     1972                                                 MediumVariant_Standard,
    19751973                                                 pIfIo,
    1976                                                  pStorage, 
     1974                                                 pStorage,
    19771975                                                 pProgress2);
    19781976                    if (FAILED(rc)) throw rc;
Note: See TracChangeset for help on using the changeset viewer.

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