[lxc-devel] [PATCH] Add man page for lxc-clone

Serge Hallyn serge.hallyn at canonical.com
Fri Feb 8 22:58:01 UTC 2013


And doing so pointed out a bug in lxc-clone itself - it claims
default fssize is 2G.  It's not.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
 configure.ac          |   1 +
 doc/Makefile.am       |   1 +
 doc/lxc-clone.sgml.in | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/lxc/lxc-clone.in  |   3 +-
 4 files changed, 197 insertions(+), 2 deletions(-)
 create mode 100644 doc/lxc-clone.sgml.in

diff --git a/configure.ac b/configure.ac
index 8963e3d..6402024 100644
--- a/configure.ac
+++ b/configure.ac
@@ -302,6 +302,7 @@ AC_CONFIG_FILES([
 	config/Makefile
 
 	doc/Makefile
+	doc/lxc-clone.sgml
 	doc/lxc-create.sgml
 	doc/lxc-destroy.sgml
 	doc/lxc-execute.sgml
diff --git a/doc/Makefile.am b/doc/Makefile.am
index e539254..e54a087 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -7,6 +7,7 @@ EXTRA_DIST = \
 
 if ENABLE_DOCBOOK
 man_MANS = \
+	lxc-clone.1 \
 	lxc-create.1 \
 	lxc-destroy.1 \
 	lxc-execute.1 \
diff --git a/doc/lxc-clone.sgml.in b/doc/lxc-clone.sgml.in
new file mode 100644
index 0000000..e3eb946
--- /dev/null
+++ b/doc/lxc-clone.sgml.in
@@ -0,0 +1,194 @@
+<!--
+
+lxc: linux Container library
+
+(C) Copyright IBM Corp. 2007, 2008
+
+Authors:
+Daniel Lezcano <dlezcano at fr.ibm.com>
+Serge Hallyn <serge.hallyn at ubuntu.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+-->
+
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+
+<!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-clone</refentrytitle>
+    <manvolnum>1</manvolnum>
+  </refmeta>
+
+  <refnamediv>
+    <refname>lxc-clone</refname>
+
+    <refpurpose>
+      clone a new container from an existing one.
+    </refpurpose>
+  </refnamediv>
+
+  <refsynopsisdiv>
+    <cmdsynopsis>
+      <command>lxc-clone</command>
+      <arg choice="req">-o <replaceable>orig</replaceable></arg>
+      <arg choice="req">-n <replaceable>new</replaceable></arg>
+      <arg choice="opt">-s </arg>
+      <arg choice="opt">-L <replaceable>fssize</replaceable></arg>
+      <arg choice="opt">-v <replaceable>vgname</replaceable></arg>
+      <arg choice="opt">-p <replaceable>lxc_lv_prefix</replaceable></arg>
+      <arg choice="opt">-t <replaceable>fstype</replaceable></arg>
+    </cmdsynopsis>
+  </refsynopsisdiv>
+
+  <refsect1>
+    <title>Description</title>
+
+    <para>
+      <command>lxc-clone</command> Creates a new container as a copy of an existing
+      container.  When the original container's rootfs is an LVM block device or
+      is on a btrfs filesystem, then a snapshotted clone can be created, taking up
+      very little initial disk space.
+    </para>
+
+  </refsect1>
+
+  <refsect1>
+
+    <title>Options</title>
+
+    <variablelist>
+
+      <varlistentry>
+	<term>
+	  <option>-o, --orig <replaceable>orig</replaceable></option>
+	</term>
+	<listitem>
+	  <para>
+	    The name of the original container to clone.
+	  </para>
+	</listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>
+	  <option>-n, --new <replaceable>new</replaceable></option>
+	</term>
+	<listitem>
+	  <para>
+	    The name of the new container to create.
+	  </para>
+	</listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>
+	  <option>-s, --snapshot</option>
+	</term>
+	<listitem>
+	  <para>
+	    The new container's rootfs should be a LVM or btrfs snapshot of the original.
+	  </para>
+	</listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>
+	  <option>-L, --fssize <replaceable>fssize</replaceable></option>
+	</term>
+	<listitem>
+	  <para>
+	    In the case of a LVM-backed container, a size for the new
+	    block device.  By default, the new device will be made the
+	    same size as the original.
+	  </para>
+	</listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>
+	  <option>-v, --vgname <replaceable>vgname</replaceable></option>
+	</term>
+	<listitem>
+	  <para>
+	    For an LVM-backed container, the volume group name to use.  By
+	    default it is 'lxc'.
+	  </para>
+	</listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>
+	  <option>-p, --lvprefix <replaceable>lxc_lv_prefix</replaceable></option>
+	</term>
+	<listitem>
+	  <para>
+	    For an LVM-backed container, a string to prefix to the container name to
+	    form the logical volume name.  For instance, specifying
+	    <command>-n c1 -p lxc_</command> will cause the container rootfs to
+	    be on a logical volume called <replaceable>lxc_c1</replaceable>.
+	  </para>
+	</listitem>
+      </varlistentry>
+
+      <varlistentry>
+	<term>
+	  <option>-t, --fstype <replaceable>fstype</replaceable></option>
+	</term>
+	<listitem>
+	  <para>
+	    For a non-snapshot LVM clone, the file system to use for the new
+	    container.  Note this option is ignored when requesting a
+	    snapshotted container.
+	  </para>
+	</listitem>
+      </varlistentry>
+
+    </variablelist>
+
+  </refsect1>
+
+  &seealso;
+
+  <refsect1>
+    <title>Author</title>
+    <para>Serge Hallyn <email>serge.hallyn at ubuntu.com</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-clone.in b/src/lxc/lxc-clone.in
index fcf34a9..291db30 100755
--- a/src/lxc/lxc-clone.in
+++ b/src/lxc/lxc-clone.in
@@ -37,7 +37,7 @@ help() {
     echo "  -o ORIG_NAME   specify the name of the original container" >&2
     echo "  -n NEW_NAME    specify the name of the new container" >&2
     echo "  -s             make the new rootfs a snapshot of the original" >&2
-    echo "  -L FS_SIZE     specify the new filesystem size (default: 2G)" >&2
+    echo "  -L FS_SIZE     specify the new filesystem size (default: same as original)" >&2
     echo "  -v VG_NAME     specify the new LVM volume group name (default: lxc)" >&2
     echo "  -p LV_PREFIX   add a prefix to new LVM logical volume names" >&2
     echo "  -t FS_TYPE     specify the new filesystem type (default: ext3;" >&2
@@ -56,7 +56,6 @@ optarg_check() {
 
 . @DATADIR@/lxc/lxc.functions
 snapshot=no
-lxc_defsize=2G
 lxc_size=_unset
 lxc_vg=lxc
 lxc_lv_prefix=""
-- 
1.8.1.2





More information about the lxc-devel mailing list