@Override public void rollback(FlowRollback trigger, Map data) { final ParamOut out = (ParamOut) data.get(ParamOut.class); if (out.getBackupStorageInstallPath() != null) { DeleteBitsOnBackupStorageMsg msg = new DeleteBitsOnBackupStorageMsg(); msg.setInstallPath(out.getBackupStorageInstallPath()); msg.setBackupStorageUuid(paramIn.getBackupStorageUuid()); bus.makeTargetServiceIdByResourceUuid(msg, BackupStorageConstant.SERVICE_ID, paramIn.getBackupStorageUuid()); bus.send(msg); } trigger.rollback(); } });
@Override public void run(final FlowTrigger trigger, Map data) { final ParamOut out = (ParamOut) data.get(ParamOut.class); CreateTemporaryVolumeFromSnapshotMsg msg = new CreateTemporaryVolumeFromSnapshotMsg(); msg.setPrimaryStorageUuid(paramIn.getPrimaryStorageUuid()); msg.setSnapshot(paramIn.getSnapshot()); msg.setTemporaryVolumeUuid(paramIn.getImage().getUuid()); msg.setHypervisorType(hvtype.toString()); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid()); bus.send(msg, new CloudBusCallBack(trigger) { @Override public void run(MessageReply reply) { if (!reply.isSuccess()) { trigger.fail(reply.getError()); } else { CreateTemporaryVolumeFromSnapshotReply r = reply.castReply(); ctx.tempInstallPath = r.getInstallPath(); out.setActualSize(r.getActualSize()); out.setSize(r.getSize()); trigger.next(); } } }); }
ParamIn paramIn = new ParamIn(); paramIn.setPrimaryStorageUuid(currentRoot.getPrimaryStorageUuid()); paramIn.setSnapshot(currentLeaf.getInventory()); paramIn.setImage(ImageInventory.valueOf(dbf.findByUuid(msg.getImageUuid(), ImageVO.class))); WorkflowTemplate workflowTemplate = ext.createTemplateFromVolumeSnapshot(paramIn);
WorkflowTemplate template = new WorkflowTemplate(); final HypervisorType hvtype = VolumeFormat.getMasterHypervisorTypeByVolumeFormat(paramIn.getSnapshot().getFormat());
@Override public WorkflowTemplate createTemplateFromVolumeSnapshot(final ParamIn paramIn) { WorkflowTemplate template = new WorkflowTemplate(); final HypervisorType hvType = VolumeFormat.getMasterHypervisorTypeByVolumeFormat(paramIn.getSnapshot().getFormat());
ask.setImageUuid(paramIn.getImage().getUuid()); ask.setBackupStorageUuid(paramIn.getBackupStorageUuid()); ask.setImageMediaType(paramIn.getImage().getMediaType()); bus.makeTargetServiceIdByResourceUuid(ask, BackupStorageConstant.SERVICE_ID, paramIn.getBackupStorageUuid()); MessageReply ar = bus.call(ask); if (!ar.isSuccess()) { msg.setPrimaryStorageUuid(paramIn.getPrimaryStorageUuid()); msg.setPrimaryStorageInstallPath(paramIn.getSnapshot().getPrimaryStorageInstallPath()); msg.setBackupStorageUuid(paramIn.getBackupStorageUuid()); msg.setBackupStorageInstallPath(bsInstallPath); msg.setImageUuid(paramIn.getImage().getUuid()); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid()); bus.send(msg, new CloudBusCallBack(trigger) { @Override
ask.setImageUuid(paramIn.getImage().getUuid()); ask.setBackupStorageUuid(paramIn.getBackupStorageUuid()); ask.setImageMediaType(paramIn.getImage().getMediaType()); bus.makeTargetServiceIdByResourceUuid(ask, BackupStorageConstant.SERVICE_ID, paramIn.getBackupStorageUuid()); MessageReply ar = bus.call(ask); if (!ar.isSuccess()) { msg.setImageUuid(paramIn.getImage().getUuid()); msg.setPrimaryStorageUuid(paramIn.getPrimaryStorageUuid()); msg.setHypervisorType(hvType.toString()); msg.setPrimaryStorageInstallPath(paramIn.getSnapshot().getPrimaryStorageInstallPath()); msg.setBackupStorageUuid(paramIn.getBackupStorageUuid()); msg.setBackupStorageInstallPath(bsInstallPath); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid());
ask.setImageUuid(paramIn.getImage().getUuid()); ask.setBackupStorageUuid(paramIn.getBackupStorageUuid()); ask.setImageMediaType(paramIn.getImage().getMediaType()); bus.makeTargetServiceIdByResourceUuid(ask, BackupStorageConstant.SERVICE_ID, paramIn.getBackupStorageUuid()); MessageReply ar = bus.call(ask); if (!ar.isSuccess()) { msg.setPrimaryStorageUuid(paramIn.getPrimaryStorageUuid()); msg.setPrimaryStorageInstallPath(ctx.tempInstallPath); msg.setBackupStorageUuid(paramIn.getBackupStorageUuid()); msg.setBackupStorageInstallPath(bsInstallPath); msg.setImageUuid(paramIn.getImage().getUuid()); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid());
@Override public void run(final FlowTrigger trigger, final Map data) { BackupStorageAskInstallPathMsg ask = new BackupStorageAskInstallPathMsg(); ask.setBackupStorageUuid(paramIn.getBackupStorageUuid()); ask.setImageMediaType(paramIn.getImage().getMediaType()); ask.setImageUuid(paramIn.getImage().getUuid()); bus.makeTargetServiceIdByResourceUuid(ask, BackupStorageConstant.SERVICE_ID, paramIn.getBackupStorageUuid()); MessageReply areply = bus.call(ask); if (!areply.isSuccess()) { msg.setHostUuid(ctx.hostUuid); msg.setPrimaryStorageInstallPath(ctx.temporaryInstallPath); msg.setPrimaryStorageUuid(paramIn.getPrimaryStorageUuid()); msg.setBackupStorageUuid(paramIn.getBackupStorageUuid()); msg.setBackupStorageInstallPath(bsInstallPath); msg.setImageUuid(paramIn.getImage().getUuid()); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid());
@Override public void run(final FlowTrigger trigger, final Map data) { CreateTemporaryVolumeFromSnapshotMsg msg = new CreateTemporaryVolumeFromSnapshotMsg(); msg.setHypervisorType(hvType.toString()); msg.setPrimaryStorageUuid(paramIn.getPrimaryStorageUuid()); msg.setTemporaryVolumeUuid(paramIn.getImage().getUuid()); msg.setSnapshot(paramIn.getSnapshot()); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid()); bus.send(msg, new CloudBusCallBack(trigger) { @Override public void run(MessageReply reply) { if (!reply.isSuccess()) { trigger.fail(reply.getError()); } else { ParamOut paramOut = (ParamOut) data.get(ParamOut.class); CreateTemporaryVolumeFromSnapshotReply ar = reply.castReply(); ctx.temporaryInstallPath = ar.getInstallPath(); paramOut.setSize(ar.getSize()); paramOut.setActualSize(ar.getActualSize()); trigger.next(); } } }); }
@Override public void run(final FlowTrigger trigger, final Map data) { CreateTemporaryVolumeFromSnapshotMsg msg = new CreateTemporaryVolumeFromSnapshotMsg(); msg.setSnapshot(paramIn.getSnapshot()); msg.setPrimaryStorageUuid(paramIn.getPrimaryStorageUuid()); msg.setImageUuid(paramIn.getImage().getUuid()); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid()); bus.send(msg, new CloudBusCallBack(trigger) { @Override public void run(MessageReply reply) { if (!reply.isSuccess()) { trigger.fail(reply.getError()); } else { ParamOut out = (ParamOut) data.get(ParamOut.class); CreateTemporaryVolumeFromSnapshotReply r = reply.castReply(); out.setActualSize(r.getActualSize()); out.setSize(r.getSize()); ctx.temporaryInstallPath = r.getInstallPath(); ctx.hostUuid = r.getHostUuid(); trigger.next(); } } }); }
ask.setImageUuid(paramIn.getImage().getUuid()); ask.setBackupStorageUuid(paramIn.getBackupStorageUuid()); ask.setImageMediaType(paramIn.getImage().getMediaType()); bus.makeTargetServiceIdByResourceUuid(ask, BackupStorageConstant.SERVICE_ID, paramIn.getBackupStorageUuid()); MessageReply ar = bus.call(ask); if (!ar.isSuccess()) { msg.setPrimaryStorageUuid(paramIn.getPrimaryStorageUuid()); msg.setPrimaryStorageInstallPath(paramIn.getSnapshot().getPrimaryStorageInstallPath()); msg.setBackupStorageUuid(paramIn.getBackupStorageUuid()); msg.setBackupStorageInstallPath(bsInstallPath); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid());
@Override public void run(final FlowTrigger trigger, final Map data) { SyncVolumeSizeMsg msg = new SyncVolumeSizeMsg(); msg.setVolumeUuid(paramIn.getSnapshot().getVolumeUuid()); bus.makeTargetServiceIdByResourceUuid(msg, VolumeConstant.SERVICE_ID, paramIn.getSnapshot().getVolumeUuid()); bus.send(msg, new CloudBusCallBack(trigger) { @Override public void run(MessageReply reply) { if (reply.isSuccess()) { ParamOut paramOut = (ParamOut) data.get(ParamOut.class); SyncVolumeSizeReply gr = reply.castReply(); paramOut.setActualSize(gr.getActualSize()); paramOut.setSize(gr.getSize()); trigger.next(); } else { trigger.fail(reply.getError()); } } }); } });
@Override public void run(final FlowTrigger trigger, final Map data) { markTaskStage(parentStage, CREATE_TEMPORARY_TEMPLATE_STAGE); SyncVolumeSizeMsg msg = new SyncVolumeSizeMsg(); msg.setVolumeUuid(paramIn.getSnapshot().getVolumeUuid()); bus.makeTargetServiceIdByResourceUuid(msg, VolumeConstant.SERVICE_ID, paramIn.getSnapshot().getVolumeUuid()); bus.send(msg, new CloudBusCallBack(trigger) { @Override public void run(MessageReply reply) { if (reply.isSuccess()) { ParamOut paramOut = (ParamOut) data.get(ParamOut.class); SyncVolumeSizeReply gr = reply.castReply(); paramOut.setActualSize(gr.getActualSize()); paramOut.setSize(gr.getSize()); trigger.next(); } else { trigger.fail(reply.getError()); } } }); } });
@Override public void rollback(FlowRollback trigger, Map data) { if (ctx.temporaryInstallPath != null) { LocalStorageDirectlyDeleteBitsMsg msg = new LocalStorageDirectlyDeleteBitsMsg(); msg.setPrimaryStorageUuid(paramIn.getPrimaryStorageUuid()); msg.setHostUuid(ctx.hostUuid); msg.setPath(ctx.temporaryInstallPath); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid()); bus.send(msg); } trigger.rollback(); } });
@Override public void rollback(FlowRollback trigger, Map data) { final ParamOut out = (ParamOut) data.get(ParamOut.class); if (out.getBackupStorageInstallPath() != null) { DeleteBitsOnBackupStorageMsg msg = new DeleteBitsOnBackupStorageMsg(); msg.setInstallPath(out.getBackupStorageInstallPath()); msg.setBackupStorageUuid(paramIn.getBackupStorageUuid()); bus.makeTargetServiceIdByResourceUuid(msg, BackupStorageConstant.SERVICE_ID, paramIn.getBackupStorageUuid()); bus.send(msg); } trigger.rollback(); } });
@Override public void rollback(FlowRollback trigger, Map data) { if (ctx.tempInstallPath != null) { DeleteVolumeBitsOnPrimaryStorageMsg msg = new DeleteVolumeBitsOnPrimaryStorageMsg(); msg.setPrimaryStorageUuid(paramIn.getPrimaryStorageUuid()); msg.setInstallPath(ctx.tempInstallPath); msg.setHypervisorType(hvtype.toString()); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid()); bus.send(msg); } trigger.rollback(); } });
@Override public void rollback(FlowRollback trigger, Map data) { if (ctx.temporaryInstallPath != null) { DeleteVolumeBitsOnPrimaryStorageMsg msg = new DeleteVolumeBitsOnPrimaryStorageMsg(); msg.setHypervisorType(hvType.toString()); msg.setPrimaryStorageUuid(paramIn.getPrimaryStorageUuid()); msg.setInstallPath(ctx.temporaryInstallPath); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid()); bus.send(msg); } trigger.rollback(); } });
@Override public void rollback(FlowRollback trigger, Map data) { final ParamOut out = (ParamOut) data.get(ParamOut.class); if (out.getBackupStorageInstallPath() != null) { DeleteBitsOnBackupStorageMsg msg = new DeleteBitsOnBackupStorageMsg(); msg.setInstallPath(out.getBackupStorageInstallPath()); msg.setBackupStorageUuid(paramIn.getBackupStorageUuid()); bus.makeTargetServiceIdByResourceUuid(msg, BackupStorageConstant.SERVICE_ID, paramIn.getBackupStorageUuid()); bus.send(msg); } trigger.rollback(); } });
@Override public void rollback(FlowRollback trigger, Map data) { ParamOut out = (ParamOut) data.get(ParamOut.class); if (out.getBackupStorageInstallPath() != null) { DeleteBitsOnBackupStorageMsg msg = new DeleteBitsOnBackupStorageMsg(); msg.setBackupStorageUuid(paramIn.getBackupStorageUuid()); msg.setInstallPath(out.getBackupStorageInstallPath()); bus.makeTargetServiceIdByResourceUuid(msg, BackupStorageConstant.SERVICE_ID, paramIn.getBackupStorageUuid()); bus.send(msg); } trigger.rollback(); } });