Only claim that the image does not exist if the error message
indicates it.

Signed-off-by: Fiona Ebner <f.eb...@proxmox.com>
---

If we don't want to match the error, I'll switch the helper over to
list volumes and check there.

New in v2.

 src/PVE/Storage/RBDPlugin.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Storage/RBDPlugin.pm b/src/PVE/Storage/RBDPlugin.pm
index 0e53888..004842b 100644
--- a/src/PVE/Storage/RBDPlugin.pm
+++ b/src/PVE/Storage/RBDPlugin.pm
@@ -355,7 +355,11 @@ my sub rbd_volume_exists {
        my $cmd = $rbd_cmd->($scfg, $storeid, 'info', $volname);
        run_rbd_command($cmd, errmsg => "exist check",  quiet => 1);
     };
-    return $@ ? undef : 1;
+    if (my $err = $@) {
+       return if $err =~ m/No such file or directory$/;
+       die $err;
+    }
+    return 1;
 }
 
 # Configuration
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to