[pve-devel] [PATCH storage] rbd: update features of image when mapping snapshot

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Nov 29 13:30:30 CET 2019


in order to fix the features even if the image itself never gets mapped.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 PVE/Storage/RBDPlugin.pm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index 10b54e5..538d6bb 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -580,7 +580,9 @@ my $get_kernel_device_name = sub {
 sub map_volume {
     my ($class, $storeid, $scfg, $volname, $snapname) = @_;
 
-    my ($vtype, $name, $vmid) = $class->parse_volname($volname);
+    my ($vtype, $img_name, $vmid) = $class->parse_volname($volname);
+
+    my $name = $img_name;
     $name .= '@'.$snapname if $snapname;
 
     my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
@@ -589,7 +591,8 @@ sub map_volume {
 
     return $kerneldev if -b $kerneldev; # already mapped
 
-    $krbd_feature_update->($scfg, $storeid, $name) if !$snapname;
+    # features can only be enabled/disabled for image, not for snapshot!
+    $krbd_feature_update->($scfg, $storeid, $img_name);
 
     my $cmd = &$rbd_cmd($scfg, $storeid, 'map', $name);
     run_rbd_command($cmd, errmsg => "can't map rbd volume $name");
-- 
2.20.1





More information about the pve-devel mailing list