@Override public void rollback(final FlowRollback chain, Map data) { if (!data.containsKey(VmStartOnHypervisorFlow.class.getName())) { chain.rollback(); return; } final VmInstanceSpec spec = (VmInstanceSpec) data.get(VmInstanceConstant.Params.VmInstanceSpec.toString()); StopVmOnHypervisorMsg msg = new StopVmOnHypervisorMsg(); msg.setVmInventory(spec.getVmInventory()); msg.getVmInventory().setHostUuid(spec.getDestHost().getUuid()); bus.makeTargetServiceIdByResourceUuid(msg, HostConstant.SERVICE_ID, spec.getDestHost().getUuid()); bus.send(msg, new CloudBusCallBack(chain) { @Override public void run(MessageReply reply) { if (!reply.isSuccess()) { logger.warn(String.format("failed to stop vm[uuid:%s] on host[uuid:%s], %s", spec.getVmInventory().getUuid(), spec.getDestHost().getUuid(), reply.getError())); } chain.rollback(); } }); } }
@Override public void rollback(final FlowRollback trigger, Map data) { if (!data.containsKey(SUCCESS)) { trigger.rollback(); return; } final VmInstanceSpec spec = (VmInstanceSpec) data.get(VmInstanceConstant.Params.VmInstanceSpec.toString()); DestroyVmOnHypervisorMsg msg = new DestroyVmOnHypervisorMsg(); msg.setVmInventory(spec.getVmInventory()); msg.getVmInventory().setHostUuid(spec.getDestHost().getUuid()); bus.makeTargetServiceIdByResourceUuid(msg, HostConstant.SERVICE_ID, spec.getDestHost().getUuid()); bus.send(msg, new CloudBusCallBack(trigger) { @Override public void run(MessageReply reply) { if (!reply.isSuccess()) { logger.warn(String.format("failed to roll back vm[uuid:%s, name:%s] on host[uuid:%s, ip:%s], %s", spec.getVmInventory().getUuid(), spec.getVmInventory().getName(), spec.getDestHost().getUuid(), spec.getDestHost().getName(), reply.getError())); } trigger.rollback(); } }); } }
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
vm.setDefaultL3NetworkUuid(defaultL3Uuid); vm.setDescription("web server VM"); vm.setHostUuid(uuid()); vm.setHypervisorType("KVM"); vm.setImageUuid(uuid());
public VmInstanceInventory(VmInstanceInventory origin) { VmInstanceInventory inv; try { inv = (VmInstanceInventory) origin.clone(); } catch (CloneNotSupportedException e) { throw new CloudRuntimeException(e); } this.setClusterUuid(inv.getClusterUuid()); this.setCreateDate(inv.getCreateDate()); this.setDescription(inv.getDescription()); this.setHostUuid(inv.getHostUuid()); this.setHypervisorType(inv.getHypervisorType()); this.setImageUuid(inv.getImageUuid()); this.setInstanceOfferingUuid(inv.getInstanceOfferingUuid()); this.setLastHostUuid(inv.getLastHostUuid()); this.setLastOpDate(inv.getLastOpDate()); this.setName(inv.getName()); this.setRootVolumeUuid(inv.getRootVolumeUuid()); this.setState(inv.getState()); this.setType(inv.getType()); this.setUuid(inv.getUuid()); this.setZoneUuid(inv.getZoneUuid()); this.setAllVolumes(inv.getAllVolumes()); this.setVmNics(inv.getVmNics()); this.setInternalId(inv.getInternalId()); this.setCpuNum(inv.getCpuNum()); this.setCpuSpeed(inv.getCpuSpeed()); this.setMemorySize(inv.getMemorySize()); this.setAllocatorStrategy(inv.getAllocatorStrategy()); }
protected VmInstanceInventory(VmInstanceVO vo) { this.setUuid(vo.getUuid()); this.setName(vo.getName()); this.setDescription(vo.getDescription()); this.setZoneUuid(vo.getZoneUuid()); this.setClusterUuid(vo.getClusterUuid()); this.setImageUuid(vo.getImageUuid()); this.setHostUuid(vo.getHostUuid()); this.setLastHostUuid(vo.getLastHostUuid()); this.setInstanceOfferingUuid(vo.getInstanceOfferingUuid()); this.setType(vo.getType()); this.setHypervisorType(vo.getHypervisorType()); this.setCreateDate(vo.getCreateDate()); this.setLastOpDate(vo.getLastOpDate()); this.setState(vo.getState().toString()); this.setRootVolumeUuid(vo.getRootVolumeUuid()); this.setAllVolumes(VolumeInventory.valueOf(vo.getAllVolumes())); this.setVmNics(VmNicInventory.valueOf(vo.getVmNics())); this.setVmCdRoms(VmCdRomInventory.valueOf(vo.getVmCdRoms())); this.setInternalId(vo.getInternalId()); this.setDefaultL3NetworkUuid(vo.getDefaultL3NetworkUuid()); this.setCpuNum(vo.getCpuNum()); this.setCpuSpeed(vo.getCpuSpeed()); this.setMemorySize(vo.getMemorySize()); this.setAllocatorStrategy(vo.getAllocatorStrategy()); this.setPlatform(vo.getPlatform()); }