libxl: devd: Spawn QEMU for 9pfs
PATCH v2 1/1 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 the might be used by other tooling.
---
v2:
Retain xenstore qdisk-backend-pid and qdisk-%u logfile
--- 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(-)
tools/libs/light/libxl_device.c +12 -10
@@ -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; }
tools/libs/light/libxl_dm.c +3 -2
@@ -3380,7 +3380,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;
@@ -3470,7 +3471,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;
tools/libs/light/libxl_internal.h +2 -2
@@ -4196,9 +4196,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 -----*/
Signature · 1 line
2.39.2
Quoted 6 lines · Jason Andryuk
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_qdiskstopvqemu_refcntto be more generic.Keep the qdisk-backend-pid xenstore key as well as the disk-%u log file. They are externally visible, so the might be used by other tooling.
nit: ^^^ they
Quoted 6 lines
Signed-off-by Jason Andryuk <[email protected]>Signed-off-by Jason Andryuk <[email protected]>---
v2:
Retain xenstore qdisk-backend-pid and qdisk-%u logfile
Patch looks fine otherwise:
Thanks,
Signature · 1 line
Anthony PERARD