protected VmInstanceInventory getSelfInventory() { return VmInstanceInventory.valueOf(self); }
public static List<VmInstanceInventory> valueOf(Collection<VmInstanceVO> vos) { List<VmInstanceInventory> invs = new ArrayList<VmInstanceInventory>(vos.size()); for (VmInstanceVO vo : vos) { invs.add(VmInstanceInventory.valueOf(vo)); } return invs; }
@Override public void handle(Map data) { self = dbf.reload(self); evt.setInventory(VmInstanceInventory.valueOf(self)); bus.publish(evt); } }).error(new FlowErrorHandler(msg) {
private List<VmDeletionStruct> toVmDeletionStruct(Collection<VmInstanceVO> vos) { List<VmDeletionStruct> structs = new ArrayList<>(); for (VmInstanceVO vo : vos) { VmDeletionStruct s = new VmDeletionStruct(); s.setInventory(VmInstanceInventory.valueOf(vo)); s.setDeletionPolicy(deletionPolicyManager.getDeletionPolicy(vo.getUuid())); structs.add(s); } return structs; }
@Override public void handle(Map data) { self = changeVmStateInDb(VmInstanceStateEvent.running); VmInstanceInventory inv = VmInstanceInventory.valueOf(self); extEmitter.afterRebootVm(inv); completion.success(); } }).error(new FlowErrorHandler(completion) {
private void handle(APIGetDataVolumeAttachableVmMsg msg) { APIGetDataVolumeAttachableVmReply reply = new APIGetDataVolumeAttachableVmReply(); if (volumeIsAttached(msg.getVolumeUuid())) { reply.setInventories(VmInstanceInventory.valueOf(new ArrayList<>())); } else { reply.setInventories(VmInstanceInventory.valueOf(getCandidateVmForAttaching(msg.getSession().getAccountUuid()))); } bus.reply(msg, reply); }
private void handle(APIListVmInstanceMsg msg) { List<VmInstanceVO> vos = dl.listByApiMessage(msg, VmInstanceVO.class); List<VmInstanceInventory> invs = VmInstanceInventory.valueOf(vos); APIListVmInstanceReply reply = new APIListVmInstanceReply(); reply.setInventories(invs); bus.reply(msg, reply); }
@Override public void success() { RebootVmInstanceReply reply = new RebootVmInstanceReply(); VmInstanceInventory inv = VmInstanceInventory.valueOf(self); reply.setInventory(inv); bus.reply(msg, reply); chain.next(); }
@Override public void success() { StopVmInstanceReply reply = new StopVmInstanceReply(); VmInstanceInventory inv = VmInstanceInventory.valueOf(self); reply.setInventory(inv); bus.reply(msg, reply); chain.next(); }
@Override public void success() { VmInstanceInventory inv = VmInstanceInventory.valueOf(self); StartVmInstanceReply reply = new StartVmInstanceReply(); reply.setInventory(inv); bus.reply(msg, reply); taskChain.next(); }
@Override public void success() { APIStopVmInstanceEvent evt = new APIStopVmInstanceEvent(msg.getId()); VmInstanceInventory inv = VmInstanceInventory.valueOf(self); evt.setInventory(inv); bus.publish(evt); taskChain.next(); }
@Override public void success() { APIPauseVmInstanceEvent evt = new APIPauseVmInstanceEvent(msg.getId()); VmInstanceInventory inv = VmInstanceInventory.valueOf(self); evt.setInventory(inv); bus.publish(evt); taskChain.next(); }
@Override public void success() { VmInstanceInventory inv = VmInstanceInventory.valueOf(self); APIStartVmInstanceEvent evt = new APIStartVmInstanceEvent(msg.getId()); evt.setInventory(inv); bus.publish(evt); taskChain.next(); }
@Override public void success() { APIResumeVmInstanceEvent evt = new APIResumeVmInstanceEvent(msg.getId()); VmInstanceInventory inv = VmInstanceInventory.valueOf(self); evt.setInventory(inv); bus.publish(evt); taskChain.next(); }
@Override public void run(MessageReply reply) { if (reply.isSuccess()) { event.setInventory(VmInstanceInventory.valueOf(self)); } else { event.setError(reply.getError()); } bus.publish(event); } });
@Override public void success() { APIRebootVmInstanceEvent evt = new APIRebootVmInstanceEvent(msg.getId()); VmInstanceInventory inv = VmInstanceInventory.valueOf(self); evt.setInventory(inv); bus.publish(evt); taskChain.next(); }
@Override public void handle(Map data) { self = changeVmStateInDb(VmInstanceStateEvent.stopped, ()->{ self.setLastHostUuid(self.getHostUuid()); self.setHostUuid(null); }); VmInstanceInventory inv = VmInstanceInventory.valueOf(self); extEmitter.afterStopVm(inv); completion.success(); } }).error(new FlowErrorHandler(completion) {
@Override public void handle(ErrorCode errCode, Map data) { extEmitter.failedToStartNewCreatedVm(VmInstanceInventory.valueOf(self), errCode); dbf.remove(self); InstantiateNewCreatedVmInstanceReply reply = new InstantiateNewCreatedVmInstanceReply(); reply.setError(errCode); reply.setSuccess(false); bus.reply(msg, reply); taskChain.next(); } }).start();
@Override public void handle(final ErrorCode errCode, Map data) { extEmitter.failedToStartNewCreatedVm(VmInstanceInventory.valueOf(self), errCode); dbf.remove(self); // clean up EO, otherwise API-retry may cause conflict if // the resource uuid is set try { dbf.eoCleanup(VmInstanceVO.class, CollectionDSL.list(self.getUuid())); } catch (Exception e) { logger.warn(e.getMessage()); } completion.fail(operr(errCode, errCode.getDetails())); } }).start();
@Override public void handle(Map data) { self = dbf.reload(self); evt.setInventory(VmInstanceInventory.valueOf(self)); bus.publish(evt); VmNicInventory vmNicInventory = (VmNicInventory) data.get(vmNicInvKey); VmNicCanonicalEvents.VmNicEventData vmNicEventData = new VmNicCanonicalEvents.VmNicEventData(); vmNicEventData.setCurrentStatus(self.getState().toString()); String vmNicAccountUuid = acntMgr.getOwnerAccountUuidOfResource(vmNicInventory.getUuid()); vmNicEventData.setAccountUuid(vmNicAccountUuid); vmNicEventData.setInventory(vmNicInventory); evtf.fire(VmNicCanonicalEvents.VM_NIC_CREATED_PATH, vmNicEventData); } }).error(new FlowErrorHandler(msg) {