@Override public void processConnect(final Host host, final StartupCommand cmd, final boolean forRebalance) { if (host.getType().equals(Host.Type.TrafficMonitor) || host.getType().equals(Host.Type.SecondaryStorage)) { return; } // NOTE: We don't use pingBy here because we're initiating. _pingMap.put(host.getId(), InaccurateClock.getTimeInSeconds()); }
private List<Host> getAllAgentBasedHosts() { final List<HostVO> allHosts = hostDao.listAll(); if (allHosts == null) { return new ArrayList<>(); } final List <Host> agentBasedHosts = new ArrayList<>(); for (final Host host : allHosts) { if (host == null || host.getResourceState() != ResourceState.Enabled) { continue; } if (host.getType() == Host.Type.Routing || host.getType() == Host.Type.ConsoleProxy || host.getType() == Host.Type.SecondaryStorage || host.getType() == Host.Type.SecondaryStorageVM) { if (host.getHypervisorType() != null && host.getHypervisorType() != Hypervisor.HypervisorType.KVM && host.getHypervisorType() != Hypervisor.HypervisorType.LXC) { continue; } agentBasedHosts.add(host); } } return agentBasedHosts; }
private void configure(Host host) { hostId = host.getId(); hostAddress = host.getPrivateIpAddress(); publicAddress = host.getPublicIpAddress(); if (Host.Type.SecondaryStorageVM == host.getType()) { String vmName = host.getName(); SecondaryStorageVmVO ssvm = vmDao.findByInstanceName(vmName); if (ssvm != null) { publicAddress = ssvm.getPublicIpAddress(); } } }
final Type hostType = srcHost.getType(); Pair<List<HostVO>, Integer> allHostsPair = null; List<HostVO> allHosts = null;
@Override public boolean resourceStateTransitTo(final Host host, final ResourceState.Event event, final long msId) throws NoTransitionException { final ResourceState currentState = host.getResourceState(); final ResourceState nextState = currentState.getNextState(event); if (nextState == null) { throw new NoTransitionException("No next resource state found for current state = " + currentState + " event = " + event); } // TO DO - Make it more granular and have better conversion into capacity type if(host.getType() == Type.Routing){ final CapacityState capacityState = nextState == ResourceState.Enabled ? CapacityState.Enabled : CapacityState.Disabled; final short[] capacityTypes = {Capacity.CAPACITY_TYPE_CPU, Capacity.CAPACITY_TYPE_MEMORY}; _capacityDao.updateCapacityState(null, null, null, host.getId(), capacityState.toString(), capacityTypes); final StoragePoolVO storagePool = _storageMgr.findLocalStorageOnHost(host.getId()); if(storagePool != null){ final short[] capacityTypesLocalStorage = {Capacity.CAPACITY_TYPE_LOCAL_STORAGE}; _capacityDao.updateCapacityState(null, null, null, storagePool.getId(), capacityState.toString(), capacityTypesLocalStorage); } } return _hostDao.updateResourceState(currentState, event, nextState, host); }
throw new InvalidParameterValueException("Unable to find the host to migrate the VM, host id=" + getHostId()); if (destinationHost.getType() != Host.Type.Routing) { throw new InvalidParameterValueException("The specified host(" + destinationHost.getName() + ") is not suitable to migrate the VM, please specify another one");
if (host == null || host.getType() != Host.Type.Routing) { continue;
if (host == null || host.getType() != Host.Type.Routing) { continue;