File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -187,6 +187,22 @@ resizeqcow2() {
187187 # if this is a shrink operation, fail if commands will shrink the volume and we haven't signed of on shrinking
188188 failshrink
189189
190+ # move this back into cloudstack libvirt calls once the libvirt java bindings support block resize
191+ # we try to inform hypervisor of new size, but don't fail if we can't
192+ if ` virsh help 2> /dev/null | grep -q blockresize`
193+ then
194+ if ` virsh domstate $vmname > /dev/null 2>&1 `
195+ then
196+ log " vm $vmname is running, use 'virsh blockresize' to resize the volume"
197+ notifyqemu
198+ if [ $? -eq 0 ]
199+ then
200+ log " performed successful resize - currentsize:$currentsize newsize:$newsize path:$path type:$ptype vmname:$vmname live:$liveresize shrink:$shrink "
201+ exit 0
202+ fi
203+ fi
204+ fi
205+
190206 output=` qemu-img resize $path $newsize 2>&1 `
191207 retval=$?
192208
@@ -196,10 +212,6 @@ resizeqcow2() {
196212 exit 1
197213 fi
198214
199- # move this back into cloudstack libvirt calls once the libvirt java bindings support block resize
200- # we try to inform hypervisor of new size, but don't fail if we can't
201- notifyqemu
202-
203215 log " performed successful resize - currentsize:$currentsize newsize:$newsize path:$path type:$ptype vmname:$vmname live:$liveresize shrink:$shrink "
204216}
205217
244256 resizelvm
245257elif [ " $ptype " == " QCOW2" ]
246258then
247- notifyqemu
259+ resizeqcow2
248260elif [ " $ptype " == " NOTIFYONLY" ]
249261then
250262 notifyqemu
You can’t perform that action at this time.
0 commit comments