mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-9101: resize root volume of stopped vm on KVM
This commit is contained in:
parent
d6e21f7416
commit
9221cb3e0d
@ -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
|
# if this is a shrink operation, fail if commands will shrink the volume and we haven't signed of on shrinking
|
||||||
failshrink
|
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`
|
output=`qemu-img resize $path $newsize 2>&1`
|
||||||
retval=$?
|
retval=$?
|
||||||
|
|
||||||
@ -196,10 +212,6 @@ resizeqcow2() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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"
|
log "performed successful resize - currentsize:$currentsize newsize:$newsize path:$path type:$ptype vmname:$vmname live:$liveresize shrink:$shrink"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,7 +256,7 @@ then
|
|||||||
resizelvm
|
resizelvm
|
||||||
elif [ "$ptype" == "QCOW2" ]
|
elif [ "$ptype" == "QCOW2" ]
|
||||||
then
|
then
|
||||||
notifyqemu
|
resizeqcow2
|
||||||
elif [ "$ptype" == "NOTIFYONLY" ]
|
elif [ "$ptype" == "NOTIFYONLY" ]
|
||||||
then
|
then
|
||||||
notifyqemu
|
notifyqemu
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user