VirtualBox

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


Ignore:
Timestamp:
May 26, 2020 10:39:05 AM (5 years ago)
Author:
vboxsync
Message:

bugref:9745. Added basic support of virtio-scsi controller into OVF export\import.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r84326 r84532  
    39573957  <enum
    39583958    name="VirtualSystemDescriptionType"
    3959     uuid="9078595f-74cf-4454-8787-34a8f72beed5"
     3959    uuid="6e18c6d7-e1b7-4cb0-9706-1f31d18248f8"
    39603960    >
    39613961    <desc>Used with <link to="IVirtualSystemDescription" /> to describe the type of
     
    40254025    <const name="CloudPublicSSHKey" value="48" />
    40264026    <const name="BootingFirmware" value="49" />
     4027    <const name="HardDiskControllerVirtioSCSI" value="60" />
    40274028  </enum>
    40284029
  • trunk/src/VBox/Main/include/ovfreader.h

    r82968 r84532  
    535535    uint32_t                idController;       // instance ID (Item/InstanceId); this gets referenced from VirtualDisk
    536536
    537     enum ControllerSystemType { IDE, SATA, SCSI };
    538     ControllerSystemType    system;             // one of IDE, SATA, SCSI
     537    enum ControllerSystemType { IDE, SATA, SCSI, VIRTIOSCSI };
     538    ControllerSystemType    system;             // one of IDE, SATA, SCSI, VIRTIOSCSI
    539539
    540540    RTCString        strControllerType;
  • trunk/src/VBox/Main/src-server/ApplianceImpl.cpp

    r84153 r84532  
    17701770            case VirtualSystemDescriptionType_HardDiskControllerSATA:
    17711771            case VirtualSystemDescriptionType_HardDiskControllerSCSI:
     1772            case VirtualSystemDescriptionType_HardDiskControllerVirtioSCSI:
    17721773            case VirtualSystemDescriptionType_HardDiskControllerSAS:
    17731774                if (d.strRef == strRef)
  • trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp

    r83794 r84532  
    187187        int32_t lSATAControllerIndex = 0;
    188188        int32_t lSCSIControllerIndex = 0;
     189        int32_t lVirtioSCSIControllerIndex = 0;
    189190
    190191        /* Fetch all available storage controllers */
     
    196197        ComPtr<IStorageController> pSATAController;
    197198        ComPtr<IStorageController> pSCSIController;
     199        ComPtr<IStorageController> pVirtioSCSIController;
    198200        ComPtr<IStorageController> pSASController;
    199201        for (size_t j = 0; j < nwControllers.size(); ++j)
     
    214216                     && pSASController.isNull())
    215217                pSASController = nwControllers[j];
     218            else if (   eType == StorageBus_VirtioSCSI
     219                     && pVirtioSCSIController.isNull())
     220                pVirtioSCSIController = nwControllers[j];
    216221        }
    217222
     
    294299        }
    295300
     301        if (!pVirtioSCSIController.isNull())
     302        {
     303            StorageControllerType_T ctlr;
     304            rc = pVirtioSCSIController->COMGETTER(ControllerType)(&ctlr);
     305            if (SUCCEEDED(rc))
     306            {
     307                Utf8Str strVBox = "VirtioSCSI";       // the default in VBox
     308                switch (ctlr)
     309                {
     310                    case StorageControllerType_VirtioSCSI: strVBox = "VirtioSCSI"; break;
     311                    default: break; /* Shut up MSC. */
     312                }
     313                lVirtioSCSIControllerIndex = (int32_t)pNewDesc->m->maDescriptions.size();
     314                pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerVirtioSCSI,
     315                                     Utf8StrFmt("%d", lVirtioSCSIControllerIndex),
     316                                     strVBox,
     317                                     strVBox);
     318            }
     319            else
     320                throw rc;
     321        }
     322
    296323//     <const name="HardDiskImage" value="9" />
    297324//     <const name="Floppy" value="18" />
     
    339366                Utf8Str strStBus;
    340367                if ( storageBus == StorageBus_IDE)
    341                 strStBus = "IDE";
     368                    strStBus = "IDE";
    342369                else if ( storageBus == StorageBus_SATA)
    343                 strStBus = "SATA";
     370                    strStBus = "SATA";
    344371                else if ( storageBus == StorageBus_SCSI)
    345                 strStBus = "SCSI";
     372                    strStBus = "SCSI";
    346373                else if ( storageBus == StorageBus_SAS)
    347                 strStBus = "SAS";
     374                    strStBus = "SAS";
     375                else if ( storageBus == StorageBus_VirtioSCSI)
     376                    strStBus = "VirtioSCSI";
     377
    348378                LogRel(("Warning: skip the medium (bus: %s, slot: %d, port: %d). No storage device attached.\n",
    349379                strStBus.c_str(), lDevice, lChannel));
     
    516546                    break;
    517547
     548                case StorageBus_VirtioSCSI:
     549                    lChannelVsys = lChannel;        // should be between 0 and 255
     550                    lControllerVsys = lVirtioSCSIControllerIndex;
     551                    break;
     552
    518553                case StorageBus_SCSI:
    519554                case StorageBus_SAS:
     
    896931    }
    897932
    898     // we need to do that as otherwise Task won't be created successfully
    899     /// @todo r=bird: What's 'that' here exactly?
     933    // Create a progress object here otherwise Task won't be created successfully
    900934    HRESULT hrc = aProgress.createObject();
    901935    if (SUCCEEDED(hrc))
     
    14791513    uint32_t idSCSIController = 0;
    14801514    int32_t lSCSIControllerIndex = 0;
     1515    uint32_t idVirtioSCSIController = 0;
     1516    int32_t lVirtioSCSIControllerIndex = 0;
    14811517
    14821518    uint32_t ulInstanceID = 1;
     
    16911727                    break;
    16921728
     1729
     1730                case VirtualSystemDescriptionType_HardDiskControllerVirtioSCSI:
     1731                    /*  <Item>
     1732                            <rasd:Caption>VirtioSCSIController0</rasd:Caption>
     1733                            <rasd:Description>VirtioSCSI Controller</rasd:Description>
     1734                            <rasd:InstanceId>4</rasd:InstanceId>
     1735                            <rasd:ResourceType>20</rasd:ResourceType>
     1736                            <rasd:Address>0</rasd:Address>
     1737                            <rasd:BusNumber>0</rasd:BusNumber>
     1738                        </Item>
     1739                    */
     1740                    if (uLoop == 1)
     1741                    {
     1742                        strDescription = "VirtioSCSI Controller";
     1743                        strCaption = "virtioSCSIController0";
     1744                        type = ovf::ResourceType_OtherStorageDevice; // 20
     1745                        lAddress = 0;
     1746                        lBusNumber = 0;
     1747                        strResourceSubType = "VirtioSCSI";
     1748                        // remember this ID
     1749                        idVirtioSCSIController = ulInstanceID;
     1750                        lVirtioSCSIControllerIndex = lIndexThis;
     1751                    }
     1752                    break;
     1753
    16931754                case VirtualSystemDescriptionType_HardDiskImage:
    16941755                    /*  <Item>
     
    17271788                            else if (lControllerIndex == lSATAControllerIndex)
    17281789                                ulParent = idSATAController;
     1790                            else if (lControllerIndex == lVirtioSCSIControllerIndex)
     1791                                ulParent = idVirtioSCSIController;
    17291792                        }
    17301793                        if (pos2 != Utf8Str::npos)
  • trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp

    r84531 r84532  
    563563            uint16_t cSATAused = 0; NOREF(cSATAused);
    564564            uint16_t cSCSIused = 0; NOREF(cSCSIused);
     565            uint16_t cVIRTIOSCSIused = 0; NOREF(cVIRTIOSCSIused);
     566
    565567            ovf::ControllersMap::const_iterator hdcIt;
    566568            /* Iterate through all storage controllers */
     
    651653                        ++cSCSIused;
    652654                    break;
     655
     656                    case ovf::HardDiskController::VIRTIOSCSI:
     657                        /* Check for the constrains */
     658                        if (cVIRTIOSCSIused < 1)
     659                        {
     660                            pNewDesc->i_addEntry(VirtualSystemDescriptionType_HardDiskControllerVirtioSCSI,
     661                                                 strControllerID,
     662                                                 hdc.strControllerType,
     663                                                 "VirtioSCSI");
     664                        }
     665                        else
     666                        {
     667                            /* Warn only once */
     668                            if (cVIRTIOSCSIused == 1)
     669                                i_addWarning(tr("The virtual system \"%s\" requests support for more than one "
     670                                                "VirtioSCSI controller, but VirtualBox has support for only one"),
     671                                                vsysThis.strName.c_str());
     672
     673                        }
     674                        ++cVIRTIOSCSIused;
     675                    break;
     676
    653677                }
    654678            }
     
    39443968        }
    39453969
     3970        case ovf::HardDiskController::VIRTIOSCSI:
     3971            controllerName = "VirtioSCSI";
     3972            lControllerPort = (long)ulAddressOnParent;
     3973            lDevice = (long)0;
     3974            break;
     3975
    39463976        default: break;
    39473977    }
     
    46554685        rc = pController->COMSETTER(ControllerType)(StorageControllerType_LsiLogicSas);
    46564686        if (FAILED(rc)) throw rc;
     4687    }
     4688
     4689
     4690    /* Storage controller VirtioSCSI */
     4691    std::list<VirtualSystemDescriptionEntry*> vsdeHDCVirtioSCSI =
     4692        vsdescThis->i_findByType(VirtualSystemDescriptionType_HardDiskControllerVirtioSCSI);
     4693    if (vsdeHDCVirtioSCSI.size() > 1)
     4694        throw setError(VBOX_E_FILE_ERROR,
     4695                       tr("Too many VirtioSCSI controllers in OVF; import facility only supports one"));
     4696    if (!vsdeHDCVirtioSCSI.empty())
     4697    {
     4698        ComPtr<IStorageController> pController;
     4699        Utf8Str strName("VirtioSCSI");
     4700        const Utf8Str &hdcVBox = vsdeHDCVirtioSCSI.front()->strVBoxCurrent;
     4701        if (hdcVBox == "VirtioSCSI")
     4702        {
     4703            rc = pNewMachine->AddStorageController(Bstr(strName).raw(),
     4704                                                   StorageBus_VirtioSCSI,
     4705                                                   pController.asOutParam());
     4706            if (FAILED(rc)) throw rc;
     4707
     4708            rc = pController->COMSETTER(ControllerType)(StorageControllerType_VirtioSCSI);
     4709            if (FAILED(rc)) throw rc;
     4710        }
     4711        else
     4712            throw setError(VBOX_E_FILE_ERROR,
     4713                           tr("Invalid VirtioSCSI controller type \"%s\""),
     4714                           hdcVBox.c_str());
    46574715    }
    46584716
  • trunk/src/VBox/Main/xml/ovfreader.cpp

    r82968 r84532  
    662662                            vsys.mapControllers[i.ulInstanceID] = hdc;
    663663                        }
     664                        else if ( i.strResourceSubType.compare("VirtioSCSI", RTCString::CaseInsensitive) == 0 )
     665                        {
     666                            HardDiskController hdc;
     667                            hdc.system = HardDiskController::VIRTIOSCSI;
     668                            hdc.idController = i.ulInstanceID;
     669                            //<rasd:ResourceSubType>VirtioSCSI</rasd:ResourceSubType>
     670                            hdc.strControllerType = i.strResourceSubType;
     671                            vsys.mapControllers[i.ulInstanceID] = hdc;
     672                        }
    664673                        else
    665674                            throw OVFLogicError(N_("Error reading \"%s\": Host resource of type \"Other Storage Device (%d)\" is supported with SATA AHCI controllers only, line %d (subtype:%s)"),
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