rbd: path: don't build the entire path if we don't use it

This commit is contained in:
Wolfgang Bumiller
2016-07-11 13:55:47 +02:00
committed by Fabian Grünbichler
parent 0423e8c686
commit 33cef4c84e

View 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);
}