The return value of get_rbd_dev_path() is only used when $scfg->{krbd}
evaluates to true and the function shouldn't have any side effects
that are needed later, so the call can be avoided otherwise.
This also saves a RADOS connection and command with configurations for
external clusters with krbd disabled.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
$name .= '@'.$snapname if $snapname;
my ($vtype, $name, $vmid) = $class->parse_volname($volname);
$name .= '@'.$snapname if $snapname;
- my $rbd_dev_path = get_rbd_dev_path($scfg, $storeid, $name);
- return ($rbd_dev_path, $vmid, $vtype) if $scfg->{krbd};
+ if ($scfg->{krbd}) {
+ my $rbd_dev_path = get_rbd_dev_path($scfg, $storeid, $name);
+ return ($rbd_dev_path, $vmid, $vtype);
+ }
my $rbd_path = get_rbd_path($scfg, $name);
my $path = "rbd:${rbd_path}";
my $rbd_path = get_rbd_path($scfg, $name);
my $path = "rbd:${rbd_path}";