aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore/xenstored_domain.c
diff options
context:
space:
mode:
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>2005-10-23 22:45:15 +0100
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>2005-10-23 22:45:15 +0100
commitfea77823212ce8b48b1897cb73dd0590896809eb (patch)
tree4440fe26eddd8ca15bc3a57646a2a83f08ef5911 /tools/xenstore/xenstored_domain.c
parent4384b3fc7028be8e027d984e4f7e38a0d488211d (diff)
downloadxen-fea77823212ce8b48b1897cb73dd0590896809eb.tar.gz
xen-fea77823212ce8b48b1897cb73dd0590896809eb.tar.bz2
xen-fea77823212ce8b48b1897cb73dd0590896809eb.zip
Change the semantics of GetDomainPath so that it always succeeds, regardless of
whether a domain has been introduced to the store. Added a separate message XS_IS_DOMAIN_INTRODUCED and API for that (xs_is_domain_introduced) to determine whether the domain has really been introduced. This change means that the tools can determine the correct domain path earlier in the domain creation process, which is particularly a factor with live migration, as it allows us to create the devices earlier in the process, and unpause the new domain before performing the introduce. Until recently we already had these features, but the simplification of the interface between xend and xenstored caused breakage. No longer clear out the domain path when a domain is introduced -- this was a hack to work around the recent problematic semantics of GetDomainPath. Do not write the contents of the info block to the store. All the configuration info is written to the /vm path, and anything else in the info block is either dealt with explicitly or is ephemeral and has no place in the store. Signed-off-by: Ewan Mellor <ewan@xensource.com>
Diffstat (limited to 'tools/xenstore/xenstored_domain.c')
-rw-r--r--tools/xenstore/xenstored_domain.c39
1 files changed, 27 insertions, 12 deletions
diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c
index 69e429ccfa..d252469617 100644
--- a/tools/xenstore/xenstored_domain.c
+++ b/tools/xenstore/xenstored_domain.c
@@ -250,6 +250,11 @@ bool domain_can_write(struct connection *conn)
return ((intf->rsp_prod - intf->rsp_cons) != XENSTORE_RING_SIZE);
}
+static char *talloc_domain_path(void *context, unsigned int domid)
+{
+ return talloc_asprintf(context, "/local/domain/%u", domid);
+}
+
static struct domain *new_domain(void *context, unsigned int domid,
unsigned long mfn, int port)
{
@@ -262,7 +267,7 @@ static struct domain *new_domain(void *context, unsigned int domid,
domain->port = 0;
domain->shutdown = 0;
domain->domid = domid;
- domain->path = talloc_asprintf(domain, "/local/domain/%d", domid);
+ domain->path = talloc_domain_path(domain, domid);
domain->interface = xc_map_foreign_range(
*xc_handle, domain->domid,
getpagesize(), PROT_READ|PROT_WRITE, mfn);
@@ -272,8 +277,6 @@ static struct domain *new_domain(void *context, unsigned int domid,
list_add(&domain->list, &domains);
talloc_set_destructor(domain, destroy_domain);
- internal_rm(domain->path);
-
/* Tell kernel we're interested in this event. */
bind.remote_domain = domid;
bind.remote_port = port;
@@ -403,25 +406,37 @@ void do_release(struct connection *conn, const char *domid_str)
void do_get_domain_path(struct connection *conn, const char *domid_str)
{
- struct domain *domain;
- unsigned int domid;
+ char *path;
if (!domid_str) {
send_error(conn, EINVAL);
return;
}
+ path = talloc_domain_path(conn, atoi(domid_str));
+
+ send_reply(conn, XS_GET_DOMAIN_PATH, path, strlen(path) + 1);
+
+ talloc_free(path);
+}
+
+void do_is_domain_introduced(struct connection *conn, const char *domid_str)
+{
+ int result;
+ unsigned int domid;
+
+ if (!domid_str) {
+ send_error(conn, EINVAL);
+ return;
+ }
+
domid = atoi(domid_str);
if (domid == DOMID_SELF)
- domain = conn->domain;
+ result = 1;
else
- domain = find_domain_by_domid(domid);
+ result = (find_domain_by_domid(domid) != NULL);
- if (!domain)
- send_error(conn, ENOENT);
- else
- send_reply(conn, XS_GET_DOMAIN_PATH, domain->path,
- strlen(domain->path) + 1);
+ send_reply(conn, XS_IS_DOMAIN_INTRODUCED, result ? "T" : "F", 2);
}
static int close_xc_handle(void *_handle)