Please see attached a patch to implement "resize" for the DRBD backend.

I hope it matches all your coding style guidelines;
feedback is welcome, of course.


Regards,

Phil
>From 4ceb4d737d4c604dcf99bbd46d60d731626e9781 Mon Sep 17 00:00:00 2001
From: root <r...@proxmox4b2.at.linbit>
Date: Mon, 3 Aug 2015 16:15:33 +0200
Subject: [PATCH] Implement "resize" for the DRBD backend.

Sadly DRBD 9 itself currently has a small bug that makes
that incompatible with drbdmanage's way of resizing (the
"size" argument must not be given), so actually it won't
really work yet, even with this patch.
---
 PVE/Storage/DRBDPlugin.pm | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/PVE/Storage/DRBDPlugin.pm b/PVE/Storage/DRBDPlugin.pm
index 91420da..d031db6 100644
--- a/PVE/Storage/DRBDPlugin.pm
+++ b/PVE/Storage/DRBDPlugin.pm
@@ -356,19 +356,19 @@ sub deactivate_volume {
 }
 
 sub volume_resize {
-    my ($class, $scfg, $storeid, $volname, $size, $running) = @_;
+    my ($class, $scfg, $storeid, $name, $size, $running) = @_;
 
-    $size = ($size/1024/1024) . "M";
+    $size = int($size/1024);
+    my $hdl = connect_drbdmanage_service();
 
-    my $path = $class->path($scfg, $volname);
+    die "illegal name '$name' - should be 'vm-*-*'\n"
+	if $name !~ m/^vm-\d+-/;
 
-    # fixme: howto implement this
-    die "drbd volume_resize is not implemented";
-    
-    #my $cmd = ['/sbin/lvextend', '-L', $size, $path];
-    #run_command($cmd, errmsg => "error resizing volume '$path'");
+    # FIXME if there's ever more than one volume in a resource
+    my ($rc) = $hdl->resize_volume($name, 0, 0, $size, 0);
+    check_drbd_res($rc);
 
-    return 1;
+    return undef;
 }
 
 sub volume_snapshot {
-- 
2.1.4

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to