• E
    virsh: report exit status of failed lxc-enter-namespace · 2ebf593a
    Eric Blake 提交于
    '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: NEric Blake <eblake@redhat.com>
    2ebf593a
virsh-domain.c 317.2 KB