Changeset 16360 in vbox for trunk/src/VBox
- Timestamp:
- Jan 29, 2009 10:51:37 AM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 42200
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ApplianceImpl.cpp
r16325 r16360 1229 1229 vsd->addEntry(VirtualSystemDescriptionType_Memory, "", toString<uint64_t>(vs.ullMemorySize), toString<uint64_t>(ullMemSizeVBox)); 1230 1230 1231 /* Audio */ 1232 if (!vs.strSoundCardType.isNull()) 1233 /* Currently we set the AC97 always. 1234 @todo: figure out the hardware which could be possible */ 1235 vsd->addEntry(VirtualSystemDescriptionType_SoundCard, "", vs.strSoundCardType, toString<uint32_t>(AudioControllerType_AC97)); 1236 1237 /* USB Controller */ 1238 if (vs.fHasUsbController) 1239 vsd->addEntry(VirtualSystemDescriptionType_USBController, "", "", "1"); 1240 1241 /* Network Controller */ 1242 // @todo: is there no hardware specified in the OVF-Format? 1243 if (vs.llNetworkNames.size() > 0) 1244 { 1245 /* Get the default network adapter type for the selected guest OS */ 1246 NetworkAdapterType_T nwAdapterVBox = NetworkAdapterType_Am79C970A; 1247 rc = osType->COMGETTER(AdapterType)(&nwAdapterVBox); 1248 ComAssertComRCThrowRC(rc); 1249 list<Utf8Str>::const_iterator nwIt; 1250 /* Iterate through all abstract networks. We support 8 network 1251 * adapters at the maximum. (@todo: warn if it are more!) */ 1252 size_t a = 0; 1253 for (nwIt = vs.llNetworkNames.begin(); 1254 nwIt != vs.llNetworkNames.end() && a < SchemaDefs::NetworkAdapterCount; 1255 ++nwIt, ++a) 1256 { 1257 // Utf8Str nwController = *nwIt; // @todo: not used yet 1258 vsd->addEntry(VirtualSystemDescriptionType_NetworkAdapter, "", "", toString<ULONG>(nwAdapterVBox)); 1259 } 1260 } 1261 1262 /* Floppy Drive */ 1263 if (vs.fHasFloppyDrive) 1264 vsd->addEntry(VirtualSystemDescriptionType_Floppy, "", "", "1"); 1265 1266 /* CD Drive */ 1267 /* @todo: I can't disable the CDROM. So nothing to do for now. */ 1268 //if (vs.fHasCdromDrive) 1269 // vsd->addEntry(VirtualSystemDescriptionType_CDROM, "", "", "1"); 1270 1231 1271 /* Hard disk Controller */ 1232 1272 ControllersMap::const_iterator hdcIt; … … 1331 1371 } 1332 1372 1333 /* Network Controller */1334 // @todo: is there no hardware specified in the OVF-Format?1335 if (vs.llNetworkNames.size() > 0)1336 {1337 /* Get the default network adapter type for the selected guest OS */1338 NetworkAdapterType_T nwAdapterVBox = NetworkAdapterType_Am79C970A;1339 rc = osType->COMGETTER(AdapterType)(&nwAdapterVBox);1340 ComAssertComRCThrowRC(rc);1341 list<Utf8Str>::const_iterator nwIt;1342 /* Iterate through all abstract networks. We support 8 network1343 * adapters at the maximum. (@todo: warn if it are more!) */1344 size_t a = 0;1345 for (nwIt = vs.llNetworkNames.begin();1346 nwIt != vs.llNetworkNames.end() && a < SchemaDefs::NetworkAdapterCount;1347 ++nwIt, ++a)1348 {1349 // Utf8Str nwController = *nwIt; // @todo: not used yet1350 vsd->addEntry(VirtualSystemDescriptionType_NetworkAdapter, "", "", toString<ULONG>(nwAdapterVBox));1351 }1352 }1353 1373 m->virtualSystemDescriptions.push_back(vsd); 1354 1374 } … … 1420 1440 /* Set the VRAM */ 1421 1441 rc = newMachine->COMSETTER(VRAMSize)(vramVBox); 1442 ComAssertComRCThrowRC(rc); 1443 1444 1445 /* Audio Adapter */ 1446 std::list<VirtualSystemDescriptionEntry*> vsdeAudioAdapter = vsd->findByType(VirtualSystemDescriptionType_SoundCard); 1447 /* @todo: we support one audio adapter only */ 1448 if (vsdeAudioAdapter.size() > 0) 1449 { 1450 const Utf8Str& audioAdapterVBox = vsdeAudioAdapter.front()->strFinalValue; 1451 if (RTStrICmp(audioAdapterVBox, "null") != 0) 1452 { 1453 ComPtr<IAudioAdapter> audioAdapter; 1454 rc = newMachine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam()); 1455 ComAssertComRCThrowRC(rc); 1456 rc = audioAdapter->COMSETTER(Enabled)(true); 1457 ComAssertComRCThrowRC(rc); 1458 /* @todo: For now this is preselected, but on Linux for example 1459 more drivers are possible. The user should be able to change 1460 this also. */ 1461 AudioDriverType_T adt = AudioDriverType_Null; 1462 #if defined(RT_OS_WINDOWS) 1463 # ifdef VBOX_WITH_WINMM 1464 adt = AudioDriverType_WinMM; 1465 # else 1466 adt = AudioDriverType_DirectSound; 1467 # endif 1468 #elif defined(RT_OS_LINUX) 1469 # ifdef VBOX_WITH_ALSA 1470 adt = AudioDriverType_Alsa; 1471 # elif defined(VBOX_WITH_PULSE) 1472 adt = AudioDriverType_Pulse; 1473 # else 1474 adt = AudioDriverType_OSS; 1475 # endif 1476 #elif defined(RT_OS_DARWIN) 1477 adt = AudioDriverType_CoreAudio; 1478 #elif defined(RT_OS_SOLARIS) 1479 adt = AudioDriverType_SolAudio; 1480 #elif defined(RT_OS_OS2) 1481 adt = AudioDriverType_MMPM; 1482 #endif 1483 rc = audioAdapter->COMSETTER(AudioDriver)(adt); 1484 ComAssertComRCThrowRC(rc); 1485 rc = audioAdapter->COMSETTER(AudioController)(audioAdapterVBox); 1486 ComAssertComRCThrowRC(rc); 1487 } 1488 } 1489 1490 /* USB Controller */ 1491 std::list<VirtualSystemDescriptionEntry*> vsdeUSBController = vsd->findByType(VirtualSystemDescriptionType_USBController); 1492 /* If there is no USB controller entry it will be disabled */ 1493 bool fUSBEnabled = vsdeUSBController.size() > 0; 1494 if (fUSBEnabled) 1495 { 1496 /* Check if the user has disabled the USB controller in the client */ 1497 const Utf8Str& usbVBox = vsdeUSBController.front()->strFinalValue; 1498 fUSBEnabled = usbVBox == "1"; 1499 } 1500 ComPtr<IUSBController> usbController; 1501 rc = newMachine->COMGETTER(USBController)(usbController.asOutParam()); 1502 ComAssertComRCThrowRC(rc); 1503 rc = usbController->COMSETTER(Enabled)(fUSBEnabled); 1422 1504 ComAssertComRCThrowRC(rc); 1423 1505 … … 1457 1539 } 1458 1540 1541 /* Floppy drive */ 1542 std::list<VirtualSystemDescriptionEntry*> vsdeFloppy = vsd->findByType(VirtualSystemDescriptionType_Floppy); 1543 /* If there is no floppy drive entry it will be disabled */ 1544 bool fFloppyEnabled = vsdeFloppy.size() > 0; 1545 if (fFloppyEnabled) 1546 { 1547 /* Check if the user has disabled the floppy drive in the client */ 1548 const Utf8Str& floppyVBox = vsdeFloppy.front()->strFinalValue; 1549 fFloppyEnabled = floppyVBox == "1"; 1550 } 1551 ComPtr<IFloppyDrive> floppyDrive; 1552 rc = newMachine->COMGETTER(FloppyDrive)(floppyDrive.asOutParam()); 1553 ComAssertComRCThrowRC(rc); 1554 rc = floppyDrive->COMSETTER(Enabled)(fFloppyEnabled); 1555 ComAssertComRCThrowRC(rc); 1556 1557 /* CDROM drive */ 1558 /* @todo: I can't disable the CDROM. So nothing to do for now */ 1559 // std::list<VirtualSystemDescriptionEntry*> vsdeFloppy = vsd->findByType(VirtualSystemDescriptionType_CDROM); 1560 1459 1561 /* Hard disk controller IDE */ 1460 1562 std::list<VirtualSystemDescriptionEntry*> vsdeHDCIDE = vsd->findByType(VirtualSystemDescriptionType_HardDiskControllerIDE); … … 1542 1644 /* @todo: what now? For now we override in no 1543 1645 * circumstances. */ 1544 //continue;1646 continue; 1545 1647 } 1546 1648 const Utf8Str &strRef = (*hdIt)->strRef; 1547 1649 /* Get the associated disk image */ 1548 if (m->mapDisks.find(strRef) == m->mapDisks.end()) 1650 if (m->mapDisks.find(strRef) == m->mapDisks.end() || 1651 vs.mapVirtualDisks.find(strRef) == vs.mapVirtualDisks.end()) 1549 1652 { 1550 1653 /* @todo: error: entry doesn't exists */ 1551 1654 } 1552 1655 DiskImage di = m->mapDisks[strRef]; 1656 VirtualDisk vd = (*vs.mapVirtualDisks.find(strRef)).second; 1553 1657 /* Construct the source file path */ 1554 1658 char *srcFilePath; … … 1594 1698 rc = dstHdVBox->COMGETTER(Id)(hdId.asOutParam());; 1595 1699 CheckComRCReturnRC(rc); 1596 rc = sMachine->AttachHardDisk2(hdId, StorageBus_IDE, 0, 0); // 1700 /* For now we assume we have one controller of every type only */ 1701 HardDiskController hdc = (*vs.mapControllers.find(vd.idController)).second; 1702 StorageBus_T sbt = StorageBus_IDE; 1703 switch (hdc.controllerSystem) 1704 { 1705 case IDE: sbt = StorageBus_IDE; break; 1706 case SATA: sbt = StorageBus_SATA; break; 1707 //case SCSI: sbt = StorageBus_SCSI; break; // @todo: not available yet 1708 default: break; 1709 } 1710 rc = sMachine->AttachHardDisk2(hdId, sbt, hdc.ulBusNumber, 0); 1597 1711 CheckComRCReturnRC(rc); 1598 1712 rc = sMachine->SaveSettings();
Note:
See TracChangeset
for help on using the changeset viewer.