]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/API2/Disks.pm
merge get_smart_data/health
[pve-storage.git] / PVE / API2 / Disks.pm
index 208485f6ab465b51892f3c7cf10be32ba2af425f..366cd629137839930c555216445c8297cd9b8101 100644 (file)
@@ -140,13 +140,10 @@ __PACKAGE__->register_method ({
 
        my $result = {};
 
-       if ($param->{healthonly}) {
-           $result = { health => PVE::Diskmanage::get_smart_health($disk) };
-       } else {
-           $result = PVE::Diskmanage::get_smart_data($disk);
-       }
+       my $result = PVE::Diskmanage::get_smart_data($disk, $param->{healthonly});
 
        $result->{health} = 'UNKNOWN' if !defined $result->{health};
+       $result = { health => $result->{health} } if $param->{healthonly};
 
        return $result;
     }});