Re: [PATCH v2 8/8] virsh: Extend virsh dominfo to display if managed state exists

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/15/2011 03:06 AM, Osier Yang wrote:
> ---
>  tools/virsh.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/virsh.c b/tools/virsh.c
> index 8a62612..120f3c8 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -2366,6 +2366,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
>      int autostart;
>      unsigned int id;
>      char *str, uuid[VIR_UUID_STRING_BUFLEN];
> +    int has_managed_state = 0;
>  
>      if (!vshConnectionUsability(ctl, ctl->conn))
>          return false;
> @@ -2430,6 +2431,13 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
>                   autostart ? _("enable") : _("disable") );
>      }
>  
> +    has_managed_state = virDomainHasManagedSaveImage(dom, 0);
> +    if (has_managed_state < 0)
> +        vshPrint(ctl, "%-15s %s\n", _("Has managed state:"), _("unknown"));
> +    else
> +        vshPrint(ctl, "%-15s %s\n", _("Has managed state:"),
> +                 has_managed_state ? _("yes") : _("no"));

This changes default output of an existing command, but it's not the
first time we've done that (for example, commit aa2c9726 added the
"Security model" string).  For this particular command, that's fine,
since it remains machine parsable (each line is a name-value pair, and
you search for the line with the name you care about); still, I'd feel
better if your new string came last rather than in the middle in case
existing parsers count a certain number of lines and expect a particular
name on that line.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]