Changeset 93405 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jan 24, 2022 9:56:23 AM (3 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/Global.h
r93115 r93405 163 163 164 164 /** 165 * Stringify a storage bus type. 166 * 167 * @returns Pointer to a read only string. 168 * @param aBusType The storage bus type. 169 */ 170 static const char *stringifyStorageBus(StorageBus_T aBus); 171 172 /** 165 173 * Stringify a device type. 166 174 * -
trunk/src/VBox/Main/include/UnattendedImpl.h
r93189 r93405 81 81 bool i_isGuestOs64Bit() const; 82 82 bool i_isFirmwareEFI() const; 83 VBOXOSTYPE i_getGuestOsType() const;84 83 Utf8Str const &i_getDetectedOSVersion(); 85 84 … … 94 93 bool mfGuestOs64Bit; /**< 64-bit (true) or 32-bit guest OS (set by prepare). */ 95 94 FirmwareType_T menmFirmwareType; /**< Firmware type BIOS/EFI (set by prepare). */ 96 VBOXOSTYPE meGuestOsType; /**< The guest OS type (set by prepare). */97 95 UnattendedInstaller *mpInstaller; /**< The installer instance (set by prepare, deleted by done). */ 98 96 -
trunk/src/VBox/Main/include/UnattendedInstaller.h
r93115 r93405 102 102 * 103 103 * @returns Pointer to the new instance, NULL if no appropriate installer. 104 * @param enm OsType Theguest OS type value.105 * @param str GuestOsType Theguest OS type string104 * @param enmDetectedOSType The detected guest OS type value. 105 * @param strDetectedOSType The detected guest OS type string 106 106 * @param strDetectedOSVersion The detected guest OS version. 107 107 * @param strDetectedOSFlavor The detected guest OS flavor. … … 111 111 * @throws std::bad_alloc 112 112 */ 113 static UnattendedInstaller *createInstance(VBOXOSTYPE enm OsType, const Utf8Str &strGuestOsType,113 static UnattendedInstaller *createInstance(VBOXOSTYPE enmDetectedOSType, const Utf8Str &strDetectedOSType, 114 114 const Utf8Str &strDetectedOSVersion, const Utf8Str &strDetectedOSFlavor, 115 115 const Utf8Str &strDetectedOSHints, Unattended *pParent); -
trunk/src/VBox/Main/src-all/Global.cpp
r93115 r93405 645 645 646 646 /*static*/ const char * 647 Global::stringifyStorageBus(StorageBus_T aBus) 648 { 649 switch (aBus) 650 { 651 case StorageBus_Null: return "Null"; 652 case StorageBus_IDE: return "IDE"; 653 case StorageBus_SATA: return "SATA"; 654 case StorageBus_Floppy: return "Floppy"; 655 case StorageBus_SAS: return "SAS"; 656 case StorageBus_USB: return "USB"; 657 case StorageBus_PCIe: return "PCIe"; 658 case StorageBus_VirtioSCSI: return "VirtioSCSI"; 659 default: 660 { 661 AssertMsgFailed(("%d (%#x)\n", aBus, aBus)); 662 static char s_szMsg[48]; 663 RTStrPrintf(s_szMsg, sizeof(s_szMsg), "InvalidBus-0x%08x", aBus); 664 return s_szMsg; 665 } 666 } 667 } 668 669 /*static*/ const char * 647 670 Global::stringifyDeviceType(DeviceType_T aType) 648 671 { … … 666 689 } 667 690 668 669 691 /*static*/ const char * 670 692 Global::stringifyReason(Reason_T aReason) -
trunk/src/VBox/Main/src-server/UnattendedImpl.cpp
r93377 r93405 1725 1725 1726 1726 /* 1727 * Get the ISO's detect guest OS type info and make it's a known one (just 1728 * in case the above step doesn't work right). 1729 */ 1730 uint32_t const idxIsoOSType = Global::getOSTypeIndexFromId(mStrDetectedOSTypeId.c_str()); 1731 VBOXOSTYPE const enmIsoOSType = idxIsoOSType < Global::cOSTypes ? Global::sOSTypes[idxIsoOSType].osType : VBOXOSTYPE_Unknown; 1732 if ((enmIsoOSType & VBOXOSTYPE_OsTypeMask) == VBOXOSTYPE_Unknown) 1733 return setError(E_FAIL, tr("The supplied ISO file does not contain an OS currently supported for unattended installation")); 1734 1735 /* 1736 * Get the VM's configured guest OS type info. 1737 */ 1738 uint32_t const idxMachineOSType = Global::getOSTypeIndexFromId(mStrGuestOsTypeId.c_str()); 1739 VBOXOSTYPE const enmMachineOSType = idxMachineOSType < Global::cOSTypes 1740 ? Global::sOSTypes[idxMachineOSType].osType : VBOXOSTYPE_Unknown; 1741 1742 /* 1743 * Check that the detected guest OS type for the ISO is compatible with 1744 * that of the VM, boardly speaking. 1745 */ 1746 if (idxMachineOSType != idxIsoOSType) 1747 { 1748 /* Check that the architecture is compatible: */ 1749 if ( (enmIsoOSType & VBOXOSTYPE_ArchitectureMask) != (enmMachineOSType & VBOXOSTYPE_ArchitectureMask) 1750 && ( (enmIsoOSType & VBOXOSTYPE_ArchitectureMask) != VBOXOSTYPE_x86 1751 || (enmMachineOSType & VBOXOSTYPE_ArchitectureMask) != VBOXOSTYPE_x64)) 1752 return setError(E_FAIL, tr("The supplied ISO file is incompatible with the guest OS type of the VM: CPU architecture mismatch")); 1753 1754 /** @todo check BIOS/EFI requirement */ 1755 } 1756 1757 /* 1727 1758 * Do some default property stuff and check other properties. 1728 1759 */ … … 1810 1841 1811 1842 /* 1812 * Get the guest OS type info and instantiate the appropriate installer. 1813 */ 1814 uint32_t const idxOSType = Global::getOSTypeIndexFromId(mStrGuestOsTypeId.c_str()); 1815 meGuestOsType = idxOSType < Global::cOSTypes ? Global::sOSTypes[idxOSType].osType : VBOXOSTYPE_Unknown; 1816 1817 mpInstaller = UnattendedInstaller::createInstance(meGuestOsType, mStrGuestOsTypeId, mStrDetectedOSVersion, 1843 * Instatiate the guest installer matching the ISO. 1844 */ 1845 mpInstaller = UnattendedInstaller::createInstance(enmIsoOSType, mStrDetectedOSTypeId, mStrDetectedOSVersion, 1818 1846 mStrDetectedOSFlavor, mStrDetectedOSHints, this); 1819 1847 if (mpInstaller != NULL) … … 1868 1896 { 1869 1897 Bstr bstrGuestOsTypeId; 1898 Bstr bstrDetectedOSTypeId; 1870 1899 { 1871 1900 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1872 bstrGuestOsTypeId = mStrGuestOsTypeId; 1901 if (mpInstaller == NULL) 1902 return setErrorBoth(E_FAIL, VERR_WRONG_ORDER, tr("prepare() not yet called")); 1903 bstrGuestOsTypeId = mStrGuestOsTypeId; 1904 bstrDetectedOSTypeId = mStrDetectedOSTypeId; 1873 1905 } 1874 1906 ComPtr<IGuestOSType> ptrGuestOSType; … … 1881 1913 if (FAILED(hrc)) 1882 1914 return hrc; 1915 1916 /* If the detected guest OS type differs, log a warning if their DVD storage 1917 bus recommendations differ. */ 1918 if (bstrGuestOsTypeId != bstrDetectedOSTypeId) 1919 { 1920 StorageBus_T enmRecommendedStorageBus2 = StorageBus_IDE; 1921 hrc = mParent->GetGuestOSType(bstrDetectedOSTypeId.raw(), ptrGuestOSType.asOutParam()); 1922 if (SUCCEEDED(hrc) && !ptrGuestOSType.isNull()) 1923 hrc = ptrGuestOSType->COMGETTER(RecommendedDVDStorageBus)(&enmRecommendedStorageBus2); 1924 if (FAILED(hrc)) 1925 return hrc; 1926 1927 if (enmRecommendedStorageBus != enmRecommendedStorageBus2) 1928 LogRel(("Unattended::reconfigureVM: DVD storage bus recommendations differs for the VM and the ISO guest OS types: VM: %s (%ls), ISO: %s (%ls)\n", 1929 Global::stringifyStorageBus(enmRecommendedStorageBus), bstrGuestOsTypeId.raw(), 1930 Global::stringifyStorageBus(enmRecommendedStorageBus2), bstrDetectedOSTypeId.raw() )); 1931 } 1883 1932 } 1884 1933 … … 3153 3202 } 3154 3203 3155 VBOXOSTYPE Unattended::i_getGuestOsType() const3156 {3157 Assert(isReadLockedOnCurrentThread());3158 return meGuestOsType;3159 }3160 3161 3204 Utf8Str const &Unattended::i_getDetectedOSVersion() 3162 3205 { -
trunk/src/VBox/Main/src-server/UnattendedInstaller.cpp
r93115 r93405 50 50 51 51 52 /* static */ UnattendedInstaller *UnattendedInstaller::createInstance(VBOXOSTYPE enmOsType, 53 const Utf8Str &strGuestOsType, 54 const Utf8Str &strDetectedOSVersion, 55 const Utf8Str &strDetectedOSFlavor, 56 const Utf8Str &strDetectedOSHints, 57 Unattended *pParent) 52 /* static */ UnattendedInstaller * 53 UnattendedInstaller::createInstance(VBOXOSTYPE enmDetectedOSType, const Utf8Str &strDetectedOSType, 54 const Utf8Str &strDetectedOSVersion, const Utf8Str &strDetectedOSFlavor, 55 const Utf8Str &strDetectedOSHints, Unattended *pParent) 58 56 { 59 57 UnattendedInstaller *pUinstaller = NULL; 60 58 61 if (str GuestOsType.find("Windows") != RTCString::npos)62 { 63 if (enm OsType >= VBOXOSTYPE_WinVista)59 if (strDetectedOSType.find("Windows") != RTCString::npos) 60 { 61 if (enmDetectedOSType >= VBOXOSTYPE_WinVista) 64 62 pUinstaller = new UnattendedWindowsXmlInstaller(pParent); 65 63 else 66 64 pUinstaller = new UnattendedWindowsSifInstaller(pParent); 67 65 } 68 else if (enm OsType >= VBOXOSTYPE_OS2 && enmOsType < VBOXOSTYPE_Linux)66 else if (enmDetectedOSType >= VBOXOSTYPE_OS2 && enmDetectedOSType < VBOXOSTYPE_Linux) 69 67 pUinstaller = new UnattendedOs2Installer(pParent, strDetectedOSHints); 70 68 else 71 69 { 72 if (enm OsType == VBOXOSTYPE_Debian || enmOsType == VBOXOSTYPE_Debian_x64)70 if (enmDetectedOSType == VBOXOSTYPE_Debian || enmDetectedOSType == VBOXOSTYPE_Debian_x64) 73 71 pUinstaller = new UnattendedDebianInstaller(pParent); 74 else if (enm OsType >= VBOXOSTYPE_Ubuntu && enmOsType <= VBOXOSTYPE_Ubuntu_x64)72 else if (enmDetectedOSType >= VBOXOSTYPE_Ubuntu && enmDetectedOSType <= VBOXOSTYPE_Ubuntu_x64) 75 73 pUinstaller = new UnattendedUbuntuInstaller(pParent); 76 else if (enm OsType >= VBOXOSTYPE_RedHat && enmOsType <= VBOXOSTYPE_RedHat_x64)74 else if (enmDetectedOSType >= VBOXOSTYPE_RedHat && enmDetectedOSType <= VBOXOSTYPE_RedHat_x64) 77 75 { 78 76 if (RTStrVersionCompare(strDetectedOSVersion.c_str(), "8") >= 0) … … 91 89 pUinstaller = new UnattendedRhel6Installer(pParent); 92 90 } 93 else if (enm OsType >= VBOXOSTYPE_FedoraCore && enmOsType <= VBOXOSTYPE_FedoraCore_x64)91 else if (enmDetectedOSType >= VBOXOSTYPE_FedoraCore && enmDetectedOSType <= VBOXOSTYPE_FedoraCore_x64) 94 92 pUinstaller = new UnattendedFedoraInstaller(pParent); 95 else if (enm OsType >= VBOXOSTYPE_Oracle && enmOsType <= VBOXOSTYPE_Oracle_x64)93 else if (enmDetectedOSType >= VBOXOSTYPE_Oracle && enmDetectedOSType <= VBOXOSTYPE_Oracle_x64) 96 94 { 97 95 if (RTStrVersionCompare(strDetectedOSVersion.c_str(), "8") >= 0) … … 105 103 } 106 104 #if 0 /* doesn't work, so convert later. */ 107 else if (enm OsType == VBOXOSTYPE_OpenSUSE || enmOsType == VBOXOSTYPE_OpenSUSE_x64)105 else if (enmDetectedOSType == VBOXOSTYPE_OpenSUSE || enmDetectedOSType == VBOXOSTYPE_OpenSUSE_x64) 108 106 pUinstaller = new UnattendedSuseInstaller(new UnattendedSUSEXMLScript(pParent), pParent); 109 107 #endif -
trunk/src/VBox/Main/testcase/tstUnattendedScript.cpp
r93194 r93405 582 582 } 583 583 584 VBOXOSTYPE Unattended::i_getGuestOsType() const585 {586 return meGuestOsType;587 }588 589 584 Utf8Str const &Unattended::i_getDetectedOSVersion() 590 585 {
Note:
See TracChangeset
for help on using the changeset viewer.