儲存庫 vbox 的更動 16515
- 時間撮記:
- 2009-2-4 下午03:01:28 (16 年 以前)
- 位置:
- trunk/src/VBox
- 檔案:
-
- 修改 4 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageImport.cpp
r16495 r16515 97 97 { 98 98 com::SafeArray<VirtualSystemDescriptionType_T> retTypes; 99 com::SafeArray< ULONG> aRefs;99 com::SafeArray<BSTR> aRefs; 100 100 com::SafeArray<BSTR> aOrigValues; 101 101 com::SafeArray<BSTR> aConfigValues; … … 147 147 148 148 case VirtualSystemDescriptionType_HardDiskControllerIDE: 149 RTPrintf("%2d: IDE controller : reference ID %d"150 "\n (disable with \"-vsys %d -ignore %d\")\n", 151 a, 152 a Refs[a],149 RTPrintf("%2d: IDE controller, type %ls" 150 "\n (disable with \"-vsys %d -ignore %d\")\n", 151 a, 152 aConfigValues[a], 153 153 i, a); 154 154 break; 155 155 156 156 case VirtualSystemDescriptionType_HardDiskControllerSATA: 157 RTPrintf("%2d: SATA controller : reference ID %d"158 "\n (disable with \"-vsys %d -ignore %d\")\n", 159 a, 160 a Refs[a],157 RTPrintf("%2d: SATA controller, type %ls" 158 "\n (disable with \"-vsys %d -ignore %d\")\n", 159 a, 160 aConfigValues[a], 161 161 i, a); 162 162 break; 163 163 164 164 case VirtualSystemDescriptionType_HardDiskControllerSCSI: 165 RTPrintf("%2d: SCSI controller : reference ID %d, type %ls"166 "\n (change with \"-vsys %d - scsitype%d={BusLogic|LsiLogic}\";"165 RTPrintf("%2d: SCSI controller, type %ls" 166 "\n (change with \"-vsys %d -type%d={BusLogic|LsiLogic}\";" 167 167 "\n disable with \"-vsys %d -ignore %d\")\n", 168 168 a, 169 aRefs[a],170 169 aConfigValues[a], 171 170 i, a, i, a); … … 173 172 174 173 case VirtualSystemDescriptionType_HardDiskImage: 175 RTPrintf("%2d: Hard disk image: controller %d, source image \"%ls\", target image \"%ls\""174 RTPrintf("%2d: Hard disk image: source image=%ls, target path=%ls, %ls" 176 175 "\n (change controller with \"-vsys %d -controller%d=<id>\";" 177 176 "\n disable with \"-vsys %d -ignore %d\")\n", 178 177 a, 179 aRefs[a],180 178 aOrigValues[a], 181 179 aConfigValues[a], 180 aExtraConfigValues[a], 182 181 i, a, i, a); 183 182 break; … … 196 195 197 196 case VirtualSystemDescriptionType_NetworkAdapter: 198 RTPrintf("%2d: Network adapter: orig %ls, auto %ls, conf%ls\n",197 RTPrintf("%2d: Network adapter: orig %ls, config %ls, extra %ls\n", 199 198 a, 200 199 aOrigValues[a], -
trunk/src/VBox/Main/ApplianceImpl.cpp
r16512 r16515 109 109 }; 110 110 111 typedef map< uint32_t, DiskImage> DiskImagesMap;111 typedef map<Utf8Str, DiskImage> DiskImagesMap; 112 112 typedef map<Utf8Str, Network> NetworksMap; 113 113 … … 135 135 enum ControllerSystemType { IDE, SATA, SCSI }; 136 136 ControllerSystemType system; // one of IDE, SATA, SCSI 137 Utf8Str strControllerType; // controller type (Item/ResourceSubType); e.g. "LsiLogic"; can be empty (esp. for IDE)137 Utf8Str strControllerType; // controller subtype (Item/ResourceSubType); e.g. "LsiLogic"; can be empty (esp. for IDE) 138 138 Utf8Str strAddress; // for IDE 139 139 uint32_t ulBusNumber; // for IDE … … 1237 1237 convertCIMOSType2VBoxOSType(strOsTypeVBox, vsysThis.cimos); 1238 1238 pNewDesc->addEntry(VirtualSystemDescriptionType_OS, 1239 0,1239 "", 1240 1240 strCIMOSType, 1241 1241 strOsTypeVBox); … … 1249 1249 searchUniqueVMName(nameVBox); 1250 1250 pNewDesc->addEntry(VirtualSystemDescriptionType_Name, 1251 0,1251 "", 1252 1252 vsysThis.strName, 1253 1253 nameVBox); … … 1264 1264 cpuCountVBox = 1; 1265 1265 pNewDesc->addEntry(VirtualSystemDescriptionType_CPU, 1266 0,1266 "", 1267 1267 toString<ULONG>(vsysThis.cCPUs), 1268 1268 toString<ULONG>(cpuCountVBox)); … … 1281 1281 } 1282 1282 pNewDesc->addEntry(VirtualSystemDescriptionType_Memory, 1283 0,1283 "", 1284 1284 toString<uint64_t>(vsysThis.ullMemorySize), 1285 1285 toString<uint64_t>(ullMemSizeVBox)); … … 1290 1290 @todo: figure out the hardware which could be possible */ 1291 1291 pNewDesc->addEntry(VirtualSystemDescriptionType_SoundCard, 1292 0,1292 "", 1293 1293 vsysThis.strSoundCardType, 1294 1294 ""); … … 1296 1296 /* USB Controller */ 1297 1297 if (vsysThis.fHasUsbController) 1298 pNewDesc->addEntry(VirtualSystemDescriptionType_USBController, 0, "", "");1298 pNewDesc->addEntry(VirtualSystemDescriptionType_USBController, "", "", ""); 1299 1299 1300 1300 /* Network Controller */ … … 1316 1316 { 1317 1317 Utf8Str nwController = *nwIt; // @todo: not used yet 1318 pNewDesc->addEntry(VirtualSystemDescriptionType_NetworkAdapter, 0, "", toString<ULONG>(nwAdapterVBox));1318 pNewDesc->addEntry(VirtualSystemDescriptionType_NetworkAdapter, "", "", toString<ULONG>(nwAdapterVBox)); 1319 1319 } 1320 1320 } … … 1322 1322 /* Floppy Drive */ 1323 1323 if (vsysThis.fHasFloppyDrive) 1324 pNewDesc->addEntry(VirtualSystemDescriptionType_Floppy, 0, "", "");1324 pNewDesc->addEntry(VirtualSystemDescriptionType_Floppy, "", "", ""); 1325 1325 1326 1326 /* CD Drive */ 1327 1327 if (vsysThis.fHasCdromDrive) 1328 pNewDesc->addEntry(VirtualSystemDescriptionType_CDROM, 0, "", "");1328 pNewDesc->addEntry(VirtualSystemDescriptionType_CDROM, "", "", ""); 1329 1329 1330 1330 /* Hard disk Controller */ … … 1336 1336 { 1337 1337 const HardDiskController &hdc = hdcIt->second; 1338 Utf8Str strControllerID = toString<uint32_t>(hdc.idController); 1339 1338 1340 switch (hdc.system) 1339 1341 { … … 1342 1344 // @todo: figure out the IDE types 1343 1345 /* Use PIIX4 as default */ 1344 IDEControllerType_T hdcController = IDEControllerType_PIIX4; 1346 // IDEControllerType_T hdcController = IDEControllerType_PIIX4; 1347 Utf8Str strType = "PIIX4"; 1345 1348 if (!RTStrICmp(hdc.strControllerType.c_str(), "PIIX3")) 1346 hdcController = IDEControllerType_PIIX3;1347 elseif (!RTStrICmp(hdc.strControllerType.c_str(), "PIIX4"))1348 hdcController = IDEControllerType_PIIX4;1349 strType = "PIIX3"; 1350 // else // if (!RTStrICmp(hdc.strControllerType.c_str(), "PIIX4")) 1351 // hdcController = IDEControllerType_PIIX4; 1349 1352 pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerIDE, 1350 hdc.idController,1353 strControllerID, 1351 1354 hdc.strControllerType, 1352 toString<ULONG>(hdcController));1355 strType); 1353 1356 break; 1354 1357 } … … 1359 1362 /* We only support a plain AHCI controller, so use them always */ 1360 1363 pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerSATA, 1361 hdc.idController,1364 strControllerID, 1362 1365 hdc.strControllerType, 1363 1366 "AHCI"); … … 1369 1372 // @todo: figure out the SCSI types 1370 1373 Utf8Str hdcController = "LsiLogic"; 1371 if (!RTStrICmp(hdc.strControllerType.c_str(), "LsiLogic"))1374 /* if (!RTStrICmp(hdc.strControllerType.c_str(), "LsiLogic")) 1372 1375 hdcController = "LsiLogic"; 1373 else if (!RTStrICmp(hdc.strControllerType.c_str(), "BusLogic")) 1376 else*/ 1377 if (!RTStrICmp(hdc.strControllerType.c_str(), "BusLogic")) 1374 1378 hdcController = "BusLogic"; 1375 1379 pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskControllerSCSI, 1376 hdc.idController,1380 strControllerID, 1377 1381 hdc.strControllerType, 1378 1382 hdcController); … … 1388 1392 // - strHref could be empty (construct a new default file name) 1389 1393 // - check that the filename is unique to vbox in any case 1390 VirtualDisksMap::const_iterator hdIt;1394 VirtualDisksMap::const_iterator itVD; 1391 1395 /* Iterate through all hard disks ()*/ 1392 for ( hdIt= vsysThis.mapVirtualDisks.begin();1393 hdIt!= vsysThis.mapVirtualDisks.end();1394 ++ hdIt)1396 for (itVD = vsysThis.mapVirtualDisks.begin(); 1397 itVD != vsysThis.mapVirtualDisks.end(); 1398 ++itVD) 1395 1399 { 1396 const VirtualDisk &hd = hdIt->second;1400 const VirtualDisk &hd = itVD->second; 1397 1401 /* Get the associated disk image */ 1398 1402 const DiskImage &di = m->mapDisks[hd.strDiskId]; … … 1403 1407 // - we need a url specifier for the vdi format 1404 1408 if ( (!RTStrICmp(di.strFormat.c_str(), "http://www.vmware.com/specifications/vmdk.html#sparse")) 1405 1409 || (!RTStrICmp(di.strFormat.c_str(), "http://www.vmware.com/specifications/vmdk.html#compressed")) 1406 1410 ) 1407 1411 { 1408 /* Construct the path */ 1409 Utf8StrFmt path("%ls%c%s", bstrDefaultHardDiskLocation.raw(), RTPATH_DELIMITER, di.strHref.c_str()); 1410 /* Make the path unique to the VBox installation */ 1411 searchUniqueDiskImageFilePath(path); 1412 // construct a unique target path 1413 Utf8StrFmt strPath("%ls%c%s", 1414 bstrDefaultHardDiskLocation.raw(), 1415 RTPATH_DELIMITER, 1416 di.strHref.c_str()); 1417 searchUniqueDiskImageFilePath(strPath); 1418 1419 // find the description for the hard disk controller that has the 1420 // same ID as hd.idController 1421 const VirtualSystemDescriptionEntry *pController; 1422 if (!(pController = pNewDesc->findControllerFromID(hd.idController))) 1423 throw setError(E_FAIL, 1424 tr("Internal inconsistency looking up hard disk controller.")); 1425 1426 // controller to attach to @todo bus? 1427 Utf8StrFmt strExtraConfig("controller=%RI16", 1428 pController->ulIndex); 1412 1429 pNewDesc->addEntry(VirtualSystemDescriptionType_HardDiskImage, 1413 hd.idController,1430 "", 1414 1431 di.strHref, 1415 path); 1432 strPath, 1433 strExtraConfig); 1416 1434 } 1417 1435 } … … 1803 1821 1804 1822 /* Iterate over all given disk images */ 1805 list<VirtualSystemDescriptionEntry*>::const_iterator hdIt;1806 for ( hdIt= avsdeHDs.begin();1807 hdIt!= avsdeHDs.end();1808 ++ hdIt)1823 list<VirtualSystemDescriptionEntry*>::const_iterator itHD; 1824 for (itHD = avsdeHDs.begin(); 1825 itHD != avsdeHDs.end(); 1826 ++itHD) 1809 1827 { 1810 const char *pcszDstFilePath = (*hdIt)->strConfig.c_str(); 1828 VirtualSystemDescriptionEntry *vsdeHD = *itHD; 1829 1830 const char *pcszDstFilePath = vsdeHD->strConfig.c_str(); 1811 1831 /* Check if the destination file exists already or the 1812 1832 * destination path is empty. */ … … 1819 1839 pcszDstFilePath)); 1820 1840 } 1821 ULONG ulRef = (*hdIt)->ulRef; 1822 /* Get the associated disk image */ 1823 if (app->m->mapDisks.find(ulRef) == app->m->mapDisks.end() || 1824 vsysThis.mapVirtualDisks.find(ulRef) == vsysThis.mapVirtualDisks.end()) 1825 { 1826 /* This isn't allowed */ 1841 1842 // find the disk from the OVF's disk list 1843 DiskImagesMap::const_iterator itDiskImage = app->m->mapDisks.find(vsdeHD->strRef); 1844 VirtualDisksMap::const_iterator itVirtualDisk = vsysThis.mapVirtualDisks.find(vsdeHD->strRef); 1845 1846 if ( itDiskImage == app->m->mapDisks.end() 1847 || itVirtualDisk == vsysThis.mapVirtualDisks.end() 1848 ) 1827 1849 throw setError(E_FAIL, 1828 tr("Some internal error occured")); 1829 } 1830 DiskImage di = app->m->mapDisks[ulRef]; 1831 VirtualDisk vd = (*vsysThis.mapVirtualDisks.find(ulRef)).second; 1850 tr("Internal inconsistency looking up disk images.")); 1851 1852 const DiskImage &di = itDiskImage->second; 1853 const VirtualDisk &vd = itVirtualDisk->second; 1854 1832 1855 /* Construct the source file path */ 1833 1856 Utf8StrFmt strSrcFilePath("%s/%s", strSrcDir.c_str(), di.strHref.c_str()); … … 1969 1992 1970 1993 STDMETHODIMP VirtualSystemDescription::GetDescription(ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes), 1971 ComSafeArrayOut( ULONG, aRefs),1994 ComSafeArrayOut(BSTR, aRefs), 1972 1995 ComSafeArrayOut(BSTR, aOrigValues), 1973 1996 ComSafeArrayOut(BSTR, aConfigValues), … … 1988 2011 ULONG c = (ULONG)m->descriptions.size(); 1989 2012 com::SafeArray<VirtualSystemDescriptionType_T> sfaTypes(c); 1990 com::SafeArray< ULONG> sfaRefs(c);2013 com::SafeArray<BSTR> sfaRefs(c); 1991 2014 com::SafeArray<BSTR> sfaOrigValues(c); 1992 2015 com::SafeArray<BSTR> sfaConfigValues(c); … … 2003 2026 sfaTypes[i] = vsde.type; 2004 2027 2005 sfaRefs[i] = vsde.ulRef; 2006 2007 Bstr bstr = vsde.strOrig; 2028 Bstr bstr = vsde.strRef; 2029 bstr.cloneTo(&sfaRefs[i]); 2030 2031 bstr = vsde.strOrig; 2008 2032 bstr.cloneTo(&sfaOrigValues[i]); 2009 2033 … … 2051 2075 2052 2076 void VirtualSystemDescription::addEntry(VirtualSystemDescriptionType_T aType, 2053 uint32_t ulRef,2077 const Utf8Str &strRef, 2054 2078 const Utf8Str &aOrigValue, 2055 const Utf8Str &aAutoValue) 2079 const Utf8Str &aAutoValue, 2080 const Utf8Str &strExtraConfig /*= ""*/) 2056 2081 { 2057 2082 VirtualSystemDescriptionEntry vsde; 2083 vsde.ulIndex = m->descriptions.size(); // each entry gets an index so the client side can reference them 2058 2084 vsde.type = aType; 2059 vsde. ulRef = ulRef;2085 vsde.strRef = strRef; 2060 2086 vsde.strOrig = aOrigValue; 2061 2087 vsde.strConfig = aAutoValue; 2088 vsde.strExtraConfig = strExtraConfig; 2062 2089 2063 2090 m->descriptions.push_back(vsde); … … 2077 2104 } 2078 2105 2106 const VirtualSystemDescriptionEntry* VirtualSystemDescription::findControllerFromID(uint32_t id) 2107 { 2108 Utf8Str strRef = toString<uint32_t>(id); 2109 list<VirtualSystemDescriptionEntry>::const_iterator it; 2110 for (it = m->descriptions.begin(); 2111 it != m->descriptions.end(); 2112 ++it) 2113 { 2114 switch (it->type) 2115 { 2116 case VirtualSystemDescriptionType_HardDiskControllerIDE: 2117 case VirtualSystemDescriptionType_HardDiskControllerSATA: 2118 case VirtualSystemDescriptionType_HardDiskControllerSCSI: 2119 if (it->strRef == strRef) 2120 return &(*it); 2121 break; 2122 } 2123 } 2124 2125 return NULL; 2126 } -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r16510 r16515 3100 3100 </param> 3101 3101 3102 <param name="aRefs" type=" unsigned long" dir="out" safearray="yes">3102 <param name="aRefs" type="wstring" dir="out" safearray="yes"> 3103 3103 <desc></desc> 3104 3104 </param> -
trunk/src/VBox/Main/include/ApplianceImpl.h
r16503 r16515 100 100 struct VirtualSystemDescriptionEntry 101 101 { 102 VirtualSystemDescriptionType_T type; /* Of which type is this value */ 103 uint32_t ulRef; // reference number 104 Utf8Str strOrig; /* The original OVF value */ 105 Utf8Str strConfig; /* The value which VBox suggest */ 106 Utf8Str strExtraConfig; /* Additional configuration data for this type */ 102 uint32_t ulIndex; // zero-based index of this entry within array 103 VirtualSystemDescriptionType_T type; // type of this entry 104 Utf8Str strRef; // reference number (hard disk controllers only) 105 Utf8Str strOrig; // original OVF value (type-dependent) 106 Utf8Str strConfig; // configuration value (type-dependent) 107 Utf8Str strExtraConfig; // extra configuration key=value strings (type-dependent) 107 108 }; 108 109 … … 144 145 /* IVirtualSystemDescription methods */ 145 146 STDMETHOD(GetDescription)(ComSafeArrayOut(VirtualSystemDescriptionType_T, aTypes), 146 ComSafeArrayOut( ULONG, aRefs),147 ComSafeArrayOut(BSTR, aRefs), 147 148 ComSafeArrayOut(BSTR, aOrigValues), 148 149 ComSafeArrayOut(BSTR, aConfigValues), … … 155 156 private: 156 157 void addEntry(VirtualSystemDescriptionType_T aType, 157 uint32_t ulRef,158 const Utf8Str &strRef, 158 159 const Utf8Str &aOrigValue, 159 const Utf8Str &aAutoValue); 160 const Utf8Str &aAutoValue, 161 const Utf8Str &strExtraConfig = ""); 160 162 161 163 std::list<VirtualSystemDescriptionEntry*> findByType(VirtualSystemDescriptionType_T aType); 164 const VirtualSystemDescriptionEntry* findControllerFromID(uint32_t id); 162 165 163 166 struct Data;
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器