Commit 984bd620 by Serge Hallyn

honor lxc.rootfs.bdev

If that is specified, then we only use the specified backing store type. This can be useful if you know that lxc.rootfs is a directory type and you do not want lxc to waste time searching for zfs, btrfs, etc. Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com>
parent bfd77214
...@@ -201,7 +201,7 @@ static const struct bdev_type bdevs[] = { ...@@ -201,7 +201,7 @@ static const struct bdev_type bdevs[] = {
static const size_t numbdevs = sizeof(bdevs) / sizeof(struct bdev_type); static const size_t numbdevs = sizeof(bdevs) / sizeof(struct bdev_type);
/* helpers */ /* helpers */
static const struct bdev_type *bdev_query(const char *src); static const struct bdev_type *bdev_query(struct lxc_conf *conf, const char *src);
static struct bdev *bdev_get(const char *type); static struct bdev *bdev_get(const char *type);
static struct bdev *do_bdev_create(const char *dest, const char *type, static struct bdev *do_bdev_create(const char *dest, const char *type,
const char *cname, struct bdev_specs *specs); const char *cname, struct bdev_specs *specs);
...@@ -542,7 +542,7 @@ struct bdev *bdev_init(struct lxc_conf *conf, const char *src, const char *dst, ...@@ -542,7 +542,7 @@ struct bdev *bdev_init(struct lxc_conf *conf, const char *src, const char *dst,
if (!src) if (!src)
return NULL; return NULL;
q = bdev_query(src); q = bdev_query(conf, src);
if (!q) if (!q)
return NULL; return NULL;
...@@ -794,7 +794,7 @@ bool rootfs_is_blockdev(struct lxc_conf *conf) ...@@ -794,7 +794,7 @@ bool rootfs_is_blockdev(struct lxc_conf *conf)
ret = stat(conf->rootfs.path, &st); ret = stat(conf->rootfs.path, &st);
if (ret == 0 && S_ISBLK(st.st_mode)) if (ret == 0 && S_ISBLK(st.st_mode))
return true; return true;
q = bdev_query(conf->rootfs.path); q = bdev_query(conf, conf->rootfs.path);
if (!q) if (!q)
return false; return false;
if (strcmp(q->name, "lvm") == 0 || if (strcmp(q->name, "lvm") == 0 ||
...@@ -841,9 +841,26 @@ static struct bdev *bdev_get(const char *type) ...@@ -841,9 +841,26 @@ static struct bdev *bdev_get(const char *type)
return bdev; return bdev;
} }
static const struct bdev_type *bdev_query(const char *src) static const struct bdev_type *get_bdev_by_name(const char *name)
{ {
int i; int i;
for (i = 0; i < numbdevs; i++) {
if (strcmp(bdevs[i].name, name) == 0)
return &bdevs[i];
}
ERROR("Backing store %s unknown but not caught earlier\n", name);
return NULL;
}
static const struct bdev_type *bdev_query(struct lxc_conf *conf, const char *src)
{
int i;
if (conf->rootfs.bdev)
return get_bdev_by_name(conf->rootfs.bdev);
for (i = 0; i < numbdevs; i++) { for (i = 0; i < numbdevs; i++) {
int r; int r;
r = bdevs[i].ops->detect(src); r = bdevs[i].ops->detect(src);
......
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