Repository: cloudstack
Updated Branches:
  refs/heads/4.4 a8273c0a9 -> f0893d579


CLOUDSTACK-8263: KVM - notify qemu process of resized volume for 
libvirt-resized storage

Change-Id: Iddd8bb068855d3565075d3ecf7c6c0f074d00e1a


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

Branch: refs/heads/4.4
Commit: f0893d57948eea73c45ab1f1335fd43509b0e479
Parents: a8273c0
Author: Marcus Sorensen <[email protected]>
Authored: Tue Feb 17 14:25:55 2015 -0800
Committer: Marcus Sorensen <[email protected]>
Committed: Tue Feb 17 17:23:18 2015 -0800

----------------------------------------------------------------------
 .../kvm/resource/LibvirtComputingResource.java  | 27 ++++++++++++--------
 scripts/storage/qcow2/resizevolume.sh           |  3 +++
 2 files changed, 19 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f0893d57/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
 
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index 1b78f60..4f2067c 100755
--- 
a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ 
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -1833,6 +1833,7 @@ public class LibvirtComputingResource extends 
ServerResourceBase implements Serv
         String vmInstanceName = cmd.getInstanceName();
         boolean shrinkOk = cmd.getShrinkOk();
         StorageFilerTO spool = cmd.getPool();
+        final String notifyOnlyType = "NOTIFYONLY";
 
         if ( currentSize == newSize) {
             // nothing to do
@@ -1870,21 +1871,25 @@ public class LibvirtComputingResource extends 
ServerResourceBase implements Serv
                     }
 
                     v.resize(newSize, flags);
+                    type = notifyOnlyType;
                 } catch (LibvirtException e) {
                     return new ResizeVolumeAnswer(cmd, false, e.toString());
                 }
-            } else {
-                s_logger.debug("Volume " + path + " is of the type LVM and can 
not be resized using libvirt. Invoking resize script.");
-                final Script resizecmd = new Script(_resizeVolumePath, 
_cmdsTimeout, s_logger);
-                resizecmd.add("-s", String.valueOf(newSize));
-                resizecmd.add("-c", String.valueOf(currentSize));
-                resizecmd.add("-p", path);
-                resizecmd.add("-t", type);
-                resizecmd.add("-r", String.valueOf(shrinkOk));
-                resizecmd.add("-v", vmInstanceName);
-                String result = resizecmd.execute();
+            }
+            s_logger.debug("Invoking resize script to handle type " + type);
+            final Script resizecmd = new Script(_resizeVolumePath, 
_cmdsTimeout, s_logger);
+            resizecmd.add("-s", String.valueOf(newSize));
+            resizecmd.add("-c", String.valueOf(currentSize));
+            resizecmd.add("-p", path);
+            resizecmd.add("-t", type);
+            resizecmd.add("-r", String.valueOf(shrinkOk));
+            resizecmd.add("-v", vmInstanceName);
+            String result = resizecmd.execute();
 
-                if (result != null) {
+            if (result != null) {
+                if(type.equals(notifyOnlyType)) {
+                    return new ResizeVolumeAnswer(cmd, true, "Resize 
succeeded, but need reboot to notify guest");
+                } else {
                     return new ResizeVolumeAnswer(cmd, false, result);
                 }
             }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f0893d57/scripts/storage/qcow2/resizevolume.sh
----------------------------------------------------------------------
diff --git a/scripts/storage/qcow2/resizevolume.sh 
b/scripts/storage/qcow2/resizevolume.sh
index 6a5c91d..bc763d0 100755
--- a/scripts/storage/qcow2/resizevolume.sh
+++ b/scripts/storage/qcow2/resizevolume.sh
@@ -245,6 +245,9 @@ then
 elif [ "$ptype" == "QCOW2" ]
 then
   resizeqcow2
+elif [ "$ptype" == "NOTIFYONLY" ]
+then
+  notifyqemu
 else
   echo "unsupported type $ptype"
   exit 1;

Reply via email to