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

Re: [Libvir] Record an error when refusing a read-only operation



On Wed, Aug 16, 2006 at 03:30:30PM +0100, Daniel P. Berrange wrote:
> The libvirt.c front-end can be compiled in 'pedantic' mode in which case it
> explicitly refuses operations with side-effects in read-only connections. 
> When doing so, however, it was not recording any error message so feedback
> to the user was misleading / obsure. This patch adds an extra error code
> VIR_ERR_READ_ONLY which is used when an operation is denied due to a read
> only connection.

  argh, I developped a similar patch independantly, using 
"VIR_ERR_OPERATION_DENIED" instead, it also reports the operation name
and drop the #ifdef PEDANTIC , making it the default behaviour.

> This patch also passes 'VIR_DRV_OPEN_QUIET' to the 'open' method so tell
> the XenD driver not complain if it fails to open a HV connection. This is
> because it was complaining whenever trying to open a test:///default 
> connection.

  That should not conflict, yeah it's probably better to have the libvirt
front-end function report the connection error than letting the drivers
emit errors themselves. The only problem is that you won't detect hypervisor
connection failure say if you manage to connect with xend, because at least
one access method succeeded ...

> Index: src/libvirt.c
> ===================================================================
> RCS file: /data/cvs/libvirt/src/libvirt.c,v
> retrieving revision 1.42
> diff -c -r1.42 libvirt.c
> *** src/libvirt.c	11 Aug 2006 14:40:04 -0000	1.42
> --- src/libvirt.c	16 Aug 2006 15:17:43 -0000
> ***************
> *** 240,246 ****
>   
>       for (i = 0;i < MAX_DRIVERS;i++) {
>           if ((virDriverTab[i] != NULL) && (virDriverTab[i]->open != NULL)) {
> ! 	    res = virDriverTab[i]->open(ret, name, 0);
>   	    /*
>   	     * For a default connect to Xen make sure we manage to contact
>   	     * all related drivers.
> --- 240,246 ----
>   
>       for (i = 0;i < MAX_DRIVERS;i++) {
>           if ((virDriverTab[i] != NULL) && (virDriverTab[i]->open != NULL)) {
> ! 	    res = virDriverTab[i]->open(ret, name, VIR_DRV_OPEN_QUIET);
>   	    /*
>   	     * For a default connect to Xen make sure we manage to contact
>   	     * all related drivers.

  Okay, I'm afraid everything else clashes with my own patch <grin/>
which is attached below. I also swapped a few function entry tests.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/


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