[pve-devel] [PATCH 1/8] Storage : add global volume_resize

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


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

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 6257782..4afdf15 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -123,6 +123,21 @@ sub volume_size_info {
     }
 }
 
+sub volume_resize {
+    my ($cfg, $volid, $size, $running) = @_;
+
+    my ($storeid, $volname) = parse_volume_id($volid, 1);
+    if ($storeid) {
+        my $scfg = storage_config($cfg, $storeid);
+        my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
+        return $plugin->volume_resize($scfg, $storeid, $volname, $size, $running);
+    } elsif ($volid =~ m|^(/.+)$| && -e $volid) {
+        die "resize device is not possible";
+    } else {
+        die "can't resize";
+    }
+}
+
 sub get_image_dir {
     my ($cfg, $storeid, $vmid) = @_;
 
-- 
1.7.2.5



More information about the pve-devel mailing list