QEMU will now write its status in another XenStore path because multiple QEMU can run for a same domain. If xen_dmid machine option is not specified, it means that an old version of Xen is used, so status is written in the old path.
Signed-off-by: Julien Grall <julien.gr...@citrix.com> --- xen-all.c | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/xen-all.c b/xen-all.c index 61def2e..df6927d 100644 --- a/xen-all.c +++ b/xen-all.c @@ -36,6 +36,7 @@ static MemoryRegion ram_memory, ram_640k, ram_lo, ram_hi; static MemoryRegion *framebuffer; +static uint32_t xen_dmid = ~0; /* Compatibility with older version */ #if __XEN_LATEST_INTERFACE_VERSION__ < 0x0003020a @@ -958,7 +959,14 @@ static void xenstore_record_dm_state(struct xs_handle *xs, const char *state) exit(1); } - snprintf(path, sizeof (path), "/local/domain/0/device-model/%u/state", xen_domid); + if (xen_dmid == ~0) { + snprintf(path, sizeof(path), "/local/domain/0/device-model/%u/state", + xen_domid); + } else { + snprintf(path, sizeof(path), "/local/domain/0/dms/%u/%u/state", + xen_domid, xen_dmid); + } + if (!xs_write(xs, XBT_NULL, path, state, strlen(state))) { fprintf(stderr, "error recording dm state\n"); exit(1); @@ -1077,6 +1085,12 @@ int xen_hvm_init(void) unsigned long ioreq_pfn; unsigned long bufioreq_evtchn; XenIOState *state; + QemuOptsList *list = qemu_find_opts("machine"); + + if (!QTAILQ_EMPTY(&list->head)) { + xen_dmid = qemu_opt_get_number(QTAILQ_FIRST(&list->head), + "xen_dmid", ~0); + } state = g_malloc0(sizeof (XenIOState)); -- Julien Grall