Updated Branches:
  refs/heads/master 984b59d1e -> b4969c4af

CLOUDSTACK-2796

Hypervisor type validation would be applicable only for zone wide primary 
storage pool.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b4969c4a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b4969c4a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b4969c4a

Branch: refs/heads/master
Commit: b4969c4af5264879ccbec01b65b6c94886fc79d4
Parents: 984b59d
Author: Sateesh Chodapuneedi <[email protected]>
Authored: Mon Jun 3 10:10:03 2013 +0530
Committer: Sateesh Chodapuneedi <[email protected]>
Committed: Mon Jun 3 10:10:03 2013 +0530

----------------------------------------------------------------------
 .../src/com/cloud/storage/StorageManagerImpl.java  |   32 +++++++-------
 1 files changed, 16 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b4969c4a/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java 
b/server/src/com/cloud/storage/StorageManagerImpl.java
index f0cb1ff..cdfc19a 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -777,23 +777,23 @@ public class StorageManagerImpl extends ManagerBase 
implements StorageManager, C
                     "zone id can't be null, if scope is zone");
         }
 
-        String hypervisor = cmd.getHypervisor();
-        HypervisorType hypervisorType;
-        if (hypervisor != null) {
-            try {
-                hypervisorType = HypervisorType.getType(hypervisor);
-            } catch (Exception e) {
-                throw new InvalidParameterValueException("invalid hypervisor 
type" + hypervisor);
+        HypervisorType hypervisorType = HypervisorType.KVM;
+        if (scopeType == ScopeType.ZONE) {
+            String hypervisor = cmd.getHypervisor();
+            if (hypervisor != null) {
+                try {
+                    hypervisorType = HypervisorType.getType(hypervisor);
+                } catch (Exception e) {
+                    throw new InvalidParameterValueException("invalid 
hypervisor type" + hypervisor);
+                }
+            } else {
+                throw new InvalidParameterValueException(
+                        "Missing parameter hypervisor. Hypervisor type is 
required to create zone wide primary storage.");
+            }
+            if (hypervisorType != HypervisorType.KVM && hypervisorType != 
HypervisorType.VMware) {
+                throw new InvalidParameterValueException(
+                        "zone wide storage pool is not suported for hypervisor 
type " + hypervisor);
             }
-        } else {
-            throw new InvalidParameterValueException(
-                    "Missing parameter hypervisor. Hypervisor type is required 
to create zone wide primary storage.");
-        }
-
-        if (scopeType == ScopeType.ZONE &&
-                (hypervisorType != HypervisorType.KVM && hypervisorType != 
HypervisorType.VMware)) {
-            throw new InvalidParameterValueException(
-                    "zone wide storage pool is not suported for hypervisor 
type " + hypervisor);
         }
 
         Map ds = cmd.getDetails();

Reply via email to