[pve-devel] [PATCH 3/8] lvmplugin : volume_resize

Alexandre Derumier aderumier at odiso.com
Mon Aug 6 11:57:28 CEST 2012


resize the lvm device (online or offline)

return 1 to use qmp block_resize to online update size in guest

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

diff --git a/PVE/Storage/LVMPlugin.pm b/PVE/Storage/LVMPlugin.pm
index 8c0b613..d49a2b9 100644
--- a/PVE/Storage/LVMPlugin.pm
+++ b/PVE/Storage/LVMPlugin.pm
@@ -408,4 +408,16 @@ sub deactivate_volume {
     run_command($cmd, errmsg => "can't deactivate LV '$path'");
 }
 
+sub volume_resize {
+    my ($class, $scfg, $storeid, $volname, $size, $running) = @_;
+
+    $size = ($size/1024/1024) . "M";
+
+    my $path = $class->path($scfg, $volname);
+    my $cmd = ['/sbin/lvextend', '-L', $size, $path];
+    run_command($cmd, errmsg => "error resizing volume '$path'");
+
+    return 1;
+}
+
 1;
-- 
1.7.2.5



More information about the pve-devel mailing list