[Libvir] [PATCH 4/6] Inactive domain support: Ignore inactive domains

Daniel Veillard veillard at redhat.com
Wed Nov 15 10:12:49 UTC 2006


On Wed, Nov 15, 2006 at 02:23:23AM +0000, Daniel P. Berrange wrote:
> The attached path makes the xen_internal, xend_internall, xs_internal and
> proxy driver backends ignore all virDomainPtr objects which have an ID 
> number of -1. All operations on such domains need to instead be handled 
> by the new xm_internal.c backend which uses the config files. Without this
> patch, the existing drivers would all throw bogus errors due to ID of -1.
> 
> This patch is slightly simpler than last time, because the code to ignore
> HTTP 404 errors from XenD was already merged last week.

[...]
> ***************
> *** 716,730 ****
>       int ret;
>   
>       if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
> ! 	if (domain == NULL)
> ! 	    virProxyError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
> ! 	else
> ! 	    virProxyError(domain->conn, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
> !         return (0);
>       }
>       if (info == NULL) {
>           virProxyError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
> ! 	return (-1);
>       }
>       memset(&req, 0, sizeof(req));
>       req.command = VIR_PROXY_DOMAIN_INFO;
> --- 718,734 ----
>       int ret;
>   
>       if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
> !         if (domain == NULL)
> !             virProxyError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
> !         else
> !             virProxyError(domain->conn, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
> !         return (-1);

   Agreed for the Proxy driver you now want to return -1 on Info if
it's not a connected domain. We already emitted an error there anyway
make sense, but I wonder why it used to return 0 there ... hum....


> --- src/xend_internal.c	15 Nov 2006 02:34:04 -0000
> ***************
> *** 1266,1272 ****
>       return node;
>   }
>   
> ! static int
>   xend_get_config_version(virConnectPtr conn) {
>       struct sexpr *root;
>       const char *value;
> --- 1266,1272 ----
>       return node;
>   }
>   
> ! int
>   xend_get_config_version(virConnectPtr conn) {
>       struct sexpr *root;
>       const char *value;

  I assume exporting it is needed for other patches. Just check  :-)

> *** src/xend_internal.h	12 Sep 2006 01:16:22 -0000	1.26
> --- src/xend_internal.h	15 Nov 2006 02:34:05 -0000
> ***************
> *** 613,618 ****
> --- 613,619 ----
>    */
>       int xend_log(virConnectPtr xend, char *buffer, size_t n_buffer);
>   
> +   int xend_get_config_version(virConnectPtr conn);
>     char *xend_parse_domain_sexp(virConnectPtr conn,  char *root, int xendConfigVersion);

  
   Okidoc, long patch but repetitive changes. The only mistake possible is to
forgot some entry points or code paths. There is a few reformatting changes
too, but all fine :-)

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