The scfg variable holds an extra parameter to verify that it's lxc that
needs krbd regardless its storage config entry.

Without this there would be the need for an extra storage entry to use
the same RBD pool with LXC (krbd 0/1).

Signed-off-by: Alwin Antreich <a.antre...@proxmox.com>
---
 PVE/Storage/RBDPlugin.pm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index be88ad7..1a5582d 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -74,7 +74,7 @@ my $librados_connect = sub {
 my $krbd_feature_disable = sub {
     my ($scfg, $storeid, $name) = @_;
 
-    return 1 if !$scfg->{krbd};
+    return 1 if (!$scfg->{krbd} && !$scfg->{lxc_krbd});
 
     my ($major, undef, undef, undef) = ceph_version();
     return 1 if $major < 10;
@@ -309,7 +309,7 @@ sub path {
     $name .= '@'.$snapname if $snapname;
 
     my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
-    return ("/dev/rbd/$pool/$name", $vmid, $vtype) if $scfg->{krbd};
+    return ("/dev/rbd/$pool/$name", $vmid, $vtype) if ($scfg->{krbd} || 
$scfg->{lxc_krbd});
 
     my $path = "rbd:$pool/$name";
 
@@ -550,7 +550,7 @@ sub deactivate_storage {
 sub activate_volume {
     my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
 
-    return 1 if !$scfg->{krbd};
+    return 1 if (!$scfg->{krbd} && !$scfg->{lxc_krbd});
 
     my ($vtype, $name, $vmid) = $class->parse_volname($volname);
     my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
@@ -569,7 +569,7 @@ sub activate_volume {
 sub deactivate_volume {
     my ($class, $storeid, $scfg, $volname, $snapname, $cache) = @_;
 
-    return 1 if !$scfg->{krbd};
+    return 1 if (!$scfg->{krbd} && !$scfg->{lxc_krbd});
 
     my ($vtype, $name, $vmid) = $class->parse_volname($volname);
     my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
@@ -595,7 +595,7 @@ sub volume_size_info {
 sub volume_resize {
     my ($class, $scfg, $storeid, $volname, $size, $running) = @_;
 
-    return 1 if $running && !$scfg->{krbd};
+    return 1 if $running && (!$scfg->{krbd} && !$scfg->{lxc_krbd});
 
     my ($vtype, $name, $vmid) = $class->parse_volname($volname);
 
@@ -626,7 +626,7 @@ sub volume_snapshot_rollback {
 sub volume_snapshot_delete {
     my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
 
-    return 1 if $running && !$scfg->{krbd};
+    return 1 if $running && (!$scfg->{krbd} && !$scfg->{lxc_krbd});
 
     $class->deactivate_volume($storeid, $scfg, $volname, $snap, {});
 
-- 
2.11.0


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

Reply via email to