def __init__(
         self, parent_storage_obj: m.SnapshotStorage,
         children_snapshot_storage_objs: typing.List[m.SnapshotStorage]):
     super(MergeWork, self).__init__()
     self.parent_storage: storage.Storage = storage.Storage(
         parent_storage_obj) if parent_storage_obj else None
     self.children_snapshot_storage: typing.List[storage.Storage] = [
         storage.Storage(_) for _ in children_snapshot_storage_objs
     ]
     self.new_storage: storage.Storage = self._create_or_get_new_storage()
Exemple #2
0
 def children_storages(self) -> typing.List[storage.Storage]:
     if not self.journal_obj.children_idents:
         return list()
     return [
         storage.Storage(da_storage.get_obj_by_ident(ident))
         for ident in self.journal_obj.children_idents.split(',')
     ]
 def __init__(
         self, parent_storage_obj: m.SnapshotStorage,
         merge_storage_obj: m.SnapshotStorage,
         children_snapshot_storage_objs: typing.List[m.SnapshotStorage]):
     # 校验入参数据
     if parent_storage_obj is None:  # 被合并的快照是根节点
         assert len(children_snapshot_storage_objs) == 1  # 子节点的数量必须为 1
         assert merge_storage_obj.parent_ident is None
     else:
         assert merge_storage_obj.parent_ident == parent_storage_obj.ident
     for child in children_snapshot_storage_objs:
         assert child.parent_ident == merge_storage_obj.parent_ident
     # 构造
     self.merge_storage: storage.Storage = storage.Storage(
         merge_storage_obj)
     super(MergeQcowSnapshotTypeAWork,
           self).__init__(parent_storage_obj,
                          children_snapshot_storage_objs)
 def __init__(
         self, parent_storage_obj: m.SnapshotStorage,
         merge_storage_obj: m.SnapshotStorage,
         children_snapshot_storage_objs: typing.List[m.SnapshotStorage],
         storage_tree: tree.DiskSnapshotStorageTree, call_name: str):
     # 校验入参数据
     assert merge_storage_obj.parent_ident == parent_storage_obj.ident
     assert merge_storage_obj.image_path != parent_storage_obj.image_path
     for child in children_snapshot_storage_objs:
         assert child.parent_ident == merge_storage_obj.parent_ident
         assert child.image_path != merge_storage_obj.image_path
     # 构造
     self.merge_storage: storage.Storage = storage.Storage(
         merge_storage_obj)
     super(MergeQcowSnapshotTypeBWork,
           self).__init__(parent_storage_obj,
                          children_snapshot_storage_objs)
     call_name += f' MergeQcowSnapshotTypeBWork {self.new_storage.ident}'
     self.write_chain: chain.StorageChainForWrite = self._create_write_chain(
         storage_tree, call_name)
 def __init__(
         self, parent_storage_obj: m.SnapshotStorage,
         merge_cdp_snapshot_storage_objs: typing.List[m.SnapshotStorage],
         children_snapshot_storage_objs: typing.List[m.SnapshotStorage],
         storage_tree: tree.DiskSnapshotStorageTree, call_name: str):
     # 校验入参数据
     assert len(merge_cdp_snapshot_storage_objs) > 0
     assert merge_cdp_snapshot_storage_objs[
         0].parent_ident == parent_storage_obj.ident
     for child in children_snapshot_storage_objs:
         assert child.parent_ident == children_snapshot_storage_objs[
             -1].parent_ident
     # 构造
     super(MergeCdpWork, self).__init__(parent_storage_obj,
                                        children_snapshot_storage_objs)
     self.merge_cdp_snapshot_storages: typing.List[storage.Storage] = [
         storage.Storage(_) for _ in merge_cdp_snapshot_storage_objs
     ]
     call_name += f' MergeCdpWork {self.new_storage.ident}'
     self.rw_chain: chain.StorageChainForRW = self._create_rw_chain(
         storage_tree, call_name)