[pve-devel] [PATCH storage] fix #1123: handle devices without smartctl support
Fabian Grünbichler
f.gruenbichler at proxmox.com
Tue Sep 27 13:49:47 CEST 2016
---
Note: this also affected pveceph, which calls get_disk() as well..
PVE/Diskmanage.pm | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index bee5d99..5f8b092 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -73,10 +73,20 @@ sub get_smart_data {
my ($disk) = @_;
assert_blockdev($disk);
+ my $returncode = 0;
+
+ # test smart disk type auto-detection
+ # needed to skip NVME and other devices not supported by smartctl
+ eval {
+ $returncode = run_command([$SMARTCTL, '-d', 'test', $disk], noerr => 1, outfunc => sub {});
+ };
+ if ($@ || $returncode != 0) {
+ return { 'health' => 'UNKNOWN' };
+ }
+
my $smartdata = {};
my $datastarted = 0;
- my $returncode = 0;
eval {
$returncode = run_command([$SMARTCTL, '-a', '-f', 'brief', $disk], noerr => 1, outfunc => sub{
my ($line) = @_;
--
2.1.4
More information about the pve-devel
mailing list