]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
rollback configuration is a file
authorDaniel Lezcano <dlezcano@fr.ibm.com>
Fri, 20 Nov 2009 14:01:30 +0000 (15:01 +0100)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Fri, 20 Nov 2009 14:01:30 +0000 (15:01 +0100)
The container will be a directory where the user can store everything,
so we create one directory and store a configuration file inside.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/lxc-create.in
src/lxc/lxc-destroy.in
src/lxc/lxc_execute.c
src/lxc/lxc_start.c

index 115e52d09f232856921d4854a7fc947fefc80a8f..ee0f3d1e80ff81260e46dda7c644223f56d0acf5 100644 (file)
@@ -80,18 +80,20 @@ if [ -z "$lxc_name" ]; then
     exit 1
 fi
 
-if [ -f "$lxc_path/$lxc_name" ]; then
+if [ -d "$lxc_path/$lxc_name" ]; then
     echo "'$lxc_name' already exists"
     exit 1
 fi
 
+mkdir -p $lxc_path/$lxc_name
+
 if [ -z "$lxc_config" ]; then
-    touch $lxc_path/$lxc_name
+    touch $lxc_path/$lxc_name/config
 else
     if [ ! -r "$lxc_config" ]; then
        echo "'$lxc_config' configuration file not found"
        exit 1
     fi
 
-    cp $lxc_config $lxc_path/$lxc_name
+    cp $lxc_config $lxc_path/$lxc_name/config
 fi
\ No newline at end of file
index 18d95b8f6ecd3507c39e2d9d01d73990aefd4fd9..565d89d6cc1914d8080397c6f727227b3283c65b 100644 (file)
@@ -70,7 +70,7 @@ if [ -z "$lxc_name" ]; then
     exit 1
 fi
 
-if [ ! -f "$lxc_path/$lxc_name" ]; then
+if [ ! -d "$lxc_path/$lxc_name" ]; then
     echo "'$lxc_name' does not exist"
     exit 1
 fi
index efc03ebfa3770f69ea5e560d502ed5dc26094c17..846a96fad814ea6efc50a2958d8e91ceac2c30d0 100644 (file)
@@ -99,7 +99,7 @@ int main(int argc, char *argv[])
        if (my_args.rcfile)
                rcfile = (char *)my_args.rcfile;
        else {
-               if (!asprintf(&rcfile, LXCPATH "/%s", my_args.name)) {
+               if (!asprintf(&rcfile, LXCPATH "/%s/config", my_args.name)) {
                        SYSERROR("failed to allocate memory");
                        return -1;
                }
index c2c5fa41a323f419d4ffbf713e9bb03c9c8beecc..cf87abfb0ac1c7036fcbde71818ca1bca0719efa 100644 (file)
@@ -149,7 +149,7 @@ int main(int argc, char *argv[])
        if (my_args.rcfile)
                rcfile = (char *)my_args.rcfile;
        else {
-               if (!asprintf(&rcfile, LXCPATH "/%s", my_args.name)) {
+               if (!asprintf(&rcfile, LXCPATH "/%s/config", my_args.name)) {
                        SYSERROR("failed to allocate memory");
                        return err;
                }