[pve-devel] [PATCH manager v2 2/7] include a 'status' field for storages

Dietmar Maurer dietmar at proxmox.com
Thu May 4 07:14:46 CEST 2017


In the previous patch you use:

status => unknown/online/offline

And now you use:

status => unknown/undef

I do not really understand why you want different states here?

Also, you can/should use a boolean if you have only 3 states:

unknown => undef
online => 1
offline => 0

> On May 3, 2017 at 4:35 PM Dominik Csapak <d.csapak at proxmox.com> wrote:
> 
> 
> by default it is empty,
> if we dont have rrd stats, it is 'unknown'
> 
> we can use this information for the tree
> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  PVE/API2Tools.pm | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/PVE/API2Tools.pm b/PVE/API2Tools.pm
> index 78eb4718..1cb494e7 100644
> --- a/PVE/API2Tools.pm
> +++ b/PVE/API2Tools.pm
> @@ -121,6 +121,8 @@ sub extract_storage_stats {
>      if (my $d = $rrd->{"pve2-storage/$node/$storeid"}) {
>  	$entry->{maxdisk} = ($d->[1] || 0) + 0;
>  	$entry->{disk} = ($d->[2] || 0) + 0;
> +    } else {
> +	$entry->{status} = 'unknown';
>      }
>  
>      return $entry;
> -- 
> 2.11.0
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list