You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/05/05 15:28:15 UTC

git commit: updated refs/heads/4.4-forward to 2c4ae08

Repository: cloudstack
Updated Branches:
  refs/heads/4.4-forward 149cb33e3 -> 2c4ae0883


CLOUDSTACK-5907, CLOUDSTACK-6396: KVM/RBD & KVM/CLVM volumes mistakenly shown as OVM, disables snapshotting

modified:   server/src/com/cloud/api/ApiDBUtils.java

Signed-off-by: Daan Hoogland <da...@onecht.net>


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

Branch: refs/heads/4.4-forward
Commit: 2c4ae0883be04840a90b7238ad32aeaa38cc43ae
Parents: 149cb33
Author: Tanner Danzey <ar...@gmail.com>
Authored: Mon Apr 14 16:52:05 2014 -0500
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon May 5 15:27:38 2014 +0200

----------------------------------------------------------------------
 server/src/com/cloud/api/ApiDBUtils.java | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2c4ae088/server/src/com/cloud/api/ApiDBUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java
index 2da107f..296a1f4 100755
--- a/server/src/com/cloud/api/ApiDBUtils.java
+++ b/server/src/com/cloud/api/ApiDBUtils.java
@@ -19,6 +19,7 @@ package com.cloud.api;
 import java.util.ArrayList;
 import java.util.EnumSet;
 import java.util.List;
+import java.util.ListIterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -236,6 +237,7 @@ import com.cloud.storage.ImageStore;
 import com.cloud.storage.Snapshot;
 import com.cloud.storage.SnapshotVO;
 import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.storage.Storage.StoragePoolType;
 import com.cloud.storage.StorageManager;
 import com.cloud.storage.StoragePool;
 import com.cloud.storage.StorageStats;
@@ -1071,6 +1073,26 @@ public class ApiDBUtils {
             if (xenClusters.isEmpty()) {
                 type = HypervisorType.Hyperv;
             }
+        } if (format == ImageFormat.RAW) {
+            // Currently, KVM only suppoorts RBD images of type RAW.
+            // This results in a weird collision with OVM volumes which
+            // can only be raw, thus making KVM RBD volumes show up as OVM
+            // rather than RBD. This block of code can (hopefuly) by checking to
+            // see if the pool is using either RBD or NFS. However, it isn't
+            // quite clear what to do if both storage types are used. If the image
+            // format is RAW, it narrows the hypervisor choice down to OVM and KVM / RBD or KVM / CLVM
+            // This would be better implemented at a cluster level.
+            List<StoragePoolVO> pools = s_storagePoolDao.listByDataCenterId(dcId);
+            ListIterator<StoragePoolVO> itr = pools.listIterator();
+            while(itr.hasNext()) {
+                StoragePoolVO pool = itr.next();
+                if(pool.getPoolType() == StoragePoolType.RBD || pool.getPoolType() == StoragePoolType.CLVM) {
+                  // This case will note the presence of non-qcow2 primary stores, suggesting KVM without NFS. Otherwse,
+                  // If this check is not passed, the hypervisor type will remain OVM.
+                  type = HypervisorType.KVM;
+                  break;
+                }
+            }
         }
         return type;
     }