@Override public void run(FlowTrigger trigger, Map data) { ErrorCodeList errList = new ErrorCodeList(); new While<>(currentLeaf.getDescendants()).all((sp, whileCompletion) -> { Optional<VolumeSnapshotDeletionProtector> protector = pluginRgty.getExtensionList(VolumeSnapshotDeletionProtector.class).stream().filter(p -> p.getPrimaryStorageType().equals(primaryStorageType)) .findFirst();
final List<VolumeSnapshotInventory> children = new ArrayList<VolumeSnapshotInventory>(); for (VolumeSnapshotTree t : p.snapshotTrees) { children.addAll(t.getRoot().getDescendants());
@Override protected void scripts() { String psUuid = q(VolumeSnapshotVO.class) .select(VolumeSnapshotVO_.primaryStorageUuid) .eq(VolumeSnapshotVO_.uuid, currentRoot.getUuid()) .findValue(); if (psUuid != null) { ret.value = false; return; } // the snapshot is on neither primary storage, delete it and descendants List<String> uuids = currentLeaf.getDescendants().stream().map(VolumeSnapshotInventory::getUuid).collect(Collectors.toList()); if (!uuids.isEmpty()) { sql(VolumeSnapshotVO.class).in(VolumeSnapshotVO_.uuid, uuids).hardDelete(); } if (!q(VolumeSnapshotVO.class).eq(VolumeSnapshotVO_.treeUuid, currentRoot.getTreeUuid()).isExists()) { logger.debug(String.format("volume snapshot tree[uuid:%s] has no leaf, delete it", currentRoot.getTreeUuid())); sql(VolumeSnapshotTreeVO.class).eq(VolumeSnapshotTreeVO_.uuid, currentRoot.getTreeUuid()).hardDelete(); } ret.value = true; } }.execute();
for (VolumeSnapshotInventory inv : currentLeaf.getDescendants()) { if (inv.isLatest()) { ancestorOfLatest = true;
changeStatusOfSnapshots(StatusEvent.ready, currentLeaf.getDescendants(), new Completion(msg, completion) { @Override public void success() {
for (VolumeSnapshotInventory inv : currentLeaf.getDescendants()) { List<String> buuids = CollectionUtils.transformToList(inv.getBackupStorageRefs(), new Function<String, VolumeSnapshotBackupStorageRefInventory>() { @Override
@Override public void run(final FlowTrigger trigger, Map data) { final List<VolumeSnapshotPrimaryStorageDeletionMsg> pmsgs = CollectionUtils.transformToList(currentLeaf.getDescendants(), new Function<VolumeSnapshotPrimaryStorageDeletionMsg, VolumeSnapshotInventory>() { @Override public VolumeSnapshotPrimaryStorageDeletionMsg call(VolumeSnapshotInventory arg) {
@Override public void rollback(final FlowRollback trigger, Map data) { changeStatusOfSnapshots(StatusEvent.ready, currentLeaf.getDescendants(), new Completion(trigger) { @Override public void success() { trigger.rollback(); } @Override public void fail(ErrorCode errorCode) { trigger.rollback(); } }); } });
public void run(final FlowTrigger trigger, Map data) { changeStatusOfSnapshots(StatusEvent.delete, currentLeaf.getDescendants(), new Completion(trigger) { @Override public void success() { trigger.next(); } @Override public void fail(ErrorCode errorCode) { trigger.fail(errorCode); } }); }