VirtualBox

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


Ignore:
Timestamp:
Jul 30, 2021 12:41:38 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
146024
Message:

Main/Appliance: Allow arbitrary unique resource IDs, not just integers. The OVF spec examples and the vast majority of OVF files use purely integers (and appliance export in VirtualBox also uses integers), but the type declaration allows any string.

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ApplianceImpl.h

    r86650 r90424  
    306306
    307307    std::list<VirtualSystemDescriptionEntry*> i_findByType(VirtualSystemDescriptionType_T aType);
    308     const VirtualSystemDescriptionEntry* i_findControllerFromID(uint32_t id);
     308    const VirtualSystemDescriptionEntry* i_findControllerFromID(const Utf8Str &id);
    309309
    310310    void i_importVBoxMachineXML(const xml::ElementNode &elmMachine);
  • trunk/src/VBox/Main/src-server/ApplianceImpl.cpp

    r86650 r90424  
    17571757 * virtual disk.
    17581758 */
    1759 const VirtualSystemDescriptionEntry* VirtualSystemDescription::i_findControllerFromID(uint32_t id)
    1760 {
    1761     Utf8Str strRef = Utf8StrFmt("%RI32", id);
     1759const VirtualSystemDescriptionEntry* VirtualSystemDescription::i_findControllerFromID(const Utf8Str &id)
     1760{
    17621761    vector<VirtualSystemDescriptionEntry>::const_iterator it;
    17631762    for (it = m->maDescriptions.begin();
     
    17731772            case VirtualSystemDescriptionType_HardDiskControllerVirtioSCSI:
    17741773            case VirtualSystemDescriptionType_HardDiskControllerSAS:
    1775                 if (d.strRef == strRef)
     1774                if (d.strRef == id)
    17761775                    return &d;
    17771776                break;
  • trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp

    r86509 r90424  
    511511                    }
    512512#endif /* VBOX_WITH_E1000 */
     513                    else if (   !ea.strAdapterType.compare("VirtioNet", Utf8Str::CaseInsensitive)
     514                             || !ea.strAdapterType.compare("virtio-net", Utf8Str::CaseInsensitive)
     515                             || !ea.strAdapterType.compare("3", Utf8Str::CaseInsensitive))
     516                        nwAdapterVBox = NetworkAdapterType_Virtio;
    513517
    514518                    pNewDesc->i_addEntry(VirtualSystemDescriptionType_NetworkAdapter,
     
    572576            {
    573577                const ovf::HardDiskController &hdc = hdcIt->second;
    574                 Utf8Str strControllerID = Utf8StrFmt("%RI32", (uint32_t)hdc.idController);
    575578
    576579                switch (hdc.system)
     
    588591                                strType = "ICH6";
    589592                            pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE,
    590                                                  strControllerID,         // strRef
    591                                                  hdc.strControllerType,   // aOvfValue
    592                                                  strType);                // aVBoxValue
     593                                                 hdc.strIdController,       // strRef
     594                                                 hdc.strControllerType,     // aOvfValue
     595                                                 strType);                  // aVBoxValue
    593596                        }
    594597                        else
     
    609612                            /* We only support a plain AHCI controller, so use them always */
    610613                            pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerSATA,
    611                                                  strControllerID,
     614                                                 hdc.strIdController,
    612615                                                 hdc.strControllerType,
    613616                                                 "AHCI");
     
    640643                                hdcController = "BusLogic";
    641644                            pNewDesc->i_addEntry(vsdet,
    642                                                  strControllerID,
     645                                                 hdc.strIdController,
    643646                                                 hdc.strControllerType,
    644647                                                 hdcController);
     
    650653                                            vsysThis.strName.c_str(),
    651654                                            hdc.strControllerType.c_str(),
    652                                             strControllerID.c_str());
     655                                            hdc.strIdController.c_str());
    653656                        ++cSCSIused;
    654657                    break;
     
    659662                        {
    660663                            pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerVirtioSCSI,
    661                                                  strControllerID,
     664                                                 hdc.strIdController,
    662665                                                 hdc.strControllerType,
    663666                                                 "VirtioSCSI");
     
    753756
    754757                    /* find the description for the storage controller
    755                      * that has the same ID as hd.idController */
     758                     * that has the same ID as hd.strIdController */
    756759                    const VirtualSystemDescriptionEntry *pController;
    757                     if (!(pController = pNewDesc->i_findControllerFromID(hd.idController)))
     760                    if (!(pController = pNewDesc->i_findControllerFromID(hd.strIdController)))
    758761                        throw setError(E_FAIL,
    759                                        tr("Cannot find storage controller with OVF instance ID %RI32 "
     762                                       tr("Cannot find storage controller with OVF instance ID \"%s\" "
    760763                                          "to which medium \"%s\" should be attached"),
    761                                        hd.idController,
     764                                       hd.strIdController,
    762765                                       di.strHref.c_str());
    763766
     
    13171320
    13181321    int vrc = VINF_SUCCESS;
     1322    /** @todo r=klaus This should be a MultiResult, because this can cause
     1323     * multiple errors and warnings which should be relevant for the caller.
     1324     * Needs some work, because there might be errors which need to be
     1325     * excluded if they happen in error recovery code paths. */
    13191326    HRESULT hrc = S_OK;
    13201327    bool fKeepDownloadedObject = false;//in the future should be passed from the caller
     
    17891796                    //It's thought that SATA is supported by any OS types
    17901797                    hdc.system = ovf::HardDiskController::SATA;
    1791                     hdc.idController = 0;
     1798                    hdc.strIdController = "0";
    17921799
    17931800                    GET_VSD_DESCRIPTION_BY_TYPE(VirtualSystemDescriptionType_HardDiskControllerSATA)//aVBoxValues is set in this #define
     
    17981805
    17991806                    LogRel(("%s: Hard disk controller type is %s\n", __FUNCTION__, hdc.strControllerType.c_str()));
    1800                     vsys.mapControllers[hdc.idController] = hdc;
     1807                    vsys.mapControllers[hdc.strIdController] = hdc;
    18011808
    18021809                    if (aVBoxValues.size() == 0)
     
    20302037
    20312038                            ovf::VirtualDisk vd;
    2032                             vd.idController = vsys.mapControllers[0].idController;
     2039                            vd.strIdController = vsys.mapControllers[0].strIdController;
    20332040                            vd.ulAddressOnParent = 0;
    20342041                            vd.strDiskId = d.strDiskId;
     
    50195026
    50205027                // find the hard disk controller to which we should attach
    5021                 ovf::HardDiskController hdc = (*vsysThis.mapControllers.find(ovfVdisk.idController)).second;
     5028                ovf::HardDiskController hdc = (*vsysThis.mapControllers.find(ovfVdisk.strIdController)).second;
    50225029
    50235030                // this is for rollback later
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