<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">-a, --allowrunning</arg>
<arg choice="opt">-K, --keepname</arg>
<arg choice="opt">-D, --keepdata</arg>
<arg choice="opt">-M, --keepmac</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">-a, --allowrunning</arg>
<arg choice="opt">-K, --keepname</arg>
<arg choice="opt">-D, --keepdata</arg>
<arg choice="opt">-M, --keepmac</arg>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term> <option>-a,--allowrunning </option> </term>
+ <listitem>
+ <para> Allow the creation of a Snapshot of an already running container.
+ This may cause data corruption or data loss depending on the used
+ filesystem and applications. Use with care. </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term> <option>-F,--foreground</option> </term>
<listitem>
if (container_mem_lock(c))
return NULL;
-
- if (!is_stopped(c)) {
- ERROR("error: Original container (%s) is running", c->name);
+ if (!is_stopped(c) && !(flags & LXC_CLONE_ALLOW_RUNNING)) {
+ ERROR("error: Original container (%s) is running. Use --allowrunning if you want to force a snapshot of the running container.", c->name);
goto out;
}
#define LXC_CLONE_KEEPBDEVTYPE (1 << 3) /*!< Use the same bdev type */
#define LXC_CLONE_MAYBE_SNAPSHOT (1 << 4) /*!< Snapshot only if bdev supports it, else copy */
#define LXC_CLONE_MAXFLAGS (1 << 5) /*!< Number of \c LXC_CLONE_* flags */
+#define LXC_CLONE_ALLOW_RUNNING (1 << 6) /*!< allow snapshot creation even if source container is running */
#define LXC_CREATE_QUIET (1 << 0) /*!< Redirect \c stdin to \c /dev/zero and \c stdout and \c stderr to \c /dev/null */
#define LXC_CREATE_MAXFLAGS (1 << 1) /*!< Number of \c LXC_CREATE* flags */
#define LXC_MOUNT_API_V1 1
int keepdata;
int keepname;
int keepmac;
+ int allowrunning;
/* lxc-ls */
char *ls_fancy_format;
{ "newpath", required_argument, 0, 'p'},
{ "rename", no_argument, 0, 'R'},
{ "snapshot", no_argument, 0, 's'},
+ { "allowrunning", no_argument, 0, 'a'},
{ "foreground", no_argument, 0, 'F'},
{ "daemon", no_argument, 0, 'd'},
{ "ephemeral", no_argument, 0, 'e'},
-p, --newpath=NEWPATH NEWPATH for the container to be stored\n\
-R, --rename rename container\n\
-s, --snapshot create snapshot instead of clone\n\
+ -a, --allowrunning allow snapshot creation even if source container is running\n\
-F, --foreground start with current tty attached to /dev/console\n\
-d, --daemon daemonize the container (default)\n\
-e, --ephemeral start ephemeral container\n\
if (my_args.task == SNAP || my_args.task == DESTROY)
flags |= LXC_CLONE_SNAPSHOT;
-
+ if (my_args.allowrunning)
+ flags |= LXC_CLONE_ALLOW_RUNNING;
if (my_args.keepname)
flags |= LXC_CLONE_KEEPNAME;
case 's':
args->task = SNAP;
break;
+ case 'a':
+ args->allowrunning = 1;
+ break;
case 'F':
args->daemonize = 0;
break;