abh1sar commented on code in PR #8875:
URL: https://github.com/apache/cloudstack/pull/8875#discussion_r1554533244
##########
server/src/main/java/com/cloud/storage/StorageManagerImpl.java:
##########
@@ -1148,6 +1150,91 @@ public PrimaryDataStoreInfo
updateStoragePool(UpdateStoragePoolCmd cmd) throws I
return (PrimaryDataStoreInfo)_dataStoreMgr.getDataStore(pool.getId(),
DataStoreRole.Primary);
}
+ @Override
+ public boolean changeStoragePoolScope(ChangeStoragePoolScopeCmd cmd)
throws IllegalArgumentException, InvalidParameterValueException,
PermissionDeniedException {
+ Long id = cmd.getId();
+
+ Long accountId = cmd.getEntityOwnerId();
+ if (!_accountMgr.isRootAdmin(accountId)) {
+ throw new PermissionDeniedException("Only root admin can perform
this operation");
+ }
+
+ ScopeType scopeType =
ScopeType.validateAndGetScopeType(cmd.getScope());
+ if (scopeType != ScopeType.ZONE && scopeType != ScopeType.CLUSTER) {
+ throw new InvalidParameterValueException("Invalid scope " +
scopeType.toString() + "for Primary storage");
+ }
+
+ StoragePoolVO primaryStorage = _storagePoolDao.findById(id);
+ if (primaryStorage == null) {
+ throw new IllegalArgumentException("Unable to find storage pool
with ID: " + id);
+ }
+
+ if
(!primaryStorage.getStorageProviderName().equals(DataStoreProvider.DEFAULT_PRIMARY))
{
+ throw new InvalidParameterValueException("Primary storage scope
change is only supported with "
+ + DataStoreProvider.DEFAULT_PRIMARY.toString() + " data
store provider");
+ }
+
+ if
(!primaryStorage.getPoolType().equals(Storage.StoragePoolType.NetworkFilesystem)
&&
+ !primaryStorage.getPoolType().equals(Storage.StoragePoolType.RBD))
{
+ throw new InvalidParameterValueException("Primary storage scope
change is not supported for protocol "
+ + primaryStorage.getPoolType().toString());
+ }
+
+ HypervisorType hypervisorType = primaryStorage.getHypervisor();
+ Set<HypervisorType> supportedHypervisorTypes =
Sets.newHashSet(HypervisorType.KVM, HypervisorType.VMware,
HypervisorType.Simulator);
Review Comment:
Now we are using the same hypervisorTypes as in createPool(). Have extracted
that as a class attribute.
##########
ui/public/locales/en.json:
##########
@@ -2447,6 +2448,8 @@
"message.action.patch.router": "Please confirm that you want to live patch the
router. <br> This operation is equivalent updating the router packages and
restarting the Network without cleanup.",
"message.action.patch.systemvm": "Please confirm that you want to patch the
System VM.",
"message.action.primarystorage.enable.maintenance.mode": "Warning: placing the
primary storage into maintenance mode will cause all Instances using volumes
from it to be stopped. Do you want to continue?",
+"message.action.primary.storage.scope.cluster": "Change the primary storage
scope from zone to cluster",
Review Comment:
Done
--
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]