@Override public void run(NeedReplyMessage msg, MessageReply reply) { ConnectHostMsg cmsg = (ConnectHostMsg) msg; if (!reply.isSuccess()) { logger.warn(String.format("failed to load host[uuid:%s], %s", cmsg.getHostUuid(), reply.getError())); } else { logger.debug(String.format("host[uuid:%s] load successfully", cmsg.getHostUuid())); } } });
@Override public String getHostUuid() { return getUuid(); } }
public static ConnectHostInfo fromConnectHostMsg(ConnectHostMsg msg) { ConnectHostInfo info = new ConnectHostInfo(); info.setNewAdded(msg.isNewAdd()); info.setStartPingTaskOnFailure(msg.isStartPingTaskOnFailure()); return info; } }
final List<ConnectHostMsg> msgs = new ArrayList<ConnectHostMsg>(hostsToLoad.size()); for (String uuid : hostsToLoad) { ConnectHostMsg connectMsg = new ConnectHostMsg(uuid); connectMsg.setNewAdd(false); connectMsg.setServiceId(serviceId); connectMsg.setStartPingTaskOnFailure(true); msgs.add(connectMsg);
@Override public void run(final FlowTrigger trigger, Map data) { ConnectHostMsg connectMsg = new ConnectHostMsg(vo.getUuid()); connectMsg.setNewAdd(true); connectMsg.setStartPingTaskOnFailure(false); bus.makeTargetServiceIdByResourceUuid(connectMsg, HostConstant.SERVICE_ID, hvo.getUuid()); bus.send(connectMsg, new CloudBusCallBack(trigger) { @Override public void run(MessageReply reply) { if (reply.isSuccess()) { trigger.next(); } else { trigger.fail(reply.getError()); } } }); } }).then(new NoRollbackFlow() {
ConnectHostMsg msg = new ConnectHostMsg(); msg.setNewAdd(false); msg.setUuid(huuid); bus.makeTargetServiceIdByResourceUuid(msg, HostConstant.SERVICE_ID, huuid); msgs.add(msg);
ConnectHostMsg connectMsg = new ConnectHostMsg(vo.getUuid()); connectMsg.setNewAdd(true); connectMsg.setStartPingTaskOnFailure(false);
@Override public void run(NeedReplyMessage msg, MessageReply reply) { ConnectHostMsg cmsg = (ConnectHostMsg) msg; if (!reply.isSuccess()) { logger.warn(String.format("failed to connect kvm host[uuid:%s], %s", cmsg.getHostUuid(), reply.getError())); } else { logger.debug(String.format("successfully to connect kvm host[uuid:%s]", cmsg.getHostUuid())); } } });