@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 protected void handle(final DeleteBitsOnBackupStorageMsg msg) { final DeleteBitsOnBackupStorageReply reply = new DeleteBitsOnBackupStorageReply(); if (!canDelete(msg.getInstallPath())) { //TODO: GC, the image is still referred, need to cleanup bus.reply(msg, reply); return; } DeleteCmd cmd = new DeleteCmd(); cmd.installPath = msg.getInstallPath(); httpCall(DELETE_IMAGE_PATH, cmd, DeleteRsp.class, new ReturnValueCompletion<DeleteRsp>(msg) { @Override public void fail(ErrorCode err) { //TODO GC, do not reply error reply.setError(err); bus.reply(msg, reply); } @Override public void success(DeleteRsp ret) { bus.reply(msg, reply); } }); }
DeleteBitsOnBackupStorageMsg msg = new DeleteBitsOnBackupStorageMsg(); msg.setBackupStorageUuid(backupStorageUuid); msg.setInstallPath(installPath); bus.makeTargetServiceIdByResourceUuid(msg, BackupStorageConstant.SERVICE_ID, msg.getBackupStorageUuid()); bus.send(msg, new CloudBusCallBack(completion) { @Override
public void run(final FlowTrigger trigger, Map data) { if (deletionPolicy == ImageDeletionPolicy.Direct) { DeleteBitsOnBackupStorageMsg dmsg = new DeleteBitsOnBackupStorageMsg(); dmsg.setBackupStorageUuid(ref.getBackupStorageUuid()); dmsg.setInstallPath(ref.getInstallPath());
@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) { if (deletionPolicy == ImageDeletionPolicy.Direct) { DeleteBitsOnBackupStorageMsg dmsg = new DeleteBitsOnBackupStorageMsg(); dmsg.setBackupStorageUuid(ref.getBackupStorageUuid()); dmsg.setInstallPath(ref.getInstallPath()); bus.makeTargetServiceIdByResourceUuid(dmsg, BackupStorageConstant.SERVICE_ID, dmsg.getBackupStorageUuid()); bus.send(dmsg, new CloudBusCallBack(trigger) { @Override
@Override protected void handle(final DeleteBitsOnBackupStorageMsg msg) { final DeleteBitsOnBackupStorageReply reply = new DeleteBitsOnBackupStorageReply(); if (!canDelete(msg.getInstallPath())) { //TODO: GC, the image is still referred, need to cleanup bus.reply(msg, reply); return; } DeleteCmd cmd = new DeleteCmd(); cmd.installPath = msg.getInstallPath(); httpCall(DELETE_IMAGE_PATH, cmd, DeleteRsp.class, new ReturnValueCompletion<DeleteRsp>(msg) { @Override public void fail(ErrorCode err) { //TODO GC, instead of error reply.setError(err); bus.reply(msg, reply); } @Override public void success(DeleteRsp ret) { bus.reply(msg, reply); } }); }
@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(); } });
DeleteBitsOnBackupStorageMsg dmsg = new DeleteBitsOnBackupStorageMsg(); dmsg.setBackupStorageUuid(ref.getBackupStorageUuid()); dmsg.setInstallPath(ref.getInstallPath()); bus.makeTargetServiceIdByResourceUuid(dmsg, BackupStorageConstant.SERVICE_ID, dmsg.getBackupStorageUuid()); bus.send(dmsg, new CloudBusCallBack(msg) { @Override
@Override public void success(DeleteResponse ret) { if (!ret.isSuccess()) { logger.warn(String.format("failed to delete bits[%s], schedule clean up, %s", msg.getInstallPath(), ret.getError())); //TODO GC } else { updateCapacity(ret.getTotalCapacity(), ret.getAvailableCapacity()); } bus.reply(msg, reply); }
@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 protected void handle(final DeleteBitsOnBackupStorageMsg msg) { final DeleteBitsOnBackupStorageReply reply = new DeleteBitsOnBackupStorageReply(); DeleteCmd cmd = new DeleteCmd(); cmd.uuid = self.getUuid(); cmd.setInstallUrl(msg.getInstallPath()); restf.asyncJsonPost(buildUrl(SftpBackupStorageConstant.DELETE_PATH), cmd, new JsonAsyncRESTCallback<DeleteResponse>(msg) { @Override public void fail(ErrorCode err) { reply.setError(err); bus.reply(msg, reply); } @Override public void success(DeleteResponse ret) { if (!ret.isSuccess()) { logger.warn(String.format("failed to delete bits[%s], schedule clean up, %s", msg.getInstallPath(), ret.getError())); //TODO GC } else { updateCapacity(ret.getTotalCapacity(), ret.getAvailableCapacity()); } bus.reply(msg, reply); } @Override public Class<DeleteResponse> getReturnClass() { return DeleteResponse.class; } }); }
@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(); } });
DeleteBitsOnBackupStorageMsg msg = new DeleteBitsOnBackupStorageMsg(); msg.setInstallPath(spec.getInstallPath()); msg.setBackupStorageUuid(self.getUuid()); bus.makeTargetServiceIdByResourceUuid(msg, BackupStorageConstant.SERVICE_ID, self.getUuid()); bus.send(msg, new CloudBusCallBack(coml) {
return; DeleteBitsOnBackupStorageMsg msg = new DeleteBitsOnBackupStorageMsg(); msg.setInstallPath(spec.getInstallPath()); msg.setBackupStorageUuid(self.getUuid()); bus.makeTargetServiceIdByResourceUuid(msg, BackupStorageConstant.SERVICE_ID, self.getUuid()); bus.send(msg, new CloudBusCallBack(completion) {