[pve-devel] [PATCH qemu-server 1/4] vmstatus: make boolean value explicit

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Mar 3 17:53:29 CET 2021


On 03.03.21 12:01, Fabian Ebner wrote:
> as otherwise the empty string is printed with 'qm status <id> --verbose' when
> it's not a template.
> 
> Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
> ---
>  PVE/QemuServer.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index a498444..43d7c6b 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -2621,7 +2621,7 @@ sub vmstatus {
>  	$d->{diskread} = 0;
>  	$d->{diskwrite} = 0;
>  
> -        $d->{template} = PVE::QemuConfig->is_template($conf);
> +        $d->{template} = PVE::QemuConfig->is_template($conf) ? 1 : 0;


Any reason to not do:

$d->{template} = 1 if PVE::QemuConfig->is_template($conf);

(no hard feelings, but this is relatively common pattern for such things,
especially if they can be normally more often omitted than not, templates
are normally rather outnumbered by non-templates)

>  
>  	$d->{serial} = 1 if conf_has_serial($conf);
>  	$d->{lock} = $conf->{lock} if $conf->{lock};
> 






More information about the pve-devel mailing list