public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH storage] RBD plugin: path: conditionalize get_rbd_dev_path() call
@ 2022-08-31  8:50 Fiona Ebner
  2022-09-13  7:56 ` [pve-devel] applied: " Fabian Grünbichler
  0 siblings, 1 reply; 2+ messages in thread
From: Fiona Ebner @ 2022-08-31  8:50 UTC (permalink / raw)
  To: pve-devel

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>
---
 PVE/Storage/RBDPlugin.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index eeeaf3f..d76f930 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -417,8 +417,10 @@ sub path {
     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}";
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH storage] RBD plugin: path: conditionalize get_rbd_dev_path() call
  2022-08-31  8:50 [pve-devel] [PATCH storage] RBD plugin: path: conditionalize get_rbd_dev_path() call Fiona Ebner
@ 2022-09-13  7:56 ` Fabian Grünbichler
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2022-09-13  7:56 UTC (permalink / raw)
  To: Proxmox VE development discussion

thanks!

On August 31, 2022 10:50 am, Fiona Ebner wrote:
> 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>
> ---
>  PVE/Storage/RBDPlugin.pm | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
> index eeeaf3f..d76f930 100644
> --- a/PVE/Storage/RBDPlugin.pm
> +++ b/PVE/Storage/RBDPlugin.pm
> @@ -417,8 +417,10 @@ sub path {
>      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}";
> -- 
> 2.30.2
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-09-13  7:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-31  8:50 [pve-devel] [PATCH storage] RBD plugin: path: conditionalize get_rbd_dev_path() call Fiona Ebner
2022-09-13  7:56 ` [pve-devel] applied: " Fabian Grünbichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal