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

[13/20] git commit: updated refs/heads/4.3 to 67df5b9

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>
(cherry picked from commit 601827e6b34cb7debe67a8415a09440c389ba4a1)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>


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

Branch: refs/heads/4.3
Commit: 5ac44896c8ad2e5838f91b841d9d041790d17775
Parents: af79d6a
Author: Tanner Danzey <ar...@gmail.com>
Authored: Mon Apr 14 16:52:05 2014 -0500
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Tue Nov 25 23:17:09 2014 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5ac44896/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 2617097..1df872e 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;
 
@@ -233,6 +234,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;
@@ -969,6 +971,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;
     }