[lxc-devel] [PATCH] Add manpage for lxc-copy
Serge Hallyn
serge.hallyn at ubuntu.com
Fri Nov 13 17:52:53 UTC 2015
Quoting Christian Brauner (christian.brauner at mailbox.org):
> (A trivial fix for lxc-copy is included.)
>
> Signed-off-by: Christian Brauner <christian.brauner at mailbox.org>
Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>
> ---
> configure.ac | 1 +
> doc/Makefile.am | 1 +
> doc/lxc-copy.sgml.in | 291 +++++++++++++++++++++++++++++++++++++++++++++++++++
> src/lxc/lxc_copy.c | 2 +-
> 4 files changed, 294 insertions(+), 1 deletion(-)
> create mode 100644 doc/lxc-copy.sgml.in
>
> diff --git a/configure.ac b/configure.ac
> index c5e6d28..beb53fe 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -680,6 +680,7 @@ AC_CONFIG_FILES([
> doc/lxc-clone.sgml
> doc/lxc-config.sgml
> doc/lxc-console.sgml
> + doc/lxc-copy.sgml
> doc/lxc-create.sgml
> doc/lxc-destroy.sgml
> doc/lxc-device.sgml
> diff --git a/doc/Makefile.am b/doc/Makefile.am
> index ca69bfa..f58c240 100644
> --- a/doc/Makefile.am
> +++ b/doc/Makefile.am
> @@ -24,6 +24,7 @@ man_MANS = \
> lxc-clone.1 \
> lxc-config.1 \
> lxc-console.1 \
> + lxc-copy.1 \
> lxc-create.1 \
> lxc-destroy.1 \
> lxc-execute.1 \
> diff --git a/doc/lxc-copy.sgml.in b/doc/lxc-copy.sgml.in
> new file mode 100644
> index 0000000..34ebcc5
> --- /dev/null
> +++ b/doc/lxc-copy.sgml.in
> @@ -0,0 +1,291 @@
> +<!--
> +
> +lxc: linux Container library
> +
> +(C) Copyright Canonical Inc. 2007, 2008
> +
> +Authors:
> +Christian Brauner <christian.brauner at mailbox.org>
> +
> +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 commonoptions SYSTEM "@builddir@/common_options.sgml">
> +<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
> +]>
> +
> +<refentry>
> +
> + <docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>
> +
> + <refmeta>
> + <refentrytitle>lxc-copy</refentrytitle>
> + <manvolnum>1</manvolnum>
> + </refmeta>
> +
> + <refnamediv>
> + <refname>lxc-copy</refname>
> +
> + <refpurpose>
> + copy an existing container.
> + </refpurpose>
> + </refnamediv>
> +
> + <refsynopsisdiv>
> + <cmdsynopsis>
> + <command>lxc-copy</command>
> + <arg choice="req">-n, --name <replaceable>name</replaceable></arg>
> + <arg choice="opt">-P, --lxcpath <replaceable>path</replaceable></arg>
> + <arg choice="req">-N, --newname <replaceable>newname</replaceable></arg>
> + <arg choice="opt">-p, --newpath <replaceable>newpath</replaceable></arg>
> + <arg choice="opt">-B, --backingstorage <replaceable>backingstorage</replaceable></arg>
> + <arg choice="opt">-s, --snapshot</arg>
> + <arg choice="opt">-K, --keepdata</arg>
> + <arg choice="opt">-M, --keepmac</arg>
> + <arg choice="opt">-L, --fssize <replaceable>size [unit]</replaceable></arg>
> + </cmdsynopsis>
> + <cmdsynopsis>
> + <command>lxc-copy</command>
> + <arg choice="req">-n, --name <replaceable>name</replaceable></arg>
> + <arg choice="opt">-P, --lxcpath <replaceable>path</replaceable></arg>
> + <arg choice="opt">-N, --newname <replaceable>newname</replaceable></arg>
> + <arg choice="opt">-p, --newpath <replaceable>newpath</replaceable></arg>
> + <arg choice="req">-e, --ephemeral</arg>
> + <arg choice="opt">-B, --backingstorage <replaceable>backingstorage</replaceable></arg>
> + <arg choice="opt">-s, --snapshot</arg>
> + <arg choice="opt">-K, --keepdata</arg>
> + <arg choice="opt">-M, --keepmac</arg>
> + <arg choice="opt">-L, --fssize <replaceable>size [unit]</replaceable></arg>
> + </cmdsynopsis>
> + <cmdsynopsis>
> + <command>lxc-copy</command>
> + <arg choice="req">-n, --name <replaceable>name</replaceable></arg>
> + <arg choice="opt">-P, --lxcpath <replaceable>path</replaceable></arg>
> + <arg choice="req">-N, --newname <replaceable>newname</replaceable></arg>
> + <arg choice="opt">-p, --newpath <replaceable>newpath</replaceable></arg>
> + <arg choice="req">-R, --rename</arg>
> + </cmdsynopsis>
> + </refsynopsisdiv>
> +
> + <refsect1>
> + <title>Description</title>
> +
> + <para>
> + <command>lxc-copy</command> creates and optionally starts (ephemeral or
> + non-ephemeral) copies of existing containers. It replaces
> + <command>lxc-clone</command> and <command>lxc-start-ephemeral</command>.
> + </para>
> + <para>
> + <command>lxc-copy</command> creates copies of existing containers. Copies
> + can be complete clones of the original container. In this case the whole
> + root filesystem of the container is simply copied to the new container. Or
> + they can be snapshots, i.e. small copy-on-write copies of the original
> + container. In this case the specified backing storage for the copy must
> + support snapshots. This currently includes aufs, btrfs, lvm (lvm devices
> + do not support snapshots of snapshots.), overlay, and zfs.
> + </para>
> +
> + <para>
> + The copy's backing storage will be of the same type as the original
> + container. aufs or overlayfs snapshots of directory backed containers are
> + exempted from this rule.
> + </para>
> +
> + <para>
> + When the <replaceable>-e</replaceable> flag is specified an ephemeral
> + snapshot of the original container is created and started. Ephemeral
> + containers will have <command>lxc.ephemeral = 1</command> set in their
> + config file and will be destroyed on shutdown. When
> + <replaceable>-e</replaceable> is used in combination with
> + <replaceable>-D</replaceable> a non-ephemeral snapshot of the original
> + container is created and started.</para>
> +
> + <para>
> + When <replaceable>-e</replaceable> is specified and no newname is given via
> + <replaceable>-N</replaceable> a random name for the snapshot will be chosen.
> + </para>
> +
> + <para>
> + Containers created and started with <replaceable>-e</replaceable> can have
> + custom mounts. These are specified with the <replaceable>-m</replaceable>
> + flag. Currently three types of mounts are supported:
> + <replaceable>aufs</replaceable>, <replaceable>bind</replaceable>, and
> + <replaceable>overlay</replaceable>. Mount types are specified as suboptions
> + to the <replaceable>-m</replaceable> flag and can be specified multiple
> + times separated by commas. <replaceable>aufs</replaceable> and
> + <replaceable>overlay</replaceable> mounts are currently specified in the
> + format <replaceable>-m overlay=/src:/dest</replaceable>. When no
> + destination <replaceable>dest</replaceable> is specified
> + <replaceable>dest</replaceable> will be identical to
> + <replaceable>src</replaceable>. Read-only <replaceable>bind</replaceable>
> + mounts are specified <replaceable>-m bind=/src:/dest:ro</replaceable> and
> + read-write <replaceable>bind</replaceable> mounts <replaceable>-m
> + bind=/src:/dest:rw</replaceable>. Read-write <replaceable>bind</replaceable>
> + mounts are the default and <replaceable>rw</replaceable> can be missing when
> + a read-write mount is wanted. When <replaceable>dest</replaceable> is
> + missing <replaceable>dest</replaceable> will be identical to
> + <replaceable>src</replaceable>. An example for multiple mounts would be
> + <replaceable>-m
> + bind=/src1:/dest1:ro,bind=/src2:ro,overlay=/src3:/dest3</replaceable>.
> + </para>
> +
> + <para>
> + The mounts, their options, and formats supported via the
> + <replaceable>-m</replaceable> flag are subject to change.
> + </para>
> + </refsect1>
> +
> + <refsect1>
> +
> + <title>Options</title>
> +
> + <variablelist>
> +
> + <varlistentry>
> + <term> <option>-N,--newname <replaceable>newname</replaceable></option> </term>
> + <listitem>
> + <para>The name for the copy.</para>
> + </listitem>
> + </varlistentry>
> +
> + <varlistentry>
> + <term> <option>-p,--newpath <replaceable>newpath</replaceable></option> </term>
> + <listitem>
> + <para>The path for the copy.</para>
> + </listitem>
> + </varlistentry>
> +
> + <varlistentry>
> + <term> <option>-R,--rename </option> </term>
> + <listitem>
> + <para>Rename the original container. </para>
> + </listitem>
> + </varlistentry>
> +
> + <varlistentry>
> + <term> <option>-s,--snapshot </option> </term>
> + <listitem>
> + <para> Create a snapshot of the orginal container. The backing
> + storage for the copy must support snapshots. This currently includes
> + aufs, btrfs, lvm, overlay, and zfs. </para>
> + </listitem>
> + </varlistentry>
> +
> + <varlistentry>
> + <term> <option>-F,--foreground</option> </term>
> + <listitem>
> + <para>Run the snapshot in the foreground. The snapshots console will
> + be attached to the current tty. (This option can only be specified
> + in conjunction with <replaceable>-e</replaceable>.)
> + </para>
> + </listitem>
> + </varlistentry>
> +
> + <varlistentry>
> + <term> <option>-d, --daemon</option> </term>
> + <listitem>
> + <para> Run the snapshot as a daemon (This is the default mode for
> + ephemeral containers.). As the container has no more tty, if an
> + error occurs nothing will be displayed, the log file can
> + be used to check the error. (This option can only be specified in
> + conjunction with <replaceable>-e</replaceable>.)
> + </para>
> + </listitem>
> + </varlistentry>
> +
> + <varlistentry>
> + <term> <option>-m, --mount <replaceable>mounttype</replaceable></option> </term>
> + <listitem>
> + <para> Specify a mount for a snapshot The
> + <replaceable>opts</replaceable> argument for the mount type can by
> + of type {aufs, bind, overlay}. For example <option>-m
> + bind=/src:/dest:ro,overlay=/src:/dest</option> (This option can
> + currently only be specified in conjunction with
> + <replaceable>-e</replaceable>.).</para>
> + </listitem>
> + </varlistentry>
> +
> + <varlistentry>
> + <term> <option>-B, --backingstorage <replaceable>backingstorage</replaceable></option></term>
> + <listitem>
> + <para>Specify the backing storage type to be used for the copy
> + where 'backingstorage' is of type 'aufs', 'btrfs', 'dir', 'lvm', 'loop',
> + 'overlay', or 'zfs'. </para>
> + </listitem>
> + </varlistentry>
> +
> + <varlistentry>
> + <term> <option>-L, --fssize <replaceable>size [unit]</replaceable></option></term>
> + <listitem>
> + <para>Specify the size for an 'lvm' filesystem. </para>
> + </listitem>
> + </varlistentry>
> +
> + <varlistentry>
> + <term> <option>-D, --keepdata </option></term>
> + <listitem>
> + <para>When this option is specified with
> + <replaceable>-e</replaceable> a non-ephemeral container is created
> + and started. </para> </listitem>
> + </varlistentry>
> +
> + <varlistentry>
> + <term> <option>-K, --keepname </option></term>
> + <listitem>
> + <para> When this option is specified the hostname of the original
> + container will be kept for the copy.</para> </listitem>
> + </varlistentry>
> +
> + <varlistentry>
> + <term> <option>-M, --keepmac </option></term>
> + <listitem>
> + <para> When this option is specified the MAC address of the original
> + container will be kept for the copy.</para> </listitem>
> + </varlistentry>
> +
> + </variablelist>
> +
> + </refsect1>
> +
> + &commonoptions;
> +
> + &seealso;
> +
> + <refsect1>
> + <title>Author</title>
> + <para>Christian Brauner <email>christian.brauner at mailbox.org</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:
> +-->
> diff --git a/src/lxc/lxc_copy.c b/src/lxc/lxc_copy.c
> index 5eb00b5..54f56f4 100644
> --- a/src/lxc/lxc_copy.c
> +++ b/src/lxc/lxc_copy.c
> @@ -94,7 +94,7 @@ static char *const keys[] = {
>
> static struct lxc_arguments my_args = {
> .progname = "lxc-copy",
> - .help = "\
> + .help = "\n\
> --name=NAME [-P lxcpath] -N newname [-p newpath] [-B backingstorage] [-s] [-K] [-M] [-L size [unit]]\n\
> --name=NAME [-P lxcpath] [-N newname] [-p newpath] [-B backingstorage] -e [-d] [-D] [-K] [-M] [-m {bind,aufs,overlay}=/src:/dest]\n\
> --name=NAME [-P lxcpath] -N newname -R\n\
> --
> 2.6.2
>
More information about the lxc-devel
mailing list