]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/Storage/DRBDPlugin.pm
path: corretly implement path to snapshots
[pve-storage.git] / PVE / Storage / DRBDPlugin.pm
index 7f79d1220e142adc3a0f29b165176b1efe04689f..b209ac814afcd04b37545e431c2f4c8d56bf334b 100644 (file)
@@ -72,16 +72,23 @@ sub check_drbd_res {
     die "got undefined drbd result\n" if !$rc;
 
     foreach my $res (@$rc) {
-       my ($code, $msg, $details) = @$res;
+       my ($code, $format, $details) = @$res;
 
-       return undef if $code == 0;
+       next if $code == 0;
 
-       $msg = "drbd error: got error code $code" if !$msg;
+       my $msg;
+       if (defined($format)) {
+           my @args = ();
+           push @args, $details->{$1} // "" 
+               while $format =~ s,\%\((\w+)\),%,;
+
+           $msg = sprintf($format, @args);
+
+       } else {    
+           $msg = "drbd error: got error code $code";
+       }
+       
        chomp $msg;
-    
-       # fixme: add error details?
-       #print Dumper($details);
-    
        die "drbd error: $msg\n";
     }
 
@@ -126,14 +133,16 @@ sub parse_volname {
     my ($class, $volname) = @_;
 
     if ($volname =~ m/^(vm-(\d+)-[a-z][a-z0-9\-\_\.]*[a-z0-9]+)$/) {
-       return ('images', $1, $2);
+       return ('images', $1, $2, undef, undef, undef, 'raw');
     }
 
     die "unable to parse lvm volume name '$volname'\n";
 }
 
 sub filesystem_path {
-    my ($class, $scfg, $volname) = @_;
+    my ($class, $scfg, $volname, $snapname) = @_;
+
+    die "drbd snapshot is not implemented\n" if defined($snapname);
 
     my ($vtype, $name, $vmid) = $class->parse_volname($volname);