Commit 99bfcb4d by Serge Hallyn Committed by Stéphane Graber

add dir support

It used to be supported with the lxc-create.in script, and the manpage says it's supported... So let's just support it. Now sudo lxc-create -t download --dir /opt/ab -n ab works, creating the container rootfs under /opt/ab. This generally isn't something I'd recommend, however telling users to use a different lxc-path isn't as friendly as I'd like, because each lxcpath requires separate lxc-ls and lxc-autostart runs. Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent dd666a90
...@@ -477,7 +477,10 @@ static int dir_destroy(struct bdev *orig) ...@@ -477,7 +477,10 @@ static int dir_destroy(struct bdev *orig)
static int dir_create(struct bdev *bdev, const char *dest, const char *n, static int dir_create(struct bdev *bdev, const char *dest, const char *n,
struct bdev_specs *specs) struct bdev_specs *specs)
{ {
bdev->src = strdup(dest); if (specs->dir)
bdev->src = strdup(specs->dir);
else
bdev->src = strdup(dest);
bdev->dest = strdup(dest); bdev->dest = strdup(dest);
if (!bdev->src || !bdev->dest) { if (!bdev->src || !bdev->dest) {
ERROR("Out of memory"); ERROR("Out of memory");
......
...@@ -48,6 +48,7 @@ struct bdev_specs { ...@@ -48,6 +48,7 @@ struct bdev_specs {
char *lv; char *lv;
char *thinpool; // lvm thin pool to use, if any char *thinpool; // lvm thin pool to use, if any
} lvm; } lvm;
char *dir;
}; };
struct bdev_ops { struct bdev_ops {
......
...@@ -256,8 +256,7 @@ int main(int argc, char *argv[]) ...@@ -256,8 +256,7 @@ int main(int argc, char *argv[])
spec.lvm.thinpool = my_args.thinpool; spec.lvm.thinpool = my_args.thinpool;
} }
if (my_args.dir) { if (my_args.dir) {
ERROR("--dir is not yet supported"); spec.dir = my_args.dir;
exit(1);
} }
if (strcmp(my_args.bdevtype, "_unset") == 0) if (strcmp(my_args.bdevtype, "_unset") == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment