@@ -1543,21 +1543,11 @@ static void domcreate_devmodel_started(libxl__egc *egc,
STATE_AO_GC(dmss->spawn.ao);
int domid = dcs->guest_domid;
- /* convenience aliases */
- libxl_domain_config *const d_config = dcs->guest_config;
-
if (ret) {
LOGD(ERROR, domid, "device model did not start: %d", ret);
goto error_out;
}
- if (dcs->sdss.dm.guest_domid) {
- if (d_config->b_info.device_model_version
- == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
- libxl__qmp_initializations(gc, domid, d_config);
- }
- }
-
dcs->device_type_idx = -1;
domcreate_attach_devices(egc, &dcs->multidev, 0);
return;
@@ -2744,6 +2744,9 @@ static void device_model_spawn_outcome(libxl__egc *egc,
STATE_AO_GC(dmss->spawn.ao);
int ret2;
+ /* Convenience aliases */
+ libxl_domain_config *const d_config = dmss->guest_config;
+
if (rc)
LOGD(ERROR, dmss->guest_domid,
"%s: spawn failed (rc=%d)", dmss->spawn.what, rc);
@@ -2760,6 +2763,11 @@ static void device_model_spawn_outcome(libxl__egc *egc,
}
}
+ if (d_config->b_info.device_model_version
+ == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
+ libxl__qmp_initializations(gc, dmss->guest_domid, d_config);
+ }
+
out:
dmss_dispose(gc, dmss);
dmss->callback(egc, dmss, rc);
libxl__qmp_initializations is part of the device domain startup, it queries information about the newly spawned QEMU and do some post-startup configuration. So the function call doesn't belong to the general domain creation, but only to the device model part of the process, thus the call belong to libxl_dm and libxl__dm_spawn_state's machinery. We move the call ahead of a follow-up patch which going to "inline" libxl__qmp_initializations. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- tools/libxl/libxl_create.c | 10 ---------- tools/libxl/libxl_dm.c | 8 ++++++++ 2 files changed, 8 insertions(+), 10 deletions(-)