[pve-devel] [PATCH 2/8] plugins : add volume_resize
Alexandre Derumier
aderumier at odiso.com
Mon Aug 6 11:57:27 CEST 2012
this add qemu-img resize for file devices (raw - qcow2) if vm is offline.
otherwise we need to use online qmp block_resize
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/Storage/Plugin.pm | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index a50b602..be1189a 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -488,6 +488,22 @@ sub volume_size_info {
}
+sub volume_resize {
+ my ($class, $scfg, $storeid, $volname, $size, $running) = @_;
+
+ die "can't resize this image format" if $volname !~ m/\.(raw|qcow2)$/;
+
+ return 1 if $running;
+
+ my $path = $class->path($scfg, $volname);
+
+ my $cmd = ['/usr/bin/qemu-img', 'resize', $path , $size];
+
+ run_command($cmd, timeout => 1);
+
+ return undef;
+}
+
sub list_images {
my ($class, $storeid, $scfg, $vmid, $vollist, $cache) = @_;
--
1.7.2.5
More information about the pve-devel
mailing list