@Override public void deleteHook() { logger.debug(String.format("Host: %s is being deleted", self.getName())); }
@Override public void changeStateHook(HostState current, HostStateEvent stateEvent, HostState next) { logger.debug(String.format("Host: %s changed state from %s to %s by %s", self.getName(), current, next, stateEvent)); }
@Override public void maintenanceHook(Completion completion) { logger.debug(String.format("Host: %s entered maintenance mode", self.getName())); completion.success(); }
@Override public void next(List<HostVO> candidates) { DebugUtils.Assert(candidates != null, "cannot pass null to next() method"); DebugUtils.Assert(!candidates.isEmpty(), "cannot pass empty candidates to next() method"); result = candidates; VmInstanceInventory vm = allocationSpec.getVmInstance(); logger.debug(String.format("[Host Allocation]: flow[%s] successfully found %s candidate hosts for vm[uuid:%s, name:%s]", lastFlow.getClass().getName(), result.size(), vm.getUuid(), vm.getName())); if (logger.isTraceEnabled()) { StringBuilder sb = new StringBuilder("[Host Allocation Details]:"); for (HostVO vo : result) { sb.append(String.format("\ncandidate host[name:%s, uuid:%s, zoneUuid:%s, clusterUuid:%s, hypervisorType:%s]", vo.getName(), vo.getUuid(), vo.getZoneUuid(), vo.getClusterUuid(), vo.getHypervisorType())); } logger.trace(sb.toString()); } if (it.hasNext()) { runFlow(it.next()); return; } done(); }
@Override public void handle(Map data) { HostInventory inv = factory.getHostInventory(vo.getUuid()); logger.debug(String.format("successfully added host[name:%s, hypervisor:%s, uuid:%s]", vo.getName(), vo.getHypervisorType(), vo.getUuid())); completion.success(inv); } }).error(new FlowErrorHandler(amsg) {
@Override public void connectHook(ConnectHostInfo info, Completion complete) { for (SimulatorConnectExtensionPoint sc : pluginRegty.getExtensionList(SimulatorConnectExtensionPoint.class)) { String err = sc.connect(conn); if (err != null) { logger.warn(err); complete.fail(operr(err)); return; } } logger.debug(String.format("Host: %s is connected", self.getName())); complete.success(); }
protected void checkStatus() { if (HostStatus.Connected != self.getStatus()) { ErrorCode cause = err(HostErrors.HOST_IS_DISCONNECTED, "host[uuid:%s, name:%s] is in status[%s], cannot perform required operation", self.getUuid(), self.getName(), self.getStatus()); throw new OperationFailureException(err(HostErrors.OPERATION_FAILURE_GC_ELIGIBLE, cause, "unable to do the operation because the host is in status of Disconnected")); } }
protected void checkState() { if (HostState.PreMaintenance == self.getState() || HostState.Maintenance == self.getState()) { throw new OperationFailureException(operr("host[uuid:%s, name:%s] is in state[%s], cannot perform required operation", self.getUuid(), self.getName(), self.getState())); } }
self = dbf.updateAndRefresh(self); logger.debug(String.format("Host %s [uuid:%s] changed connection state from %s to %s", self.getName(), self.getUuid(), before, next));
protected HostVO(HostVO vo) { this.setClusterUuid(vo.getClusterUuid()); this.setStatus(vo.getStatus()); this.setCreateDate(vo.getCreateDate()); this.setDescription(vo.getDescription()); this.setHypervisorType(vo.getHypervisorType()); this.setLastOpDate(vo.getLastOpDate()); this.setManagementIp(vo.getManagementIp()); this.setName(vo.getName()); this.setState(vo.getState()); this.setUuid(vo.getUuid()); this.setZoneUuid(vo.getZoneUuid()); this.setCapacity(vo.getCapacity()); } }
hostOS, self.getUuid(), self.getName(), self.getManagementIp(), rsp.getLibvirtVersion(), rsp.getQemuVersion()));
protected HostInventory(HostVO vo) { this.setStatus(vo.getStatus().toString()); this.setCreateDate(vo.getCreateDate()); this.setDescription(vo.getDescription()); this.setHypervisorType(vo.getHypervisorType()); this.setLastOpDate(vo.getLastOpDate()); this.setManagementIp(vo.getManagementIp()); this.setName(vo.getName()); this.setState(vo.getState().toString()); this.setUuid(vo.getUuid()); this.setZoneUuid(vo.getZoneUuid()); this.setClusterUuid(vo.getClusterUuid()); if (vo.getCapacity() != null) { this.setTotalCpuCapacity(vo.getCapacity().getTotalCpu()); this.setAvailableCpuCapacity(vo.getCapacity().getAvailableCpu()); this.setTotalMemoryCapacity(vo.getCapacity().getTotalMemory()); this.setAvailableMemoryCapacity(vo.getCapacity().getAvailableMemory()); this.setCpuSockets(vo.getCapacity().getCpuSockets()); this.setCpuNum(vo.getCapacity().getCpuNum()); } }
throw new OperationFailureException(err(SysErrors.NO_CAPABILITY_ERROR, "kvm host[uuid:%s, name:%s, ip:%s] doesn't not support live snapshot. please stop vm[uuid:%s] and try again", self.getUuid(), self.getName(), self.getManagementIp(), msg.getVmUuid() ));