Changeset 72919 in vbox
- Timestamp:
- Jul 5, 2018 2:44:31 PM (7 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r70790 r72919 673 673 674 674 SHOW_STRING_PROP( machine, Name, "name", "Name:"); 675 675 SHOW_STRINGARRAY_PROP( machine, Groups, "groups", "Groups:"); 676 676 Bstr osTypeId; 677 677 CHECK_ERROR2I_RET(machine, COMGETTER(OSTypeId)(osTypeId.asOutParam()), hrcCheck); 678 678 ComPtr<IGuestOSType> osType; 679 CHECK_ERROR2I_RET(pVirtualBox, GetGuestOSType(osTypeId.raw(), osType.asOutParam()), hrcCheck); 680 SHOW_STRINGARRAY_PROP( machine, Groups, "groups", "Groups:"); 681 SHOW_STRING_PROP( osType, Description, "ostype", "Guest OS:"); 679 pVirtualBox->GetGuestOSType(osTypeId.raw(), osType.asOutParam()); 680 if (!osType.isNull()) 681 SHOW_STRING_PROP( osType, Description, "ostype", "Guest OS:"); 682 else 683 SHOW_STRING_PROP( machine, OSTypeId, "ostype", "Guest OS:"); 682 684 SHOW_UUID_PROP( machine, Id, "UUID", "UUID:"); 683 685 SHOW_STRING_PROP( machine, SettingsFilePath, "CfgFile", "Config file:"); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r72143 r72919 564 564 case MODIFYVM_OSTYPE: 565 565 { 566 ComPtr<IGuestOSType> guestOSType; 567 CHECK_ERROR(a->virtualBox, GetGuestOSType(Bstr(ValueUnion.psz).raw(), 568 guestOSType.asOutParam())); 569 if (SUCCEEDED(rc) && guestOSType) 570 { 571 CHECK_ERROR(sessionMachine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz).raw())); 572 } 573 else 574 { 575 errorArgument("Invalid guest OS type '%s'", ValueUnion.psz); 576 rc = E_FAIL; 577 } 566 CHECK_ERROR(sessionMachine, COMSETTER(OSTypeId)(Bstr(ValueUnion.psz).raw())); 578 567 break; 579 568 } -
trunk/src/VBox/Frontends/VBoxShell/vboxshell.py
r71179 r72919 962 962 if mach == None: 963 963 return 0 964 vmos = ctx['vb'].getGuestOSType(mach.OSTypeId) 964 try: 965 vmos = ctx['vb'].getGuestOSType(mach.OSTypeId) 966 except: 967 vmos = None 965 968 print(" One can use setvar <mach> <var> <value> to change variable, using name in [].") 966 969 print(" Name [name]: %s" % (colVm(ctx, mach.name))) 967 970 print(" Description [description]: %s" % (mach.description)) 968 971 print(" ID [n/a]: %s" % (mach.id)) 969 print(" OS Type [via OSTypeId]: %s" % (vmos.description ))972 print(" OS Type [via OSTypeId]: %s" % (vmos.description if vmos is not None else mach.OSTypeId)) 970 973 print(" Firmware [firmwareType]: %s (%s)" % (asEnumElem(ctx, "FirmwareType", mach.firmwareType), mach.firmwareType)) 971 974 print() -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r72915 r72919 2640 2640 the guest OS this object describes. 2641 2641 2642 While this function returns an error for unknown guest OS types, they 2643 can be still used without serious problems (if one accepts the fact 2644 that there is no default VM config information). 2645 2642 2646 <result name="E_INVALIDARG"> 2643 2647 @a id is not a valid Guest OS type. … … 5026 5030 You may use <link to="IVirtualBox::getGuestOSType"/> to obtain 5027 5031 an IGuestOSType object representing details about the given 5028 Guest OS type. 5032 Guest OS type. All Guest OS types are considered valid, even those 5033 which are not known to <link to="IVirtualBox::getGuestOSType"/>. 5029 5034 <note> 5030 5035 This value may differ from the value returned by -
trunk/src/VBox/Main/include/MachineImpl.h
r72476 r72919 351 351 const Utf8Str &strName, 352 352 const StringsList &llGroups, 353 const Utf8Str &strOsTypeId, 353 354 GuestOSType *aOsType, 354 355 const Guid &aId, -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r72343 r72919 820 820 } 821 821 822 ComPtr<IGuestOSType> guestOSType; 823 hrc = virtualBox->GetGuestOSType(osTypeId.raw(), guestOSType.asOutParam()); H(); 824 825 Bstr guestTypeFamilyId; 826 hrc = guestOSType->COMGETTER(FamilyId)(guestTypeFamilyId.asOutParam()); H(); 827 BOOL fOsXGuest = guestTypeFamilyId == Bstr("MacOS"); 822 ComPtr<IGuestOSType> pGuestOSType; 823 virtualBox->GetGuestOSType(osTypeId.raw(), pGuestOSType.asOutParam()); 824 825 BOOL fOsXGuest = FALSE; 826 if (!pGuestOSType.isNull()) 827 { 828 Bstr guestTypeFamilyId; 829 hrc = pGuestOSType->COMGETTER(FamilyId)(guestTypeFamilyId.asOutParam()); H(); 830 fOsXGuest = guestTypeFamilyId == Bstr("MacOS"); 831 } 828 832 829 833 ULONG maxNetworkAdapters; -
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.