VirtualBox

Changeset 16298 in vbox


Ignore:
Timestamp:
Jan 28, 2009 11:35:52 AM (16 years ago)
Author:
vboxsync
Message:

OVF: copy disk image & attach it to the IDE controller for now

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

Legend:

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

    r16248 r16298  
    2323#include <iprt/stream.h>
    2424#include <iprt/path.h>
     25#include <iprt/dir.h>
     26#include <iprt/file.h>
    2527
    2628#include "ApplianceImpl.h"
     
    132134    uint32_t             idController;           // instance ID (Item/InstanceId); this gets referenced from HardDisk
    133135    ControllerSystemType controllerSystem;       // one of IDE, SATA, SCSI
    134     string               strControllerType;      // controller type (Item/ResourceSubType); e.g. "LsiLogic"; can be empty (esp. for IDE)
     136    string               strControllerType;      // controllertype (Item/ResourceSubType); e.g. "LsiLogic"; can be empty (esp. for IDE)
    135137    string               strAddress;             // for IDE
    136138    uint32_t             ulBusNumber;            // for IDE
     
    154156};
    155157
     158typedef map<string, VirtualDisk> VirtualDisksMap;
     159
    156160struct VirtualSystem
    157161{
     
    174178            // (one for each VirtualSystem/Item[@ResourceType=6] element with accumulated data from children)
    175179
    176     list<VirtualDisk>   llVirtualDisks;
     180    VirtualDisksMap     mapVirtualDisks;
    177181            // (one for each VirtualSystem/Item[@ResourceType=17] element with accumulated data from children)
    178182
     
    713717                                            i.ulLineNumber);
    714718
    715                         d.llVirtualDisks.push_back(vd);
     719                        d.mapVirtualDisks[vd.strDiskId] = vd;
    716720                    }
    717721                    break;
     
    913917    //  - don't use COM methods but the methods directly (faster, but needs appropriate locking of that objects itself (s. HardDisk2))
    914918    //  - Appropriate handle errors like not supported file formats
     919    AutoCaller autoCaller(this);
     920    CheckComRCReturnRC(autoCaller.rc());
    915921
    916922    HRESULT rc = S_OK;
     
    921927
    922928    /* We need the default path for storing disk images */
    923     ISystemProperties *systemProps = NULL;
    924     rc = mVirtualBox->COMGETTER(SystemProperties)(&systemProps);
     929    ComPtr<ISystemProperties> systemProps;
     930    rc = mVirtualBox->COMGETTER(SystemProperties)(systemProps.asOutParam());
    925931    ComAssertComRCThrowRC(rc);
    926932    BSTR defaultHardDiskLocation;
     
    11241130                }
    11251131        }
    1126         vsd->addEntry(VirtualSystemDescriptionType_OS, 0, toString<ULONG>(vs.cimos), osTypeVBox);
     1132        vsd->addEntry(VirtualSystemDescriptionType_OS, "", toString<ULONG>(vs.cimos), osTypeVBox);
    11271133
    11281134        /* VM name */
     
    11331139            nameVBox = osTypeVBox;
    11341140        searchUniqueVMName(nameVBox);
    1135         vsd->addEntry(VirtualSystemDescriptionType_Name, 0, vs.strName, nameVBox);
     1141        vsd->addEntry(VirtualSystemDescriptionType_Name, "", vs.strName, nameVBox);
    11361142
    11371143        /* Now that we know the base system get our internal defaults based on that. */
    1138         IGuestOSType *osType = NULL;
    1139         rc = mVirtualBox->GetGuestOSType(Bstr(Utf8Str(osTypeVBox.c_str())), &osType);
     1144        ComPtr<IGuestOSType> osType;
     1145        rc = mVirtualBox->COMGETTER(GuestOSType)(Bstr(Utf8Str(osTypeVBox.c_str())), osType.asOutParam());
    11401146        ComAssertComRCThrowRC(rc);
    11411147
     
    11451151        if (vs.cCPUs == 0)
    11461152            cpuCountVBox = 1;
    1147         vsd->addEntry(VirtualSystemDescriptionType_CPU, 0, toString<ULONG>(vs.cCPUs), toString<ULONG>(cpuCountVBox));
     1153        vsd->addEntry(VirtualSystemDescriptionType_CPU, "", toString<ULONG>(vs.cCPUs), toString<ULONG>(cpuCountVBox));
    11481154
    11491155        /* RAM */
     
    11591165            ullMemSizeVBox = memSizeVBox2 * _1M;
    11601166        }
    1161         vsd->addEntry(VirtualSystemDescriptionType_Memory, 0, toString<uint64_t>(vs.ullMemorySize), toString<uint64_t>(ullMemSizeVBox));
     1167        vsd->addEntry(VirtualSystemDescriptionType_Memory, "", toString<uint64_t>(vs.ullMemorySize), toString<uint64_t>(ullMemSizeVBox));
    11621168
    11631169        /* Hard disk Controller */
     
    11801186                        else if (!RTStrICmp(hdc.strControllerType.c_str(), "PIIX4"))
    11811187                            hdcController = IDEControllerType_PIIX4;
    1182                         vsd->addEntry(VirtualSystemDescriptionType_HarddiskControllerIDE, hdc.idController, hdc.strControllerType, toString<ULONG>(hdcController));
     1188                        vsd->addEntry(VirtualSystemDescriptionType_HarddiskControllerIDE, toString<uint32_t>(hdc.idController), hdc.strControllerType, toString<ULONG>(hdcController));
    11831189                        break;
    11841190                    }
     1191#ifdef VBOX_WITH_AHCI
    11851192                case SATA:
    11861193                    {
    11871194                        // @todo: figure out the SATA types
    11881195                        /* We only support a plain AHCI controller, so use them always */
    1189                         vsd->addEntry(VirtualSystemDescriptionType_HarddiskControllerSATA, hdc.idController, hdc.strControllerType, "AHCI");
     1196                        vsd->addEntry(VirtualSystemDescriptionType_HarddiskControllerSATA, toString<uint32_t>(hdc.idController), hdc.strControllerType, "AHCI");
    11901197                        break;
    11911198                    }
     1199#endif /* VBOX_WITH_AHCI */
     1200#ifdef VBOX_WITH_SCSI
    11921201                case SCSI:
    11931202                    {
     1203                        // @todo: figure out the SCSI types
     1204# ifdef VBOX_WITH_LSILOGIC
    11941205                        string hdcController = "LsiLogic";
    1195                         // @todo: figure out the SCSI types
     1206# elif VBOX_WITH_BUSLOGIC
     1207                        string hdcController = "BusLogic";
     1208# else /* !VBOX_WITH_BUSLOGIC */
     1209                        string hdcController;
     1210# endif
     1211# ifdef VBOX_WITH_LSILOGIC
    11961212                        if (!RTStrICmp(hdc.strControllerType.c_str(), "LsiLogic"))
    11971213                            hdcController = "LsiLogic";
    1198                         else if (!RTStrICmp(hdc.strControllerType.c_str(), "BusLogic"))
     1214# endif /* VBOX_WITH_LSILOGIC */
     1215# ifdef VBOX_WITH_BUSLOGIC
     1216                        if (!RTStrICmp(hdc.strControllerType.c_str(), "BusLogic"))
    11991217                            hdcController = "BusLogic";
    1200                         vsd->addEntry(VirtualSystemDescriptionType_HarddiskControllerSCSI, hdc.idController, hdc.strControllerType, hdcController);
     1218# endif /* VBOX_WITH_BUSLOGIC */
     1219                        vsd->addEntry(VirtualSystemDescriptionType_HarddiskControllerSCSI, toString<uint32_t>(hdc.idController), hdc.strControllerType, hdcController);
    12011220                        break;
    12021221                    }
     1222#endif /* VBOX_WITH_SCSI */
     1223                default:
     1224                    {
     1225                    /* @todo: hmm, ok, this needs some explanation to the user,
     1226                     * so set an error! The other possibility is to set IDE
     1227                     * PIIX4 as default & redirect all hard disks to this
     1228                     * controller. */
     1229                    break;
     1230                    }
    12031231            }
    12041232        }
    12051233
    12061234        /* Hard disks */
    1207         if (vs.llVirtualDisks.size() > 0)
     1235        if (vs.mapVirtualDisks.size() > 0)
    12081236        {
    12091237            // @todo:
    12101238            //  - strHref could be empty (construct a new default file name)
    12111239            //  - check that the filename is unique to vbox in any case
    1212             list<VirtualDisk>::const_iterator hdIt;
     1240            VirtualDisksMap::const_iterator hdIt;
    12131241            /* Iterate through all hard disks ()*/
    1214             for (hdIt = vs.llVirtualDisks.begin();
    1215                  hdIt != vs.llVirtualDisks.end();
     1242            for (hdIt = vs.mapVirtualDisks.begin();
     1243                 hdIt != vs.mapVirtualDisks.end();
    12161244                 ++hdIt)
    12171245            {
    1218                 VirtualDisk hd = *hdIt;
     1246                VirtualDisk hd = hdIt->second;
    12191247                /* Get the associated disk image */
    12201248                DiskImage di = m->mapDisks [hd.strDiskId];
     
    12341262                    /* Construct the path */
    12351263                    string path = Utf8StrFmt("%ls%c%s", defaultHardDiskLocation, RTPATH_DELIMITER, di.strHref.c_str()).raw();
    1236                     vsd->addEntry(VirtualSystemDescriptionType_Harddisk, hd.idController, di.strHref, path);
     1264                    /* Make the path unique to the VBox installation */
     1265                    searchUniqueDiskImageFilePath(path);
     1266                    vsd->addEntry(VirtualSystemDescriptionType_Harddisk, hd.strDiskId, di.strHref, path);
    12371267                }
    12381268            }
     
    12561286            {
    12571287                // string nwController = *nwIt; // @todo: not used yet
    1258                 vsd->addEntry(VirtualSystemDescriptionType_NetworkAdapter, 0, "", toString<ULONG>(nwAdapterVBox));
     1288                vsd->addEntry(VirtualSystemDescriptionType_NetworkAdapter, "", "", toString<ULONG>(nwAdapterVBox));
    12591289            }
    12601290        }
     
    12671297STDMETHODIMP Appliance::ImportAppliance()
    12681298{
     1299    // @todo: we need definitely a IProgress object here (disk image copying, ...)
     1300    AutoCaller autoCaller(this);
     1301    CheckComRCReturnRC(autoCaller.rc());
     1302
    12691303    HRESULT rc = S_OK;
    12701304
    12711305    list<VirtualSystem>::const_iterator it;
    12721306    list< ComObjPtr<VirtualSystemDescription> >::const_iterator it1;
    1273     /* Iterate through all appliances */
     1307    /* Iterate through all virtual systems of that appliance */
    12741308    size_t i = 0;
    12751309    for (it = m->llVirtualSystems.begin(),
     
    12871321
    12881322        /* Now that we know the base system get our internal defaults based on that. */
    1289         IGuestOSType *osType = NULL;
    1290         rc = mVirtualBox->GetGuestOSType(Bstr(Utf8Str(osTypeVBox.c_str())), &osType);
     1323        ComPtr<IGuestOSType> osType;
     1324        rc = mVirtualBox->COMGETTER(GuestOSType)(Bstr(Utf8Str(osTypeVBox.c_str())), osType.asOutParam());
    12911325        ComAssertComRCThrowRC(rc);
    12921326
     
    12961330        Assert(vsdeName.size() == 1);
    12971331        string nameVBox = vsdeName.front().strFinalValue;
    1298         IMachine *newMachine = NULL;
     1332        ComPtr<IMachine> newMachine;
    12991333        rc = mVirtualBox->CreateMachine(Bstr(nameVBox.c_str()), Bstr(osTypeVBox.c_str()),
    13001334                                        Bstr(), Guid(),
    1301                                         &newMachine);
     1335                                        newMachine.asOutParam());
    13021336        ComAssertComRCThrowRC(rc);
    13031337
     
    13311365        {
    13321366            /* No network adapters, so we have to disable our default one */
    1333             INetworkAdapter *nwVBox = NULL;
    1334             rc = newMachine->GetNetworkAdapter(0, &nwVBox);
     1367            ComPtr<INetworkAdapter> nwVBox;
     1368            rc = newMachine->GetNetworkAdapter(0, nwVBox.asOutParam());
    13351369            ComAssertComRCThrowRC(rc);
    13361370            rc = nwVBox->COMSETTER(Enabled)(false);
     
    13491383                string nwTypeVBox = nwIt->strFinalValue;
    13501384                uint32_t tt1 = RTStrToUInt32(nwTypeVBox.c_str());
    1351                 INetworkAdapter *nwVBox = NULL;
    1352                 rc = newMachine->GetNetworkAdapter((ULONG)a, &nwVBox);
     1385                ComPtr<INetworkAdapter> nwVBox;
     1386                rc = newMachine->GetNetworkAdapter((ULONG)a, nwVBox.asOutParam());
    13531387                ComAssertComRCThrowRC(rc);
    13541388                /* Enable the network card & set the adapter type */
     
    13601394            }
    13611395        }
     1396
     1397        /* Hard disk controller IDE */
     1398        list<VirtualSystemDescriptionEntry> vsdeHDCIDE = vsd->findByType(VirtualSystemDescriptionType_HarddiskControllerIDE);
     1399        /* @todo: we support one IDE controller only */
     1400        if (vsdeHDCIDE.size() > 0)
     1401        {
     1402             IDEControllerType_T hdcVBox = static_cast<IDEControllerType_T>(RTStrToUInt32(vsdeHDCIDE.front().strFinalValue.c_str()));
     1403             /* Set the appropriate IDE controller in the virtual BIOS of the
     1404              * VM. */
     1405             ComPtr<IBIOSSettings> biosSettings;
     1406             rc = newMachine->COMGETTER(BIOSSettings)(biosSettings.asOutParam());
     1407             CheckComRCReturnRC(rc);
     1408             rc = biosSettings->COMSETTER(IDEControllerType)(hdcVBox);
     1409             CheckComRCReturnRC(rc);
     1410        }
     1411#ifdef VBOX_WITH_AHCI
     1412        /* Hard disk controller SATA */
     1413        list<VirtualSystemDescriptionEntry> vsdeHDCSATA = vsd->findByType(VirtualSystemDescriptionType_HarddiskControllerSATA);
     1414        /* @todo: we support one SATA controller only */
     1415        if (vsdeHDCSATA.size() > 0)
     1416        {
     1417            string hdcVBox = vsdeHDCIDE.front().strFinalValue;
     1418            if (!RTStrCmp(hdcVBox.c_str(), "AHCI"))
     1419            {
     1420                /* For now we have just to enable the AHCI controller. */
     1421                ComPtr<ISATAController> hdcSATAVBox;
     1422                rc = newMachine->COMGETTER(SATAController)(hdcSATAVBox.asOutParam());
     1423                CheckComRCReturnRC(rc);
     1424                rc = hdcSATAVBox->COMSETTER(Enabled)(true);
     1425                CheckComRCReturnRC(rc);
     1426            }
     1427            else
     1428            {
     1429                /* @todo: set an error if this is other than AHCI */
     1430            }
     1431        }
     1432#endif /* VBOX_WITH_AHCI */
     1433#ifdef VBOX_WITH_SCSI
     1434        /* Hard disk controller SCSI */
     1435        list<VirtualSystemDescriptionEntry> vsdeHDCSCSI = vsd->findByType(VirtualSystemDescriptionType_HarddiskControllerSCSI);
     1436        /* @todo: do we support more than one SCSI controller? */
     1437        if (vsdeHDCSCSI.size() > 0)
     1438        {
     1439            /* @todo: Currently I have no idea how to enable this. Someone has
     1440             * to write main support for SCSI at all. */
     1441        }
     1442#endif /* VBOX_WITH_SCSI */
     1443
    13621444        /* Now its time to register the machine before we add any hard disks */
    13631445        rc = mVirtualBox->RegisterMachine(newMachine);
    13641446        ComAssertComRCThrowRC(rc);
    13651447
     1448        /* Create the hard disks & connect them to the appropriate controllers. */
     1449        list<VirtualSystemDescriptionEntry> vsdeHD = vsd->findByType(VirtualSystemDescriptionType_Harddisk);
     1450        if (vsdeHD.size() > 0)
     1451        {
     1452            /* That we can attach hard disks we need to open a session for the
     1453             * new machine */
     1454            Guid newMachineId;
     1455            rc = newMachine->COMGETTER(Id)(newMachineId.asOutParam());
     1456            CheckComRCReturnRC(rc);
     1457            ComPtr<ISession> session;
     1458            rc = session.createInprocObject(CLSID_Session);
     1459            CheckComRCReturnRC(rc);
     1460            rc = mVirtualBox->OpenSession(session, newMachineId);
     1461            CheckComRCReturnRC(rc);
     1462
     1463            int result;
     1464            /* The disk image has to be on the same place as the OVF file. So
     1465             * strip the filename out of the full file path. */
     1466            char *srcDir = RTStrDup(Utf8Str(m->bstrPath).raw());
     1467            RTPathStripFilename(srcDir);
     1468            /* Iterate over all given disk images */
     1469            list<VirtualSystemDescriptionEntry>::const_iterator hdIt;
     1470            for (hdIt = vsdeHD.begin();
     1471                 hdIt != vsdeHD.end();
     1472                 ++hdIt)
     1473            {
     1474                char *dstFilePath = RTStrDup(hdIt->strFinalValue.c_str());
     1475                /* Check if the destination file exists already or the
     1476                 * destination path is empty. */
     1477                if (RTPathExists(dstFilePath) ||
     1478                    !RTStrCmp(dstFilePath, ""))
     1479                {
     1480                    /* @todo: what now? For now we override in no
     1481                     * circumstances. */
     1482//                    continue;
     1483                }
     1484                /* Get the associated disk image */
     1485                if (m->mapDisks.find(hdIt->strRef) == m->mapDisks.end())
     1486                {
     1487                    /* @todo: error: entry doesn't exists */
     1488                }
     1489                DiskImage di = m->mapDisks [hdIt->strRef];
     1490                /* Construct the source file path */
     1491                char *srcFilePath;
     1492                RTStrAPrintf(&srcFilePath, "%s/%s", srcDir, di.strHref.c_str());
     1493                /* Check if the source file exists */
     1494                if (!RTPathExists(srcFilePath))
     1495                {
     1496                    /* @todo: we have to create a new one */
     1497                }
     1498                else
     1499                {
     1500                    /* Make sure all target directories exists */
     1501                    rc = VirtualBox::ensureFilePathExists(dstFilePath);
     1502                    CheckComRCThrowRC(rc);
     1503                    /* Clone the disk image (this is necessary cause the id has
     1504                     * to be recreated for the case the same hard disk is
     1505                     * attached already from a previous import) */
     1506                    /* First open the existing disk image */
     1507                    ComPtr<IHardDisk2> srcHdVBox;
     1508                    rc = mVirtualBox->OpenHardDisk2(Bstr(srcFilePath), srcHdVBox.asOutParam());
     1509                    CheckComRCReturnRC(rc);
     1510                    /* We need the format description of the source disk image */
     1511                    Bstr srcFormat;
     1512                    rc = srcHdVBox->COMGETTER(Format)(srcFormat.asOutParam());
     1513                    CheckComRCReturnRC(rc);
     1514                    /* Create a new hard disk interface for the destination disk image */
     1515                    ComPtr<IHardDisk2> dstHdVBox;
     1516                    rc = mVirtualBox->CreateHardDisk2(srcFormat, Bstr(dstFilePath), dstHdVBox.asOutParam());
     1517                    CheckComRCReturnRC(rc);
     1518                    /* Clone the source disk image */
     1519                    ComPtr<IProgress> progress;
     1520                    rc = srcHdVBox->CloneTo(dstHdVBox, progress.asOutParam());
     1521                    CheckComRCReturnRC(rc);
     1522                    rc = progress->WaitForCompletion(-1);
     1523                    CheckComRCReturnRC(rc);
     1524                    /* We *must* close the source disk image in order to deregister it */
     1525                    rc = srcHdVBox->Close();
     1526                    CheckComRCReturnRC(rc);
     1527                    /* Now use the new uuid to attach the disk image to our new machine */
     1528                    ComPtr<IMachine> sMachine;
     1529                    rc = session->COMGETTER(Machine)(sMachine.asOutParam());
     1530                    Guid hdId;
     1531                    rc = dstHdVBox->COMGETTER(Id)(hdId.asOutParam());;
     1532                    CheckComRCReturnRC(rc);
     1533                    rc = sMachine->AttachHardDisk2(hdId, StorageBus_IDE, 0, 0); //
     1534                    CheckComRCReturnRC(rc);
     1535                    rc = sMachine->SaveSettings();
     1536                    CheckComRCReturnRC(rc);
     1537                    rc = session->Close();
     1538                    CheckComRCReturnRC(rc);
     1539                }
     1540                RTStrFree(srcFilePath);
     1541                RTStrFree(dstFilePath);
     1542            }
     1543            RTStrFree(srcDir);
     1544        }
    13661545        /* @todo: Unregister on failure */
    13671546#if 0
     
    13761555}
    13771556
    1378 HRESULT Appliance::searchUniqueVMName(std::string& aName)
     1557HRESULT Appliance::searchUniqueVMName(std::string& aName) const
    13791558{
    13801559    IMachine *machine = NULL;
     
    13941573}
    13951574
     1575HRESULT Appliance::searchUniqueDiskImageFilePath(std::string& aName) const
     1576{
     1577    IHardDisk2 *harddisk = NULL;
     1578    char *tmpName = RTStrDup(aName.c_str());
     1579    int i = 1;
     1580    /* Check if the file exists or if a file with this path is registered
     1581     * already */
     1582    /* @todo: Maybe to cost intensive; try to find a lighter way */
     1583    while (RTPathExists(tmpName) ||
     1584           mVirtualBox->FindHardDisk2(Bstr(tmpName), &harddisk) != VBOX_E_OBJECT_NOT_FOUND)
     1585    {
     1586        RTStrFree(tmpName);
     1587        char *tmpDir = RTStrDup(aName.c_str());
     1588        RTPathStripFilename(tmpDir);;
     1589        char *tmpFile = RTStrDup(RTPathFilename(aName.c_str()));
     1590        RTPathStripExt(tmpFile);
     1591        char *tmpExt = RTPathExt(aName.c_str());
     1592        RTStrAPrintf(&tmpName, "%s/%s_%d%s", tmpDir, tmpFile, i, tmpExt);
     1593        RTStrFree(tmpFile);
     1594        RTStrFree(tmpDir);
     1595        ++i;
     1596    }
     1597    aName = tmpName;
     1598    RTStrFree(tmpName);
     1599
     1600    return S_OK;
     1601}
     1602
    13961603// IVirtualSystemDescription constructor / destructor
    13971604////////////////////////////////////////////////////////////////////////////////
     
    14271634
    14281635STDMETHODIMP VirtualSystemDescription::GetDescription(ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
    1429                                                       ComSafeArrayOut(ULONG, aRefs),
    14301636                                                      ComSafeArrayOut(BSTR, aOrigValues),
    14311637                                                      ComSafeArrayOut(BSTR, aAutoValues),
     
    14331639{
    14341640    if (ComSafeArrayOutIsNull(aTypes) ||
    1435         ComSafeArrayOutIsNull(aRefs) ||
    14361641        ComSafeArrayOutIsNull(aOrigValues) ||
    14371642        ComSafeArrayOutIsNull(aAutoValues) ||
     
    14461651    ULONG c = (ULONG)m->descriptions.size();
    14471652    com::SafeArray<VirtualSystemDescriptionType_T> sfaTypes(c);
    1448     com::SafeArray<ULONG> sfaRefs(c);
    14491653    com::SafeArray<BSTR> sfaOrigValues(c);
    14501654    com::SafeArray<BSTR> sfaAutoValues(c);
     
    14601664        /* Types */
    14611665        sfaTypes [i] = vsde.type;
    1462         /* Refs */
    1463         sfaRefs [i] = vsde.ref;
    14641666        /* Original value */
    14651667        Bstr bstr = Utf8Str(vsde.strOriginalValue.c_str());
     
    14741676
    14751677    sfaTypes.detachTo(ComSafeArrayOutArg(aTypes));
    1476     sfaRefs.detachTo(ComSafeArrayOutArg(aRefs));
    14771678    sfaOrigValues.detachTo(ComSafeArrayOutArg(aOrigValues));
    14781679    sfaAutoValues.detachTo(ComSafeArrayOutArg(aAutoValues));
     
    15081709}
    15091710
    1510 void VirtualSystemDescription::addEntry(VirtualSystemDescriptionType_T aType, ULONG aRef, std::string aOrigValue, std::string aAutoValue)
     1711void VirtualSystemDescription::addEntry(VirtualSystemDescriptionType_T aType, std::string aRef, std::string aOrigValue, std::string aAutoValue, std::string aConfig /* = "" */)
    15111712{
    15121713    VirtualSystemDescriptionEntry vsde;
    15131714    vsde.type = aType;
    1514     vsde.ref = aRef;
     1715    vsde.strRef = aRef;
    15151716    vsde.strOriginalValue = aOrigValue;
    15161717    vsde.strAutoValue = aAutoValue;
     1718    vsde.strConfiguration = aConfig;
    15171719    /* For now we add the auto value as final value also */
    15181720    vsde.strFinalValue = aAutoValue;
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r16248 r16298  
    29832983  <enum
    29842984    name="VirtualSystemDescriptionType"
    2985     uuid="36209b5a-8f96-44de-a0af-1bb037cef324"
     2985    uuid="8ac36d00-bb7c-4a35-a835-3f004b27427b"
    29862986  >
    29872987    <desc>Used with <link to="IVirtualSystemDescription" /> to describe the type of
     
    30683068
    30693069      <param name="aTypes" type="VirtualSystemDescriptionType" dir="out" safearray="yes">
    3070         <desc></desc>
    3071       </param>
    3072 
    3073       <param name="aRefs" type="unsigned long" dir="out" safearray="yes">
    30743070        <desc></desc>
    30753071      </param>
  • trunk/src/VBox/Main/include/ApplianceImpl.h

    r16248 r16298  
    2626
    2727#include "VirtualBoxBase.h"
     28
     29#include <string>
    2830
    2931class VirtualBox;
     
    8890    HRESULT HandleVirtualSystemContent(const char *pcszPath, const xml::Node *pContentElem);
    8991
    90     HRESULT searchUniqueVMName (std::string& aName);
     92    HRESULT searchUniqueVMName (std::string& aName) const;
     93    HRESULT searchUniqueDiskImageFilePath(std::string& aName) const;
    9194};
    9295
    93 
    94 #include <string>
    9596struct VirtualSystemDescriptionEntry
    9697{
    9798    VirtualSystemDescriptionType_T type; /* Of which type is this value */
    98     uint64_t ref; /* Reference value to the internal implementation */
    99     std::string strOriginalValue; /* The original ovf value */
    100     std::string strAutoValue; /* The value which vbox suggest */
     99    std::string strRef; /* Reference value to the internal implementation */
     100    std::string strOriginalValue; /* The original OVF value */
     101    std::string strAutoValue; /* The value which VBox suggest */
    101102    std::string strFinalValue; /* The value the user select */
    102103    std::string strConfiguration; /* Additional configuration data for this type */
     
    140141    /* IVirtualSystemDescription methods */
    141142    STDMETHOD(GetDescription)(ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes),
    142                               ComSafeArrayOut(ULONG, aRefs),
    143143                              ComSafeArrayOut(BSTR, aOrigValues),
    144144                              ComSafeArrayOut(BSTR, aAutoValues),
     
    150150    /* private instance data */
    151151private:
    152     void addEntry(VirtualSystemDescriptionType_T aType, ULONG aRef, std::string aOrigValue, std::string aAutoValue);
     152    void addEntry(VirtualSystemDescriptionType_T aType, std::string aRef, std::string aOrigValue, std::string aAutoValue, std::string aConfig = "");
    153153    std::list<VirtualSystemDescriptionEntry> findByType(VirtualSystemDescriptionType_T aType);
    154154
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