cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [3/4] git commit: updated refs/heads/4.6 to 998b1ba
Date Sun, 06 Dec 2015 18:44:46 GMT
CLOUDSTACK-9101: resize root volume of stopped vm on KVM


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

Branch: refs/heads/4.6
Commit: 9221cb3e0d0e5a0ea374f10e889f7e32c2a3eda1
Parents: d6e21f7
Author: Wei Zhou <w.zhou@tech.leaseweb.com>
Authored: Thu Dec 3 14:31:55 2015 +0100
Committer: Wei Zhou <w.zhou@tech.leaseweb.com>
Committed: Thu Dec 3 14:54:49 2015 +0100

----------------------------------------------------------------------
 scripts/storage/qcow2/resizevolume.sh | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9221cb3e/scripts/storage/qcow2/resizevolume.sh
----------------------------------------------------------------------
diff --git a/scripts/storage/qcow2/resizevolume.sh b/scripts/storage/qcow2/resizevolume.sh
index 1e6ffd6..da77cb1 100755
--- a/scripts/storage/qcow2/resizevolume.sh
+++ b/scripts/storage/qcow2/resizevolume.sh
@@ -187,6 +187,22 @@ resizeqcow2() {
   # if this is a shrink operation, fail if commands will shrink the volume and we haven't
signed of on shrinking
   failshrink
 
+  #move this back into cloudstack libvirt calls once the libvirt java bindings support block
resize
+  #we try to inform hypervisor of new size, but don't fail if we can't
+  if `virsh help 2>/dev/null | grep -q blockresize`
+  then
+    if `virsh domstate $vmname >/dev/null 2>&1`
+    then
+        log "vm $vmname is running, use 'virsh blockresize' to resize the volume"
+        notifyqemu
+        if [ $? -eq 0 ]
+        then
+            log "performed successful resize - currentsize:$currentsize newsize:$newsize
path:$path type:$ptype vmname:$vmname live:$liveresize shrink:$shrink"
+            exit 0
+        fi
+    fi
+  fi
+
   output=`qemu-img resize $path $newsize 2>&1`
   retval=$?
 
@@ -196,10 +212,6 @@ resizeqcow2() {
     exit 1
   fi
 
-  #move this back into cloudstack libvirt calls once the libvirt java bindings support block
resize
-  #we try to inform hypervisor of new size, but don't fail if we can't
-  notifyqemu
-
   log "performed successful resize - currentsize:$currentsize newsize:$newsize path:$path
type:$ptype vmname:$vmname live:$liveresize shrink:$shrink"
 }
 
@@ -244,7 +256,7 @@ then
   resizelvm
 elif [ "$ptype" == "QCOW2" ]
 then
-  notifyqemu
+  resizeqcow2
 elif [ "$ptype" == "NOTIFYONLY" ]
 then
   notifyqemu


Mime
View raw message