[libvirt] [PATCH] Clean up chardev sockets on QEMU shutdown

https://bugzilla.redhat.com/show_bug.cgi?id=1088787 Clean up unix socket files for chardevs using mode='bind', like we clean up the monitor socket. They are created by QEMU on startup and not really useful after shutting it down. --- src/qemu/qemu_process.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 592e3b7..f3ec246 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2655,6 +2655,19 @@ qemuProcessPrepareChardevDevice(virDomainDefPtr def ATTRIBUTE_UNUSED, } +static int +qemuProcessCleanupChardevDevice(virDomainDefPtr def ATTRIBUTE_UNUSED, + virDomainChrDefPtr dev, + void *opaque ATTRIBUTE_UNUSED) +{ + if (dev->source.type == VIR_DOMAIN_CHR_TYPE_UNIX && + dev->source.data.nix.listen) + unlink(dev->source.data.nix.path); + + return 0; +} + + struct qemuProcessHookData { virConnectPtr conn; virDomainObjPtr vm; @@ -4339,6 +4352,12 @@ void qemuProcessStop(virQEMUDriverPtr driver, priv->monConfig = NULL; } + ignore_value(virDomainChrDefForeach(vm->def, + false, + qemuProcessCleanupChardevDevice, + NULL)); + + /* shut it off for sure */ ignore_value(qemuProcessKill(vm, VIR_QEMU_PROCESS_KILL_FORCE| -- 1.8.3.2

On 05/13/2014 03:21 PM, Ján Tomko wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=1088787
Clean up unix socket files for chardevs using mode='bind', like we clean up the monitor socket. They are created by QEMU on startup and not really useful after shutting it down. --- src/qemu/qemu_process.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
This one still applies cleanly. Jan

On 05/13/14 15:21, Ján Tomko wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=1088787
Clean up unix socket files for chardevs using mode='bind', like we clean up the monitor socket. They are created by QEMU on startup and not really useful after shutting it down. --- src/qemu/qemu_process.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
ACK, Peter

On 05/26/2014 02:45 PM, Peter Krempa wrote:
On 05/13/14 15:21, Ján Tomko wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=1088787
Clean up unix socket files for chardevs using mode='bind', like we clean up the monitor socket. They are created by QEMU on startup and not really useful after shutting it down. --- src/qemu/qemu_process.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
ACK,
Peter
Thanks, pushed. Jan
participants (2)
-
Ján Tomko
-
Peter Krempa