private void getStartingCandidateHosts(final NeedReplyMessage msg, final ReturnValueCompletion completion) { refreshVO(); ErrorCode err = validateOperationByState(msg, self.getState(), SysErrors.OPERATION_ERROR); if (err != null) { throw new OperationFailureException(err); } final DesignatedAllocateHostMsg amsg = new DesignatedAllocateHostMsg(); amsg.setCpuCapacity(self.getCpuNum()); amsg.setMemoryCapacity(self.getMemorySize()); amsg.setVmInstance(VmInstanceInventory.valueOf(self)); amsg.setServiceId(bus.makeLocalServiceId(HostAllocatorConstant.SERVICE_ID)); amsg.setAllocatorStrategy(self.getAllocatorStrategy()); amsg.setVmOperation(VmOperation.Start.toString()); if (self.getImageUuid() != null && dbf.findByUuid(self.getImageUuid(), ImageVO.class) != null) { amsg.setImage(ImageInventory.valueOf(dbf.findByUuid(self.getImageUuid(), ImageVO.class))); } amsg.setL3NetworkUuids(VmNicHelper.getL3Uuids(VmNicInventory.valueOf(self.getVmNics()))); amsg.setDryRun(true); amsg.setListAllHosts(true); bus.send(amsg, new CloudBusCallBack(completion) { @Override public void run(MessageReply re) { if (!re.isSuccess()) { completion.fail(re.getError()); } else { completion.success(re); } } }); }
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()); }