[pve-devel] [PATCH 6/8] rbd : volume_resize

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


resize disk with rbd command if vm is offline
otherwise we can use qmp block_resize if vm is online

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

diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index 76ab9b2..2b36cc9 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -266,4 +266,14 @@ sub volume_size_info {
     return $size;
 }
 
+sub volume_resize {
+    my ($class, $scfg, $storeid, $volname, $size, $running) = @_;
+
+    return 1 if $running;
+
+    my $cmd = &$rbd_cmd($scfg, $storeid, 'resize', '--size', ($size/1024/1024), $volname);
+    run_command($cmd, errmsg => "rbd resize $volname' error", errfunc => sub {});
+    return undef;
+}
+
 1;
-- 
1.7.2.5




More information about the pve-devel mailing list