[pve-devel] Implement "resize" for the DRBD backend.

Dietmar Maurer dietmar at proxmox.com
Tue Aug 4 07:34:43 CEST 2015


> 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.

Please can you send patches inline? That way it is easier to review code
and add comments. I copied the code for this purpose - comments inline:

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) = @_;

why do you rename $volname to $name?
 
-    $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+-/;

And reason for above check? Or did you just copied that code from alloc_image?
 
-    # 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

not sure if we ever want to support multiple volumes inside one resource?
Why would we want to do that?

Anyways, I tested the patch, and volume_resize() now returns without errors.
The problem is that it does not resize the underlying LVM volume.

Do I need to install any drbdmanage updates/patches to make that work?




More information about the pve-devel mailing list