[libvirt] [PATCH] lxc: return -1 if failed to kill lxc process

From: Chen Hanxiao <chenhanxiao@cn.fujitsu.com> We missed a return when virProcessKillPainfully failed to kill lxc process Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com> --- src/lxc/lxc_process.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index c51c4d5..4e1e3ac 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -711,7 +711,11 @@ int virLXCProcessStop(virLXCDriverPtr driver, } else { /* If cgroup doesn't exist, just try cleaning up the * libvirt_lxc process */ - virProcessKillPainfully(vm->pid, true); + if (virProcessKillPainfully(vm->pid, true) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Processes %d refused to die"), (int)vm->pid); + return -1; + } } virLXCProcessCleanup(driver, vm, reason); -- 1.8.2.1

On Fri, Dec 13, 2013 at 04:30:36PM +0800, Chen Hanxiao wrote:
From: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
We missed a return when virProcessKillPainfully failed to kill lxc process
Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com> --- src/lxc/lxc_process.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index c51c4d5..4e1e3ac 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -711,7 +711,11 @@ int virLXCProcessStop(virLXCDriverPtr driver, } else { /* If cgroup doesn't exist, just try cleaning up the * libvirt_lxc process */ - virProcessKillPainfully(vm->pid, true); + if (virProcessKillPainfully(vm->pid, true) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Processes %d refused to die"), (int)vm->pid); + return -1; + } }
virLXCProcessCleanup(driver, vm, reason);
ACK 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 :|

On 12/13/2013 04:03 AM, Daniel P. Berrange wrote:
On Fri, Dec 13, 2013 at 04:30:36PM +0800, Chen Hanxiao wrote:
From: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
We missed a return when virProcessKillPainfully failed to kill lxc process
ACK
Pushed. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (3)
-
Chen Hanxiao
-
Daniel P. Berrange
-
Eric Blake