Changeset 72919 in vbox for trunk/src/VBox/Main/src-server
- Timestamp:
- Jul 5, 2018 2:44:31 PM (7 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r72525 r72919 289 289 vsysThis.strLicenseText); 290 290 291 /* Now that we know the OS type, get our internal defaults based on that. */ 291 /* Now that we know the OS type, get our internal defaults based on 292 * that, if it is known (otherwise pGuestOSType will be NULL). */ 292 293 ComPtr<IGuestOSType> pGuestOSType; 293 rc = mVirtualBox->GetGuestOSType(Bstr(strOsTypeVBox).raw(), pGuestOSType.asOutParam()); 294 if (FAILED(rc)) throw rc; 294 mVirtualBox->GetGuestOSType(Bstr(strOsTypeVBox).raw(), pGuestOSType.asOutParam()); 295 295 296 296 /* CPU count */ … … 341 341 /* If the RAM of the OVF is zero, use our predefined values */ 342 342 ULONG memSizeVBox2; 343 rc = pGuestOSType->COMGETTER(RecommendedRAM)(&memSizeVBox2); 344 if (FAILED(rc)) throw rc; 343 if (!pGuestOSType.isNull()) 344 { 345 rc = pGuestOSType->COMGETTER(RecommendedRAM)(&memSizeVBox2); 346 if (FAILED(rc)) throw rc; 347 } 348 else 349 memSizeVBox2 = 1024; 345 350 /* VBox stores that in MByte */ 346 351 ullMemSizeVBox = (uint64_t)memSizeVBox2; … … 428 433 /* Get the default network adapter type for the selected guest OS */ 429 434 NetworkAdapterType_T defaultAdapterVBox = NetworkAdapterType_Am79C970A; 430 rc = pGuestOSType->COMGETTER(AdapterType)(&defaultAdapterVBox); 431 if (FAILED(rc)) throw rc; 435 if (!pGuestOSType.isNull()) 436 { 437 rc = pGuestOSType->COMGETTER(AdapterType)(&defaultAdapterVBox); 438 if (FAILED(rc)) throw rc; 439 } 440 else 441 { 442 #ifdef VBOX_WITH_E1000 443 defaultAdapterVBox = NetworkAdapterType_I82540EM; 444 #else 445 defaultAdapterVBox = NetworkAdapterType_Am79C973A; 446 #endif 447 } 432 448 433 449 ovf::EthernetAdaptersList::const_iterator itEA; -
trunk/src/VBox/Main/src-server/BIOSSettingsImpl.cpp
r69500 r72919 59 59 void BIOSSettings::FinalRelease() 60 60 { 61 uninit 61 uninit(); 62 62 BaseFinalRelease(); 63 63 } … … 562 562 } 563 563 564 void BIOSSettings::i_copyFrom 565 { 566 AssertReturnVoid 564 void BIOSSettings::i_copyFrom(BIOSSettings *aThat) 565 { 566 AssertReturnVoid(aThat != NULL); 567 567 568 568 /* sanity */ 569 569 AutoCaller autoCaller(this); 570 AssertComRCReturnVoid 570 AssertComRCReturnVoid(autoCaller.rc()); 571 571 572 572 /* sanity too */ 573 AutoCaller thatCaller 574 AssertComRCReturnVoid 573 AutoCaller thatCaller(aThat); 574 AssertComRCReturnVoid(thatCaller.rc()); 575 575 576 576 /* peer is not modified, lock it for reading (aThat is "master" so locked … … 583 583 } 584 584 585 void BIOSSettings::i_applyDefaults (GuestOSType *aOsType) 586 { 587 AssertReturnVoid (aOsType != NULL); 588 585 void BIOSSettings::i_applyDefaults(GuestOSType *aOsType) 586 { 589 587 /* sanity */ 590 588 AutoCaller autoCaller(this); 591 AssertComRCReturnVoid 589 AssertComRCReturnVoid(autoCaller.rc()); 592 590 593 591 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 594 592 595 593 /* Initialize default BIOS settings here */ 596 m->bd->fIOAPICEnabled = aOsType->i_recommendedIOAPIC(); 594 if (aOsType) 595 m->bd->fIOAPICEnabled = aOsType->i_recommendedIOAPIC(); 596 else 597 m->bd->fIOAPICEnabled = true; 597 598 } 598 599 -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r72700 r72919 278 278 * @param strName name for the machine 279 279 * @param llGroups list of groups for the machine 280 * @param strOsType OS Type string (stored as is if aOsType is NULL). 280 281 * @param aOsType OS Type of this machine or NULL. 281 282 * @param aId UUID for the new machine. … … 290 291 const Utf8Str &strName, 291 292 const StringsList &llGroups, 293 const Utf8Str &strOsType, 292 294 GuestOSType *aOsType, 293 295 const Guid &aId, … … 343 345 mUserData->s.strOsType = aOsType->i_id(); 344 346 345 /* Apply BIOS defaults */346 mBIOSSettings->i_applyDefaults(aOsType);347 348 347 /* Let the OS type select 64-bit ness. */ 349 348 mHWData->mLongMode = aOsType->i_is64Bit() … … 353 352 mHWData->mX2APIC = aOsType->i_recommendedX2APIC(); 354 353 } 354 else if (!strOsType.isEmpty()) 355 { 356 /* Store OS type */ 357 mUserData->s.strOsType = strOsType; 358 359 /* No guest OS type object. Pick some plausible defaults which the 360 * host can handle. There's no way to know or validate anything. */ 361 mHWData->mLongMode = HC_ARCH_BITS == 64 ? settings::Hardware::LongMode_Enabled : settings::Hardware::LongMode_Disabled; 362 mHWData->mX2APIC = false; 363 } 364 365 /* Apply BIOS defaults */ 366 mBIOSSettings->i_applyDefaults(aOsType); 355 367 356 368 /* Apply network adapters defaults */ … … 1087 1099 /* look up the object by Id to check it is valid */ 1088 1100 ComObjPtr<GuestOSType> pGuestOSType; 1089 HRESULT rc = mParent->i_findGuestOSType(aOSTypeId, 1090 pGuestOSType); 1091 if (FAILED(rc)) return rc; 1101 mParent->i_findGuestOSType(aOSTypeId, pGuestOSType); 1092 1102 1093 1103 /* when setting, always use the "etalon" value for consistency -- lookup 1094 1104 * by ID is case-insensitive and the input value may have different case */ 1095 Utf8Str osTypeId = pGuestOSType->i_id();1105 Utf8Str osTypeId = !pGuestOSType.isNull() ? pGuestOSType->i_id() : aOSTypeId; 1096 1106 1097 1107 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1098 1108 1099 rc = i_checkStateDependency(MutableStateDep);1109 HRESULT rc = i_checkStateDependency(MutableStateDep); 1100 1110 if (FAILED(rc)) return rc; 1101 1111 … … 1288 1298 HRESULT hrc2 = mParent->i_findGuestOSType(mUserData->s.strOsType, 1289 1299 pGuestOSType); 1290 AssertMsgReturn(SUCCEEDED(hrc2), ("Failed to get guest OS type. hrc2=%Rhrc\n", hrc2), hrc2); 1300 if (FAILED(hrc2) || pGuestOSType.isNull()) 1301 { 1302 *aParavirtProvider = ParavirtProvider_None; 1303 break; 1304 } 1291 1305 1292 1306 Utf8Str guestTypeFamilyId = pGuestOSType->i_familyId(); … … 2228 2242 HRESULT hrc2 = mParent->i_findGuestOSType(mUserData->s.strOsType, 2229 2243 pGuestOSType); 2230 if (SUCCEEDED(hrc2) )2244 if (SUCCEEDED(hrc2) && !pGuestOSType.isNull()) 2231 2245 { 2232 2246 if (pGuestOSType->i_is64Bit()) … … 8830 8844 // look up the object by Id to check it is valid 8831 8845 ComObjPtr<GuestOSType> pGuestOSType; 8832 HRESULT rc = mParent->i_findGuestOSType(mUserData->s.strOsType, 8833 pGuestOSType); 8834 if (FAILED(rc)) return rc; 8835 mUserData->s.strOsType = pGuestOSType->i_id(); 8846 mParent->i_findGuestOSType(mUserData->s.strOsType, pGuestOSType); 8847 if (!pGuestOSType.isNull()) 8848 mUserData->s.strOsType = pGuestOSType->i_id(); 8836 8849 8837 8850 // stateFile (optional) … … 8851 8864 8852 8865 // snapshot folder needs special processing so set it again 8853 rc = COMSETTER(SnapshotFolder)(Bstr(config.machineUserData.strSnapshotFolder).raw());8866 HRESULT rc = COMSETTER(SnapshotFolder)(Bstr(config.machineUserData.strSnapshotFolder).raw()); 8854 8867 if (FAILED(rc)) return rc; 8855 8868 … … 9032 9045 { 9033 9046 ComObjPtr<GuestOSType> pGuestOSType; 9034 rc = mParent->i_findGuestOSType(Bstr(mUserData->s.strOsType).raw(), 9035 pGuestOSType); 9036 if (FAILED(rc)) 9037 return rc; 9047 mParent->i_findGuestOSType(mUserData->s.strOsType, pGuestOSType); 9038 9048 9039 9049 /* The hardware version attribute (optional). */ -
trunk/src/VBox/Main/src-server/NATEngineImpl.cpp
r69500 r72919 20 20 #include "Logging.h" 21 21 #include "MachineImpl.h" 22 #include "GuestOSTypeImpl.h"23 22 24 23 #include <iprt/string.h> -
trunk/src/VBox/Main/src-server/NetworkAdapterImpl.cpp
r72482 r72919 1233 1233 #endif // VBOX_WITH_E1000 1234 1234 1235 NetworkAdapterType_T defaultType = NetworkAdapterType_Am79C973;1235 NetworkAdapterType_T defaultType; 1236 1236 if (aOsType) 1237 1237 defaultType = aOsType->i_networkAdapterType(); 1238 else 1239 { 1240 #ifdef VBOX_WITH_E1000 1241 defaultType = NetworkAdapterType_I82540EM; 1242 #else 1243 defaultType = NetworkAdapterType_Am79C973A; 1244 #endif 1245 } 1246 1238 1247 1239 1248 /* Set default network adapter for this OS type */ -
trunk/src/VBox/Main/src-server/UnattendedImpl.cpp
r71012 r72919 1037 1037 HRESULT hrc = mParent->GetGuestOSType(bstrGuestOsTypeId.raw(), ptrGuestOSType.asOutParam()); 1038 1038 if (SUCCEEDED(hrc)) 1039 hrc = ptrGuestOSType->COMGETTER(RecommendedDVDStorageBus)(&enmRecommendedStorageBus); 1039 { 1040 if (!ptrGuestOSType.isNull()) 1041 hrc = ptrGuestOSType->COMGETTER(RecommendedDVDStorageBus)(&enmRecommendedStorageBus); 1042 } 1040 1043 if (FAILED(hrc)) 1041 1044 return hrc; … … 2337 2340 { 2338 2341 BOOL fIs64Bit = FALSE; 2339 hrc = pGuestOSType->COMGETTER(Is64Bit)(&fIs64Bit); 2342 if (!pGuestOSType.isNull()) 2343 hrc = pGuestOSType->COMGETTER(Is64Bit)(&fIs64Bit); 2340 2344 if (SUCCEEDED(hrc)) 2341 2345 return fIs64Bit != FALSE; -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r72205 r72919 1517 1517 LogFlowThisFunc(("aSettingsFile=\"%s\", aName=\"%s\", aOsTypeId =\"%s\", aCreateFlags=\"%s\"\n", 1518 1518 aSettingsFile.c_str(), aName.c_str(), aOsTypeId.c_str(), aFlags.c_str())); 1519 /** @todo tighten checks on aId? */1520 1519 1521 1520 StringsList llGroups; … … 1596 1595 ComObjPtr<GuestOSType> osType; 1597 1596 if (!aOsTypeId.isEmpty()) 1598 { 1599 rc = i_findGuestOSType(aOsTypeId, osType); 1600 if (FAILED(rc)) return rc; 1601 } 1597 i_findGuestOSType(aOsTypeId, osType); 1602 1598 1603 1599 /* initialize the machine object */ 1604 1600 rc = machine->init(this, 1605 1601 strSettingsFile, 1606 Utf8Str(aName),1602 aName, 1607 1603 llGroups, 1604 aOsTypeId, 1608 1605 osType, 1609 1606 id,
Note:
See TracChangeset
for help on using the changeset viewer.