Commit 57e40de3 by Christian Brauner

Merge pull request #793 from stgraber/master

Remove legacy versions of lxc-ls
parents 81db4189 5de4efe3
......@@ -62,7 +62,6 @@ src/lxc/lxc-unfreeze
src/lxc/lxc-unshare
src/lxc/lxc-usernsexec
src/lxc/lxc-wait
src/lxc/legacy/lxc-ls
src/lxc/lxc-user-nic
src/lxc/version.h
......@@ -121,12 +120,9 @@ doc/*.7
doc/ja/*.1
doc/ja/*.5
doc/ja/*.7
doc/ja/legacy/*.1
doc/legacy/*.1
doc/ko/*.1
doc/ko/*.5
doc/ko/*.7
doc/ko/legacy/*.1
doc/manpage.links
doc/manpage.refs
doc/api/html/*
......
......@@ -685,7 +685,6 @@ AC_CONFIG_FILES([
doc/Makefile
doc/api/Makefile
doc/legacy/lxc-ls.sgml
doc/lxc-attach.sgml
doc/lxc-autostart.sgml
doc/lxc-cgroup.sgml
......@@ -734,7 +733,6 @@ AC_CONFIG_FILES([
doc/examples/lxc-complex.conf
doc/ja/Makefile
doc/ja/legacy/lxc-ls.sgml
doc/ja/lxc-attach.sgml
doc/ja/lxc-autostart.sgml
doc/ja/lxc-cgroup.sgml
......@@ -772,7 +770,6 @@ AC_CONFIG_FILES([
doc/ja/see_also.sgml
doc/ko/Makefile
doc/ko/legacy/lxc-ls.sgml
doc/ko/lxc-attach.sgml
doc/ko/lxc-autostart.sgml
doc/ko/lxc-cgroup.sgml
......@@ -835,9 +832,7 @@ AC_CONFIG_FILES([
src/Makefile
src/lxc/Makefile
src/lxc/lxc-checkconfig
src/lxc/lxc-ls
src/lxc/lxc-start-ephemeral
src/lxc/legacy/lxc-ls
src/lxc/lxc.functions
src/lxc/version.h
src/python-lxc/Makefile
......
......@@ -31,6 +31,7 @@ man_MANS = \
lxc-execute.1 \
lxc-freeze.1 \
lxc-info.1 \
lxc-ls.1 \
lxc-monitor.1 \
lxc-snapshot.1 \
lxc-start.1 \
......@@ -50,10 +51,7 @@ man_MANS = \
lxc.7
if ENABLE_PYTHON
man_MANS += lxc-ls.1
man_MANS += lxc-start-ephemeral.1
else
man_MANS += legacy/lxc-ls.1
endif
%.1 : %.sgml
......
......@@ -23,6 +23,7 @@ man_MANS = \
lxc-execute.1 \
lxc-freeze.1 \
lxc-info.1 \
lxc-ls.1 \
lxc-monitor.1 \
lxc-snapshot.1 \
lxc-start.1 \
......@@ -42,10 +43,7 @@ man_MANS = \
lxc.7
if ENABLE_PYTHON
man_MANS += lxc-ls.1
man_MANS += lxc-start-ephemeral.1
else
man_MANS += legacy/lxc-ls.1
endif
%.1 : %.sgml
......
<!--
lxc: linux Container library
(C) Copyright IBM Corp. 2007, 2008
Authors:
Daniel Lezcano <dlezcano at fr.ibm.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Translated into Japanese
by KATOH Yasufumi <karma at jazz.email.ne.jp>
-->
<!DOCTYPE refentry PUBLIC @docdtd@ [
<!ENTITY seealso SYSTEM "@builddir@/../see_also.sgml">
]>
<refentry>
<docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
<refmeta>
<refentrytitle>lxc-ls</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>lxc-ls</refname>
<refpurpose>
<!--
list the containers existing on the system
-->
システム上に存在するコンテナをリスト表示する。
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>lxc-ls</command>
<arg choice="opt">--active</arg>
<arg choice="opt">ls option</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title><!-- Description -->説明</title>
<para>
<!--
<command>lxc-ls</command> list the containers existing on the
system.
-->
<command>lxc-ls</command> はシステム上に存在するコンテナをリスト表示します。
</para>
</refsect1>
<refsect1>
<title><!-- Options -->オプション</title>
<variablelist>
<varlistentry>
<term>
<option><optional>--active</optional></option>
</term>
<listitem>
<para>
<!--
List active containers.
-->
稼働中のコンテナをリスト表示します。
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option><optional>ls options</optional></option>
</term>
<listitem>
<para>
<!--
The option passed to <command>lxc-ls</command> are the
same as the <command>ls</command> command.
-->
<command>lxc-ls</command> が受け付けるオプションは、<command>ls</command> コマンドと同じです。
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title><!-- Examples -->例</title>
<variablelist>
<varlistentry>
<term>lxc-ls -l</term>
<listitem>
<para>
<!--
list all the container and their permissions.
-->
全てのコンテナとそのパーミッションをリスト表示します。
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>lxc-ls --active -1</term>
<listitem>
<para>
<!--
list active containers and display the list in one column.
-->
稼働中のコンテナを一列にリスト表示します。
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>See Also</title>
<simpara>
<citerefentry>
<refentrytitle>ls</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>,
</simpara>
</refsect1>
&seealso;
<refsect1>
<title><!-- Author -->作者</title>
<para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
......@@ -23,6 +23,7 @@ man_MANS = \
lxc-execute.1 \
lxc-freeze.1 \
lxc-info.1 \
lxc-ls.1 \
lxc-monitor.1 \
lxc-snapshot.1 \
lxc-start.1 \
......@@ -42,10 +43,7 @@ man_MANS = \
lxc.7
if ENABLE_PYTHON
man_MANS += lxc-ls.1
man_MANS += lxc-start-ephemeral.1
else
man_MANS += legacy/lxc-ls.1
endif
%.1 : %.sgml
......
<!--
lxc: linux Container library
(C) Copyright IBM Corp. 2007, 2008
Authors:
Daniel Lezcano <dlezcano at fr.ibm.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Translated into Korean
by Sungbae Yoo <sungbae.yoo at samsung.com>
-->
<!DOCTYPE refentry PUBLIC @docdtd@ [
<!ENTITY seealso SYSTEM "@builddir@/../see_also.sgml">
]>
<refentry>
<docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
<refmeta>
<refentrytitle>lxc-ls</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>lxc-ls</refname>
<refpurpose>
<!--
list the containers existing on the system
-->
시스템 내에 존재하는 컨테이너들의 리스트 표시
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>lxc-ls</command>
<arg choice="opt">--active</arg>
<arg choice="opt">ls option</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title><!-- Description -->설명</title>
<para>
<!--
<command>lxc-ls</command> list the containers existing on the
system.
-->
<command>lxc-ls</command>는 시스템 내에 존재하는 컨테이너들의 리스트를 표시한다.
</para>
</refsect1>
<refsect1>
<title><!-- Options -->옵션</title>
<variablelist>
<varlistentry>
<term>
<option><optional>--active</optional></option>
</term>
<listitem>
<para>
<!--
List active containers.
-->
동작 중인 컨테이너들의 리스트를 표시한다.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option><optional>ls options</optional></option>
</term>
<listitem>
<para>
<!--
The option passed to <command>lxc-ls</command> are the
same as the <command>ls</command> command.
-->
<command>lxc-ls</command>에는 <command>ls</command>와 같은 옵션을 사용할 수 있다.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title><!-- Examples -->예제</title>
<variablelist>
<varlistentry>
<term>lxc-ls -l</term>
<listitem>
<para>
<!--
list all the container and their permissions.
-->
모든 컨테이너들의 리스트와 그들의 퍼미션 정보를 표시한다.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>lxc-ls --active -1</term>
<listitem>
<para>
<!--
list active containers and display the list in one column.
-->
동작 중인 컨테이너들의 리스트를 1열로 표시한다.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title><!-- See Also -->참조</title>
<simpara>
<citerefentry>
<refentrytitle>ls</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>,
</simpara>
</refsect1>
&seealso;
<refsect1>
<title><!-- Author -->저자</title>
<para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
<!--
lxc: linux Container library
(C) Copyright IBM Corp. 2007, 2008
Authors:
Daniel Lezcano <dlezcano at fr.ibm.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-->
<!DOCTYPE refentry PUBLIC @docdtd@ [
<!ENTITY seealso SYSTEM "@builddir@/../see_also.sgml">
]>
<refentry>
<docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
<refmeta>
<refentrytitle>lxc-ls</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>lxc-ls</refname>
<refpurpose>
list the containers existing on the system
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>lxc-ls</command>
<arg choice="opt">--active</arg>
<arg choice="opt"><replaceable>ls options</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>lxc-ls</command> list the containers existing on the
system.
</para>
</refsect1>
<refsect1>
<title>Options</title>
<variablelist>
<varlistentry>
<term>
<option><optional>--active</optional></option>
</term>
<listitem>
<para>
List active containers.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option><optional><replaceable>ls options</replaceable></optional></option>
</term>
<listitem>
<para>
The option passed to <command>lxc-ls</command> are the
same as the <command>ls</command> command.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Examples</title>
<variablelist>
<varlistentry>
<term>lxc-ls -l</term>
<listitem>
<para>
list all the container and their permissions.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>lxc-ls --active -1</term>
<listitem>
<para>
list active containers and display the list in one column.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>See Also</title>
<simpara>
<citerefentry>
<refentrytitle>ls</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>,
</simpara>
</refsect1>
&seealso;
<refsect1>
<title>Author</title>
<para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
......@@ -190,14 +190,10 @@ endif
bin_SCRIPTS = lxc-checkconfig
EXTRA_DIST = \
lxc-ls \
lxc-top.lua
if ENABLE_PYTHON
bin_SCRIPTS += lxc-ls
bin_SCRIPTS += lxc-start-ephemeral
else
bin_SCRIPTS += legacy/lxc-ls
endif
bin_PROGRAMS = \
......
#!/bin/sh
#
# lxc: linux Container library
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
. @DATADIR@/lxc/lxc.functions
usage()
{
echo "usage: $(basename $0) [--active] [--] [LS_OPTIONS...]" >&2
}
help() {
usage
echo >&2
echo "List containers existing on the system." >&2
echo >&2
echo " --active list active containers" >&2
echo " LS_OPTIONS ls command options (see \`ls --help')" >&2
}
get_parent_cgroup()
{
parent_cgroup=""
# Obtain a list of hierarchies that contain one or more subsystems
hierarchies=$(tail -n +2 /proc/cgroups | cut -f 2)
# Iterate through the list until a suitable hierarchy is found
for hierarchy in $hierarchies; do
# Obtain information about the init process in the hierarchy
fields=$(grep -E "^$hierarchy:" /proc/1/cgroup | head -n 1)
if [ -z "$fields" ]; then continue; fi
fields=${fields#*:}
# Get a comma-separated list of the hierarchy's subsystems
subsystems=${fields%:*}
# Get the cgroup of the init process in the hierarchy
init_cgroup=${fields#*:}
# Get the filesystem mountpoint of the hierarchy
mountpoint=$(awk -v subsysregex="(^|,)$subsystems(,|\$)" \
'$3 == "cgroup" && $4 ~ subsysregex {print $2}' /proc/self/mounts)
if [ -z "$mountpoint" ]; then continue; fi
# Return the absolute path to the containers' parent cgroup
# (do not append '/lxc' if the hierarchy contains the 'ns' subsystem)
case ",$subsystems," in
*,ns,*) parent_cgroup="${mountpoint}${init_cgroup%/}";;
*) parent_cgroup="${mountpoint}${init_cgroup%/}/lxc";;
esac
break
done
}
directory=$(readlink -f "$lxc_path")
for i in "$@"; do
case $i in
--help)
help; exit;;
--active)
get_parent_cgroup; directory="$parent_cgroup"; shift;;
--)
shift; break;;
*)
break;;
esac
done
containers=""
if [ ! -z "$directory" ]; then
if [ x"$parent_cgroup" = x ]; then
containers=$(find -L $directory -mindepth 2 -maxdepth 2 -name config -type f |awk -F "/" '{print $(NF-1)}')
else
containers=$(find $directory -mindepth 1 -maxdepth 1 -type d 2>/dev/null | sed 's:.*/::')
fi
if [ x"$containers" = x ]; then
exit 0
fi
fi
cd "$directory"
ls -d $@ -- $containers
......@@ -291,7 +291,7 @@ int main(int argc, char *argv[])
}
ret = readlink("/proc/self/fd/2", ttyname2, sizeof(ttyname2));
if (ret < 0) {
printf("Warning: unable to open stderr, continueing.");
printf("Warning: unable to open stderr, continuing.");
memset(ttyname2, '\0', sizeof(ttyname2));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment