[pve-devel] [RFC v2 storage 08/10] rbd plugin: volume exists helper: distinguish between different errors
Fiona Ebner
f.ebner at proxmox.com
Tue Dec 17 16:48:12 CET 2024
Only claim that the image does not exist if the error message
indicates it.
Signed-off-by: Fiona Ebner <f.ebner at 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
More information about the pve-devel
mailing list