You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ch...@apache.org on 2013/04/25 15:46:13 UTC

git commit: updated refs/heads/4.1 to 8836c85

Updated Branches:
  refs/heads/4.1 3be175462 -> 8836c85f2


CLOUDSTACK-2173: Don't do KVM heartbeat on secondary storage sources, primary only

The KVM HA runner uses any NFS secondary storage resource available to a
host to store it's HA data. This causes template deletes to fail because
it cannot delete KVMHA, which is a directory that is not empty. So if
KVMHA directory is found, delete it's contents before trying to delete
it.

Tested with a new 4.1 zone deployment. Verified bug was reproducable
with 4.1 HEAD, applied patch, ran through adding two NFS primary
storages, verified KVM heartbeat was working on them, then ran various
secondary storage operations (register template, download volume, take
snapshot) and verified that they worked, and that KVM heartbeat
operations were NOT acting on them.

Signed-off-by: Chip Childers <ch...@gmail.com>


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

Branch: refs/heads/4.1
Commit: 8836c85f2d1c44959bafc5ba8c435451d838ac17
Parents: 3be1754
Author: Marcus Sorensen <sh...@gmail.com>
Authored: Thu Apr 25 14:37:01 2013 +0100
Committer: Chip Childers <ch...@gmail.com>
Committed: Thu Apr 25 14:45:42 2013 +0100

----------------------------------------------------------------------
 .../hypervisor/kvm/resource/KVMHAMonitor.java      |    7 ++++---
 .../kvm/storage/KVMStoragePoolManager.java         |   12 ++++++++++--
 2 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8836c85f/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java
index d1470d6..0e4d9ee 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/KVMHAMonitor.java
@@ -55,9 +55,10 @@ public class KVMHAMonitor extends KVMHABase implements Runnable {
     public void removeStoragePool(String uuid) {
         synchronized (_storagePool) {
             NfsStoragePool pool = this._storagePool.get(uuid);
-            Script.runSimpleBashScript("umount " + pool._mountDestPath);
-            s_logger.debug("attempted to umount '" + pool._mountDestPath + "'");
-            this._storagePool.remove(uuid);
+            if (pool != null) {
+                Script.runSimpleBashScript("umount " + pool._mountDestPath);
+                this._storagePool.remove(uuid);
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8836c85f/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java
index c2bfad9..0482cec 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java
@@ -93,18 +93,26 @@ public class KVMStoragePoolManager {
             protocol = StoragePoolType.NetworkFilesystem;
         }
 
-        return createStoragePool(uuid, sourceHost, 0, sourcePath, "", protocol);
+        // secondary storage registers itself through here
+        return createStoragePool(uuid, sourceHost, 0, sourcePath, "", protocol, false);
     }
 
     public KVMStoragePool createStoragePool( String name, String host, int port,
                                              String path, String userInfo,
                                              StoragePoolType type) {
+        // primary storage registers itself through here
+        return createStoragePool(name, host, port, path, userInfo, type, true);
+    }
+
+    private KVMStoragePool createStoragePool( String name, String host, int port,
+                                             String path, String userInfo,
+                                             StoragePoolType type, boolean primaryStorage) {
         StorageAdaptor adaptor = getStorageAdaptor(type);
         KVMStoragePool pool = adaptor.createStoragePool(name,
                                 host, port, path, userInfo, type);
 
         // LibvirtStorageAdaptor-specific statement
-        if (type == StoragePoolType.NetworkFilesystem) {
+        if (type == StoragePoolType.NetworkFilesystem && primaryStorage) {
             KVMHABase.NfsStoragePool nfspool = new KVMHABase.NfsStoragePool(
                     pool.getUuid(), host, path, pool.getLocalPath(),
                     PoolType.PrimaryStorage);