Changeset 97367 in vbox for trunk/src/VBox/Main/src-server/UnattendedImpl.cpp
- Timestamp:
- Nov 1, 2022 10:38:05 AM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/UnattendedImpl.cpp
r97366 r97367 141 141 bool fMountOnly; 142 142 Utf8Str strImagePath; 143 bool fAuxiliary;144 143 145 144 UnattendedInstallationDisk(StorageBus_T a_enmBusType, Utf8Str const &a_rBusName, DeviceType_T a_enmDeviceType, 146 145 AccessMode_T a_enmAccessType, LONG a_iPort, LONG a_iDevice, bool a_fMountOnly, 147 Utf8Str const &a_rImagePath , bool a_fAuxiliary)146 Utf8Str const &a_rImagePath) 148 147 : enmBusType(a_enmBusType), strControllerName(a_rBusName), enmDeviceType(a_enmDeviceType), enmAccessType(a_enmAccessType) 149 , iPort(a_iPort), iDevice(a_iDevice), fMountOnly(a_fMountOnly), strImagePath(a_rImagePath) , fAuxiliary(a_fAuxiliary)148 , iPort(a_iPort), iDevice(a_iDevice), fMountOnly(a_fMountOnly), strImagePath(a_rImagePath) 150 149 { 151 150 Assert(strControllerName.length() > 0); 152 151 } 153 152 154 UnattendedInstallationDisk(std::list<ControllerSlot>::const_iterator const &itDvdSlot, Utf8Str const &a_rImagePath, 155 bool a_fAuxiliary) 153 UnattendedInstallationDisk(std::list<ControllerSlot>::const_iterator const &itDvdSlot, Utf8Str const &a_rImagePath) 156 154 : enmBusType(itDvdSlot->enmBus), strControllerName(itDvdSlot->strControllerName), enmDeviceType(DeviceType_DVD) 157 155 , enmAccessType(AccessMode_ReadOnly), iPort(itDvdSlot->iPort), iDevice(itDvdSlot->iDevice) 158 , fMountOnly(!itDvdSlot->fFree), strImagePath(a_rImagePath) , fAuxiliary(a_fAuxiliary)156 , fMountOnly(!itDvdSlot->fFree), strImagePath(a_rImagePath) 159 157 { 160 158 Assert(strControllerName.length() > 0); … … 3054 3052 0, 0, 3055 3053 fFoundPort0Dev0 /*fMountOnly*/, 3056 mpInstaller->getAuxiliaryFloppyFilePath() , false));3054 mpInstaller->getAuxiliaryFloppyFilePath())); 3057 3055 return S_OK; 3058 3056 } … … 3213 3211 if (mpInstaller->isAuxiliaryIsoNeeded() && mpInstaller->bootFromAuxiliaryIso()) 3214 3212 { 3215 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, mpInstaller->getAuxiliaryIsoFilePath() , true));3213 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, mpInstaller->getAuxiliaryIsoFilePath())); 3216 3214 ++itDvdSlot; 3217 3215 } … … 3219 3217 if (mpInstaller->isOriginalIsoNeeded()) 3220 3218 { 3221 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getIsoPath() , false));3219 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getIsoPath())); 3222 3220 ++itDvdSlot; 3223 3221 } … … 3225 3223 if (mpInstaller->isAuxiliaryIsoNeeded() && !mpInstaller->bootFromAuxiliaryIso()) 3226 3224 { 3227 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, mpInstaller->getAuxiliaryIsoFilePath() , true));3225 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, mpInstaller->getAuxiliaryIsoFilePath())); 3228 3226 ++itDvdSlot; 3229 3227 } … … 3232 3230 if (mpInstaller->isAdditionsIsoNeeded()) 3233 3231 { 3234 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getAdditionsIsoPath() , false));3232 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getAdditionsIsoPath())); 3235 3233 ++itDvdSlot; 3236 3234 } … … 3238 3236 if (mpInstaller->isValidationKitIsoNeeded()) 3239 3237 { 3240 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getValidationKitIsoPath() , false));3238 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getValidationKitIsoPath())); 3241 3239 ++itDvdSlot; 3242 3240 } … … 4209 4207 4210 4208 ComPtr<IMedium> ptrMedium; 4211 HRESULT hrc = mParent->OpenMedium(Bstr(pImage->strImagePath).raw(), 4212 pImage->enmDeviceType, 4213 pImage->enmAccessType, 4214 true, 4215 ptrMedium.asOutParam()); 4216 LogRelFlowFunc(("VirtualBox::openMedium -> %Rhrc\n", hrc)); 4217 if (SUCCEEDED(hrc)) 4218 { 4219 if (pImage->fAuxiliary && pImage->strImagePath.endsWith(".viso")) 4220 { 4221 hrc = ptrMedium->SetProperty(Bstr("UnattendedInstall").raw(), Bstr("1").raw()); 4222 LogRelFlowFunc(("Medium::SetProperty -> %Rhrc\n", hrc)); 4223 } 4224 4209 HRESULT rc = mParent->OpenMedium(Bstr(pImage->strImagePath).raw(), 4210 pImage->enmDeviceType, 4211 pImage->enmAccessType, 4212 true, 4213 ptrMedium.asOutParam()); 4214 LogRelFlowFunc(("VirtualBox::openMedium -> %Rhrc\n", rc)); 4215 if (SUCCEEDED(rc)) 4216 { 4225 4217 if (pImage->fMountOnly) 4226 4218 { 4227 4219 // mount the opened disk image 4228 hrc = rPtrSessionMachine->MountMedium(Bstr(pImage->strControllerName).raw(), pImage->iPort,4229 4230 LogRelFlowFunc(("Machine::MountMedium -> %Rhrc\n", hrc));4220 rc = rPtrSessionMachine->MountMedium(Bstr(pImage->strControllerName).raw(), pImage->iPort, 4221 pImage->iDevice, ptrMedium, TRUE /*fForce*/); 4222 LogRelFlowFunc(("Machine::MountMedium -> %Rhrc\n", rc)); 4231 4223 } 4232 4224 else 4233 4225 { 4234 4226 //attach the opened disk image to the controller 4235 hrc = rPtrSessionMachine->AttachDevice(Bstr(pImage->strControllerName).raw(), pImage->iPort,4236 4237 LogRelFlowFunc(("Machine::AttachDevice -> %Rhrc\n", hrc));4227 rc = rPtrSessionMachine->AttachDevice(Bstr(pImage->strControllerName).raw(), pImage->iPort, 4228 pImage->iDevice, pImage->enmDeviceType, ptrMedium); 4229 LogRelFlowFunc(("Machine::AttachDevice -> %Rhrc\n", rc)); 4238 4230 } 4239 4231 } 4240 4232 4241 4233 rLock.acquire(); 4242 return hrc;4234 return rc; 4243 4235 } 4244 4236
Note:
See TracChangeset
for help on using the changeset viewer.