This is an automated email from the ASF dual-hosted git repository.

nvazquez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/main by this push:
     new ed30683  [Simulator] Add zone wide storage (#5986)
ed30683 is described below

commit ed30683e5211f87d51f9e8d8f5c495fc7ada4a5d
Author: Nicolas Vazquez <[email protected]>
AuthorDate: Wed Feb 16 22:50:55 2022 -0300

    [Simulator] Add zone wide storage (#5986)
    
    * [Simulator] Add zone wide storage
    
    * Refactor
---
 server/src/main/java/com/cloud/storage/StorageManagerImpl.java | 9 ++++++---
 ui/src/views/infra/AddPrimaryStorage.vue                       | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java 
b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java
index 3522bb0..b1a33c0 100644
--- a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java
@@ -50,6 +50,7 @@ import com.cloud.agent.api.GetStoragePoolCapabilitiesCommand;
 import com.cloud.network.router.VirtualNetworkApplianceManager;
 import com.cloud.server.StatsCollector;
 import com.cloud.upgrade.SystemVmTemplateRegistration;
+import com.google.common.collect.Sets;
 import org.apache.cloudstack.annotation.AnnotationService;
 import org.apache.cloudstack.annotation.dao.AnnotationDao;
 import org.apache.cloudstack.api.ApiConstants;
@@ -775,9 +776,11 @@ public class StorageManagerImpl extends ManagerBase 
implements StorageManager, C
             } else {
                 throw new InvalidParameterValueException("Missing parameter 
hypervisor. Hypervisor type is required to create zone wide primary storage.");
             }
-            if (hypervisorType != HypervisorType.KVM && hypervisorType != 
HypervisorType.VMware && hypervisorType != HypervisorType.Hyperv && 
hypervisorType != HypervisorType.LXC
-                    && hypervisorType != HypervisorType.Any) {
-                throw new InvalidParameterValueException("zone wide storage 
pool is not supported for hypervisor type " + hypervisor);
+
+            Set<HypervisorType> supportedHypervisorTypes = 
Sets.newHashSet(HypervisorType.KVM, HypervisorType.VMware,
+                    HypervisorType.Hyperv, HypervisorType.LXC, 
HypervisorType.Any, HypervisorType.Simulator);
+            if (!supportedHypervisorTypes.contains(hypervisorType)) {
+                throw new InvalidParameterValueException("Zone wide storage 
pool is not supported for hypervisor type " + hypervisor);
             }
         } else {
             ClusterVO clusterVO = _clusterDao.findById(clusterId);
diff --git a/ui/src/views/infra/AddPrimaryStorage.vue 
b/ui/src/views/infra/AddPrimaryStorage.vue
index dbab19e..3a38975 100644
--- a/ui/src/views/infra/AddPrimaryStorage.vue
+++ b/ui/src/views/infra/AddPrimaryStorage.vue
@@ -313,7 +313,7 @@ export default {
   inject: ['parentFetchData'],
   data () {
     return {
-      hypervisors: ['KVM', 'VMware', 'Hyperv', 'Any'],
+      hypervisors: ['KVM', 'VMware', 'Hyperv', 'Any', 'Simulator'],
       protocols: [],
       providers: [],
       scope: 'cluster',

Reply via email to