Changeset 98035 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jan 10, 2023 6:35:56 AM (2 years ago)
- svn:sync-xref-src-repo-rev:
- 155131
- Location:
- trunk/src/VBox/Main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r97935 r98035 6523 6523 <desc>Cleanup mode, used with <link to="IMachine::unregister" />. 6524 6524 </desc> 6525 <const name="UnregisterOnly" value="1">6525 <const name="UnregisterOnly" value="1"> 6526 6526 <desc>Unregister only the machine, but neither delete snapshots nor detach media.</desc> 6527 6527 </const> 6528 <const name="DetachAllReturnNone" value="2">6528 <const name="DetachAllReturnNone" value="2"> 6529 6529 <desc>Delete all snapshots and detach all media but return none; this will keep all media registered.</desc> 6530 6530 </const> 6531 <const name="DetachAllReturnHardDisksOnly" value="3">6531 <const name="DetachAllReturnHardDisksOnly" value="3"> 6532 6532 <desc>Delete all snapshots, detach all media and return hard disks for closing, but not removable media.</desc> 6533 6533 </const> 6534 <const name="Full" value="4">6534 <const name="Full" value="4"> 6535 6535 <desc>Delete all snapshots, detach all media and return all media for closing.</desc> 6536 </const> 6537 <const name="DetachAllReturnHardDisksAndVMRemovable" value="5"> 6538 <desc>Delete all snapshots, detach all media and return hard disks and removable locating in the folder of the machine to be deleted and referenced only to this machine, for closing.</desc> 6536 6539 </const> 6537 6540 </enum> -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r97523 r98035 11897 11897 * adds hard disks to the list. If it is CleanupMode_Full, this adds all 11898 11898 * media to the list. 11899 * CleanupMode_DetachAllReturnHardDisksAndVMRemovable adds hard disk and 11900 * also removable medias if they are located in the VM folder and referenced 11901 * only by this VM (media prepared by unattended installer). 11899 11902 * 11900 11903 * This gets called from Machine::Unregister, both for the actual Machine and … … 11942 11945 AutoReadLock lock(pMedium COMMA_LOCKVAL_SRC_POS); 11943 11946 DeviceType_T devType = pMedium->i_getDeviceType(); 11947 size_t cBackRefs = pMedium->i_getMachineBackRefCount(); 11948 Utf8Str strMediumLocation = pMedium->i_getLocationFull(); 11949 strMediumLocation.stripFilename(); 11950 Utf8Str strMachineFolder = i_getSettingsFileFull(); 11951 strMachineFolder.stripFilename(); 11944 11952 if ( ( cleanupMode == CleanupMode_DetachAllReturnHardDisksOnly 11945 11953 && devType == DeviceType_HardDisk) 11954 || ( cleanupMode == CleanupMode_DetachAllReturnHardDisksAndVMRemovable 11955 && ( devType == DeviceType_HardDisk 11956 || ( cBackRefs <= 1 11957 && strMediumLocation == strMachineFolder 11958 && *pMedium->i_getFirstMachineBackrefId() == i_getId()))) 11946 11959 || (cleanupMode == CleanupMode_Full) 11947 11960 ) -
trunk/src/VBox/Main/src-server/MediumImpl.cpp
r97935 r98035 1061 1061 1062 1062 if (!(m->formatObj->i_getCapabilities() & ( MediumFormatCapabilities_CreateFixed 1063 | MediumFormatCapabilities_CreateDynamic)) 1063 | MediumFormatCapabilities_CreateDynamic 1064 | MediumFormatCapabilities_File)) 1064 1065 ) 1065 1066 { -
trunk/src/VBox/Main/src-server/UnattendedImpl.cpp
r97367 r98035 141 141 bool fMountOnly; 142 142 Utf8Str strImagePath; 143 bool fAuxiliary; 143 144 144 145 UnattendedInstallationDisk(StorageBus_T a_enmBusType, Utf8Str const &a_rBusName, DeviceType_T a_enmDeviceType, 145 146 AccessMode_T a_enmAccessType, LONG a_iPort, LONG a_iDevice, bool a_fMountOnly, 146 Utf8Str const &a_rImagePath )147 Utf8Str const &a_rImagePath, bool a_fAuxiliary) 147 148 : enmBusType(a_enmBusType), strControllerName(a_rBusName), enmDeviceType(a_enmDeviceType), enmAccessType(a_enmAccessType) 148 , iPort(a_iPort), iDevice(a_iDevice), fMountOnly(a_fMountOnly), strImagePath(a_rImagePath) 149 , iPort(a_iPort), iDevice(a_iDevice), fMountOnly(a_fMountOnly), strImagePath(a_rImagePath), fAuxiliary(a_fAuxiliary) 149 150 { 150 151 Assert(strControllerName.length() > 0); 151 152 } 152 153 153 UnattendedInstallationDisk(std::list<ControllerSlot>::const_iterator const &itDvdSlot, Utf8Str const &a_rImagePath) 154 UnattendedInstallationDisk(std::list<ControllerSlot>::const_iterator const &itDvdSlot, Utf8Str const &a_rImagePath, 155 bool a_fAuxiliary) 154 156 : enmBusType(itDvdSlot->enmBus), strControllerName(itDvdSlot->strControllerName), enmDeviceType(DeviceType_DVD) 155 157 , enmAccessType(AccessMode_ReadOnly), iPort(itDvdSlot->iPort), iDevice(itDvdSlot->iDevice) 156 , fMountOnly(!itDvdSlot->fFree), strImagePath(a_rImagePath) 158 , fMountOnly(!itDvdSlot->fFree), strImagePath(a_rImagePath), fAuxiliary(a_fAuxiliary) 157 159 { 158 160 Assert(strControllerName.length() > 0); … … 3052 3054 0, 0, 3053 3055 fFoundPort0Dev0 /*fMountOnly*/, 3054 mpInstaller->getAuxiliaryFloppyFilePath() ));3056 mpInstaller->getAuxiliaryFloppyFilePath(), false)); 3055 3057 return S_OK; 3056 3058 } … … 3211 3213 if (mpInstaller->isAuxiliaryIsoNeeded() && mpInstaller->bootFromAuxiliaryIso()) 3212 3214 { 3213 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, mpInstaller->getAuxiliaryIsoFilePath() ));3215 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, mpInstaller->getAuxiliaryIsoFilePath(), true)); 3214 3216 ++itDvdSlot; 3215 3217 } … … 3217 3219 if (mpInstaller->isOriginalIsoNeeded()) 3218 3220 { 3219 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getIsoPath() ));3221 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getIsoPath(), false)); 3220 3222 ++itDvdSlot; 3221 3223 } … … 3223 3225 if (mpInstaller->isAuxiliaryIsoNeeded() && !mpInstaller->bootFromAuxiliaryIso()) 3224 3226 { 3225 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, mpInstaller->getAuxiliaryIsoFilePath() ));3227 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, mpInstaller->getAuxiliaryIsoFilePath(), true)); 3226 3228 ++itDvdSlot; 3227 3229 } … … 3230 3232 if (mpInstaller->isAdditionsIsoNeeded()) 3231 3233 { 3232 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getAdditionsIsoPath() ));3234 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getAdditionsIsoPath(), false)); 3233 3235 ++itDvdSlot; 3234 3236 } … … 3236 3238 if (mpInstaller->isValidationKitIsoNeeded()) 3237 3239 { 3238 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getValidationKitIsoPath() ));3240 rVecInstallatationDisks.push_back(UnattendedInstallationDisk(itDvdSlot, i_getValidationKitIsoPath(), false)); 3239 3241 ++itDvdSlot; 3240 3242 } … … 4207 4209 4208 4210 ComPtr<IMedium> ptrMedium; 4209 HRESULT rc = mParent->OpenMedium(Bstr(pImage->strImagePath).raw(),4211 HRESULT hrc = mParent->OpenMedium(Bstr(pImage->strImagePath).raw(), 4210 4212 pImage->enmDeviceType, 4211 4213 pImage->enmAccessType, 4212 4214 true, 4213 4215 ptrMedium.asOutParam()); 4214 LogRelFlowFunc(("VirtualBox::openMedium -> %Rhrc\n", rc)); 4215 if (SUCCEEDED(rc)) 4216 { 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 } 4217 4224 if (pImage->fMountOnly) 4218 4225 { 4219 4226 // mount the opened disk image 4220 rc = rPtrSessionMachine->MountMedium(Bstr(pImage->strControllerName).raw(), pImage->iPort,4221 pImage->iDevice, ptrMedium, TRUE /*fForce*/);4222 LogRelFlowFunc(("Machine::MountMedium -> %Rhrc\n", rc));4227 hrc = rPtrSessionMachine->MountMedium(Bstr(pImage->strControllerName).raw(), pImage->iPort, 4228 pImage->iDevice, ptrMedium, TRUE /*fForce*/); 4229 LogRelFlowFunc(("Machine::MountMedium -> %Rhrc\n", hrc)); 4223 4230 } 4224 4231 else 4225 4232 { 4226 4233 //attach the opened disk image to the controller 4227 rc = rPtrSessionMachine->AttachDevice(Bstr(pImage->strControllerName).raw(), pImage->iPort,4228 pImage->iDevice, pImage->enmDeviceType, ptrMedium);4229 LogRelFlowFunc(("Machine::AttachDevice -> %Rhrc\n", rc));4234 hrc = rPtrSessionMachine->AttachDevice(Bstr(pImage->strControllerName).raw(), pImage->iPort, 4235 pImage->iDevice, pImage->enmDeviceType, ptrMedium); 4236 LogRelFlowFunc(("Machine::AttachDevice -> %Rhrc\n", hrc)); 4230 4237 } 4231 4238 } 4232 4239 4233 4240 rLock.acquire(); 4234 return rc;4241 return hrc; 4235 4242 } 4236 4243
Note:
See TracChangeset
for help on using the changeset viewer.