[pve-devel] [RFC qemu-server 1/1] partially fix #4501: migration: start vm: move port reservation and usage closer together

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Nov 15 12:21:16 CET 2023

On Wed, Nov 15, 2023 at 11:22:46AM +0100, Fiona Ebner wrote:
> Am 15.11.23 um 11:12 schrieb Wolfgang Bumiller:
> >
> > What about adding an option to `next_migrate_port()` to actually return
> > the open socket to keep the reservation?
> > 
> > Also, did we consider passing the file descriptor through to qemu via
> > `-incoming fd:$number`?
> > 
> Sounds promising :) We do invoke QEMU after forking. Is there any
> pitfall with that and passing the fd? Or is it enough if we simply don't
> touch it or close it in the parent?

We just have to explicitly remove the CLOEXEC flag from the fd before
the exec() happens.

Since we use `run_command` for the exec, I've been wondering if maybe
`run_command` itself should get an `fds => [ numbers ]` list it should
drop the CLOEXEC on before opening the subprocess and then restoring the
original flags afterwards.

More information about the pve-devel mailing list