Skip to content

Commit

Permalink
doc: Add the description of new style hook to Japanese lxc.containers…
Browse files Browse the repository at this point in the history
….conf(5)

Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
  • Loading branch information
tenforward committed Dec 19, 2017
1 parent 4eeecbd commit efcbd1a
Showing 1 changed file with 89 additions and 36 deletions.
125 changes: 89 additions & 36 deletions doc/ja/lxc.container.conf.sgml.in
Expand Up @@ -2235,63 +2235,116 @@ by KATOH Yasufumi <karma at jazz.email.ne.jp>
<refsect2>
<title><!-- Container hooks -->コンテナのフック</title>
<para>
<!--
<!--
Container hooks are programs or scripts which can be executed
at various times in a container's lifetime.
-->
コンテナのフックは、コンテナの存続期間の色々な場面で実行することのできるプログラムやスクリプトです。
-->
コンテナのフックは、コンテナの存続期間の色々な場面で実行することのできるプログラムやスクリプトです。
</para>
<para>
<!--
When a container hook is executed, information is passed both
as command line arguments and through environment variables.
The arguments are:
<!--
When a container hook is executed, additional information is passed
along. The <option>lxc.hook.version</option> argument can be used to
determine if the following arguments are passed as command line
arguments or through environment variables. The arguments are:
-->
コンテナフックが実行されるとき、追加の情報が渡されます。追加の引数がコマンドライン引数で渡されるか、環境変数経由で渡されるかを判断するのに、<option>lxc.hook.version</option> が使えます。引数は:
<itemizedlist>
<listitem><para> Container name. </para></listitem>
<listitem><para> Section (always 'lxc'). </para></listitem>
<listitem><para> The hook type (i.e. 'clone' or 'pre-mount'). </para></listitem>
<listitem><para> Additional arguments. In the
<listitem><para> コンテナ名 <!-- Container name.--></para></listitem>
<listitem><para> セクション (常に 'lxc') <!-- Section (always 'lxc'). --></para></listitem>
<listitem><para> フックのタイプ ('clone' や 'pre-mount' など) <!-- The hook type (i.e. 'clone' or 'pre-mount'). --></para></listitem>
<listitem><para> 追加の引数。clone フックの場合、lxc-clone に渡される追加の引数は、フックへの引数として追加されます。stop フックの場合は、コンテナの名前空間のそれぞれに対するファイルディスクリプタへのパスが、名前空間名とともに渡されます。 <!-- Additional arguments. In the
case of the clone hook, any extra arguments passed to
lxc-clone will appear as further arguments to the hook.
In the case of the stop hook, paths to filedescriptors
for each of the container's namespaces along with their types
are passed. </para></listitem>
are passed. --></para></listitem>
</itemizedlist>
<!--
The following environment variables are set:
-->
次の環境変数がセットされます。
<itemizedlist>
<listitem><para> LXC_NAME: is the container's name. </para></listitem>
<listitem><para> LXC_ROOTFS_MOUNT: the path to the mounted root filesystem. </para></listitem>
<listitem><para> LXC_CONFIG_FILE: the path to the container configuration file. </para></listitem>
<listitem><para> LXC_SRC_NAME: in the case of the clone hook, this is the original container's name. </para></listitem>
<listitem><para> LXC_ROOTFS_PATH: this is the lxc.rootfs.path entry for the container. Note this is likely not where the mounted rootfs is to be found, use LXC_ROOTFS_MOUNT for that. </para></listitem>
</itemizedlist>
-->
コンテナのフックが実行されるとき、情報がコマンドライン引数と環境変数の両方を通して渡されます。引数は:
<itemizedlist>
<listitem><para>コンテナ名</para></listitem>
<listitem><para>セクション (常に 'lxc')</para></listitem>
<listitem><para>フックのタイプ ('clone' や 'pre-mount' など)</para></listitem>
<listitem><para>追加の引数。clone フックの場合、lxc-clone に渡される追加の引数は、フックへの引数として追加されます。stop フックの場合は、コンテナの名前空間のそれぞれに対するファイルディスクリプタへのパスが、名前空間名とともに渡されます。</para></listitem>
</itemizedlist>
以下の環境変数がセットされます。
<itemizedlist>
<listitem><para> LXC_NAME: コンテナ名</para></listitem>
<listitem><para> LXC_ROOTFS_MOUNT: マウントされた root ファイルシステムへのパス</para></listitem>
<listitem><para> LXC_CONFIG_FILE: コンテナの設定ファイルのパス </para></listitem>
<listitem><para> LXC_SRC_NAME: clone フックの場合、元のコンテナの名前</para></listitem>
<listitem><para> LXC_ROOTFS_PATH: コンテナの lxc.rootfs.path エントリ。これはマウントされた rootfs が存在する場所にはならないでしょう。それには LXC_ROOTFS_MOUNT を使用してください。</para></listitem>
<listitem><para> LXC_CGNS_AWARE: コンテナで cgroup namespace が使えるかどうか <!-- indicator whether the container is
cgroup namespace aware. --></para></listitem>
<listitem><para> LXC_CONFIG_FILE: コンテナの設定ファイルのパス <!-- the path to the container
configuration file. --></para></listitem>
<listitem><para> LXC_HOOK_TYPE: フックのタイプ (例えば 'clone'、'mount'、'pre-mount')。この環境変数が存在するかどうかは <option>lxc.hook.version</option> の値次第です。この値が 1 なら、LXC_HOOK_TYPE が設定されています。
<!-- the hook type (e.g. 'clone', 'mount',
'pre-mount'). Note that the existence of this environment variable is
conditional on the value of <option>lxc.hook.version</option>. If it
is set to 1 then LXC_HOOK_TYPE will be set. -->
</para></listitem>
<listitem><para> LXC_HOOK_SECTION: セクションタイプ (例えば 'lxc'、'net')。この環境変数が存在するかどうかは <option>lxc.hook.version</option> の値次第です。この値が 1 なら、LXC_HOOK_TYPE が設定されています。
<!-- the section type (e.g. 'lxc',
'net'). Note that the existence of this environment variable is
conditional on the value of <option>lxc.hook.version</option>. If it
is set to 1 then LXC_HOOK_SECTION will be set. -->
</para></listitem>
<listitem><para> LXC_HOOK_VERSION: フックのバージョン。この値は、コンテナの <option>lxc.hook.version</option> の値と同じです。もし、この値が 0 に設定されているなら、古いスタイルのフックが使われます。もし 1 に設定されているなら、新しいスタイルのフックが使われます。
<!-- the version of the hooks. This
value is identical to the value of the container's
<option>lxc.hook.version</option> config item. If it is set to 0 then
old-style hooks are used. If it is set to 1 then new-style hooks are
used. --></para></listitem>
<listitem><para> LXC_LOG_LEVEL: コンテナのログレベル <!-- the container's log level. --></para></listitem>
<listitem><para> LXC_NAME: コンテナ名 <!-- is the container's name. --></para></listitem>
<listitem><para> LXC_[NAMESPACE IDENTIFIER]_NS: コンテナの名前空間が参照する /proc/PID/fd/ 以下のファイルディスクリプタのパス。それぞれの名前空間ごとに別々の環境変数になります。これらの環境変数は <option>lxc.hook.version</option> が 1 に設定されてる場合のみ設定されます。
<!-- path under
/proc/PID/fd/ to a file descriptor referring to the container's
namespace. For each preserved namespace type there will be a separate
environment variable. These environment variables will only be set if
<option>lxc.hook.version</option> is set to 1. --></para></listitem>
<listitem><para> LXC_ROOTFS_MOUNT: マウントされた root ファイルシステムへのパス <!-- the path to the mounted root filesystem. --></para></listitem>
<listitem><para> LXC_ROOTFS_PATH: コンテナの lxc.rootfs.path エントリ。これはマウントされた rootfs が存在する場所にはならないでしょう。それには LXC_ROOTFS_MOUNT を使用してください。 <!-- this is the lxc.rootfs.path entry
for the container. Note this is likely not where the mounted rootfs is
to be found, use LXC_ROOTFS_MOUNT for that. --></para></listitem>
<listitem><para> LXC_SRC_NAME: clone フックの場合、元のコンテナの名前 <!-- in the case of the clone hook, this is
the original container's name. --></para></listitem>
</itemizedlist>
</para>
<para>
<!--
<!--
Standard output from the hooks is logged at debug level.
Standard error is not logged, but can be captured by the
hook redirecting its standard error to standard output.
-->
スクリプトからの標準出力は debug レベルでロギングされます。
-->
スクリプトからの標準出力は debug レベルでロギングされます。
標準エラー出力はロギングされません。
しかし、フックの標準エラー出力を標準出力にリダイレクトすることにより保存することは可能です。
</para>
<variablelist>
<varlistentry>
<term>
<option>lxc.hook.version</option>
</term>
<listitem>
<para>
<!--
To pass the arguments in new style via environment variables set to
1 otherwise set to 0 to pass them as arguments.
This setting affects all hooks arguments that were traditionally
passed as arguments to the script. Specifically, it affects the
container name, section (e.g. 'lxc', 'net') and hook type (e.g.
'clone', 'mount', 'pre-mount') arguments. If new-style hooks are
used then the arguments will be available as environment variables.
The container name will be set in LXC_NAME. (This is set
independently of the value used for this config item.) The section
will be set in LXC_HOOK_SECTION and the hook type will be set in
LXC_HOOK_TYPE.
It also affects how the paths to file descriptors referring to the
container's namespaces are passed. If set to 1 then for each
namespace a separate environment variable LXC_[NAMESPACE
IDENTIFIER]_NS will be set. If set to 0 then the paths will be
passed as arguments to the stop hook.
-->
環境変数経由の新しいスタイルで引数を渡すには 1 に設定します。そうでなく、引数として渡すには 0 に設定します。この設定は、古い方法でスクリプトに引数として渡されているすべてのフック引数に影響します。特に、コンテナ名のセクション (例: 'lxc', 'net') とフックタイプ (例: 'clone', 'mount', 'pre-mount') 引数に影響します。新しいスタイルのフックが使われる場合、引数は環境変数として利用できます。
コンテナ名は LXC_NAME に設定されます(これはこの設定項目に設定されている値とは関係なく設定されます)。セクションは LXC_HOOK_SECTION に設定されます。そしてフックタイプは LXC_HOOK_TYPE に設定されます。
この設定は、コンテナの名前空間を参照するファイルディスクリプタのパスをどのように渡すかにも影響します。1 に設定した場合、名前空間ごとに別の環境変数 LXC_[NAMESPACE IDENTIFIER]_NS に設定されます。0 に設定すると、パスは stop フックの引数として渡されます。
</para>
</listitem>
</varlistentry>
</variablelist>
<variablelist>
<varlistentry>
<term>
Expand Down

0 comments on commit efcbd1a

Please sign in to comment.