aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore/xenstored_domain.c
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-09-26 18:49:21 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-09-26 18:49:21 +0100
commit45dc6ad80a811a8ca2decab2d364f9e9a041fbc9 (patch)
treeaad0a28566df63e65c14c43a60b6c4723c80ea6f /tools/xenstore/xenstored_domain.c
parentf61d64c62e3945c1f9b18c4917e16f7d7c7556e2 (diff)
downloadxen-45dc6ad80a811a8ca2decab2d364f9e9a041fbc9.tar.gz
xen-45dc6ad80a811a8ca2decab2d364f9e9a041fbc9.tar.bz2
xen-45dc6ad80a811a8ca2decab2d364f9e9a041fbc9.zip
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>
Diffstat (limited to 'tools/xenstore/xenstored_domain.c')
-rw-r--r--tools/xenstore/xenstored_domain.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 3732781df9..9ac1b28eef 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -63,6 +63,8 @@ struct domain
/* The connection associated with this. */
struct connection *conn;
+ /* Have we noticed that this domain is shutdown? */
+ int shutdown;
};
static LIST_HEAD(domains);
@@ -222,19 +224,25 @@ static void domain_cleanup(void)
{
xc_dominfo_t dominfo;
struct domain *domain, *tmp;
- int released = 0;
+ int notify = 0;
list_for_each_entry_safe(domain, tmp, &domains, list) {
if (xc_domain_getinfo(*xc_handle, domain->domid, 1,
&dominfo) == 1 &&
- dominfo.domid == domain->domid &&
- !dominfo.dying && !dominfo.crashed && !dominfo.shutdown)
- continue;
+ dominfo.domid == domain->domid) {
+ if ((dominfo.crashed || dominfo.shutdown)
+ && !domain->shutdown) {
+ domain->shutdown = 1;
+ notify = 1;
+ }
+ if (!dominfo.dying)
+ continue;
+ }
talloc_free(domain->conn);
- released++;
+ notify = 1;
}
- if (released)
+ if (notify)
fire_watches(NULL, "@releaseDomain", false);
}
@@ -272,6 +280,7 @@ static struct domain *new_domain(void *context, domid_t domid,
struct domain *domain;
domain = talloc(context, struct domain);
domain->port = 0;
+ domain->shutdown = 0;
domain->domid = domid;
domain->path = talloc_strdup(domain, path);
domain->page = xc_map_foreign_range(*xc_handle, domain->domid,