[pve-devel] [PATCH storage 1/2] merge get_smart_data/health

Dietmar Maurer dietmar at proxmox.com
Thu Oct 6 07:38:54 CEST 2016



> On October 5, 2016 at 10:57 AM Dominik Csapak <d.csapak at proxmox.com> wrote:
> 
> 
> instead of parsing the output of smart in two places,
> give get_smart_data a flag if we only want health
> 
> this fixes a bug (not on the bugtracker), where
> an ssd with disabled smart had an empty string as health
> in the gui
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  PVE/API2/Disks.pm |  7 ++-----
>  PVE/Diskmanage.pm | 42 +++++++++++-------------------------------
>  2 files changed, 13 insertions(+), 36 deletions(-)
> 
> diff --git a/PVE/API2/Disks.pm b/PVE/API2/Disks.pm
> index 208485f..366cd62 100644
> --- a/PVE/API2/Disks.pm
> +++ b/PVE/API2/Disks.pm
> @@ -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};

Why is this necessary?




More information about the pve-devel mailing list