protected boolean isHostOwnerSwitched(final HostVO host) { if (host.getStatus() == Status.Up && host.getManagementServerId() != null && host.getManagementServerId() != _nodeId) { return true; } return false; }
public String getPeerName(final long agentHostId) { final HostVO host = _hostDao.findById(agentHostId); if (host != null && host.getManagementServerId() != null) { if (_clusterMgr.getSelfPeerName().equals(Long.toString(host.getManagementServerId()))) { return null; } return Long.toString(host.getManagementServerId()); } return null; }
public String getPeerName(final long agentHostId) { final HostVO host = _hostDao.findById(agentHostId); if (host != null && host.getManagementServerId() != null) { if (_clusterMgr.getSelfPeerName().equals(Long.toString(host.getManagementServerId()))) { return null; } return Long.toString(host.getManagementServerId()); } return null; }
private void checkHostReservations() { List<PlannerHostReservationVO> reservedHosts = _plannerHostReserveDao.listAllReservedHosts(); for (PlannerHostReservationVO hostReservation : reservedHosts) { HostVO host = _hostDao.findById(hostReservation.getHostId()); if (host != null && host.getManagementServerId() != null && host.getManagementServerId() == _nodeId) { checkHostReservationRelease(hostReservation.getHostId()); } } }
QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class); sc.and(sc.entity().getType(), Op.EQ, Host.Type.Routing); sc.and(sc.entity().getManagementServerId(), Op.EQ, msId); List<HostVO> allHosts = sc.list(); sc.and(sc.entity().getManagementServerId(), Op.EQ, msId); sc.and(sc.entity().getType(), Op.EQ, Host.Type.Routing); sc.and(sc.entity().getStatus(), Op.EQ, Status.Up);
@Override @DB public boolean processAnswers(long agentId, long seq, Answer[] answers) { /* * Do not collect Direct Network usage stats if the Traffic Monitor is not owned by this mgmt server */ HostVO host = _hostDao.findById(agentId); if (host != null) { if ((host.getManagementServerId() == null) || (mgmtSrvrId != host.getManagementServerId())) { s_logger.warn("Not the owner. Not collecting Direct Network usage from TrafficMonitor : " + agentId); return false; } } else { s_logger.warn("Agent not found. Not collecting Direct Network usage from TrafficMonitor : " + agentId); return false; } GlobalLock scanLock = GlobalLock.getInternLock("direct.network.usage.collect" + host.getDataCenterId()); try { if (scanLock.lock(10)) { try { return collectDirectNetworkUsage(host); } finally { scanLock.unlock(); } } } finally { scanLock.releaseRef(); } return false; }
final List<ManagementServerHostVO> allMS = _mshostDao.listBy(ManagementServerHost.State.Up); final QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class); sc.and(sc.entity().getManagementServerId(), Op.NNULL); sc.and(sc.entity().getType(), Op.EQ, Host.Type.Routing); final List<HostVO> allManagedAgents = sc.list();
sc.and(sc.entity().getManagementServerId(), Op.NNULL); sc.and(sc.entity().getType(), Op.EQ, Host.Type.Routing); final List<HostVO> allManagedRoutingAgents = sc.list();
if (newStatus.checkManagementServer()) { sb.and("ping", sb.entity().getLastPinged(), SearchCriteria.Op.EQ); sb.and().op("nullmsid", sb.entity().getManagementServerId(), SearchCriteria.Op.NULL); sb.or("msid", sb.entity().getManagementServerId(), SearchCriteria.Op.EQ); sb.cp(); if (newStatus.checkManagementServer()) { sc.setParameters("ping", oldPingTime); sc.setParameters("msid", host.getManagementServerId()); ub.set(host, _msIdAttr, null); } else { ub.set(host, _msIdAttr, host.getManagementServerId()); str.append("; New=[status=").append(newStatus.toString()).append(":msid=").append(newStatus.lostConnection() ? "null" : host.getManagementServerId()) .append(":lastpinged=").append(host.getLastPinged()).append("]"); str.append("; Old=[status=").append(oldStatus.toString()).append(":msid=").append(host.getManagementServerId()).append(":lastpinged=").append(oldPingTime) .append("]"); str.append("; DB=[status=").append(vo.getStatus().toString()).append(":msid=").append(vo.getManagementServerId()).append(":lastpinged=").append(vo.getLastPinged())
if (host == null || host.getManagementServerId() == null || host.getManagementServerId() != ManagementServerNode.getManagementServerId()) { s_logger.debug("Skip router pair (" + router0.getInstanceName() + "," + router1.getInstanceName() + ") due to not belong to this mgmt server"); continue;
if (host == null || host.getState() != Status.Up) { continue; } else if (host.getManagementServerId() != ManagementServerNode.getManagementServerId()) {
MsStatusSearch.and("ms", MsStatusSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ); MsStatusSearch.and("type", MsStatusSearch.entity().getType(), SearchCriteria.Op.EQ); MsStatusSearch.and("resourceState", MsStatusSearch.entity().getResourceState(), SearchCriteria.Op.NIN); DirectlyConnectedSearch.and("ms", DirectlyConnectedSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ); DirectlyConnectedSearch.and("statuses", DirectlyConnectedSearch.entity().getStatus(), SearchCriteria.Op.EQ); DirectlyConnectedSearch.and("resourceState", DirectlyConnectedSearch.entity().getResourceState(), SearchCriteria.Op.NOTIN); UnmanagedDirectConnectSearch.and("server", UnmanagedDirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL); UnmanagedDirectConnectSearch.and("lastPinged", UnmanagedDirectConnectSearch.entity().getLastPinged(), SearchCriteria.Op.LTEQ); UnmanagedDirectConnectSearch.and("resourceStates", UnmanagedDirectConnectSearch.entity().getResourceState(), SearchCriteria.Op.NIN); DirectConnectSearch.and("resource", DirectConnectSearch.entity().getResource(), SearchCriteria.Op.NNULL); DirectConnectSearch.and("id", DirectConnectSearch.entity().getId(), SearchCriteria.Op.EQ); DirectConnectSearch.and().op("nullserver", DirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL); DirectConnectSearch.or("server", DirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ); DirectConnectSearch.cp(); DirectConnectSearch.done(); UnmanagedApplianceSearch.and("server", UnmanagedApplianceSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL); UnmanagedApplianceSearch.and("types", UnmanagedApplianceSearch.entity().getType(), SearchCriteria.Op.IN); UnmanagedApplianceSearch.and("lastPinged", UnmanagedApplianceSearch.entity().getLastPinged(), SearchCriteria.Op.LTEQ); ManagedDirectConnectSearch.and("server", ManagedDirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL); ManagedDirectConnectSearch.done(); ManagedRoutingServersSearch.and("server", ManagedRoutingServersSearch.entity().getManagementServerId(), SearchCriteria.Op.NNULL); ManagedRoutingServersSearch.and("type", ManagedRoutingServersSearch.entity().getType(), SearchCriteria.Op.EQ); ManagedRoutingServersSearch.done();
joinHost.and("mgmtServerId", joinHost.entity().getManagementServerId(), Op.EQ); StateNetworkTypeSearch.join("host", joinHost, joinHost.entity().getId(), StateNetworkTypeSearch.entity().getHostId(), JoinType.INNER); StateNetworkTypeSearch.done(); joinHost2.and("mgmtServerId", joinHost2.entity().getManagementServerId(), Op.EQ); SearchByStateAndManagementServerId.join("host", joinHost2, joinHost2.entity().getId(), SearchByStateAndManagementServerId.entity().getHostId(), JoinType.INNER); SearchByStateAndManagementServerId.done();