Using python for the configuration file is powerfull but require duplication - for example, here we duplicate the value of BASE_DIR and the name of the backend:
BASE_DIR = "/path/to/base-dir"
BACKENDS = {
"block-4k": LoopDevice(
base_dir=BASE_DIR,
name="block-4k",
size=GiB,
sector_size=4096,
),
...
}
Add option to configure using yaml:
base_dir: /path/to/base-dir
backends:
block-4k:
backend: "loop",
size: 1073741824
sector_size: 4096
...
And json:
{
"base_dir": "/path/to/base-dir",
"backends": {
"block-4k": {
"backend": "loop",
"size": 1073741824,
"sector_size": 4096
}
}
}
Internally both formats return the same python dict, so supporting both cost nothing. yaml is shorter, easier to write and can include comments.
Not sure how stacked backeends should be described in yaml/json:
file-4k:
backend: file
mount:
backend: mount
backend: loop
size: 1073741824
sector_size: 4096
...
This should translate to:
{
"file-4k": File(
Mount(
LoopDevice(
base_dir=BASE_DIR,
name="file-4k",
size=1073741824,
sector_size=5096,
),
),
),
}
Using python for the configuration file is powerfull but require duplication - for example, here we duplicate the value of BASE_DIR and the name of the backend:
Add option to configure using yaml:
And json:
{ "base_dir": "/path/to/base-dir", "backends": { "block-4k": { "backend": "loop", "size": 1073741824, "sector_size": 4096 } } }Internally both formats return the same python dict, so supporting both cost nothing. yaml is shorter, easier to write and can include comments.
Not sure how stacked backeends should be described in yaml/json:
This should translate to:
{ "file-4k": File( Mount( LoopDevice( base_dir=BASE_DIR, name="file-4k", size=1073741824, sector_size=5096, ), ), ), }