weizhouapache commented on code in PR #8875:
URL: https://github.com/apache/cloudstack/pull/8875#discussion_r1608511027
##########
server/src/main/java/com/cloud/api/query/QueryManagerImpl.java:
##########
@@ -1147,6 +1155,41 @@ public ListResponse<UserVmResponse>
searchForUserVMs(ListVMsCmd cmd) {
return response;
}
+ @Override
+ public ListResponse<VirtualMachineResponse>
findAffectedVmsForStorageScopeChange(FindAffectedVmsForStorageScopeChangeCmd
cmd) {
+ Long poolId = cmd.getStorageId();
+ StoragePoolVO pool = storagePoolDao.findById(poolId);
+ if (pool == null) {
+ throw new IllegalArgumentException("Unable to find storage pool
with ID: " + poolId);
+ }
+ if (!pool.getStatus().equals(StoragePoolStatus.Disabled)) {
+ throw new InvalidParameterValueException("Scope change of Storage
pool is only allowed in Disabled state");
+ }
Review Comment:
I think this API could be useful in two scenarios
- users fail to change the scope of storage pool, and then use this API to
get the list of vm instances are affected.
- users use this API to check if a storage pool can be re-scoped, before
performing the actions (disable pool, change pool scope)
if the check on pool status is present (only available for Disabled pools),
users have to (1) disable pool; (2) list affected vms; (3) enable pool if the
pool cannot be re-scoped.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]