[pve-devel] [PATCH pve-manager] CephTools: improve abs_path error handling
Wolfgang Bumiller
w.bumiller at proxmox.com
Fri Sep 25 09:41:40 CEST 2015
verify_blockdev_path didn't check the result of abs_path
causing commands like `pveceph createosd bad/path` to error
with a meaningless "Use of uninitialized value" message.
---
PVE/CephTools.pm | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/PVE/CephTools.pm b/PVE/CephTools.pm
index 68bf175..1c639e3 100644
--- a/PVE/CephTools.pm
+++ b/PVE/CephTools.pm
@@ -43,9 +43,11 @@ sub get_config {
}
sub verify_blockdev_path {
- my ($path) = @_;
+ my ($rel_path) = @_;
- $path = abs_path($path);
+ die "missing path" if !$rel_path;
+ my $path = abs_path($rel_path);
+ die "failed to get absolute path to $rel_path" if !$path;
die "got unusual device path '$path'\n" if $path !~ m|^/dev/(.*)$|;
--
2.1.4
More information about the pve-devel
mailing list