[libvirt] [PATCH] virsh: Add daemon version reporting

Daniel P. Berrange berrange at redhat.com
Mon Jun 6 12:17:24 UTC 2011


On Mon, Jun 06, 2011 at 02:10:49PM +0200, Michal Prívozník wrote:
> From: Michal Privoznik <mprivozn at redhat.com>
> 
> 'virsh version' might report against which version of libvirtd is
> running.
> ---
>  tools/virsh.c |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/virsh.c b/tools/virsh.c
> index d98be1c..d3c3ce3 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -8620,6 +8620,7 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
>      unsigned long libVersion;
>      unsigned long includeVersion;
>      unsigned long apiVersion;
> +    unsigned long daemonVersion;
>      int ret;
>      unsigned int major;
>      unsigned int minor;
> @@ -8678,6 +8679,19 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
>          vshPrint(ctl, _("Running hypervisor: %s %d.%d.%d\n"),
>                   hvType, major, minor, rel);
>      }
> +
> +    ret = virConnectGetLibVersion(ctl->conn, &daemonVersion);
> +    if (ret < 0) {
> +        vshError(ctl, "%s", _("failed to get the daemon version"));
> +        return false;

Raising an error here will prevent virsh talking to any
libvirtd < 0.7.3

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list