*/
flags = LXC_CLONE_SNAPSHOT | LXC_CLONE_KEEPMACADDR | LXC_CLONE_KEEPNAME |
LXC_CLONE_KEEPBDEVTYPE | LXC_CLONE_MAYBE_SNAPSHOT;
- if (storage_is_dir(c->lxc_conf, c->lxc_conf->rootfs.path)) {
+ if (storage_is_dir(c->lxc_conf)) {
ERROR("Snapshot of directory-backed container requested.");
ERROR("Making a copy-clone. If you do want snapshots, then");
ERROR("please create an aufs or overlay clone first, snapshot that");
return bdev;
}
-bool storage_is_dir(struct lxc_conf *conf, const char *path)
+bool storage_is_dir(struct lxc_conf *conf)
{
struct lxc_storage *orig;
+ char *type = conf->rootfs.bdev_type;
bool bret = false;
- orig = storage_init(conf, path, NULL, NULL);
+ if (type)
+ return (strcmp(type, "dir") == 0);
+
+ orig = storage_init(conf, conf->lxc_rootfs.path, NULL, NULL);
if (!orig)
return bret;
int flags;
};
-extern bool storage_is_dir(struct lxc_conf *conf, const char *path);
+/**
+ * storage_is_dir : Check whether the roots is a directory. This function will
+ * trust the config file. If the config file key
+ * lxc.rootfs.path is set to <storage type>:<container path>
+ * the confile parser will have split this into <storage type>
+ * and <container path> and set the <bdev_type> member in the
+ * lxc_rootfs struct to <storage type> and the <path> member
+ * will be set to a clean <container path> without the <storage
+ * type> prefix. This is the new, clean way of handling storage
+ * type specifications. If the <storage type> prefix is not
+ * detected liblxc will try to detect the storage type.
+ */
+extern bool storage_is_dir(struct lxc_conf *conf);
extern bool storage_can_backup(struct lxc_conf *conf);
/* Instantiate a lxc_storage object. The src is used to determine which blockdev