From ed30683e5211f87d51f9e8d8f5c495fc7ada4a5d Mon Sep 17 00:00:00 2001 From: Nicolas Vazquez Date: Wed, 16 Feb 2022 22:50:55 -0300 Subject: [PATCH] [Simulator] Add zone wide storage (#5986) * [Simulator] Add zone wide storage * Refactor --- .../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 3522bb093df..b1a33c0d31c 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 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 dbab19ea9e2..3a38975393e 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',