@@ -1309,10 +1309,11 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
libxl_device_vkb_dispose(&vkb);
dcs->dmss.dm.guest_domid = domid;
- if (libxl_defbool_val(d_config->b_info.device_model_stubdomain))
- libxl__spawn_stub_dm(egc, &dcs->dmss);
- else
- libxl__spawn_local_dm(egc, &dcs->dmss.dm);
+ if (libxl_defbool_val(d_config->b_info.device_model_stubdomain)) {
+ libxl__spawn_stub_dm(egc, &dcs->dmss, EMUID_DM);
+ } else {
+ libxl__spawn_local_dm(egc, &dcs->dmss.dm, EMUID_DM);
+ }
/*
* Handle the domain's (and the related stubdomain's) access to
@@ -1348,7 +1349,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,
if (need_qemu) {
dcs->dmss.dm.guest_domid = domid;
- libxl__spawn_local_dm(egc, &dcs->dmss.dm);
+ libxl__spawn_local_dm(egc, &dcs->dmss.dm, EMUID_PV);
return;
} else {
assert(!dcs->dmss.dm.guest_domid);
@@ -1434,7 +1434,8 @@ char *libxl__stub_dm_name(libxl__gc *gc, const char *guest_name)
return GCSPRINTF("%s-dm", guest_name);
}
-void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
+void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss,
+ int emuid)
{
STATE_AO_GC(sdss->dm.spawn.ao);
libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -1558,7 +1559,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
retry_transaction:
t = xs_transaction_start(ctx->xsh);
const char *dmpath = libxl__device_model_xs_path(gc,
- dm_domid, guest_domid, EMUID_DM, "");
+ dm_domid, guest_domid, emuid, "");
xs_mkdir(ctx->xsh, t, dmpath);
xs_set_permissions(ctx->xsh, t,
dmpath,
@@ -1668,7 +1669,7 @@ static void spawn_stub_launch_dm(libxl__egc *egc,
sdss->pvqemu.build_state = &sdss->dm_state;
sdss->pvqemu.callback = spawn_stubdom_pvqemu_cb;
- libxl__spawn_local_dm(egc, &sdss->pvqemu);
+ libxl__spawn_local_dm(egc, &sdss->pvqemu, EMUID_PV);
return;
@@ -1724,7 +1725,7 @@ static void stubdom_pvqemu_cb(libxl__egc *egc,
dm_domid, sdss->dm.guest_domid);
sdss->xswait.path =
libxl__device_model_xs_path(gc, dm_domid, sdss->dm.guest_domid,
- EMUID_DM, "/state");
+ EMUID_PV, "/state");
sdss->xswait.timeout_ms = LIBXL_STUBDOM_START_TIMEOUT * 1000;
sdss->xswait.callback = stubdom_xswait_cb;
rc = libxl__xswait_start(gc, &sdss->xswait);
@@ -1771,7 +1772,8 @@ static void device_model_spawn_outcome(libxl__egc *egc,
libxl__dm_spawn_state *dmss,
int rc);
-void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss)
+void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss,
+ int emuid)
{
/* convenience aliases */
const int domid = dmss->guest_domid;
@@ -1832,7 +1834,7 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss)
}
path = libxl__device_model_xs_path(gc, LIBXL_TOOLSTACK_DOMID,
- domid, EMUID_DM, "");
+ domid, emuid, "");
xs_mkdir(ctx->xsh, XBT_NULL, path);
if (b_info->type == LIBXL_DOMAIN_TYPE_HVM &&
@@ -1887,7 +1889,7 @@ retry_transaction:
spawn->what = GCSPRINTF("domain %d device model", domid);
spawn->xspath = libxl__device_model_xs_path(gc, LIBXL_TOOLSTACK_DOMID,
- domid, EMUID_DM, "/state");
+ domid, emuid, "/state");
spawn->timeout_ms = LIBXL_DEVICE_MODEL_START_TIMEOUT * 1000;
spawn->pidpath = GCSPRINTF("%s/image/device-model-pid", dom_path);
spawn->midproc_cb = libxl__spawn_record_pid;
@@ -554,8 +554,7 @@ void libxl__update_domain_configuration(libxl__gc *gc,
}
char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid,
- uint32_t domid,
- struct dummy_qemu_emulator_id emuid,
+ uint32_t domid, int emuid,
const char *format, ...)
{
char *s, *fmt;
@@ -1956,10 +1956,15 @@ _hidden int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid);
/* Return the system-wide default device model */
_hidden libxl_device_model_version libxl__default_device_model(libxl__gc *gc);
-static const struct dummy_qemu_emulator_id { int x; } EMUID_DM;
+enum {
+ EMUID_PV,
+ EMUID_DM,
+ /* NB stubdom and its PV service domain not recorded here */
+};
+
_hidden char *libxl__device_model_xs_path(libxl__gc *gc,
uint32_t dm_domid,
- uint32_t domid, struct dummy_qemu_emulator_id,
+ uint32_t domid, int emuid,
const char *format, ...) PRINTF_ATTRIBUTE(5, 6);
/*
@@ -3399,7 +3404,8 @@ struct libxl__dm_spawn_state {
libxl__dm_spawn_cb *callback;
};
-_hidden void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state*);
+_hidden void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state*,
+ int emuid);
/* Stubdom device models. */
@@ -3418,7 +3424,8 @@ typedef struct {
libxl__xswait_state xswait;
} libxl__stub_dm_spawn_state;
-_hidden void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state*);
+_hidden void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state*,
+ int emuid);
_hidden char *libxl__stub_dm_name(libxl__gc *gc, const char * guest_name);