raise ValueError("namespace {} is not in mirror image mode".format(
ioctx.get_namespace()))
+
def group_validator(group: rbd.Group) -> None:
try:
info = group.mirror_group_get_info()
if info['image_mode'] != rbd.RBD_MIRROR_IMAGE_MODE_SNAPSHOT:
raise rbd.InvalidArgument("Invalid mirror group mode")
+
class GroupSpec(NamedTuple):
pool_id: str
namespace: str
self.handler.MODULE_OPTION_NAME_MAX_CONCURRENT_GROUP_SNAP_CREATE)
self.log.debug("GroupCreateSnapshotRequests.add: {}/{}/{} "
- "max concurrent snap create {}".format(
- pool_id, namespace, group_id, max_concurrent))
+ "max concurrent snap create {}".format(pool_id,
+ namespace,
+ group_id,
+ max_concurrent))
with self.lock:
if group_spec in self.pending:
self.finish(group_spec)
return
- if not info['primary'] :
+ if not info['primary']:
self.log.debug(
"GroupCreateSnapshotRequests.handle_get_mirror_info: "
"{}/{}/{}: {}".format(
pool_id: Optional[str],
namespace: Optional[str],
image_id: Optional[str] = None,
- group_id: Optional [str] = None) -> None:
+ group_id: Optional[str] = None) -> None:
if image_id is not None and group_id is not None:
raise ValueError("LevelSpec cannot have both image_id and group_id")
self.name = name
except rbd.InvalidArgument:
raise ValueError(
"group {} is not in snapshot mirror mode".format(
- group_id))
+ group_id))
else:
image_name = match.group(3)
try:
with rbd.Image(ioctx, image_name,
- read_only=True) as image:
+ read_only=True) as image:
image_id = image.id()
id += "/" + image_id
if image_validator:
image_id = match.group(3)
try:
with rbd.Image(ioctx, image_id=image_id,
- read_only=True) as image:
+ read_only=True) as image:
image_name = image.get_name()
name += image_name
if image_validator:
except rbd.ImageNotFound:
raise ValueError(
"image {} does not exist".format(
- image_id))
+ image_id))
except rbd.InvalidArgument:
raise ValueError(
"image {} is not in snapshot mirror mode".format(