aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lezcano <dlezcano@fr.ibm.com>2009-11-20 15:01:30 +0100
committerDaniel Lezcano <dlezcano@fr.ibm.com>2009-11-20 15:01:30 +0100
commit7418c9ced124f54e5683a448386d7dc5a8011778 (patch)
treed41ea6afce1fc1ef0692e568f6aead11da5f1c96
parentDo not chdir when daemonize (diff)
downloadlxc-7418c9ced124f54e5683a448386d7dc5a8011778.tar.gz
lxc-7418c9ced124f54e5683a448386d7dc5a8011778.tar.bz2
lxc-7418c9ced124f54e5683a448386d7dc5a8011778.zip
rollback configuration is a file
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>
-rw-r--r--src/lxc/lxc-create.in8
-rw-r--r--src/lxc/lxc-destroy.in2
-rw-r--r--src/lxc/lxc_execute.c2
-rw-r--r--src/lxc/lxc_start.c2
4 files changed, 8 insertions, 6 deletions
diff --git a/src/lxc/lxc-create.in b/src/lxc/lxc-create.in
index 115e52d..ee0f3d1 100644
--- a/src/lxc/lxc-create.in
+++ b/src/lxc/lxc-create.in
@@ -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
diff --git a/src/lxc/lxc-destroy.in b/src/lxc/lxc-destroy.in
index 18d95b8..565d89d 100644
--- a/src/lxc/lxc-destroy.in
+++ b/src/lxc/lxc-destroy.in
@@ -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
diff --git a/src/lxc/lxc_execute.c b/src/lxc/lxc_execute.c
index efc03eb..846a96f 100644
--- a/src/lxc/lxc_execute.c
+++ b/src/lxc/lxc_execute.c
@@ -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;
}
diff --git a/src/lxc/lxc_start.c b/src/lxc/lxc_start.c
index c2c5fa4..cf87abf 100644
--- a/src/lxc/lxc_start.c
+++ b/src/lxc/lxc_start.c
@@ -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;
}