Changeset 68339 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Aug 8, 2017 10:49:57 AM (7 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/settings/machine
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r66626 r68339 3981 3981 } 3982 3982 3983 /* For each controller ('updating' step): */ 3984 // We need to separately update controllers first because 3985 // attachments should be removed/updated/created same separate way. 3986 for (int iControllerIndex = 0; fSuccess && iControllerIndex < m_pCache->childCount(); ++iControllerIndex) 3987 { 3988 /* Get controller cache: */ 3989 const UISettingsCacheMachineStorageController &controllerCache = m_pCache->child(iControllerIndex); 3990 3991 /* Update controller marked for 'update' (if it can be updated): */ 3992 if (controllerCache.wasUpdated() && isControllerCouldBeUpdated(controllerCache)) 3993 fSuccess = updateStorageController(controllerCache, true); 3994 } 3995 for (int iControllerIndex = 0; fSuccess && iControllerIndex < m_pCache->childCount(); ++iControllerIndex) 3996 { 3997 /* Get controller cache: */ 3998 const UISettingsCacheMachineStorageController &controllerCache = m_pCache->child(iControllerIndex); 3999 4000 /* Update controller marked for 'update' (if it can be updated): */ 4001 if (controllerCache.wasUpdated() && isControllerCouldBeUpdated(controllerCache)) 4002 fSuccess = updateStorageController(controllerCache, false); 4003 } 4004 3983 4005 /* For each controller ('creating' step): */ 4006 // Finally we are creating new controllers, 4007 // with attachments which were released for sure. 3984 4008 for (int iControllerIndex = 0; fSuccess && iControllerIndex < m_pCache->childCount(); ++iControllerIndex) 3985 4009 { … … 3990 4014 if (controllerCache.wasCreated() || (controllerCache.wasUpdated() && !isControllerCouldBeUpdated(controllerCache))) 3991 4015 fSuccess = createStorageController(controllerCache); 3992 3993 else3994 3995 /* Update controller marked for 'update' (if it can be updated): */3996 if (controllerCache.wasUpdated() && isControllerCouldBeUpdated(controllerCache))3997 fSuccess = updateStorageController(controllerCache);3998 4016 } 3999 4017 } … … 4117 4135 } 4118 4136 4119 bool UIMachineSettingsStorage::updateStorageController(const UISettingsCacheMachineStorageController &controllerCache) 4137 bool UIMachineSettingsStorage::updateStorageController(const UISettingsCacheMachineStorageController &controllerCache, 4138 bool fRemovingStep) 4120 4139 { 4121 4140 /* Prepare result: */ … … 4179 4198 notifyOperationProgressError(UIMessageCenter::formatErrorInfo(comController)); 4180 4199 4181 /* For each attachment ('removing' step): */4182 4200 // We need to separately remove attachments first because 4183 // there could be limited amount of attachments available.4184 for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex)4201 // there could be limited amount of attachments or media available. 4202 if (fRemovingStep) 4185 4203 { 4186 /* Get attachment cache: */ 4187 const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex); 4188 4189 /* Remove attachment marked for 'remove' or 'update' (if it can't be updated): */ 4190 if (attachmentCache.wasRemoved() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache))) 4191 fSuccess = removeStorageAttachment(controllerCache, attachmentCache); 4204 /* For each attachment ('removing' step): */ 4205 for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex) 4206 { 4207 /* Get attachment cache: */ 4208 const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex); 4209 4210 /* Remove attachment marked for 'remove' or 'update' (if it can't be updated): */ 4211 if (attachmentCache.wasRemoved() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache))) 4212 fSuccess = removeStorageAttachment(controllerCache, attachmentCache); 4213 } 4192 4214 } 4193 4194 /* For each attachment ('creating' step): */ 4195 for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex) 4215 else 4196 4216 { 4197 /* Get attachment cache: */ 4198 const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex); 4199 4200 /* Create attachment marked for 'create' or 'update' (if it can't be updated): */ 4201 if (attachmentCache.wasCreated() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache))) 4202 fSuccess = createStorageAttachment(controllerCache, attachmentCache); 4203 4204 else 4205 4206 /* Update attachment marked for 'update' (if it can be updated): */ 4207 if (attachmentCache.wasUpdated() && isAttachmentCouldBeUpdated(attachmentCache)) 4208 fSuccess = updateStorageAttachment(controllerCache, attachmentCache); 4217 /* For each attachment ('creating' step): */ 4218 for (int iAttachmentIndex = 0; fSuccess && iAttachmentIndex < controllerCache.childCount(); ++iAttachmentIndex) 4219 { 4220 /* Get attachment cache: */ 4221 const UISettingsCacheMachineStorageAttachment &attachmentCache = controllerCache.child(iAttachmentIndex); 4222 4223 /* Create attachment marked for 'create' or 'update' (if it can't be updated): */ 4224 if (attachmentCache.wasCreated() || (attachmentCache.wasUpdated() && !isAttachmentCouldBeUpdated(attachmentCache))) 4225 fSuccess = createStorageAttachment(controllerCache, attachmentCache); 4226 4227 else 4228 4229 /* Update attachment marked for 'update' (if it can be updated): */ 4230 if (attachmentCache.wasUpdated() && isAttachmentCouldBeUpdated(attachmentCache)) 4231 fSuccess = updateStorageAttachment(controllerCache, attachmentCache); 4232 } 4209 4233 } 4210 4234 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.h
r66543 r68339 775 775 bool createStorageController(const UISettingsCacheMachineStorageController &controllerCache); 776 776 /** Updates existing storage controller described by the @a controllerCache. */ 777 bool updateStorageController(const UISettingsCacheMachineStorageController &controllerCache); 777 bool updateStorageController(const UISettingsCacheMachineStorageController &controllerCache, 778 bool fRemovingStep); 778 779 /** Removes existing storage attachment described by the @a controllerCache and @a attachmentCache. */ 779 780 bool removeStorageAttachment(const UISettingsCacheMachineStorageController &controllerCache,
Note:
See TracChangeset
for help on using the changeset viewer.