]> git.proxmox.com Git - pve-storage.git/commitdiff
rbd: add support to krbd
authorAlexandre Derumier <aderumier@odiso.com>
Thu, 30 Jul 2015 07:57:31 +0000 (09:57 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 7 Aug 2015 09:56:40 +0000 (11:56 +0200)
Can be use by lxc (but also qemu)

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/Storage/RBDPlugin.pm
changelog.Debian

index 878fa169c2dcfe6f008926f719b053bd26f2493b..785dca9e544cbba0f6f01d45c5f84f7332f2b6ee 100644 (file)
@@ -219,6 +219,10 @@ sub properties {
            description => "Authsupported.",
            type => 'string',
        },
+       krbd => {
+           description => "Access rbd through krbd kernel module.",
+           type => 'boolean',
+       },
     };
 }
 
@@ -230,6 +234,7 @@ sub options {
        pool => { optional => 1 },
        username => { optional => 1 },
        content => { optional => 1 },
+       krbd => { optional => 1 },
     };
 }
 
@@ -266,6 +271,8 @@ sub path {
        $path .= ":auth_supported=none";
     }
 
+    $path = "/dev/rbd/$pool/$name" if $scfg->{krbd};
+
     return ($path, $vmid, $vtype);
 }
 
@@ -481,11 +488,29 @@ sub deactivate_storage {
 
 sub activate_volume {
     my ($class, $storeid, $scfg, $volname, $exclusive, $cache) = @_;
+
+    return 1 if !$scfg->{krbd};
+
+    my ($vtype, $name, $vmid) = $class->parse_volname($volname);
+
+    my $cmd = &$rbd_cmd($scfg, $storeid, 'map', $name);
+    run_rbd_command($cmd, errmsg => "can't mount rbd volume $name");
+
     return 1;
 }
 
 sub deactivate_volume {
     my ($class, $storeid, $scfg, $volname, $exclusive, $cache) = @_;
+
+    return 1 if !$scfg->{krbd};
+
+    my ($vtype, $name, $vmid) = $class->parse_volname($volname);
+    my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
+
+    my $path = "/dev/rbd/$pool/$name";
+    my $cmd = &$rbd_cmd($scfg, $storeid, 'unmap', $path);
+    run_rbd_command($cmd, errmsg => "can't unmount rbd volume $name");
+
     return 1;
 }
 
index f74ab6350521b949a0e24e0b73eed3596fc1c382..bc9576eb8625d1ea31d3312fbdc97d9280403b02 100644 (file)
@@ -2,6 +2,8 @@ libpve-storage-perl (4.0-14) unstable; urgency=medium
 
   * storage status API: allow to filter multiple content types
 
+  * rbd: add support to krbd
+
  -- Proxmox Support Team <support@proxmox.com>  Fri, 07 Aug 2015 09:45:18 +0200
 
 libpve-storage-perl (4.0-13) unstable; urgency=medium