> On 14 Jan 2026, at 5:54 PM, Peter Krempa <[email protected]> wrote: > > !-------------------------------------------------------------------| > CAUTION: External Email > > |-------------------------------------------------------------------! > > On Wed, Jan 14, 2026 at 13:18:51 +0100, Peter Krempa via Devel wrote: >> On Wed, Jan 14, 2026 at 10:42:02 +0000, Tejus GK wrote: >>> This API allows callers to pass and store file descriptors inside libvirt >>> using a hash table, with a provided "name" serving as the key. The stored >>> file descriptors can be queried and reused later, enabling use cases such as >>> FD-based live migration. >>> >>> Signed-off-by: Tejus GK <[email protected]> >>> --- >>> include/libvirt/libvirt-domain.h | 9 +++++ >>> src/driver-hypervisor.h | 7 ++++ >>> src/libvirt-domain.c | 62 +++++++++++++++++++++++++++++ >>> src/libvirt_public.syms | 5 +++ >>> src/qemu/qemu_conf.h | 4 ++ >>> src/qemu/qemu_driver.c | 41 +++++++++++++++++++ >>> src/remote/remote_daemon_dispatch.c | 36 +++++++++++++++++ >>> src/remote/remote_driver.c | 22 ++++++++++ >>> src/remote/remote_protocol.x | 12 +++++- >>> 9 files changed, 197 insertions(+), 1 deletion(-) >> >> [...] >> >>> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c >>> index 74c70a0a43..7e194f7193 100644 >>> --- a/src/libvirt-domain.c >>> +++ b/src/libvirt-domain.c >>> @@ -14269,3 +14269,65 @@ virDomainDelThrottleGroup(virDomainPtr dom, >>> virDispatchError(dom->conn); >>> return -1; >>> } >>> + >>> + >>> +/** >>> + * virDomainFDStore: >>> + * @conn: a connection object >>> + * @name: name for the file descriptor group >>> + * @nfds: number of fds in @fds >>> + * @fds: file descriptors to store >>> + * >>> + * Store the FDs in @fds with @conn under @name. The FDs persist unitl >>> + * explicitly consumed (e.g. during a live migration) or until libvirt >>> + * shuts down/ restarts. >>> + * >>> + * Unlike virDomainFDAssociate, this does not require a domain to exist >>> + * at the time of storing the FDs. >>> + * >>> + * Returns 0 on success, -1 on error. >>> + * >>> + * Since: 12.0.0 >>> + */ >> >> This looks identical to as long as you are about to use the FD with a VM >> object: > > Looking at the usage in the code it seems to be in a place which has > @domain available, so no new API should be required for this usage.
Hi Peter, Thank you for the review! I agree that the API I’ve introduced is quite similar to virDomainFDAssociate. But it can’t be reused for the client FD-based live migration. The reason is that virDomainFDAssociate requires a @domain object, meaning a domain up and running at the time of the API call. However, in the live-migration use case, on the destination host, the domain doesn’t exist prior to the migration being triggered; hence, the client won’t be able to pass an FD to the VM, which doesn’t exist at that point. Hence, virDomainFDStore is there to store FDs associated with the “name” key, rather than the domain. Regards, Tejus
