Signed-off-by: S.Çağlar Onur <[email protected]>
---
 src/lxc/lxc_clone.c            |  5 +----
 src/lxc/lxccontainer.c         | 16 ++++++----------
 src/lxc/lxccontainer.h         |  8 +++-----
 src/python-lxc/lxc.c           |  1 -
 src/python-lxc/lxc/__init__.py |  1 -
 5 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/src/lxc/lxc_clone.c b/src/lxc/lxc_clone.c
index 88a768d..bff53b8 100644
--- a/src/lxc/lxc_clone.c
+++ b/src/lxc/lxc_clone.c
@@ -85,7 +85,6 @@ static struct option options[] = {
        { "vgname", required_argument, 0, 'v'},
        { "keepname", no_argument, 0, 'K'},
        { "keepmac", no_argument, 0, 'M'},
-       { "copyhooks", no_argument, 0, 'H'},  // should this be default?
        { "lxcpath", required_argument, 0, 'p'},
        { "newpath", required_argument, 0, 'P'},
        { "fstype", required_argument, 0, 't'},
@@ -96,7 +95,7 @@ static struct option options[] = {
 int main(int argc, char *argv[])
 {
        struct lxc_container *c1 = NULL, *c2 = NULL;
-       int snapshot = 0, keepname = 0, keepmac = 0, copyhooks = 0;
+       int snapshot = 0, keepname = 0, keepmac = 0;
        int flags = 0, option_index;
        long newsize = 0;
        char *bdevtype = NULL, *lxcpath = NULL, *newpath = NULL, *fstype = NULL;
@@ -120,7 +119,6 @@ int main(int argc, char *argv[])
                case 'v': vgname = optarg; break;
                case 'K': keepname = 1; break;
                case 'M': keepmac = 1; break;
-               case 'H': copyhooks = 1; break;
                case 'p': lxcpath = optarg; break;
                case 'P': newpath = optarg; break;
                case 't': fstype = optarg; break;
@@ -143,7 +141,6 @@ int main(int argc, char *argv[])
        if (snapshot)  flags |= LXC_CLONE_SNAPSHOT;
        if (keepname)  flags |= LXC_CLONE_KEEPNAME;
        if (keepmac)   flags |= LXC_CLONE_KEEPMACADDR;
-       if (copyhooks) flags |= LXC_CLONE_COPYHOOKS;
 
        // vgname and fstype could be supported by sending them through the
        // bdevdata.  However, they currently are not yet.  I'm not convinced
diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index 1af8d62..b70b83a 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -2546,14 +2546,11 @@ struct lxc_container *lxcapi_clone(struct lxc_container 
*c, const char *newname,
                goto out;
        }
 
-
-       // copy hooks if requested
-       if (flags & LXC_CLONE_COPYHOOKS) {
-               ret = copyhooks(c, c2);
-               if (ret < 0) {
-                       ERROR("error copying hooks");
-                       goto out;
-               }
+       // copy hooks
+       ret = copyhooks(c, c2);
+       if (ret < 0) {
+               ERROR("error copying hooks");
+               goto out;
        }
 
        if (copy_fstab(c, c2) < 0) {
@@ -2600,7 +2597,6 @@ static bool lxcapi_rename(struct lxc_container *c, const 
char *newname)
 {
        struct bdev *bdev;
        struct lxc_container *newc;
-       int flags = LXC_CLONE_KEEPMACADDR | LXC_CLONE_COPYHOOKS;
 
        if (!c || !c->name || !c->config_path)
                return false;
@@ -2611,7 +2607,7 @@ static bool lxcapi_rename(struct lxc_container *c, const 
char *newname)
                return false;
        }
 
-       newc = lxcapi_clone(c, newname, c->config_path, flags, NULL, 
bdev->type, 0, NULL);
+       newc = lxcapi_clone(c, newname, c->config_path, LXC_CLONE_KEEPMACADDR, 
NULL, bdev->type, 0, NULL);
        bdev_put(bdev);
        if (!newc) {
                lxc_container_put(newc);
diff --git a/src/lxc/lxccontainer.h b/src/lxc/lxccontainer.h
index b7c5313..797ad91 100644
--- a/src/lxc/lxccontainer.h
+++ b/src/lxc/lxccontainer.h
@@ -29,10 +29,9 @@
 #include <stdlib.h>
 
 #define LXC_CLONE_KEEPNAME        (1 << 0) /*!< Do not edit the rootfs to 
change the hostname */
-#define LXC_CLONE_COPYHOOKS       (1 << 1) /*!< Copy all hooks into the 
container directory */
-#define LXC_CLONE_KEEPMACADDR     (1 << 2) /*!< Do not change the MAC address 
on network interfaces */
-#define LXC_CLONE_SNAPSHOT        (1 << 3) /*!< Snapshot the original 
filesystem(s) */
-#define LXC_CLONE_MAXFLAGS        (1 << 4) /*!< Number of \c LXC_CLONE_* flags 
*/
+#define LXC_CLONE_KEEPMACADDR     (1 << 1) /*!< Do not change the MAC address 
on network interfaces */
+#define LXC_CLONE_SNAPSHOT        (1 << 2) /*!< Snapshot the original 
filesystem(s) */
+#define LXC_CLONE_MAXFLAGS        (1 << 3) /*!< Number of \c LXC_CLONE_* flags 
*/
 #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 
*/
 
@@ -516,7 +515,6 @@ struct lxc_container {
         *  (XXX: should we use the default instead?)
         * \param flags Additional \c LXC_CLONE* flags to change the cloning 
behaviour:
         *  - \ref LXC_CLONE_KEEPNAME
-        *  - \ref LXC_CLONE_COPYHOOKS
         *  - \ref LXC_CLONE_KEEPMACADDR
         *  - \ref LXC_CLONE_SNAPSHOT
         * \param bdevtype Optionally force the cloned bdevtype to a specified 
plugin.
diff --git a/src/python-lxc/lxc.c b/src/python-lxc/lxc.c
index cd92949..0099b98 100644
--- a/src/python-lxc/lxc.c
+++ b/src/python-lxc/lxc.c
@@ -1733,7 +1733,6 @@ PyInit__lxc(void)
     PYLXC_EXPORT_CONST(LXC_ATTACH_SET_PERSONALITY);
 
     /* clone: clone flags */
-    PYLXC_EXPORT_CONST(LXC_CLONE_COPYHOOKS);
     PYLXC_EXPORT_CONST(LXC_CLONE_KEEPMACADDR);
     PYLXC_EXPORT_CONST(LXC_CLONE_KEEPNAME);
     PYLXC_EXPORT_CONST(LXC_CLONE_SNAPSHOT);
diff --git a/src/python-lxc/lxc/__init__.py b/src/python-lxc/lxc/__init__.py
index e708781..e389abb 100644
--- a/src/python-lxc/lxc/__init__.py
+++ b/src/python-lxc/lxc/__init__.py
@@ -454,7 +454,6 @@ LXC_ATTACH_REMOUNT_PROC_SYS = 
_lxc.LXC_ATTACH_REMOUNT_PROC_SYS
 LXC_ATTACH_SET_PERSONALITY = _lxc.LXC_ATTACH_SET_PERSONALITY
 
 # clone: clone flags
-LXC_CLONE_COPYHOOKS = _lxc.LXC_CLONE_COPYHOOKS
 LXC_CLONE_KEEPMACADDR = _lxc.LXC_CLONE_KEEPMACADDR
 LXC_CLONE_KEEPNAME = _lxc.LXC_CLONE_KEEPNAME
 LXC_CLONE_SNAPSHOT = _lxc.LXC_CLONE_SNAPSHOT
-- 
1.8.3.2

_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to