]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virsh: report exit status of failed lxc-enter-namespace
authorEric Blake <eblake@redhat.com>
Mon, 23 Dec 2013 16:32:45 +0000 (09:32 -0700)
committerEric Blake <eblake@redhat.com>
Mon, 3 Mar 2014 19:40:32 +0000 (12:40 -0700)
commit2ebf593a054b81dad69e764ab8298a976b3d4efe
tree69e68d616ab6bfc34d2ce820eda47ced41ba1672
parent730fc9622b295b1dc37f620fe8a5c7391ee9a47b
virsh: report exit status of failed lxc-enter-namespace

'virsh lxc-enter-namespace' does not have a way to reflect exit
status to the caller in single-command mode, but we might as well
at least report the exit status.  Prior to this patch,

$ virsh -c lxc:/// lxc-enter-namespace shell /bin/sh 'exit 3'; echo $?
1

now it gives some details:

$ virsh -c lxc:/// lxc-enter-namespace shell /bin/sh -c 'exit 3'; echo $?
error: internal error: Child process (31557) unexpected exit status 3
1

Also useful:

$ virsh -c lxc:/// lxc-enter-namespace shell /bin/sh -c 'kill $$'; echo $?
error: internal error: Child process (31585) unexpected fatal signal 15
1

* tools/virsh-domain.c (cmdLxcEnterNamespace): Avoid magic numbers.
Dispatch any error.
* tools/virsh.pod: Document that non-zero exit status is collapsed.

Signed-off-by: Eric Blake <eblake@redhat.com>
tools/virsh-domain.c
tools/virsh.pod