Closed dimaandg closed 6 years ago
root@ovs1:~# virsh qemu-monitor-command vm-13 --hmp "block_resize drive-virtio-disk0 16106127360"
Could not resize: Operation not permitted
The storage system we use undernead does not seem to support this. Upstream ticket with FR was created. http://support.openvstorage.com/servicedesk/customer/portal/1/OVSSUP-324
I used this process for online disk resize and it works. I can send you step-by-step procedure if needed.
@dmitrydelyukin this was with an OpenvStorage backend? If so please add step-by-step procedure so we can see if this helps.
# logging to storage node
# stor-0X
truncate -s <newsize> /mnt/<storagepoolname>/myvolume.raw
# need to find what cpu node is serving VM
# logging to cpu node
# cpu-XX
root@cpu-11:~# virsh list
Id Name State
—------------------------------------------------—
110 vm-2463 running
root@cpu-11:~# virsh domblklist vm-2463 —details
Type Device Target Source
—----------------------------------------------
network cdrom hdc vm-2463/cloud-init-vm-2463
network disk vda vm-2463/bootdisk-vm-2463
network disk vdb volumes/volume_8198
root@cpu-11:~# virsh pool-list
Name State Autostart
—---------------------------------------—
root@cpu-11:~# virsh qemu-monitor-command vm-2463 —hmp "info block"
drive-ide0-1-0 (#block154): json:{"driver": "raw", "file": {"port": 26203, "host": "10.200.3.61", "driver": "openvstorage", "enable-ha": true, "volume": "vm-2463/cloud-init-vm-2463", "transport": "tcp"}} (raw, read-only)
Removable device: locked, tray closed
Cache mode: writeback, direct
drive-virtio-disk0 (#block323): json:{"driver": "raw", "file": {"port": 26203, "host": "10.200.3.65", "driver": "openvstorage", "enable-ha": true, "volume": "vm-2463/bootdisk-vm-2463", "transport": "tcp"}} (raw)
Cache mode: writeback, direct
drive-virtio-disk1 (#block555): json:{"driver": "raw", "file": {"port": 26209, "host": "10.200.3.66", "driver": "openvstorage", "enable-ha": true, "volume": "volumes/volume_8198", "transport": "tcp"}} (raw)
Cache mode: writeback, direct
root@cpu-11:~# virsh qemu-monitor-command vm-2463 —hmp "block_resize drive-virtio-disk1 <newsize>"
From within our python code
In [8]: dom.blockResize('vdb', 26777216, libvirt.VIR_DOMAIN_BLOCK_RESIZE_BYTES)
Result should be 0 if everything was successfull, I failure we return a 204 instead of a 200, this is an indication the caller of the API should restart his vm nevertheless. Possible reasons for live changing might be cause guest OS does not support it.
I changed the disk "test" to 21G but it is still 10G on the vm itself (vdb)
No need to restart VM for disk resize, all OSs can understand that disk was resized. Just need to use qemu-monitor-command to inform OS about it.
example virsh qemu-monitor-command vm-2463 --hmp "block_resize drive-virtio-disk1 "
GOGS Ticket: https://docs.greenitglobe.com/gig/proj_russia_digital_energy/issues/348