1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

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.
This commit is contained in:
Ján Tomko 2014-05-13 08:54:20 +02:00
parent cde8ca2dfd
commit 205010c40e

View File

@ -2659,6 +2659,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;
@ -4353,6 +4366,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|