]> xenbits.xensource.com Git - xen.git/commitdiff
tools/libxl: pull xenstore/console domids from xenstore
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>
Thu, 9 Feb 2012 18:33:29 +0000 (18:33 +0000)
committerDaniel De Graaf <dgdegra@tycho.nsa.gov>
Thu, 9 Feb 2012 18:33:29 +0000 (18:33 +0000)
Instead of assuming that xenstored and xenconsoled are running in dom0,
pull the domain IDs from xenstore.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
tools/libxl/libxl_dom.c
tools/libxl/libxl_internal.h

index efaa86192f78e93139bac55219641f930fafa8d4..e4961ebb527d5c6effd4771e817f4c2bf44aafeb 100644 (file)
@@ -64,6 +64,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int tsc_mode;
+    char *xs_domid, *con_domid;
     xc_domain_max_vcpus(ctx->xch, domid, info->max_vcpus);
     libxl_set_vcpuaffinity_all(ctx, domid, info->max_vcpus, &info->cpumap);
     xc_domain_setmaxmem(ctx->xch, domid, info->target_memkb + LIBXL_MAXMEM_CONSTANT);
@@ -96,9 +97,18 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
         xc_shadow_control(ctx->xch, domid, XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION, NULL, 0, &shadow, 0, NULL);
     }
 
-    state->store_port = xc_evtchn_alloc_unbound(ctx->xch, domid, 0);
-    state->console_port = xc_evtchn_alloc_unbound(ctx->xch, domid, 0);
+    xs_domid = xs_read(ctx->xsh, XBT_NULL, "/tool/xenstored/domid", NULL);
+    state->store_domid = xs_domid ? atoi(xs_domid) : 0;
+    free(xs_domid);
+
+    con_domid = xs_read(ctx->xsh, XBT_NULL, "/tool/xenconsoled/domid", NULL);
+    state->console_domid = con_domid ? atoi(con_domid) : 0;
+    free(con_domid);
+
+    state->store_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->store_domid);
+    state->console_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->console_domid);
     state->vm_generationid_addr = 0;
+
     return 0;
 }
 
index 7629ca40825e7ab860938a0eba840c6797a90b51..8846c68c2b391ebc3be5dbdf085ef1590bd2f7f7 100644 (file)
@@ -595,9 +595,11 @@ _hidden int libxl__domain_shutdown_reason(libxl__gc *gc, uint32_t domid);
     libxl__domain_type((gc), (domid)) == LIBXL_DOMAIN_TYPE_##type
 typedef struct {
     uint32_t store_port;
+    uint32_t store_domid;
     unsigned long store_mfn;
 
     uint32_t console_port;
+    uint32_t console_domid;
     unsigned long console_mfn;
 
     unsigned long vm_generationid_addr;