ia64/xen-unstable

changeset 7068:8c2aa0878927

xenstore fires @releaseDomain both when a domain shuts
down and when it eventually dies. xenconsoled now only
relinquishes its handle on a domain when it dies. This
allows us to 'xm console' connect to a crashed domain,
which is very useful!

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Mon Sep 26 18:49:21 2005 +0100 (2005-09-26)
parents 811559fb02ab
children 70b6e60df750
files .hgignore tools/console/daemon/io.c tools/xenstore/xenstored_domain.c
line diff
     1.1 --- a/.hgignore	Mon Sep 26 16:31:33 2005 +0100
     1.2 +++ b/.hgignore	Mon Sep 26 18:49:21 2005 +0100
     1.3 @@ -158,6 +158,7 @@
     1.4  ^tools/xenstore/xs_dom0_test$
     1.5  ^tools/xenstore/xs_random$
     1.6  ^tools/xenstore/xs_stress$
     1.7 +^tools/xenstore/xs_tdb_dump$
     1.8  ^tools/xenstore/xs_test$
     1.9  ^tools/xenstore/xs_watch_stress$
    1.10  ^tools/xentrace/xenctx$
     2.1 --- a/tools/console/daemon/io.c	Mon Sep 26 16:31:33 2005 +0100
     2.2 +++ b/tools/console/daemon/io.c	Mon Sep 26 18:49:21 2005 +0100
     2.3 @@ -399,7 +399,7 @@ void enum_domains(void)
     2.4  
     2.5  	while (xc_domain_getinfo(xc, domid, 1, &dominfo) == 1) {
     2.6  		dom = lookup_domain(dominfo.domid);
     2.7 -		if (dominfo.dying || dominfo.crashed || dominfo.shutdown) {
     2.8 +		if (dominfo.dying) {
     2.9  			if (dom)
    2.10  				shutdown_domain(dom);
    2.11  		} else {
     3.1 --- a/tools/xenstore/xenstored_domain.c	Mon Sep 26 16:31:33 2005 +0100
     3.2 +++ b/tools/xenstore/xenstored_domain.c	Mon Sep 26 18:49:21 2005 +0100
     3.3 @@ -63,6 +63,8 @@ struct domain
     3.4  	/* The connection associated with this. */
     3.5  	struct connection *conn;
     3.6  
     3.7 +	/* Have we noticed that this domain is shutdown? */
     3.8 +	int shutdown;
     3.9  };
    3.10  
    3.11  static LIST_HEAD(domains);
    3.12 @@ -222,19 +224,25 @@ static void domain_cleanup(void)
    3.13  {
    3.14  	xc_dominfo_t dominfo;
    3.15  	struct domain *domain, *tmp;
    3.16 -	int released = 0;
    3.17 +	int notify = 0;
    3.18  
    3.19  	list_for_each_entry_safe(domain, tmp, &domains, list) {
    3.20  		if (xc_domain_getinfo(*xc_handle, domain->domid, 1,
    3.21  				      &dominfo) == 1 &&
    3.22 -		    dominfo.domid == domain->domid &&
    3.23 -		    !dominfo.dying && !dominfo.crashed && !dominfo.shutdown)
    3.24 -			continue;
    3.25 +		    dominfo.domid == domain->domid) {
    3.26 +			if ((dominfo.crashed || dominfo.shutdown)
    3.27 +			    && !domain->shutdown) {
    3.28 +				domain->shutdown = 1;
    3.29 +				notify = 1;
    3.30 +			}
    3.31 +			if (!dominfo.dying)
    3.32 +				continue;
    3.33 +		}
    3.34  		talloc_free(domain->conn);
    3.35 -		released++;
    3.36 +		notify = 1;
    3.37  	}
    3.38  
    3.39 -	if (released)
    3.40 +	if (notify)
    3.41  		fire_watches(NULL, "@releaseDomain", false);
    3.42  }
    3.43  
    3.44 @@ -272,6 +280,7 @@ static struct domain *new_domain(void *c
    3.45  	struct domain *domain;
    3.46  	domain = talloc(context, struct domain);
    3.47  	domain->port = 0;
    3.48 +	domain->shutdown = 0;
    3.49  	domain->domid = domid;
    3.50  	domain->path = talloc_strdup(domain, path);
    3.51  	domain->page = xc_map_foreign_range(*xc_handle, domain->domid,