- Timestamp:
- May 31, 2010 6:33:15 PM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ApplianceImpl.cpp
r29875 r29925 1057 1057 bstr.cloneTo(&sfaOrigValues[i]); 1058 1058 1059 bstr = vsde.strVbox ;1059 bstr = vsde.strVboxCurrent; 1060 1060 bstr.cloneTo(&sfaVboxValues[i]); 1061 1061 1062 bstr = vsde.strExtraConfig ;1062 bstr = vsde.strExtraConfigCurrent; 1063 1063 bstr.cloneTo(&sfaExtraConfigValues[i]); 1064 1064 } … … 1120 1120 bstr.cloneTo(&sfaOrigValues[i]); 1121 1121 1122 bstr = vsde->strVbox ;1122 bstr = vsde->strVboxCurrent; 1123 1123 bstr.cloneTo(&sfaVboxValues[i]); 1124 1124 1125 bstr = vsde->strExtraConfig ;1125 bstr = vsde->strExtraConfigCurrent; 1126 1126 bstr.cloneTo(&sfaExtraConfigValues[i]); 1127 1127 } … … 1168 1168 case VirtualSystemDescriptionValueType_Reference: bstr = vsde->strRef; break; 1169 1169 case VirtualSystemDescriptionValueType_Original: bstr = vsde->strOvf; break; 1170 case VirtualSystemDescriptionValueType_Auto: bstr = vsde->strVbox ; break;1171 case VirtualSystemDescriptionValueType_ExtraConfig: bstr = vsde->strExtraConfig ; break;1170 case VirtualSystemDescriptionValueType_Auto: bstr = vsde->strVboxCurrent; break; 1171 case VirtualSystemDescriptionValueType_ExtraConfig: bstr = vsde->strExtraConfigCurrent; break; 1172 1172 } 1173 1173 … … 1221 1221 if (sfaEnabled[i]) 1222 1222 { 1223 vsde.strVbox = sfaVboxValues[i];1224 vsde.strExtraConfig = sfaExtraConfigValues[i];1223 vsde.strVboxCurrent = sfaVboxValues[i]; 1224 vsde.strExtraConfigCurrent = sfaExtraConfigValues[i]; 1225 1225 } 1226 1226 else … … 1270 1270 vsde.strRef = strRef; 1271 1271 vsde.strOvf = aOvfValue; 1272 vsde.strVbox = aVboxValue; 1273 vsde.strExtraConfig = strExtraConfig; 1272 vsde.strVboxSuggested // remember original value 1273 = vsde.strVboxCurrent // and set current value which can be overridden by setFinalValues() 1274 = aVboxValue; 1275 vsde.strExtraConfigSuggested 1276 = vsde.strExtraConfigCurrent 1277 = strExtraConfig; 1274 1278 vsde.ulSizeMB = ulSizeMB; 1275 1279 -
trunk/src/VBox/Main/ApplianceImplExport.cpp
r29901 r29925 683 683 throw setError(VBOX_E_NOT_SUPPORTED, 684 684 tr("Missing VM name")); 685 Utf8Str &strVMName = llName.front()->strVbox ;685 Utf8Str &strVMName = llName.front()->strVboxCurrent; 686 686 pelmVirtualSystem->setAttribute("ovf:id", strVMName); 687 687 … … 692 692 std::list<VirtualSystemDescriptionEntry*> llVendorUrl = vsdescThis->findByType(VirtualSystemDescriptionType_VendorUrl); 693 693 std::list<VirtualSystemDescriptionEntry*> llVersion = vsdescThis->findByType(VirtualSystemDescriptionType_Version); 694 bool fProduct = llProduct.size() && !llProduct.front()->strVbox .isEmpty();695 bool fProductUrl = llProductUrl.size() && !llProductUrl.front()->strVbox .isEmpty();696 bool fVendor = llVendor.size() && !llVendor.front()->strVbox .isEmpty();697 bool fVendorUrl = llVendorUrl.size() && !llVendorUrl.front()->strVbox .isEmpty();698 bool fVersion = llVersion.size() && !llVersion.front()->strVbox .isEmpty();694 bool fProduct = llProduct.size() && !llProduct.front()->strVboxCurrent.isEmpty(); 695 bool fProductUrl = llProductUrl.size() && !llProductUrl.front()->strVboxCurrent.isEmpty(); 696 bool fVendor = llVendor.size() && !llVendor.front()->strVboxCurrent.isEmpty(); 697 bool fVendorUrl = llVendorUrl.size() && !llVendorUrl.front()->strVboxCurrent.isEmpty(); 698 bool fVersion = llVersion.size() && !llVersion.front()->strVboxCurrent.isEmpty(); 699 699 if (fProduct || 700 700 fProductUrl || … … 723 723 pelmAnnotationSection->createChild("Info")->addContent("Meta-information about the installed software"); 724 724 if (fProduct) 725 pelmAnnotationSection->createChild("Product")->addContent(llProduct.front()->strVbox );725 pelmAnnotationSection->createChild("Product")->addContent(llProduct.front()->strVboxCurrent); 726 726 if (fVendor) 727 pelmAnnotationSection->createChild("Vendor")->addContent(llVendor.front()->strVbox );727 pelmAnnotationSection->createChild("Vendor")->addContent(llVendor.front()->strVboxCurrent); 728 728 if (fVersion) 729 pelmAnnotationSection->createChild("Version")->addContent(llVersion.front()->strVbox );729 pelmAnnotationSection->createChild("Version")->addContent(llVersion.front()->strVboxCurrent); 730 730 if (fProductUrl) 731 pelmAnnotationSection->createChild("ProductUrl")->addContent(llProductUrl.front()->strVbox );731 pelmAnnotationSection->createChild("ProductUrl")->addContent(llProductUrl.front()->strVboxCurrent); 732 732 if (fVendorUrl) 733 pelmAnnotationSection->createChild("VendorUrl")->addContent(llVendorUrl.front()->strVbox );733 pelmAnnotationSection->createChild("VendorUrl")->addContent(llVendorUrl.front()->strVboxCurrent); 734 734 } 735 735 … … 737 737 std::list<VirtualSystemDescriptionEntry*> llDescription = vsdescThis->findByType(VirtualSystemDescriptionType_Description); 738 738 if (llDescription.size() && 739 !llDescription.front()->strVbox .isEmpty())739 !llDescription.front()->strVboxCurrent.isEmpty()) 740 740 { 741 741 /* <Section ovf:required="false" xsi:type="ovf:AnnotationSection_Type"> … … 754 754 755 755 pelmAnnotationSection->createChild("Info")->addContent("A human-readable annotation"); 756 pelmAnnotationSection->createChild("Annotation")->addContent(llDescription.front()->strVbox );756 pelmAnnotationSection->createChild("Annotation")->addContent(llDescription.front()->strVboxCurrent); 757 757 } 758 758 … … 760 760 std::list<VirtualSystemDescriptionEntry*> llLicense = vsdescThis->findByType(VirtualSystemDescriptionType_License); 761 761 if (llLicense.size() && 762 !llLicense.front()->strVbox .isEmpty())762 !llLicense.front()->strVboxCurrent.isEmpty()) 763 763 { 764 764 /* <EulaSection> … … 776 776 777 777 pelmEulaSection->createChild("Info")->addContent("License agreement for the virtual system"); 778 pelmEulaSection->createChild("License")->addContent(llLicense.front()->strVbox );778 pelmEulaSection->createChild("License")->addContent(llLicense.front()->strVboxCurrent); 779 779 } 780 780 … … 879 879 desc.strRef.c_str(), 880 880 desc.strOvf.c_str(), 881 desc.strVbox .c_str(),882 desc.strExtraConfig .c_str()));881 desc.strVboxCurrent.c_str(), 882 desc.strExtraConfigCurrent.c_str())); 883 883 884 884 ovf::ResourceType_T type = (ovf::ResourceType_T)0; // if this becomes != 0 then we do stuff … … 918 918 strDescription = "Number of virtual CPUs"; 919 919 type = ovf::ResourceType_Processor; // 3 920 desc.strVbox .toInt(uTemp);920 desc.strVboxCurrent.toInt(uTemp); 921 921 lVirtualQuantity = (int32_t)uTemp; 922 922 strCaption = Utf8StrFmt("%d virtual CPU", lVirtualQuantity); // without this ovftool won't eat the item … … 938 938 strDescription = "Memory Size"; 939 939 type = ovf::ResourceType_Memory; // 4 940 desc.strVbox .toInt(uTemp);940 desc.strVboxCurrent.toInt(uTemp); 941 941 lVirtualQuantity = (int32_t)(uTemp / _1M); 942 942 strAllocationUnits = "MegaBytes"; … … 958 958 strDescription = "IDE Controller"; 959 959 type = ovf::ResourceType_IDEController; // 5 960 strResourceSubType = desc.strVbox ;960 strResourceSubType = desc.strVboxCurrent; 961 961 962 962 if (!lIDEPrimaryControllerIndex) … … 1004 1004 lBusNumber = 0; 1005 1005 1006 if ( desc.strVbox .isEmpty() // AHCI is the default in VirtualBox1007 || (!desc.strVbox.compare("ahci", Utf8Str::CaseInsensitive))1008 1006 if ( desc.strVboxCurrent.isEmpty() // AHCI is the default in VirtualBox 1007 || (!desc.strVboxCurrent.compare("ahci", Utf8Str::CaseInsensitive)) 1008 ) 1009 1009 strResourceSubType = "AHCI"; 1010 1010 else 1011 1011 throw setError(VBOX_E_NOT_SUPPORTED, 1012 tr("Invalid config string \"%s\" in SATA controller"), desc.strVbox .c_str());1012 tr("Invalid config string \"%s\" in SATA controller"), desc.strVboxCurrent.c_str()); 1013 1013 1014 1014 // remember this ID … … 1039 1039 lBusNumber = 0; 1040 1040 1041 if ( desc.strVbox .isEmpty() // LsiLogic is the default in VirtualBox1042 || (!desc.strVbox .compare("lsilogic", Utf8Str::CaseInsensitive))1041 if ( desc.strVboxCurrent.isEmpty() // LsiLogic is the default in VirtualBox 1042 || (!desc.strVboxCurrent.compare("lsilogic", Utf8Str::CaseInsensitive)) 1043 1043 ) 1044 1044 strResourceSubType = "lsilogic"; 1045 else if (!desc.strVbox .compare("buslogic", Utf8Str::CaseInsensitive))1045 else if (!desc.strVboxCurrent.compare("buslogic", Utf8Str::CaseInsensitive)) 1046 1046 strResourceSubType = "buslogic"; 1047 else if (!desc.strVbox .compare("lsilogicsas", Utf8Str::CaseInsensitive))1047 else if (!desc.strVboxCurrent.compare("lsilogicsas", Utf8Str::CaseInsensitive)) 1048 1048 strResourceSubType = "lsilogicsas"; 1049 1049 else 1050 1050 throw setError(VBOX_E_NOT_SUPPORTED, 1051 tr("Invalid config string \"%s\" in SCSI controller"), desc.strVbox .c_str());1051 tr("Invalid config string \"%s\" in SCSI controller"), desc.strVboxCurrent.c_str()); 1052 1052 1053 1053 // remember this ID … … 1079 1079 1080 1080 // controller=<index>;channel=<c> 1081 size_t pos1 = desc.strExtraConfig .find("controller=");1082 size_t pos2 = desc.strExtraConfig .find("channel=");1081 size_t pos1 = desc.strExtraConfigCurrent.find("controller="); 1082 size_t pos2 = desc.strExtraConfigCurrent.find("channel="); 1083 1083 int32_t lControllerIndex = -1; 1084 1084 if (pos1 != Utf8Str::npos) 1085 1085 { 1086 RTStrToInt32Ex(desc.strExtraConfig .c_str() + pos1 + 11, NULL, 0, &lControllerIndex);1086 RTStrToInt32Ex(desc.strExtraConfigCurrent.c_str() + pos1 + 11, NULL, 0, &lControllerIndex); 1087 1087 if (lControllerIndex == lIDEPrimaryControllerIndex) 1088 1088 ulParent = idIDEPrimaryController; … … 1095 1095 } 1096 1096 if (pos2 != Utf8Str::npos) 1097 RTStrToInt32Ex(desc.strExtraConfig .c_str() + pos2 + 8, NULL, 0, &lAddressOnParent);1097 RTStrToInt32Ex(desc.strExtraConfigCurrent.c_str() + pos2 + 8, NULL, 0, &lAddressOnParent); 1098 1098 1099 1099 LogFlowFunc(("HardDiskImage details: pos1=%d, pos2=%d, lControllerIndex=%d, lIDEPrimaryControllerIndex=%d, lIDESecondaryControllerIndex=%d, ulParent=%d, lAddressOnParent=%d\n", … … 1104 1104 ) 1105 1105 throw setError(VBOX_E_NOT_SUPPORTED, 1106 tr("Missing or bad extra config string in hard disk image: \"%s\""), desc.strExtraConfig .c_str());1106 tr("Missing or bad extra config string in hard disk image: \"%s\""), desc.strExtraConfigCurrent.c_str()); 1107 1107 1108 1108 stack.mapDisks[strDiskID] = &desc; … … 1156 1156 * PCNet32 for our PCNet types & E1000 for the 1157 1157 * E1000 cards. */ 1158 switch (desc.strVbox .toInt32())1158 switch (desc.strVboxCurrent.toInt32()) 1159 1159 { 1160 1160 case NetworkAdapterType_Am79C970A: … … 1470 1470 1471 1471 // source path: where the VBox image is 1472 const Utf8Str &strSrcFilePath = pDiskEntry->strVbox ;1472 const Utf8Str &strSrcFilePath = pDiskEntry->strVboxCurrent; 1473 1473 Bstr bstrSrcFilePath(strSrcFilePath); 1474 1474 if (!RTPathExists(strSrcFilePath.c_str())) -
trunk/src/VBox/Main/ApplianceImplImport.cpp
r29901 r29925 970 970 971 971 /** 972 * Used by Appliance::importMachineGeneric() to store973 * input parameters and rollback information.974 */975 struct Appliance::ImportStack976 {977 // input pointers978 const LocationInfo &locInfo; // ptr to location info from Appliance::importFS()979 Utf8Str strSourceDir; // directory where source files reside980 const ovf::DiskImagesMap &mapDisks; // ptr to disks map in OVF981 ComObjPtr<Progress> &pProgress; // progress object passed into Appliance::importFS()982 983 // session (not initially created)984 ComPtr<ISession> pSession; // session opened in Appliance::importFS() for machine manipulation985 bool fSessionOpen; // true if the pSession is currently open and needs closing986 987 // a list of images that we created/imported; this is initially empty988 // and will be cleaned up on errors989 list<MyHardDiskAttachment> llHardDiskAttachments; // disks that were attached990 list< ComPtr<IMedium> > llHardDisksCreated; // media that were created991 list<Bstr> llMachinesRegistered; // machines that were registered; list of string UUIDs992 993 ImportStack(const LocationInfo &aLocInfo,994 const ovf::DiskImagesMap &aMapDisks,995 ComObjPtr<Progress> &aProgress)996 : locInfo(aLocInfo),997 mapDisks(aMapDisks),998 pProgress(aProgress),999 fSessionOpen(false)1000 {1001 // disk images have to be on the same place as the OVF file. So1002 // strip the filename out of the full file path1003 strSourceDir = aLocInfo.strPath;1004 strSourceDir.stripFilename();1005 }1006 };1007 1008 /**1009 972 * Checks if a manifest file exists in the given location and, if so, verifies 1010 973 * that the relevant files (the OVF XML and the disks referenced by it, as … … 1176 1139 // VirtualSystemDescriptionEntry and do import work 1177 1140 1178 // @todo r=dj make this selection configurable at run-time, and from the GUI as well 1179 1141 // Even for the vbox:Machine case, there are a number of configuration items that will be taken from 1142 // the OVF because otherwise the "override import parameters" mechanism in the GUI won't work. 1143 1144 // VM name 1145 std::list<VirtualSystemDescriptionEntry*> vsdeName = vsdescThis->findByType(VirtualSystemDescriptionType_Name); 1146 if (vsdeName.size() < 1) 1147 throw setError(VBOX_E_FILE_ERROR, 1148 tr("Missing VM name")); 1149 stack.strNameVBox = vsdeName.front()->strVboxCurrent; 1150 1151 // guest OS type 1152 std::list<VirtualSystemDescriptionEntry*> vsdeOS; 1153 vsdeOS = vsdescThis->findByType(VirtualSystemDescriptionType_OS); 1154 if (vsdeOS.size() < 1) 1155 throw setError(VBOX_E_FILE_ERROR, 1156 tr("Missing guest OS type")); 1157 stack.strOsTypeVBox = vsdeOS.front()->strVboxCurrent; 1158 1159 // CPU count 1160 std::list<VirtualSystemDescriptionEntry*> vsdeCPU = vsdescThis->findByType(VirtualSystemDescriptionType_CPU); 1161 ComAssertMsgThrow(vsdeCPU.size() == 1, ("CPU count missing"), E_FAIL); 1162 const Utf8Str &cpuVBox = vsdeCPU.front()->strVboxCurrent; 1163 stack.cCPUs = (uint32_t)RTStrToUInt64(cpuVBox.c_str()); 1164 // We need HWVirt & IO-APIC if more than one CPU is requested 1165 if (stack.cCPUs > 1) 1166 { 1167 stack.fForceHWVirt = true; 1168 stack.fForceIOAPIC = true; 1169 } 1170 1171 // RAM 1172 std::list<VirtualSystemDescriptionEntry*> vsdeRAM = vsdescThis->findByType(VirtualSystemDescriptionType_Memory); 1173 ComAssertMsgThrow(vsdeRAM.size() == 1, ("RAM size missing"), E_FAIL); 1174 const Utf8Str &memoryVBox = vsdeRAM.front()->strVboxCurrent; 1175 stack.ulMemorySizeMB = (uint32_t)RTStrToUInt64(memoryVBox.c_str()); 1176 1177 // USB controller 1178 #ifdef VBOX_WITH_USB 1179 /* USB Controller */ 1180 std::list<VirtualSystemDescriptionEntry*> vsdeUSBController = vsdescThis->findByType(VirtualSystemDescriptionType_USBController); 1181 // USB support is enabled if there's at least one such entry; to disable USB support, 1182 // the type of the USB item would have been changed to "ignore" 1183 stack.fUSBEnabled = vsdeUSBController.size() > 0; 1184 #endif 1185 // audio adapter 1186 std::list<VirtualSystemDescriptionEntry*> vsdeAudioAdapter = vsdescThis->findByType(VirtualSystemDescriptionType_SoundCard); 1187 /* @todo: we support one audio adapter only */ 1188 if (vsdeAudioAdapter.size() > 0) 1189 stack.strAudioAdapter = vsdeAudioAdapter.front()->strVboxCurrent; 1190 1191 // import vbox:machine or OVF now 1180 1192 if (vsdescThis->m->pConfig) 1193 // vbox:Machine config 1181 1194 importVBoxMachine(vsdescThis, pNewMachine, stack); 1182 1195 else 1196 // generic OVF config 1183 1197 importMachineGeneric(vsysThis, vsdescThis, pNewMachine, stack); 1184 1198 1199 // for the description of the new machine, always use the OVF entry, the user may have changed it in the import config 1200 std::list<VirtualSystemDescriptionEntry*> vsdeDescription = vsdescThis->findByType(VirtualSystemDescriptionType_Description); 1201 if (vsdeDescription.size()) 1202 { 1203 const Utf8Str &strDescription = vsdeDescription.front()->strVboxCurrent; 1204 rc = pNewMachine->COMSETTER(Description)(Bstr(strDescription)); 1205 if (FAILED(rc)) throw rc; 1206 } 1185 1207 } // for (it = pAppliance->m->llVirtualSystems.begin() ... 1186 1208 } … … 1292 1314 || RTPathExists(strTargetPath.c_str()) 1293 1315 ) 1294 /* This isn't allowed */1295 1316 throw setError(VBOX_E_FILE_ERROR, 1296 1317 tr("Destination file '%s' exists"), … … 1410 1431 ImportStack &stack) 1411 1432 { 1412 /* Guest OS type */ 1413 std::list<VirtualSystemDescriptionEntry*> vsdeOS; 1414 vsdeOS = vsdescThis->findByType(VirtualSystemDescriptionType_OS); 1415 if (vsdeOS.size() < 1) 1416 throw setError(VBOX_E_FILE_ERROR, 1417 tr("Missing guest OS type")); 1418 const Utf8Str &strOsTypeVBox = vsdeOS.front()->strVbox; 1419 1420 /* Now that we know the base system get our internal defaults based on that. */ 1433 HRESULT rc; 1434 1435 // Get the instance of IGuestOSType which matches our string guest OS type so we 1436 // can use recommended defaults for the new machine where OVF doesen't provice any 1421 1437 ComPtr<IGuestOSType> osType; 1422 HRESULT rc = mVirtualBox->GetGuestOSType(Bstr(strOsTypeVBox), osType.asOutParam());1438 rc = mVirtualBox->GetGuestOSType(Bstr(stack.strOsTypeVBox), osType.asOutParam()); 1423 1439 if (FAILED(rc)) throw rc; 1424 1440 1425 1441 /* Create the machine */ 1426 /* First get the name */ 1427 std::list<VirtualSystemDescriptionEntry*> vsdeName = vsdescThis->findByType(VirtualSystemDescriptionType_Name); 1428 if (vsdeName.size() < 1) 1429 throw setError(VBOX_E_FILE_ERROR, 1430 tr("Missing VM name")); 1431 const Utf8Str &strNameVBox = vsdeName.front()->strVbox; 1432 rc = mVirtualBox->CreateMachine(Bstr(strNameVBox), 1433 Bstr(strOsTypeVBox), 1442 rc = mVirtualBox->CreateMachine(Bstr(stack.strNameVBox), 1443 Bstr(stack.strOsTypeVBox), 1434 1444 NULL, 1435 1445 NULL, … … 1438 1448 if (FAILED(rc)) throw rc; 1439 1449 1440 // andthe description1450 // set the description 1441 1451 std::list<VirtualSystemDescriptionEntry*> vsdeDescription = vsdescThis->findByType(VirtualSystemDescriptionType_Description); 1442 1452 if (vsdeDescription.size()) 1443 1453 { 1444 const Utf8Str &strDescription = vsdeDescription.front()->strVbox ;1454 const Utf8Str &strDescription = vsdeDescription.front()->strVboxCurrent; 1445 1455 rc = pNewMachine->COMSETTER(Description)(Bstr(strDescription)); 1446 1456 if (FAILED(rc)) throw rc; 1447 1457 } 1448 1458 1449 /* CPU count */ 1450 std::list<VirtualSystemDescriptionEntry*> vsdeCPU = vsdescThis->findByType(VirtualSystemDescriptionType_CPU); 1451 ComAssertMsgThrow(vsdeCPU.size() == 1, ("CPU count missing"), E_FAIL); 1452 const Utf8Str &cpuVBox = vsdeCPU.front()->strVbox; 1453 ULONG tmpCount = (ULONG)RTStrToUInt64(cpuVBox.c_str()); 1454 rc = pNewMachine->COMSETTER(CPUCount)(tmpCount); 1459 // CPU count 1460 rc = pNewMachine->COMSETTER(CPUCount)(stack.cCPUs); 1455 1461 if (FAILED(rc)) throw rc; 1456 bool fEnableIOApic = false; 1457 /* We need HWVirt & IO-APIC if more than one CPU is requested */ 1458 if (tmpCount > 1) 1462 1463 if (stack.fForceHWVirt) 1459 1464 { 1460 1465 rc = pNewMachine->SetHWVirtExProperty(HWVirtExPropertyType_Enabled, TRUE); 1461 1466 if (FAILED(rc)) throw rc; 1462 1463 fEnableIOApic = true; 1464 } 1465 1466 /* RAM */ 1467 std::list<VirtualSystemDescriptionEntry*> vsdeRAM = vsdescThis->findByType(VirtualSystemDescriptionType_Memory); 1468 ComAssertMsgThrow(vsdeRAM.size() == 1, ("RAM size missing"), E_FAIL); 1469 const Utf8Str &memoryVBox = vsdeRAM.front()->strVbox; 1470 ULONG tt = (ULONG)RTStrToUInt64(memoryVBox.c_str()); 1471 rc = pNewMachine->COMSETTER(MemorySize)(tt); 1467 } 1468 1469 // RAM 1470 rc = pNewMachine->COMSETTER(MemorySize)(stack.ulMemorySizeMB); 1472 1471 if (FAILED(rc)) throw rc; 1473 1472 … … 1486 1485 // it will not mind finding an one later on, but if Windows was installed 1487 1486 // _with_ an IOAPIC, it will bluescreen if it's not found 1488 if (! fEnableIOApic)1487 if (!stack.fForceIOAPIC) 1489 1488 { 1490 1489 Bstr bstrFamilyId; … … 1492 1491 if (FAILED(rc)) throw rc; 1493 1492 if (bstrFamilyId == "Windows") 1494 fEnableIOApic= true;1495 } 1496 1497 if ( fEnableIOApic)1493 stack.fForceIOAPIC = true; 1494 } 1495 1496 if (stack.fForceIOAPIC) 1498 1497 { 1499 1498 ComPtr<IBIOSSettings> pBIOSSettings; … … 1505 1504 } 1506 1505 1507 /* Audio Adapter */ 1508 std::list<VirtualSystemDescriptionEntry*> vsdeAudioAdapter = vsdescThis->findByType(VirtualSystemDescriptionType_SoundCard); 1509 /* @todo: we support one audio adapter only */ 1510 if (vsdeAudioAdapter.size() > 0) 1511 { 1512 const Utf8Str& audioAdapterVBox = vsdeAudioAdapter.front()->strVbox; 1513 if (audioAdapterVBox.compare("null", Utf8Str::CaseInsensitive) != 0) 1514 { 1515 uint32_t audio = RTStrToUInt32(audioAdapterVBox.c_str()); 1506 if (!stack.strAudioAdapter.isEmpty()) 1507 if (stack.strAudioAdapter.compare("null", Utf8Str::CaseInsensitive) != 0) 1508 { 1509 uint32_t audio = RTStrToUInt32(stack.strAudioAdapter.c_str()); // should be 0 for AC97 1516 1510 ComPtr<IAudioAdapter> audioAdapter; 1517 1511 rc = pNewMachine->COMGETTER(AudioAdapter)(audioAdapter.asOutParam()); … … 1522 1516 if (FAILED(rc)) throw rc; 1523 1517 } 1524 }1525 1518 1526 1519 #ifdef VBOX_WITH_USB 1527 1520 /* USB Controller */ 1528 std::list<VirtualSystemDescriptionEntry*> vsdeUSBController = vsdescThis->findByType(VirtualSystemDescriptionType_USBController);1529 // USB support is enabled if there's at least one such entry; to disable USB support,1530 // the type of the USB item would have been changed to "ignore"1531 bool fUSBEnabled = vsdeUSBController.size() > 0;1532 1533 1521 ComPtr<IUSBController> usbController; 1534 1522 rc = pNewMachine->COMGETTER(USBController)(usbController.asOutParam()); 1535 1523 if (FAILED(rc)) throw rc; 1536 rc = usbController->COMSETTER(Enabled)( fUSBEnabled);1524 rc = usbController->COMSETTER(Enabled)(stack.fUSBEnabled); 1537 1525 if (FAILED(rc)) throw rc; 1538 1526 #endif /* VBOX_WITH_USB */ … … 1563 1551 const VirtualSystemDescriptionEntry* pvsys = *nwIt; 1564 1552 1565 const Utf8Str &nwTypeVBox = pvsys->strVbox ;1553 const Utf8Str &nwTypeVBox = pvsys->strVboxCurrent; 1566 1554 uint32_t tt1 = RTStrToUInt32(nwTypeVBox.c_str()); 1567 1555 ComPtr<INetworkAdapter> pNetworkAdapter; … … 1575 1563 1576 1564 // default is NAT; change to "bridged" if extra conf says so 1577 if (!pvsys->strExtraConfig .compare("type=Bridged", Utf8Str::CaseInsensitive))1565 if (!pvsys->strExtraConfigCurrent.compare("type=Bridged", Utf8Str::CaseInsensitive)) 1578 1566 { 1579 1567 /* Attach to the right interface */ … … 1608 1596 } 1609 1597 /* Next test for host only interfaces */ 1610 else if (!pvsys->strExtraConfig .compare("type=HostOnly", Utf8Str::CaseInsensitive))1598 else if (!pvsys->strExtraConfigCurrent.compare("type=HostOnly", Utf8Str::CaseInsensitive)) 1611 1599 { 1612 1600 /* Attach to the right interface */ … … 1658 1646 if (FAILED(rc)) throw rc; 1659 1647 1660 const char *pcszIDEType = vsdeHDCIDE.front()->strVbox .c_str();1648 const char *pcszIDEType = vsdeHDCIDE.front()->strVboxCurrent.c_str(); 1661 1649 if (!strcmp(pcszIDEType, "PIIX3")) 1662 1650 rc = pController->COMSETTER(ControllerType)(StorageControllerType_PIIX3); … … 1680 1668 { 1681 1669 ComPtr<IStorageController> pController; 1682 const Utf8Str &hdcVBox = vsdeHDCSATA.front()->strVbox ;1670 const Utf8Str &hdcVBox = vsdeHDCSATA.front()->strVboxCurrent; 1683 1671 if (hdcVBox == "AHCI") 1684 1672 { … … 1703 1691 StorageBus_T busType = StorageBus_SCSI; 1704 1692 StorageControllerType_T controllerType; 1705 const Utf8Str &hdcVBox = vsdeHDCSCSI.front()->strVbox ;1693 const Utf8Str &hdcVBox = vsdeHDCSCSI.front()->strVboxCurrent; 1706 1694 if (hdcVBox == "LsiLogic") 1707 1695 controllerType = StorageControllerType_LsiLogic; … … 1895 1883 ComPtr<IMedium> pTargetHD; 1896 1884 importOneDiskImage(ovfDiskImage, 1897 vsdeHD->strVbox ,1885 vsdeHD->strVboxCurrent, 1898 1886 pTargetHD, 1899 1887 stack); … … 1921 1909 mhda.lDevice); 1922 1910 1923 Log(("Attaching disk %s to port %d on device %d\n", vsdeHD->strVbox .c_str(), mhda.lControllerPort, mhda.lDevice));1911 Log(("Attaching disk %s to port %d on device %d\n", vsdeHD->strVboxCurrent.c_str(), mhda.lControllerPort, mhda.lDevice)); 1924 1912 1925 1913 rc = sMachine->AttachDevice(mhda.controllerType, // wstring name … … 1971 1959 * replace the old UUID with the new one. 1972 1960 * 1973 * 3) Create the VirtualBox machine with the modfified machine config. 1961 * 3) Change the machine config according to the OVF virtual system descriptions, in case the 1962 * caller has modified them using setFinalValues(). 1963 * 1964 * 4) Create the VirtualBox machine with the modfified machine config. 1974 1965 * 1975 1966 * @param config … … 1989 1980 if (FAILED(rc)) throw rc; 1990 1981 1991 // step 1): scan the machine config for attachments 1982 /* 1983 * 1984 * step 1): modify machine config according to OVF config, in case the user 1985 * has modified them using setFinalValues() 1986 * 1987 */ 1988 1989 // std::list<VirtualSystemDescriptionEntry*> llVSDEs; 1990 1991 config.hardwareMachine.cCPUs = stack.cCPUs; 1992 config.hardwareMachine.ulMemorySizeMB = stack.ulMemorySizeMB; 1993 if (stack.fForceIOAPIC) 1994 config.hardwareMachine.fHardwareVirt = true; 1995 if (stack.fForceIOAPIC) 1996 config.hardwareMachine.biosSettings.fIOAPICEnabled = true; 1997 1998 /* 1999 <const name="HardDiskControllerIDE" value="14" /> 2000 <const name="HardDiskControllerSATA" value="15" /> 2001 <const name="HardDiskControllerSCSI" value="16" /> 2002 <const name="HardDiskControllerSAS" value="17" /> 2003 <const name="HardDiskImage" value="18" /> 2004 <const name="Floppy" value="19" /> 2005 <const name="CDROM" value="20" /> 2006 <const name="NetworkAdapter" value="21" /> 2007 */ 2008 2009 #ifdef VBOX_WITH_USB 2010 // disable USB if user disabled USB 2011 config.hardwareMachine.usbController.fEnabled = stack.fUSBEnabled; 2012 #endif 2013 2014 // audio adapter: only config is turning it off presently 2015 if (stack.strAudioAdapter.isEmpty()) 2016 config.hardwareMachine.audioAdapter.fEnabled = false; 2017 2018 /* 2019 * 2020 * step 2: scan the machine config for media attachments 2021 * 2022 */ 2023 1992 2024 for (settings::StorageControllersList::iterator sit = config.storageMachine.llStorageControllers.begin(); 1993 2025 sit != config.storageMachine.llStorageControllers.end(); … … 2024 2056 searchUniqueDiskImageFilePath(strTargetPath); 2025 2057 2026 // step 2): for each attachment, import the disk... 2058 /* 2059 * 2060 * step 3: import disk 2061 * 2062 */ 2027 2063 ComPtr<IMedium> pTargetHD; 2028 2064 importOneDiskImage(di, … … 2052 2088 } // for (settings::StorageControllersList::const_iterator sit = config.storageMachine.llStorageControllers.begin(); 2053 2089 2054 // step 3): create the machine and have it import the config 2055 2056 // use the name that we computed in the OVF fields to avoid duplicates 2057 std::list<VirtualSystemDescriptionEntry*> vsdeName = vsdescThis->findByType(VirtualSystemDescriptionType_Name); 2058 if (vsdeName.size() < 1) 2059 throw setError(VBOX_E_FILE_ERROR, 2060 tr("Missing VM name")); 2061 const Utf8Str &strNameVBox = vsdeName.front()->strVbox; 2090 /* 2091 * 2092 * step 4): create the machine and have it import the config 2093 * 2094 */ 2062 2095 2063 2096 ComObjPtr<Machine> pNewMachine; … … 2068 2101 // instance that we created from the vbox:Machine 2069 2102 rc = pNewMachine->init(mVirtualBox, 2070 st rNameVBox, // name from just above (can be suffixed to avoid duplicates)2071 config); // the whole machine config2103 stack.strNameVBox, // name from OVF preparations; can be suffixed to avoid duplicates, or changed by user 2104 config); // the whole machine config 2072 2105 if (FAILED(rc)) throw rc; 2073 2106 -
trunk/src/VBox/Main/include/ApplianceImpl.h
r29875 r29925 185 185 Utf8Str strRef; // reference number (hard disk controllers only) 186 186 Utf8Str strOvf; // original OVF value (type-dependent) 187 Utf8Str strVbox; // configuration value (type-dependent) 188 Utf8Str strExtraConfig; // extra configuration key=value strings (type-dependent) 187 Utf8Str strVboxSuggested; // configuration value (type-dependent); original value suggested by interpret() 188 Utf8Str strVboxCurrent; // configuration value (type-dependent); current value, either from interpret() or setFinalValue() 189 Utf8Str strExtraConfigSuggested; // extra configuration key=value strings (type-dependent); original value suggested by interpret() 190 Utf8Str strExtraConfigCurrent; // extra configuration key=value strings (type-dependent); current value, either from interpret() or setFinalValue() 189 191 190 192 uint32_t ulSizeMB; // hard disk images only: a copy of ovf::DiskImage::ulSuggestedSizeMB -
trunk/src/VBox/Main/include/ApplianceImplPrivate.h
r29875 r29925 132 132 }; 133 133 134 /** 135 * Used by Appliance::importMachineGeneric() to store 136 * input parameters and rollback information. 137 */ 138 struct Appliance::ImportStack 139 { 140 // input pointers 141 const LocationInfo &locInfo; // ptr to location info from Appliance::importFS() 142 Utf8Str strSourceDir; // directory where source files reside 143 const ovf::DiskImagesMap &mapDisks; // ptr to disks map in OVF 144 ComObjPtr<Progress> &pProgress; // progress object passed into Appliance::importFS() 145 146 // input parameters from VirtualSystemDescriptions 147 Utf8Str strNameVBox; // VM name 148 Utf8Str strOsTypeVBox; // VirtualBox guest OS type as string 149 uint32_t cCPUs; // CPU count 150 bool fForceHWVirt; // if true, we force enabling hardware virtualization 151 bool fForceIOAPIC; // if true, we force enabling the IOAPIC 152 uint32_t ulMemorySizeMB; // virtual machien RAM in megabytes 153 #ifdef VBOX_WITH_USB 154 bool fUSBEnabled; 155 #endif 156 Utf8Str strAudioAdapter; // if not empty, then the guest has audio enabled, and this is the decimal 157 // representation of the audio adapter (should always be "0" for AC97 presently) 158 159 // session (not initially created) 160 ComPtr<ISession> pSession; // session opened in Appliance::importFS() for machine manipulation 161 bool fSessionOpen; // true if the pSession is currently open and needs closing 162 163 // a list of images that we created/imported; this is initially empty 164 // and will be cleaned up on errors 165 std::list<MyHardDiskAttachment> llHardDiskAttachments; // disks that were attached 166 std::list< ComPtr<IMedium> > llHardDisksCreated; // media that were created 167 std::list<Bstr> llMachinesRegistered; // machines that were registered; list of string UUIDs 168 169 ImportStack(const LocationInfo &aLocInfo, 170 const ovf::DiskImagesMap &aMapDisks, 171 ComObjPtr<Progress> &aProgress) 172 : locInfo(aLocInfo), 173 mapDisks(aMapDisks), 174 pProgress(aProgress), 175 cCPUs(1), 176 fForceHWVirt(false), 177 fForceIOAPIC(false), 178 ulMemorySizeMB(0), 179 fSessionOpen(false) 180 { 181 // disk images have to be on the same place as the OVF file. So 182 // strip the filename out of the full file path 183 strSourceDir = aLocInfo.strPath; 184 strSourceDir.stripFilename(); 185 } 186 }; 187 134 188 //////////////////////////////////////////////////////////////////////////////// 135 189 // -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r29849 r29925 89 89 COM_INTERFACE_ENTRY(ISupportErrorInfo) 90 90 COM_INTERFACE_ENTRY(IVirtualBox) 91 COM_INTERFACE_ENTRY(IConnectionPointContainer) 91 COM_INTERFACE_ENTRY(IConnectionPointContainer) 92 92 END_COM_MAP() 93 93 -
trunk/src/VBox/Main/include/ovfreader.h
r29422 r29925 311 311 iprt::MiniString strName; // copy of VirtualSystem/@id 312 312 313 iprt::MiniString strDescription; // copy of VirtualSystem/ Info content313 iprt::MiniString strDescription; // copy of VirtualSystem/AnnotationSection content, if any 314 314 315 315 CIMOSType_T cimos;
Note:
See TracChangeset
for help on using the changeset viewer.