[PATCH 12/27] qemuHotplugRemoveFDSet: Prepare for proper FD unplug handling

Ján Tomko jtomko at redhat.com
Thu Feb 10 17:38:37 UTC 2022


On a Wednesday in 2022, Peter Krempa wrote:
>For now we have only one code path ('vdpa' interface) which actually
>cleans up the fdset after it's done, but there are more device types
>using fdsets.
>
>In order to unify the handling of fdsets the removal code will now be
>able to remove fdsets based on a prefix of the 'opaque' field, which
>we'll always prefix with a device alias or e.g. node name once fdsets
>are also used for disk backing.
>
>To keep compatibility with old qemus, retain the possibility for the

QEMUs

>VDPA interface to use the path.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/qemu/qemu_hotplug.c | 19 ++++++++++++-------
> 1 file changed, 12 insertions(+), 7 deletions(-)
>
>diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
>index 3264f287c3..03b7ca30de 100644
>--- a/src/qemu/qemu_hotplug.c
>+++ b/src/qemu/qemu_hotplug.c
>@@ -140,18 +140,21 @@ qemuDomainDeleteDevice(virDomainObj *vm,
> /**
>  * qemuHotplugRemoveFDSet:
>  * @mon: monitor object
>- * @fdname: the 'opaque' string used as a name for the FD
>+ * @prefix: the prefix of FD names ('opaque' filed) to delete

*field

>+ * @alternate: alternate name for FD, for historical usage (may be NULL)
>  *
>  * Looks up the 'fdset' by looking for a fd inside one of the fdsets which
>- * has the opaque string set to @fdname. Removes the whole fdset which contains
>- * the fd.
>+ * has the opaque string starting with @prefix. Removes the whole fdset which
>+ * contains the fd. Alternatively if @alternate is specified fdsets having a fd
>+ * with that exact 'opaque' string is removed too.
>  *
>  * Errors are logged, but this is a best-effort hot-unplug cleanup helper so it's
>  * pointless to return a value.
>  */
> static void
> qemuHotplugRemoveFDSet(qemuMonitor *mon,
>-                       const char *fdname)
>+                       const char *prefix,
>+                       const char *alternate)
> {
>     g_autoptr(qemuMonitorFdsets) fdsets = NULL;
>     size_t i;

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20220210/6b17e0d5/attachment-0001.sig>


More information about the libvir-list mailing list