swh.objstorage.backends.winery.pools module#
- class swh.objstorage.backends.winery.pools.Pool(*args, **kwargs)[source]#
Bases:
Protocol- image_exists(image: str) bool[source]#
Check whether the named image exists (it does not have to be mapped)
- image_mapped(image: str) Literal['ro', 'rw'] | None[source]#
Check whether the image is already mapped, read-only or read-write
- image_create(image: str) None[source]#
Create a new image named image and allocate the right amount of space.
- image_map(image: str, options: str) None[source]#
Map an image for use. Options can be “ro” to map the image read-only, or “rw” to map the image read-write.
- class swh.objstorage.backends.winery.pools.RBDPool(shard_max_size: int, rbd_use_sudo: bool = True, rbd_pool_name: str = 'shards', rbd_data_pool_name: str | None = None, rbd_image_features_unsupported: Tuple[str, ...] = (), rbd_map_options: str = '')[source]#
Bases:
PoolManage a Ceph RBD pool for Winery shards.
- Parameters:
shard_max_size – max size of shard contents
rbd_use_sudo – whether to use sudo for rbd commands
rbd_pool_name – name of the pool used for RBD images (metadata)
rbd_data_pool_name – name of the pool used for RBD images (data)
rbd_image_features_unsupported – features not supported by the kernel mounting the rbd images
rbd_map_options – options to pass to
rbd device map, e.g.ms_mode=prefer-secureto connect to a ceph cluster with encryption enabled
- POOL_CONFIG: Tuple[str, ...] = ('shard_max_size', 'rbd_use_sudo', 'rbd_pool_name', 'rbd_data_pool_name', 'rbd_image_features_unsupported', 'rbd_map_options')#
- classmethod from_kwargs(**kwargs) RBDPool[source]#
Create a Pool from a set of arbitrary keyword arguments
- run(*cmd: str) Iterable[str][source]#
Run the given command, and return its output as lines.
Return: the standard output of the run command
Raises: CalledProcessError if the command doesn’t exit with exit code 0.
- image_exists(image: str)[source]#
Check whether the named image exists (it does not have to be mapped)
- image_create(image: str)[source]#
Create a new image named image and allocate the right amount of space.
- class swh.objstorage.backends.winery.pools.FileBackedPool(base_directory: Path, pool_name: str, shard_max_size: int)[source]#
Bases:
PoolFile-backed pool for Winery shards mimicking a Ceph RBD pool.
Unmapped images are represented by setting the file permission to 0o000.
- image_exists(image: str) bool[source]#
Check whether the named image exists (it does not have to be mapped)
- image_create(image: str) None[source]#
Create a new image named image and allocate the right amount of space.
- image_map(image: str, options: str) None[source]#
Map an image for use. Options can be “ro” to map the image read-only, or “rw” to map the image read-write.
- swh.objstorage.backends.winery.pools.pool_from_settings(shards_settings: Shards, shards_pool_settings: ShardsPool) Pool[source]#
Return a Pool from the settings