[libvirt] [PATCH] qemu:Delete sockets which act as UNIX domain socket server

When I shutdown a vm, I found sockets which act as UNIX domain socket server were not deleted. When I add the following code, it work out. Signed-off-by: WangYufei <james.wangyufei@huawei.com<mailto:james.wangyufei@huawei.com>> --- src/qemu/qemu_process.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 3d5e8f6..e794f37 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4086,6 +4086,13 @@ void qemuProcessStop(virQEMUDriverPtr driver, priv->monConfig = NULL; } + /* remove socket which acts as UNIX domain socket server */ + for (i = 0; i < vm->def->nchannels; i++) { + if ((vm->def->channels[i]->source.type == VIR_DOMAIN_CHR_TYPE_UNIX) && + vm->def->channels[i]->source.data.nix.listen) + unlink(vm->def->channels[i]->source.data.nix.path); + } + /* shut it off for sure */ ignore_value(qemuProcessKill(vm, VIR_QEMU_PROCESS_KILL_FORCE| -- 1.7.3.1.msysgit.0 Best Regards, -WangYufei

On Fri, Jul 19, 2013 at 02:12:06AM +0000, Wangyufei (A) wrote:
When I shutdown a vm, I found sockets which act as UNIX domain socket server were not deleted. When I add the following code, it work out.
Signed-off-by: WangYufei <james.wangyufei@huawei.com<mailto:james.wangyufei@huawei.com>> --- src/qemu/qemu_process.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 3d5e8f6..e794f37 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4086,6 +4086,13 @@ void qemuProcessStop(virQEMUDriverPtr driver, priv->monConfig = NULL; } + /* remove socket which acts as UNIX domain socket server */ + for (i = 0; i < vm->def->nchannels; i++) { + if ((vm->def->channels[i]->source.type == VIR_DOMAIN_CHR_TYPE_UNIX) && + vm->def->channels[i]->source.data.nix.listen) + unlink(vm->def->channels[i]->source.data.nix.path); + } +
We should do the same for vm->def->serials, vm->def->parallels and vm->def->consoles while we're here, since they all are backed by char-devs. Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
Wangyufei (A)