
On 12/9/21 13:30, Peter Krempa wrote:
The opening of files for FD passing for a chardev backend was historically done in the function which is formatting the commandline.
This has multiple problems. Firstly the function takes a lot of parameters which need to be passed through the commandline formatters. This made the 'qemuBuildChrChardevStr' extremely unappealing to the extent that we have multiple other custom formatters in places which didn't really want to use the function.
Additionally the function is also creating files in the host in certain configurations which is wrong for a commandline formatter to do. This meant that e.g. not all chardev test cases can be converted to use DO_TEST_CAPS_LATEST as we attempt to use such code path and attempt to create files outside of the test directory.
This patch moves the opening of the filedescriptors from 'qemuBuildChrChardevFileStr' into a new helper 'qemuProcessPrepareHostBackendChardevOne' which is called using 'qemuDomainDeviceBackendChardevForeach'.
To preserve test behaviour we also have another instance 'testPrepareHostBackendChardevOne' which is populating mock filedescriptors.
Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- src/qemu/qemu_command.c | 160 +++++++++------------------ src/qemu/qemu_domain.c | 6 + src/qemu/qemu_domain.h | 3 + src/qemu/qemu_process.c | 229 ++++++++++++++++++++++++++++++++++----- tests/qemuxml2argvtest.c | 79 ++++++++++++++ 5 files changed, 338 insertions(+), 139 deletions(-)
libvirt.git $ git bisect bad ff024b60cc39d5d41b1e68728a00a47e103ec4dd is the first bad commit virsh # start fedora error: Failed to start domain 'fedora' error: Unable to bind to UNIX socket path '/var/lib/libvirt/qemu/channel/target/domain-2-fedora/org.qemu.guest_agent.0': No such file or directory I don't have capacity to debug right now, but maybe I'll have later today. Michal