VirtualBox

Changeset 35164 in vbox


Ignore:
Timestamp:
Dec 16, 2010 8:17:52 AM (14 years ago)
Author:
vboxsync
Message:

Main/Appliance: handle exporting of VMs with DVD drives attached to arbitrary controllers, and also allow multiple DVD drives

File:
1 edited

Legend:

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

    r34505 r35164  
    10871087    uint32_t ulInstanceID = 1;
    10881088
     1089    uint32_t cDVDs = 0;
     1090
    10891091    for (size_t uLoop = 1; uLoop <= 2; ++uLoop)
    10901092    {
     
    13541356                    if (uLoop == 2)
    13551357                    {
    1356                         // we can't have a CD without an IDE controller
    1357                         if (!idIDESecondaryController)
    1358                             throw setError(VBOX_E_NOT_SUPPORTED,
    1359                                             tr("Can't have CD-ROM without secondary IDE controller"));
    1360 
    13611358                        strDescription = "CD-ROM Drive";
    1362                         strCaption = "cdrom1";          // this is what OVFTool writes
     1359                        strCaption = Utf8StrFmt("cdrom%RI32", ++cDVDs);     // OVFTool starts with 1
    13631360                        type = ovf::ResourceType_CDDrive; // 15
    13641361                        lAutomaticAllocation = 1;
    1365                         ulParent = idIDESecondaryController;
    1366                         lAddressOnParent = 0;           // this is what OVFTool writes
     1362
     1363                        // controller=<index>;channel=<c>
     1364                        size_t pos1 = desc.strExtraConfigCurrent.find("controller=");
     1365                        size_t pos2 = desc.strExtraConfigCurrent.find("channel=");
     1366                        int32_t lControllerIndex = -1;
     1367                        if (pos1 != Utf8Str::npos)
     1368                        {
     1369                            RTStrToInt32Ex(desc.strExtraConfigCurrent.c_str() + pos1 + 11, NULL, 0, &lControllerIndex);
     1370                            if (lControllerIndex == lIDEPrimaryControllerIndex)
     1371                                ulParent = idIDEPrimaryController;
     1372                            else if (lControllerIndex == lIDESecondaryControllerIndex)
     1373                                ulParent = idIDESecondaryController;
     1374                            else if (lControllerIndex == lSCSIControllerIndex)
     1375                                ulParent = idSCSIController;
     1376                            else if (lControllerIndex == lSATAControllerIndex)
     1377                                ulParent = idSATAController;
     1378                        }
     1379                        if (pos2 != Utf8Str::npos)
     1380                            RTStrToInt32Ex(desc.strExtraConfigCurrent.c_str() + pos2 + 8, NULL, 0, &lAddressOnParent);
     1381
     1382                        LogFlowFunc(("DVD drive details: pos1=%d, pos2=%d, lControllerIndex=%d, lIDEPrimaryControllerIndex=%d, lIDESecondaryControllerIndex=%d, ulParent=%d, lAddressOnParent=%d\n",
     1383                                     pos1, pos2, lControllerIndex, lIDEPrimaryControllerIndex, lIDESecondaryControllerIndex, ulParent, lAddressOnParent));
     1384
     1385                        if (    !ulParent
     1386                             || lAddressOnParent == -1
     1387                           )
     1388                            throw setError(VBOX_E_NOT_SUPPORTED,
     1389                                            tr("Missing or bad extra config string in DVD drive medium: \"%s\""), desc.strExtraConfigCurrent.c_str());
     1390
     1391                        // there is no DVD drive map to update because it is
     1392                        // handled completely with this entry.
    13671393                    }
    13681394                break;
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