]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
Make LXC_CLONE_KEEPNAME work
authorChristian Brauner <christianvanbrauner@gmail.com>
Fri, 14 Aug 2015 18:17:21 +0000 (20:17 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Fri, 28 Aug 2015 22:05:37 +0000 (18:05 -0400)
- Passing the LXC_CLONE_KEEPNAME flag to do_lxcapi_clone() was not respected and
  let to unexpected behaviour for e.g. lxc-clone. We wrap
  clear_unexp_config_line() and set_config_item_line() in an appropriate
  if-condition.

Signed-off-by: Christian Brauner <christianvanbrauner@gmail.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxccontainer.c

index 92523116dfd522f5e2f9add14a9af94d51ee900c..49f3887e1dab6f50f63a366b55701eb564a29328 100644 (file)
@@ -2693,9 +2693,11 @@ static struct lxc_container *lxcapi_clone(struct lxc_container *c, const char *n
                goto out;
 
        // update utsname
-       if (!set_config_item_locked(c2, "lxc.utsname", newname)) {
-               ERROR("Error setting new hostname");
-               goto out;
+       if (!(flags & LXC_CLONE_KEEPNAME)) {
+               if (!set_config_item_locked(c2, "lxc.utsname", newname)) {
+                       ERROR("Error setting new hostname");
+                       goto out;
+               }
        }
 
        // copy hooks