[pve-devel] [PATCH 2/2] add qemu_block_resize

Alexandre Derumier aderumier at odiso.com
Mon Aug 6 11:56:34 CEST 2012


this call storage plugin resize first.
storage plugin will
  return undef if we don't need to call qmp block_resize
or
 return 1 if we need to call qmp block_resize

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index fafe4b5..d3a710e 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2547,6 +2547,19 @@ sub qemu_block_set_io_throttle {
 
 }
 
+sub qemu_block_resize {
+    my ($vmid, $deviceid, $storecfg, $volid, $size) = @_;
+
+    my $running = PVE::QemuServer::check_running($vmid);
+
+    return if !PVE::Storage::volume_resize($storecfg, $volid, $size, $running);
+
+    return if !$running;
+
+    vm_mon_cmd($vmid, "block_resize", device => $deviceid, size => int($size));
+
+}
+
 sub vm_start {
     my ($storecfg, $vmid, $statefile, $skiplock) = @_;
 
-- 
1.7.2.5




More information about the pve-devel mailing list