@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(); } } }); }
msg.setPrimaryStorageUuid(paramIn.getPrimaryStorageUuid()); msg.setPrimaryStorageInstallPath(paramIn.getSnapshot().getPrimaryStorageInstallPath()); msg.setBackupStorageUuid(paramIn.getBackupStorageUuid()); msg.setBackupStorageInstallPath(bsInstallPath); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid());
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());
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
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());
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(); } } }); }
@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 run(FlowTrigger trigger, Map data) { DeleteVolumeBitsOnPrimaryStorageMsg msg = new DeleteVolumeBitsOnPrimaryStorageMsg(); msg.setHypervisorType(hvtype.toString()); msg.setPrimaryStorageUuid(paramIn.getPrimaryStorageUuid()); msg.setInstallPath(ctx.tempInstallPath); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid()); bus.send(msg); trigger.next(); } });
@Override public void run(FlowTrigger trigger, Map data) { LocalStorageDirectlyDeleteBitsMsg msg = new LocalStorageDirectlyDeleteBitsMsg(); msg.setHostUuid(ctx.hostUuid); msg.setPath(ctx.temporaryInstallPath); msg.setPrimaryStorageUuid(paramIn.getPrimaryStorageUuid()); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid()); bus.send(msg); trigger.next(); } });
@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 run(FlowTrigger trigger, Map data) { DeleteVolumeBitsOnPrimaryStorageMsg msg = new DeleteVolumeBitsOnPrimaryStorageMsg(); msg.setInstallPath(ctx.temporaryInstallPath); msg.setPrimaryStorageUuid(paramIn.getPrimaryStorageUuid()); msg.setHypervisorType(hvType.toString()); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, paramIn.getPrimaryStorageUuid()); bus.send(msg); trigger.next(); } });