When device_model_args is set we almost certainly want to spawn the
device model. This is most useful when debugging with QEMU and you
want to specify a new device type for testing without teaching libxl
about the device itself.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
This is very much an RFC, it's useful to me as a developer but I can
see an argument for being more cautious for production.
---
tools/libs/light/libxl_dm.c | 6 ++++++
tools/libs/light/libxl_types.idl | 2 ++
tools/xl/xl_parse.c | 2 ++
3 files changed, 10 insertions(+)
diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 620f381560..5774510aa0 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -3969,7 +3969,13 @@ int libxl__need_xenpv_qemu(libxl__gc *gc, libxl_domain_config *d_config)
}
}
+ /* finally if we've slurped extra args we almost certainly do */
+ if (d_config->need_ext_dm) {
+ ret = 1;
+ }
+
out:
+ LOGD(INFO, domid, "need_qemu: %s", ret == 1 ? "yes":"no");
return ret;
}
diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_types.idl
index 2be194eb19..e7705bebe9 100644
--- a/tools/libs/light/libxl_types.idl
+++ b/tools/libs/light/libxl_types.idl
@@ -1113,6 +1113,8 @@ libxl_domain_config = Struct("domain_config", [
("on_watchdog", libxl_action_on_shutdown),
("on_crash", libxl_action_on_shutdown),
("on_soft_reset", libxl_action_on_shutdown),
+ # true when we need to launch dm to serve the guest
+ ("need_ext_dm", bool),
], dir=DIR_IN)
libxl_diskinfo = Struct("diskinfo", [
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c
index 52e20134a9..be0ea3e3dc 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -3083,6 +3083,8 @@ skip_usbdev:
if (e && e != ESRCH) { \
fprintf(stderr,"xl: Unable to parse device_model_args"#type".\n");\
exit(-ERROR_FAIL); \
+ } else if (e) { \
+ d_config->need_ext_dm = true; \
}
/* parse extra args for qemu, common to both pv, hvm */
--
2.39.2