[lxc-devel] [PATCH 1/6] lxc-destroy: add --lxc-path argument
Stéphane Graber
stgraber at ubuntu.com
Mon Mar 4 22:00:50 UTC 2013
On 03/04/2013 03:43 PM, Serge Hallyn wrote:
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
Do we need a similar update to the manpage or is it using the common
options include?
Acked-by: Stéphane Graber <stgraber at ubuntu.com>
> ---
> src/lxc/lxc-destroy.in | 20 +++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/src/lxc/lxc-destroy.in b/src/lxc/lxc-destroy.in
> index 6464e52..1c68f9d 100644
> --- a/src/lxc/lxc-destroy.in
> +++ b/src/lxc/lxc-destroy.in
> @@ -26,7 +26,7 @@
> #
>
> usage() {
> - echo "usage: $(basename $0) -n NAME [-f]" >&2
> + echo "usage: $(basename $0) -n NAME [-f] [-P lxcpath]" >&2
> }
>
> help() {
> @@ -35,8 +35,9 @@ help() {
> echo "Remove an existing container on the system." >&2
> echo >&2
> echo "Options:" >&2
> - echo " -n NAME specify the name of the container" >&2
> - echo " -f stop the container if it is running (rather than abort)" >&2
> + echo " -n NAME specify the name of the container" >&2
> + echo " -f stop the container if it is running (rather than abort)" >&2
> + echo " -P lxcpath container is in specified lxcpath" >&2
> }
>
> usage_err() {
> @@ -67,6 +68,11 @@ while [ $# -gt 0 ]; do
> lxc_name=$1
> shift
> ;;
> + -P|--lxcpath)
> + optarg_check "$opt" "$1"
> + lxc_path=$1
> + shift
> + ;;
> -f)
> force=1
> ;;
> @@ -104,12 +110,12 @@ if [ ! -d "$lxc_path/$lxc_name" ]; then
> fi
>
> # make sure the container is stopped
> -if ! lxc-info -n $lxc_name --state-is "STOPPED"; then
> +if ! lxc-info -n $lxc_name -P $lxc_path --state-is "STOPPED"; then
> if [ $force -eq 1 ]; then
> - lxc-stop -n $lxc_name
> - lxc-wait -n $lxc_name -s STOPPED
> + lxc-stop -P $lxc_path -n $lxc_name
> + lxc-wait -P $lxc_path -n $lxc_name -s STOPPED
> else
> - echo "$(basename $0): '$lxc_name' $(lxc-info -n $lxc_name -s); aborted" >&2
> + echo "$(basename $0): '$lxc_name' $(lxc-info -P $lxc_path -n $lxc_name -s); aborted" >&2
> exit 1
> fi
> fi
>
--
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130304/9c95011a/attachment.pgp>
More information about the lxc-devel
mailing list