[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] libxl: devd: Spawn QEMU for 9pfs
commit 09abf1b61b45f65ebd017a246d887254dc50e0f8 Author: Jason Andryuk <jandryuk@xxxxxxxxx> AuthorDate: Sun Apr 7 16:58:09 2024 -0400 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Thu Apr 11 16:41:09 2024 +0100 libxl: devd: Spawn QEMU for 9pfs Add support for xl devd to support 9pfs in a domU. devd need to spawn a pvqemu for the domain to service 9pfs as well as qdisk backends. Rename num_qdisks to pvqemu_refcnt to be more generic. Keep the qdisk-backend-pid xenstore key as well as the disk-%u log file. They are externally visible, so they might be used by other tooling. Signed-off-by: Jason Andryuk <jandryuk@xxxxxxxxx> Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx> Reviewed-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> --- tools/libs/light/libxl_device.c | 22 ++++++++++++---------- tools/libs/light/libxl_dm.c | 5 +++-- tools/libs/light/libxl_internal.h | 4 ++-- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/tools/libs/light/libxl_device.c b/tools/libs/light/libxl_device.c index 6f0100d05e..a3d9f6f7df 100644 --- a/tools/libs/light/libxl_device.c +++ b/tools/libs/light/libxl_device.c @@ -1524,12 +1524,12 @@ static void device_complete(libxl__egc *egc, libxl__ao_device *aodev) libxl__nested_ao_free(aodev->ao); } -static void qdisk_spawn_outcome(libxl__egc *egc, libxl__dm_spawn_state *dmss, - int rc) +static void qemu_xenpv_spawn_outcome(libxl__egc *egc, + libxl__dm_spawn_state *dmss, int rc) { STATE_AO_GC(dmss->spawn.ao); - LOGD(DEBUG, dmss->guest_domid, "qdisk backend spawn %s", + LOGD(DEBUG, dmss->guest_domid, "qemu xenpv backend spawn %s", rc ? "failed" : "succeed"); libxl__nested_ao_free(dmss->spawn.ao); @@ -1552,7 +1552,7 @@ typedef struct libxl__ddomain_device { */ typedef struct libxl__ddomain_guest { uint32_t domid; - int num_qdisks; + int pvqemu_refcnt; XEN_SLIST_HEAD(, struct libxl__ddomain_device) devices; XEN_SLIST_ENTRY(struct libxl__ddomain_guest) next; } libxl__ddomain_guest; @@ -1646,15 +1646,16 @@ static int add_device(libxl__egc *egc, libxl__ao *ao, switch(dev->backend_kind) { case LIBXL__DEVICE_KIND_QDISK: - if (dguest->num_qdisks == 0) { + case LIBXL__DEVICE_KIND_9PFS: + if (dguest->pvqemu_refcnt == 0) { GCNEW(dmss); dmss->guest_domid = dev->domid; dmss->spawn.ao = ao; - dmss->callback = qdisk_spawn_outcome; + dmss->callback = qemu_xenpv_spawn_outcome; - libxl__spawn_qdisk_backend(egc, dmss); + libxl__spawn_qemu_xenpv_backend(egc, dmss); } - dguest->num_qdisks++; + dguest->pvqemu_refcnt++; break; default: GCNEW(aodev); @@ -1685,8 +1686,9 @@ static int remove_device(libxl__egc *egc, libxl__ao *ao, switch(ddev->dev->backend_kind) { case LIBXL__DEVICE_KIND_QDISK: - if (--dguest->num_qdisks == 0) { - rc = libxl__destroy_qdisk_backend(gc, dev->domid); + case LIBXL__DEVICE_KIND_9PFS: + if (--dguest->pvqemu_refcnt == 0) { + rc = libxl__destroy_qemu_xenpv_backend(gc, dev->domid); if (rc) goto out; } diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c index 0b03a7c747..567ae1ec7e 100644 --- a/tools/libs/light/libxl_dm.c +++ b/tools/libs/light/libxl_dm.c @@ -3381,7 +3381,8 @@ static void device_model_postconfig_done(libxl__egc *egc, dmss->callback(egc, dmss, rc); } -void libxl__spawn_qdisk_backend(libxl__egc *egc, libxl__dm_spawn_state *dmss) +void libxl__spawn_qemu_xenpv_backend(libxl__egc *egc, + libxl__dm_spawn_state *dmss) { STATE_AO_GC(dmss->spawn.ao); flexarray_t *dm_args, *dm_envs; @@ -3471,7 +3472,7 @@ static int kill_device_model(libxl__gc *gc, const char *xs_path_pid) } /* Helper to destroy a Qdisk backend */ -int libxl__destroy_qdisk_backend(libxl__gc *gc, uint32_t domid) +int libxl__destroy_qemu_xenpv_backend(libxl__gc *gc, uint32_t domid) { char *pid_path; int rc; diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h index 803dbc1a03..3b58bb2d7f 100644 --- a/tools/libs/light/libxl_internal.h +++ b/tools/libs/light/libxl_internal.h @@ -4192,9 +4192,9 @@ _hidden char *libxl__stub_dm_name(libxl__gc *gc, const char * guest_name); /* Qdisk backend launch helpers */ -_hidden void libxl__spawn_qdisk_backend(libxl__egc *egc, +_hidden void libxl__spawn_qemu_xenpv_backend(libxl__egc *egc, libxl__dm_spawn_state *dmss); -_hidden int libxl__destroy_qdisk_backend(libxl__gc *gc, uint32_t domid); +_hidden int libxl__destroy_qemu_xenpv_backend(libxl__gc *gc, uint32_t domid); /*----- Domain creation -----*/ -- generated by git-patchbot for /home/xen/git/xen.git#staging
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |