[Libvir] Re: [PATCH] Fix pathological behaviour of "virsh help" (was: Re: RFC: replace "no support for hypervisor" error)
Daniel Veillard
veillard at redhat.com
Wed Jun 20 12:09:43 UTC 2007
On Wed, Jun 20, 2007 at 12:25:17PM +0100, Richard W.M. Jones wrote:
> Daniel Veillard wrote:
> > - if our default behaviour was a bit less pathological
> >
> > virsh: error: failed to connect to the hypervisor
> > paphio:~/libvirt -> virsh help
> > libvir: error : operation failed: xenProxyOpen
> > virsh: error: failed to connect to the hypervisor
>
> This patch fixes the pathological failure of 'virsh help command'.
>
> (1) We allow ctl->conn to be NULL, meaning "no connection".
>
> (2) All cmd* functions check vshConnectionUsability where required (I
> checked this) except the ones which don't need to such as cmdHelp.
>
> (3) vshInit has changed so that not being able to connect to a
> hypervisor is a non-fatal condition. Thus after vshInit, ctl->conn may
> be NULL.
>
> (4) I reordered the list of commands alphabetically, except that "help"
> is listed first.
>
> $ virsh help save
> libvir: error : operation failed: xenProxyOpen
> error: failed to connect to the hypervisor
> NAME
> save - save a domain state to a file
>
> SYNOPSIS
> save <domain> <file>
>
> DESCRIPTION
> Save a running domain.
>
> OPTIONS
> <domain> domain name, id or uuid
> <file> where to save the data
>
Hum, I wonder if help should not be special cased. I think it's okay
to not return immediately in the case where no command is given and
it's then possible to issue a new connect command from the shell.
So the patch looks fine to me, but we may refine this a bit too.
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard at redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
More information about the libvir-list
mailing list