Changeset 17963 in vbox
- Timestamp:
- Mar 16, 2009 5:59:29 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ApplianceImpl.cpp
r17956 r17963 143 143 typedef map<Utf8Str, VirtualDisk> VirtualDisksMap; 144 144 145 struct EthernetAdapter 146 { 147 Utf8Str strAdapterType; // "PCNet32" or "E1000" or whatever; from <rasd:ResourceSubType> 148 Utf8Str strNetworkName; // from <rasd:Connection> 149 }; 150 151 typedef list<EthernetAdapter> EthernetAdaptersList; 152 145 153 struct VirtualSystem 146 154 { … … 156 164 uint16_t cCPUs; // no. of CPUs, copied from llHardwareItems; default = 1 157 165 158 list<Utf8Str> llNetworkNames; 159 // list of strings referring to network names 160 // (one for each VirtualSystem/Item[@ResourceType=10]/Connection element) 166 EthernetAdaptersList llEthernetAdapters; // (one for each VirtualSystem/Item[@ResourceType=10]element) 161 167 162 168 ControllersMap mapControllers; … … 266 272 g_osTypes[] = 267 273 { 268 { CIMOSType_CIMOS_Unknown, SchemaDefs_OSTypeId_Other },269 { CIMOSType_CIMOS_OS2, SchemaDefs_OSTypeId_OS2 },270 { CIMOSType_CIMOS_MSDOS, SchemaDefs_OSTypeId_DOS },271 { CIMOSType_CIMOS_WIN3x, SchemaDefs_OSTypeId_Windows31 },272 { CIMOSType_CIMOS_WIN95, SchemaDefs_OSTypeId_Windows95 },273 { CIMOSType_CIMOS_WIN98, SchemaDefs_OSTypeId_Windows98 },274 { CIMOSType_CIMOS_WINNT, SchemaDefs_OSTypeId_WindowsNT4 },275 { CIMOSType_CIMOS_NetWare, SchemaDefs_OSTypeId_Netware },276 { CIMOSType_CIMOS_NovellOES, SchemaDefs_OSTypeId_Netware },277 { CIMOSType_CIMOS_Solaris, SchemaDefs_OSTypeId_Solaris },278 { CIMOSType_CIMOS_SunOS, SchemaDefs_OSTypeId_Solaris },279 { CIMOSType_CIMOS_FreeBSD, SchemaDefs_OSTypeId_FreeBSD },280 { CIMOSType_CIMOS_NetBSD, SchemaDefs_OSTypeId_NetBSD },281 { CIMOSType_CIMOS_QNX, SchemaDefs_OSTypeId_QNX },282 { CIMOSType_CIMOS_Windows2000, SchemaDefs_OSTypeId_Windows2000 },283 { CIMOSType_CIMOS_WindowsMe, SchemaDefs_OSTypeId_WindowsMe },284 { CIMOSType_CIMOS_OpenBSD, SchemaDefs_OSTypeId_OpenBSD },285 { CIMOSType_CIMOS_WindowsXP, SchemaDefs_OSTypeId_WindowsXP },286 { CIMOSType_CIMOS_WindowsXPEmbedded, SchemaDefs_OSTypeId_WindowsXP },287 { CIMOSType_CIMOS_WindowsEmbeddedforPointofService, SchemaDefs_OSTypeId_WindowsXP },288 { CIMOSType_CIMOS_MicrosoftWindowsServer2003, SchemaDefs_OSTypeId_Windows2003 },289 { CIMOSType_CIMOS_MicrosoftWindowsServer2003_64, SchemaDefs_OSTypeId_Windows2003_64 },290 { CIMOSType_CIMOS_WindowsXP_64, SchemaDefs_OSTypeId_WindowsXP_64 },291 { CIMOSType_CIMOS_WindowsVista, SchemaDefs_OSTypeId_WindowsVista },292 { CIMOSType_CIMOS_WindowsVista_64, SchemaDefs_OSTypeId_WindowsVista_64 },293 { CIMOSType_CIMOS_MicrosoftWindowsServer2008, SchemaDefs_OSTypeId_Windows2008 },294 { CIMOSType_CIMOS_MicrosoftWindowsServer2008_64, SchemaDefs_OSTypeId_Windows2008_64 },295 { CIMOSType_CIMOS_FreeBSD_64, SchemaDefs_OSTypeId_FreeBSD_64 },296 { CIMOSType_CIMOS_RedHatEnterpriseLinux, SchemaDefs_OSTypeId_RedHat },297 { CIMOSType_CIMOS_RedHatEnterpriseLinux_64, SchemaDefs_OSTypeId_RedHat_64 },298 { CIMOSType_CIMOS_Solaris_64, SchemaDefs_OSTypeId_Solaris_64 },299 { CIMOSType_CIMOS_SUSE, SchemaDefs_OSTypeId_OpenSUSE },300 { CIMOSType_CIMOS_SLES, SchemaDefs_OSTypeId_OpenSUSE },301 { CIMOSType_CIMOS_NovellLinuxDesktop, SchemaDefs_OSTypeId_OpenSUSE },302 { CIMOSType_CIMOS_SUSE_64, SchemaDefs_OSTypeId_OpenSUSE_64 },303 { CIMOSType_CIMOS_SLES_64, SchemaDefs_OSTypeId_OpenSUSE_64 },304 { CIMOSType_CIMOS_LINUX, SchemaDefs_OSTypeId_Linux },305 { CIMOSType_CIMOS_SunJavaDesktopSystem, SchemaDefs_OSTypeId_Linux },306 { CIMOSType_CIMOS_TurboLinux, SchemaDefs_OSTypeId_Linux},274 { CIMOSType_CIMOS_Unknown, SchemaDefs_OSTypeId_Other }, 275 { CIMOSType_CIMOS_OS2, SchemaDefs_OSTypeId_OS2 }, 276 { CIMOSType_CIMOS_MSDOS, SchemaDefs_OSTypeId_DOS }, 277 { CIMOSType_CIMOS_WIN3x, SchemaDefs_OSTypeId_Windows31 }, 278 { CIMOSType_CIMOS_WIN95, SchemaDefs_OSTypeId_Windows95 }, 279 { CIMOSType_CIMOS_WIN98, SchemaDefs_OSTypeId_Windows98 }, 280 { CIMOSType_CIMOS_WINNT, SchemaDefs_OSTypeId_WindowsNT4 }, 281 { CIMOSType_CIMOS_NetWare, SchemaDefs_OSTypeId_Netware }, 282 { CIMOSType_CIMOS_NovellOES, SchemaDefs_OSTypeId_Netware }, 283 { CIMOSType_CIMOS_Solaris, SchemaDefs_OSTypeId_OpenSolaris }, 284 { CIMOSType_CIMOS_SunOS, SchemaDefs_OSTypeId_OpenSolaris }, 285 { CIMOSType_CIMOS_FreeBSD, SchemaDefs_OSTypeId_FreeBSD }, 286 { CIMOSType_CIMOS_NetBSD, SchemaDefs_OSTypeId_NetBSD }, 287 { CIMOSType_CIMOS_QNX, SchemaDefs_OSTypeId_QNX }, 288 { CIMOSType_CIMOS_Windows2000, SchemaDefs_OSTypeId_Windows2000 }, 289 { CIMOSType_CIMOS_WindowsMe, SchemaDefs_OSTypeId_WindowsMe }, 290 { CIMOSType_CIMOS_OpenBSD, SchemaDefs_OSTypeId_OpenBSD }, 291 { CIMOSType_CIMOS_WindowsXP, SchemaDefs_OSTypeId_WindowsXP }, 292 { CIMOSType_CIMOS_WindowsXPEmbedded, SchemaDefs_OSTypeId_WindowsXP }, 293 { CIMOSType_CIMOS_WindowsEmbeddedforPointofService, SchemaDefs_OSTypeId_WindowsXP }, 294 { CIMOSType_CIMOS_MicrosoftWindowsServer2003, SchemaDefs_OSTypeId_Windows2003 }, 295 { CIMOSType_CIMOS_MicrosoftWindowsServer2003_64, SchemaDefs_OSTypeId_Windows2003_64 }, 296 { CIMOSType_CIMOS_WindowsXP_64, SchemaDefs_OSTypeId_WindowsXP_64 }, 297 { CIMOSType_CIMOS_WindowsVista, SchemaDefs_OSTypeId_WindowsVista }, 298 { CIMOSType_CIMOS_WindowsVista_64, SchemaDefs_OSTypeId_WindowsVista_64 }, 299 { CIMOSType_CIMOS_MicrosoftWindowsServer2008, SchemaDefs_OSTypeId_Windows2008 }, 300 { CIMOSType_CIMOS_MicrosoftWindowsServer2008_64, SchemaDefs_OSTypeId_Windows2008_64 }, 301 { CIMOSType_CIMOS_FreeBSD_64, SchemaDefs_OSTypeId_FreeBSD_64 }, 302 { CIMOSType_CIMOS_RedHatEnterpriseLinux, SchemaDefs_OSTypeId_RedHat }, 303 { CIMOSType_CIMOS_RedHatEnterpriseLinux_64, SchemaDefs_OSTypeId_RedHat_64 }, 304 { CIMOSType_CIMOS_Solaris_64, SchemaDefs_OSTypeId_OpenSolaris_64 }, 305 { CIMOSType_CIMOS_SUSE, SchemaDefs_OSTypeId_OpenSUSE }, 306 { CIMOSType_CIMOS_SLES, SchemaDefs_OSTypeId_OpenSUSE }, 307 { CIMOSType_CIMOS_NovellLinuxDesktop, SchemaDefs_OSTypeId_OpenSUSE }, 308 { CIMOSType_CIMOS_SUSE_64, SchemaDefs_OSTypeId_OpenSUSE_64 }, 309 { CIMOSType_CIMOS_SLES_64, SchemaDefs_OSTypeId_OpenSUSE_64 }, 310 { CIMOSType_CIMOS_LINUX, SchemaDefs_OSTypeId_Linux }, 311 { CIMOSType_CIMOS_SunJavaDesktopSystem, SchemaDefs_OSTypeId_Linux }, 312 { CIMOSType_CIMOS_TurboLinux, SchemaDefs_OSTypeId_Linux}, 307 313 308 314 // { CIMOSType_CIMOS_TurboLinux_64, }, … … 311 317 // break; 312 318 313 { CIMOSType_CIMOS_Mandriva, SchemaDefs_OSTypeId_Mandriva },314 { CIMOSType_CIMOS_Mandriva_64, SchemaDefs_OSTypeId_Mandriva_64 },315 { CIMOSType_CIMOS_Ubuntu, SchemaDefs_OSTypeId_Ubuntu },316 { CIMOSType_CIMOS_Ubuntu_64, SchemaDefs_OSTypeId_Ubuntu_64 },317 { CIMOSType_CIMOS_Debian, SchemaDefs_OSTypeId_Debian },318 { CIMOSType_CIMOS_Debian_64, SchemaDefs_OSTypeId_Debian_64 },319 { CIMOSType_CIMOS_Linux_2_4_x, SchemaDefs_OSTypeId_Linux24 },320 { CIMOSType_CIMOS_Linux_2_4_x_64, SchemaDefs_OSTypeId_Linux24_64 },321 { CIMOSType_CIMOS_Linux_2_6_x, SchemaDefs_OSTypeId_Linux26 },322 { CIMOSType_CIMOS_Linux_2_6_x_64, SchemaDefs_OSTypeId_Linux26_64 }319 { CIMOSType_CIMOS_Mandriva, SchemaDefs_OSTypeId_Mandriva }, 320 { CIMOSType_CIMOS_Mandriva_64, SchemaDefs_OSTypeId_Mandriva_64 }, 321 { CIMOSType_CIMOS_Ubuntu, SchemaDefs_OSTypeId_Ubuntu }, 322 { CIMOSType_CIMOS_Ubuntu_64, SchemaDefs_OSTypeId_Ubuntu_64 }, 323 { CIMOSType_CIMOS_Debian, SchemaDefs_OSTypeId_Debian }, 324 { CIMOSType_CIMOS_Debian_64, SchemaDefs_OSTypeId_Debian_64 }, 325 { CIMOSType_CIMOS_Linux_2_4_x, SchemaDefs_OSTypeId_Linux24 }, 326 { CIMOSType_CIMOS_Linux_2_4_x_64, SchemaDefs_OSTypeId_Linux24_64 }, 327 { CIMOSType_CIMOS_Linux_2_6_x, SchemaDefs_OSTypeId_Linux26 }, 328 { CIMOSType_CIMOS_Linux_2_6_x_64, SchemaDefs_OSTypeId_Linux26_64 } 323 329 }; 324 330 … … 882 888 { 883 889 /* <Item> 884 <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> 885 <rasd:Caption>Ethernet adapter on 'VM Network'</rasd:Caption> 886 <rasd:Connection>VM Network</rasd:Connection> 887 <rasd:Description>VM Network?</rasd:Description> 888 <rasd:ElementName>Ethernet adapter</rasd:ElementName> 889 <rasd:InstanceID>3</rasd:InstanceID> 890 <rasd:ResourceType>10</rasd:ResourceType> 890 <rasd:Caption>Ethernet adapter on 'Bridged'</rasd:Caption> 891 <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation> 892 <rasd:Connection>Bridged</rasd:Connection> 893 <rasd:InstanceID>6</rasd:InstanceID> 894 <rasd:ResourceType>10</rasd:ResourceType> 895 <rasd:ResourceSubType>E1000</rasd:ResourceSubType> 891 896 </Item> 892 897 … … 899 904 900 905 // only store the name 901 vsys.llNetworkNames.push_back(i.strConnection); 906 EthernetAdapter ea; 907 ea.strAdapterType = i.strResourceSubType; 908 ea.strNetworkName = i.strConnection; 909 vsys.llEthernetAdapters.push_back(ea); 902 910 } 903 911 break; … … 1347 1355 1348 1356 /* Network Controller */ 1349 // @todo: there is no hardware specification in the OVF file; supposedly the 1350 // hardware will then be determined by the VirtualSystemType element (e.g. "vmx-07") 1351 if (vsysThis.llNetworkNames.size() > 0) 1357 uint32_t cEthernetAdapters = vsysThis.llEthernetAdapters.size(); 1358 if (cEthernetAdapters > 0) 1352 1359 { 1353 1360 /* Check for the constrains */ 1354 if ( vsysThis.llNetworkNames.size()> SchemaDefs::NetworkAdapterCount)1361 if (cEthernetAdapters > SchemaDefs::NetworkAdapterCount) 1355 1362 addWarning(tr("The virtual system \"%s\" claims support for %u network adapters, but VirtualBox has support for max %u network adapter only."), 1356 vsysThis.strName.c_str(), vsysThis.llNetworkNames.size(), SchemaDefs::NetworkAdapterCount);1363 vsysThis.strName.c_str(), cEthernetAdapters, SchemaDefs::NetworkAdapterCount); 1357 1364 1358 1365 /* Get the default network adapter type for the selected guest OS */ 1359 NetworkAdapterType_T nwAdapterVBox = NetworkAdapterType_Am79C970A;1360 rc = pGuestOSType->COMGETTER(AdapterType)(& nwAdapterVBox);1366 NetworkAdapterType_T defaultAdapterVBox = NetworkAdapterType_Am79C970A; 1367 rc = pGuestOSType->COMGETTER(AdapterType)(&defaultAdapterVBox); 1361 1368 CheckComRCThrowRC(rc); 1362 list<Utf8Str>::const_iterator nwIt; 1369 1370 EthernetAdaptersList::const_iterator itEA; 1363 1371 /* Iterate through all abstract networks. We support 8 network 1364 1372 * adapters at the maximum, so the first 8 will be added only. */ 1365 1373 size_t a = 0; 1366 for ( nwIt = vsysThis.llNetworkNames.begin();1367 nwIt != vsysThis.llNetworkNames.end() && a < SchemaDefs::NetworkAdapterCount;1368 ++ nwIt, ++a)1374 for (itEA = vsysThis.llEthernetAdapters.begin(); 1375 itEA != vsysThis.llEthernetAdapters.end() && a < SchemaDefs::NetworkAdapterCount; 1376 ++itEA, ++a) 1369 1377 { 1370 Utf8Str strNetwork = *nwIt; // logical network to connect to 1378 const EthernetAdapter &ea = *itEA; // logical network to connect to 1379 Utf8Str strNetwork = ea.strNetworkName; 1371 1380 // make sure it's one of these two 1372 1381 if ( (strNetwork.compare("Null", Utf8Str::CaseInsensitive)) … … 1376 1385 ) 1377 1386 strNetwork = "NAT"; 1387 1388 NetworkAdapterType_T nwAdapterVBox = defaultAdapterVBox; 1389 if (!ea.strAdapterType.compare("PCNet32", Utf8Str::CaseInsensitive)) 1390 nwAdapterVBox = NetworkAdapterType_Am79C973; 1391 else if (!ea.strAdapterType.compare("E1000", Utf8Str::CaseInsensitive)) 1392 nwAdapterVBox = NetworkAdapterType_I82540EM; 1378 1393 1379 1394 pNewDesc->addEntry(VirtualSystemDescriptionType_NetworkAdapter,
Note:
See TracChangeset
for help on using the changeset viewer.