[pve-devel] [PATCH qemu-server] Fix block_resize qmp call for block devices

Dmitry Petuhov mityapetuhov at gmail.com
Thu Jan 12 13:29:11 CET 2017


Set zero size for backing block devices in qmp call. In that case qemu
sets size of device in guest to current size of backing device, which
was resized earlier. Otherwise, any non-zero value causes error here.

---
 PVE/QemuServer.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index bc26da2..3f53ac1 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3984,6 +3984,12 @@ sub qemu_block_resize {
 
     return if !$running;
 
+    my $path = PVE::Storage::path($cfg, $volid, undef);
+    if ($path =~ m|^/|) {
+        $path = abs_path($path);
+        $size = 0 if -d $path;
+    }
+
     vm_mon_cmd($vmid, "block_resize", device => $deviceid, size => int($size));
 
 }
-- 
2.1.4



More information about the pve-devel mailing list