]> git.proxmox.com Git - pve-storage.git/commitdiff
rbd: path: don't build the entire path if we don't use it
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 11 Jul 2016 11:55:47 +0000 (13:55 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 11 Jul 2016 11:58:56 +0000 (13:58 +0200)
PVE/Storage/RBDPlugin.pm

index 2ef7573b735100575d71e3aa3b865b5ad77cac2c..ced9af09d5c9d6471e6e395131611ad43e784f21 100644 (file)
@@ -299,10 +299,12 @@ sub path {
     my ($vtype, $name, $vmid) = $class->parse_volname($volname);
     $name .= '@'.$snapname if $snapname;
 
+    my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
+    return ("/dev/rbd/$pool/$name", $vmid, $vtype) if $scfg->{krbd};
+
     my $monhost = $scfg->{monhost};
     $monhost =~ s/:/\\:/g;
 
-    my $pool =  $scfg->{pool} ? $scfg->{pool} : 'rbd';
     my $username =  $scfg->{username} ? $scfg->{username} : 'admin';
 
     my $path = "rbd:$pool/$name:mon_host=$monhost";
@@ -314,8 +316,6 @@ sub path {
        $path .= ":auth_supported=none";
     }
 
-    $path = "/dev/rbd/$pool/$name" if $scfg->{krbd};
-
     return ($path, $vmid, $vtype);
 }