[Libvir] [Patch 3/4]: Xen inactive domains: stop xend/xs/xen using inactive domains

The existing xend, xs, xen, proxy driver backends all assume that if they're given a virDomainPtr object, the handle member is non-zero (ie its a running domain). With the addition of inactive domain support this assumption is no longer value. Thus this patch modifies all these drivers, so that if the handle is -1, then they return without doing any work. This lets the operation be correctly delegated to the new driver for inactive domains. In addition, the XenD driver assumed that if XenD returns a 404 when looking up a domain based on its name, this was a fatal error condition. Since inative domains are not known to XenD, this assumption is also now false. The attached patch modifies xend_internal so that if a 404 is returned, the error is not propagated to the libvirt error handlers. Instead the methods in question simply return -1, and control continues to the new backend for managing inactive domains. Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|

On Mon, Sep 04, 2006 at 01:37:29AM +0100, Daniel P. Berrange wrote:
The existing xend, xs, xen, proxy driver backends all assume that if they're given a virDomainPtr object, the handle member is non-zero (ie its a running domain). With the addition of inactive domain support this assumption is no longer value. Thus this patch modifies all these drivers, so that if the handle is -1, then they return without doing any work. This lets the operation be correctly delegated to the new driver for inactive domains.
In addition, the XenD driver assumed that if XenD returns a 404 when looking up a domain based on its name, this was a fatal error condition. Since inative domains are not known to XenD, this assumption is also now false. The attached patch modifies xend_internal so that if a 404 is returned, the error is not propagated to the libvirt error handlers. Instead the methods in question simply return -1, and control continues to the new backend for managing inactive domains.
[...]
*/ static int xend_get(virConnectPtr xend, const char *path, - char *content, size_t n_content) + char *content, size_t n_content, int quiet404s)
hum following comment missing from xend_get() * @quiet404s: if set then do not error on 404 for non-exitent domains
int ret; int s = do_connect(xend); @@ -444,7 +446,8 @@ ret = xend_req(s, content, n_content); close(s);
- if ((ret < 0) || (ret >= 300)) { + if (((ret < 0) || (ret >= 300)) && + ((ret != 404) || !quiet404s)) { virXendError(NULL, VIR_ERR_GET_FAILED, content); }
@@ -648,7 +651,7 @@ * Returns a parsed S-Expression in case of success, NULL in case of failure */ static struct sexpr * -sexpr_get(virConnectPtr xend, const char *fmt, ...) +sexpr_get(virConnectPtr xend, int quiet404s, const char *fmt, ...)
same missing comment. Looks fine, go ahead! 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/

On Mon, Sep 04, 2006 at 05:22:07AM -0400, Daniel Veillard wrote:
On Mon, Sep 04, 2006 at 01:37:29AM +0100, Daniel P. Berrange wrote:
static int xend_get(virConnectPtr xend, const char *path, - char *content, size_t n_content) + char *content, size_t n_content, int quiet404s)
hum following comment missing from xend_get()
* @quiet404s: if set then do not error on 404 for non-exitent domains
@@ -648,7 +651,7 @@ * Returns a parsed S-Expression in case of success, NULL in case of failure */ static struct sexpr * -sexpr_get(virConnectPtr xend, const char *fmt, ...) +sexpr_get(virConnectPtr xend, int quiet404s, const char *fmt, ...)
same missing comment.
Looks fine, go ahead!
ok, will fix missing comments & commit. Regards, Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
participants (2)
-
Daniel P. Berrange
-
Daniel Veillard