Skip to content

Management Server - Prepare for Maintenance and Cancel Maintenance improvements #10995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 21 additions & 11 deletions agent/src/main/java/com/cloud/agent/Agent.java
Original file line number Diff line number Diff line change
Expand Up @@ -453,22 +453,30 @@
certExecutor.schedule(new PostCertificateRenewalTask(this), 5, TimeUnit.SECONDS);
}

private void scheduleHostLBCheckerTask(final long checkInterval) {
private void scheduleHostLBCheckerTask(final String lbAlgorithm, final long checkInterval) {

Check warning on line 456 in agent/src/main/java/com/cloud/agent/Agent.java

View check run for this annotation

Codecov / codecov/patch

agent/src/main/java/com/cloud/agent/Agent.java#L456

Added line #L456 was not covered by tests
String name = "HostLBCheckerTask";
if (hostLbCheckExecutor != null && !hostLbCheckExecutor.isShutdown()) {
logger.info("Shutting down the preferred host checker task {}", name);

Check warning on line 459 in agent/src/main/java/com/cloud/agent/Agent.java

View check run for this annotation

Codecov / codecov/patch

agent/src/main/java/com/cloud/agent/Agent.java#L459

Added line #L459 was not covered by tests
hostLbCheckExecutor.shutdown();
try {
if (!hostLbCheckExecutor.awaitTermination(1, TimeUnit.SECONDS)) {
hostLbCheckExecutor.shutdownNow();
}
} catch (InterruptedException e) {
logger.debug("Forcing {} shutdown as it did not shutdown in the desired time due to: {}",
logger.debug("Forcing the preferred host checker task {} shutdown as it did not shutdown in the desired time due to: {}",

Check warning on line 466 in agent/src/main/java/com/cloud/agent/Agent.java

View check run for this annotation

Codecov / codecov/patch

agent/src/main/java/com/cloud/agent/Agent.java#L466

Added line #L466 was not covered by tests
name, e.getMessage());
hostLbCheckExecutor.shutdownNow();
}
}
if (checkInterval > 0L) {
logger.info("Scheduling preferred host task with host.lb.interval={}ms", checkInterval);
if ("shuffle".equalsIgnoreCase(lbAlgorithm)) {
logger.info("Scheduling the preferred host checker task to trigger once (to apply lb algorithm '{}') after host.lb.interval={} ms", lbAlgorithm, checkInterval);
hostLbCheckExecutor = Executors.newSingleThreadScheduledExecutor((new NamedThreadFactory(name)));
hostLbCheckExecutor.schedule(new PreferredHostCheckerTask(), checkInterval, TimeUnit.MILLISECONDS);
return;

Check warning on line 476 in agent/src/main/java/com/cloud/agent/Agent.java

View check run for this annotation

Codecov / codecov/patch

agent/src/main/java/com/cloud/agent/Agent.java#L473-L476

Added lines #L473 - L476 were not covered by tests
}

logger.info("Scheduling a recurring preferred host checker task with lb algorithm '{}' and host.lb.interval={} ms", lbAlgorithm, checkInterval);

Check warning on line 479 in agent/src/main/java/com/cloud/agent/Agent.java

View check run for this annotation

Codecov / codecov/patch

agent/src/main/java/com/cloud/agent/Agent.java#L479

Added line #L479 was not covered by tests
hostLbCheckExecutor = Executors.newSingleThreadScheduledExecutor((new NamedThreadFactory(name)));
hostLbCheckExecutor.scheduleAtFixedRate(new PreferredHostCheckerTask(), checkInterval, checkInterval,
TimeUnit.MILLISECONDS);
Expand Down Expand Up @@ -928,7 +936,7 @@
return new SetupCertificateAnswer(true);
}

private void processManagementServerList(final List<String> msList, final List<String> avoidMsList, final String lbAlgorithm, final Long lbCheckInterval) {
private void processManagementServerList(final List<String> msList, final List<String> avoidMsList, final String lbAlgorithm, final Long lbCheckInterval, final boolean triggerHostLB) {

Check warning on line 939 in agent/src/main/java/com/cloud/agent/Agent.java

View check run for this annotation

Codecov / codecov/patch

agent/src/main/java/com/cloud/agent/Agent.java#L939

Added line #L939 was not covered by tests
if (CollectionUtils.isNotEmpty(msList) && StringUtils.isNotEmpty(lbAlgorithm)) {
try {
final String newMSHosts = String.format("%s%s%s", com.cloud.utils.StringUtils.toCSVList(msList), IAgentShell.hostLbAlgorithmSeparator, lbAlgorithm);
Expand All @@ -941,22 +949,24 @@
}
}
shell.setAvoidHosts(avoidMsList);
if ("shuffle".equals(lbAlgorithm)) {
scheduleHostLBCheckerTask(0);
} else {
scheduleHostLBCheckerTask(shell.getLbCheckerInterval(lbCheckInterval));
if (triggerHostLB) {
logger.info("Triggering the preferred host checker task now");
ScheduledExecutorService hostLbExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("HostLB-Executor"));
hostLbExecutor.schedule(new PreferredHostCheckerTask(), 0, TimeUnit.MILLISECONDS);
hostLbExecutor.shutdown();

Check warning on line 956 in agent/src/main/java/com/cloud/agent/Agent.java

View check run for this annotation

Codecov / codecov/patch

agent/src/main/java/com/cloud/agent/Agent.java#L953-L956

Added lines #L953 - L956 were not covered by tests
}
scheduleHostLBCheckerTask(lbAlgorithm, shell.getLbCheckerInterval(lbCheckInterval));

Check warning on line 958 in agent/src/main/java/com/cloud/agent/Agent.java

View check run for this annotation

Codecov / codecov/patch

agent/src/main/java/com/cloud/agent/Agent.java#L958

Added line #L958 was not covered by tests
}

private Answer setupManagementServerList(final SetupMSListCommand cmd) {
processManagementServerList(cmd.getMsList(), cmd.getAvoidMsList(), cmd.getLbAlgorithm(), cmd.getLbCheckInterval());
processManagementServerList(cmd.getMsList(), cmd.getAvoidMsList(), cmd.getLbAlgorithm(), cmd.getLbCheckInterval(), cmd.getTriggerHostLb());

Check warning on line 962 in agent/src/main/java/com/cloud/agent/Agent.java

View check run for this annotation

Codecov / codecov/patch

agent/src/main/java/com/cloud/agent/Agent.java#L962

Added line #L962 was not covered by tests
return new SetupMSListAnswer(true);
}

private Answer migrateAgentToOtherMS(final MigrateAgentConnectionCommand cmd) {
try {
if (CollectionUtils.isNotEmpty(cmd.getMsList())) {
processManagementServerList(cmd.getMsList(), cmd.getAvoidMsList(), cmd.getLbAlgorithm(), cmd.getLbCheckInterval());
processManagementServerList(cmd.getMsList(), cmd.getAvoidMsList(), cmd.getLbAlgorithm(), cmd.getLbCheckInterval(), false);

Check warning on line 969 in agent/src/main/java/com/cloud/agent/Agent.java

View check run for this annotation

Codecov / codecov/patch

agent/src/main/java/com/cloud/agent/Agent.java#L969

Added line #L969 was not covered by tests
}
Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("MigrateAgentConnection-Job")).schedule(() -> {
migrateAgentConnection(cmd.getAvoidMsList());
Expand Down Expand Up @@ -1046,7 +1056,7 @@
}

verifyAgentArch(ready.getArch());
processManagementServerList(ready.getMsHostList(), ready.getAvoidMsHostList(), ready.getLbAlgorithm(), ready.getLbCheckInterval());
processManagementServerList(ready.getMsHostList(), ready.getAvoidMsHostList(), ready.getLbAlgorithm(), ready.getLbCheckInterval(), false);

Check warning on line 1059 in agent/src/main/java/com/cloud/agent/Agent.java

View check run for this annotation

Codecov / codecov/patch

agent/src/main/java/com/cloud/agent/Agent.java#L1059

Added line #L1059 was not covered by tests

logger.info("Ready command is processed for agent [id: {}, uuid: {}, name: {}]", getId(), getUuid(), getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class OperationTimedoutException extends CloudException {
boolean _isActive;

public OperationTimedoutException(Command[] cmds, long agentId, long seqId, int time, boolean isActive) {
super("Commands " + seqId + " to Host " + agentId + " timed out after " + time);
super("Commands " + seqId + " to Host " + agentId + " timed out after " + time + " secs");
_agentId = agentId;
_seqId = seqId;
_time = time;
Expand Down
7 changes: 5 additions & 2 deletions api/src/main/java/com/cloud/resource/ResourceState.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ public static Event toEvent(String e) {
}
}

public static List<ResourceState> s_maintenanceStates = List.of(ResourceState.Maintenance,
ResourceState.ErrorInMaintenance, ResourceState.PrepareForMaintenance,
ResourceState.ErrorInPrepareForMaintenance);

public ResourceState getNextState(Event a) {
return s_fsm.getNextState(this, a);
}
Expand All @@ -98,8 +102,7 @@ public static String[] toString(ResourceState... states) {
}

public static boolean isMaintenanceState(ResourceState state) {
return Arrays.asList(ResourceState.Maintenance, ResourceState.ErrorInMaintenance,
ResourceState.PrepareForMaintenance, ResourceState.ErrorInPrepareForMaintenance).contains(state);
return s_maintenanceStates.contains(state);
}

public static boolean canAttemptMaintenance(ResourceState state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ public class ApiConstants {
public static final String PUBLIC_END_PORT = "publicendport";
public static final String PUBLIC_ZONE = "publiczone";
public static final String PURGE_RESOURCES = "purgeresources";
public static final String REBALANCE = "rebalance";
public static final String RECEIVED_BYTES = "receivedbytes";
public static final String RECONNECT = "reconnect";
public static final String RECOVER = "recover";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class PatchSystemVMCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN,
description = "If true, initiates copy of scripts and restart of the agent, even if the scripts version matches." +
"To be used with ID parameter only")
private Boolean force;
private Boolean forced;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
Expand All @@ -58,7 +58,7 @@ public Long getId() {
}

public boolean isForced() {
return force != null && force;
return forced != null && forced;
}

/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@
private List<String> avoidMsList;
private String lbAlgorithm;
private Long lbCheckInterval;
private Boolean triggerHostLb;

public SetupMSListCommand(final List<String> msList, final List<String> avoidMsList, final String lbAlgorithm, final Long lbCheckInterval) {
public SetupMSListCommand(final List<String> msList, final List<String> avoidMsList, final String lbAlgorithm, final Long lbCheckInterval, final Boolean triggerHostLb) {
super();
this.msList = msList;
this.avoidMsList = avoidMsList;
this.lbAlgorithm = lbAlgorithm;
this.lbCheckInterval = lbCheckInterval;
this.triggerHostLb = triggerHostLb;

Check warning on line 40 in core/src/main/java/org/apache/cloudstack/agent/lb/SetupMSListCommand.java

View check run for this annotation

Codecov / codecov/patch

core/src/main/java/org/apache/cloudstack/agent/lb/SetupMSListCommand.java#L40

Added line #L40 was not covered by tests
}

public List<String> getMsList() {
Expand All @@ -54,9 +56,12 @@
return lbCheckInterval;
}

public boolean getTriggerHostLb() {
return triggerHostLb;
}

Check warning on line 61 in core/src/main/java/org/apache/cloudstack/agent/lb/SetupMSListCommand.java

View check run for this annotation

Codecov / codecov/patch

core/src/main/java/org/apache/cloudstack/agent/lb/SetupMSListCommand.java#L59-L61

Added lines #L59 - L61 were not covered by tests

@Override
public boolean executeInSequence() {
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,5 @@ enum TapAgentsAction {

void propagateChangeToAgents(Map<String, String> params);

boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long timeoutDurationInMs);
boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long timeoutDurationInMs, boolean excludeHostsInMaintenance);
}
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,6 @@

_executor = new ThreadPoolExecutor(agentTaskThreads, agentTaskThreads, 60L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), new NamedThreadFactory("AgentTaskPool"));

initConnectExecutor();

maxConcurrentNewAgentConnections = RemoteAgentMaxConcurrentNewConnections.value();

_connection = new NioServer("AgentManager", Port.value(), Workers.value() + 10,
Expand Down Expand Up @@ -828,6 +826,7 @@
return true;
}

initConnectExecutor();

Check warning on line 829 in engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java#L829

Added line #L829 was not covered by tests
startDirectlyConnectedHosts(false);

if (_connection != null) {
Expand Down Expand Up @@ -2193,7 +2192,7 @@
}

@Override
public boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long timeoutDurationInMs) {
public boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long timeoutDurationInMs, boolean excludeHostsInMaintenance) {

Check warning on line 2195 in engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

engine/orchestration/src/main/java/com/cloud/agent/manager/AgentManagerImpl.java#L2195

Added line #L2195 was not covered by tests
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;

import com.cloud.resource.ResourceState;
import org.apache.cloudstack.ca.CAManager;
import org.apache.cloudstack.framework.config.ConfigDepot;
import org.apache.cloudstack.framework.config.ConfigKey;
Expand Down Expand Up @@ -431,10 +432,10 @@
ch = connectToPeer(peer, ch);
if (ch == null) {
try {
logD(bytes, "Unable to route to peer: " + Request.parse(bytes));
logD(bytes, "Unable to establish connection to route to peer: " + Request.parse(bytes));

Check warning on line 435 in engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java#L435

Added line #L435 was not covered by tests
} catch (ClassNotFoundException | UnsupportedVersionException e) {
// Request.parse thrown exception when we try to log it, log as much as we can
logD(bytes, "Unable to route to peer, and Request.parse further caught exception" + e.getMessage());
logD(bytes, "Unable to establish connection to route to peer, and Request.parse further caught exception" + e.getMessage());

Check warning on line 438 in engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java#L438

Added line #L438 was not covered by tests
}
return false;
}
Expand Down Expand Up @@ -643,7 +644,6 @@
final Link link = task.getLink();

if (Request.fromServer(data)) {

final AgentAttache agent = findAttache(hostId);

if (Request.isControl(data)) {
Expand Down Expand Up @@ -691,7 +691,6 @@
cancel(Long.toString(Request.getManagementServerId(data)), hostId, Request.getSequence(data), e.getMessage());
}
} else {

final long mgmtId = Request.getManagementServerId(data);
if (mgmtId != -1 && mgmtId != _nodeId) {
routeToPeer(Long.toString(mgmtId), data);
Expand Down Expand Up @@ -1352,7 +1351,7 @@
if (cmd instanceof PrepareForMaintenanceManagementServerHostCommand) {
logger.debug("Received PrepareForMaintenanceManagementServerHostCommand - preparing for maintenance");
try {
managementServerMaintenanceManager.prepareForMaintenance(((PrepareForMaintenanceManagementServerHostCommand) cmd).getLbAlgorithm());
managementServerMaintenanceManager.prepareForMaintenance(((PrepareForMaintenanceManagementServerHostCommand) cmd).getLbAlgorithm(), ((PrepareForMaintenanceManagementServerHostCommand) cmd).isForced());

Check warning on line 1354 in engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java#L1354

Added line #L1354 was not covered by tests
return "Successfully prepared for maintenance";
} catch(CloudRuntimeException e) {
return e.getMessage();
Expand Down Expand Up @@ -1399,14 +1398,14 @@
}

@Override
public boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long timeoutDurationInMs) {
public boolean transferDirectAgentsFromMS(String fromMsUuid, long fromMsId, long timeoutDurationInMs, boolean excludeHostsInMaintenance) {

Check warning on line 1401 in engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java#L1401

Added line #L1401 was not covered by tests
if (timeoutDurationInMs <= 0) {
logger.debug("Not transferring direct agents from management server node {} (id: {}) to other nodes, invalid timeout duration", fromMsId, fromMsUuid);
return false;
}

long transferStartTimeInMs = System.currentTimeMillis();
if (CollectionUtils.isEmpty(getDirectAgentHosts(fromMsId))) {
if (CollectionUtils.isEmpty(getDirectAgentHosts(fromMsId, excludeHostsInMaintenance))) {
logger.info("No direct agent hosts available on management server node {} (id: {}), to transfer", fromMsId, fromMsUuid);
return true;
}
Expand All @@ -1421,7 +1420,7 @@
int agentTransferFailedCount = 0;
List<DataCenterVO> dataCenterList = dcDao.listAll();
for (DataCenterVO dc : dataCenterList) {
List<HostVO> directAgentHostsInDc = getDirectAgentHostsInDc(fromMsId, dc.getId());
List<HostVO> directAgentHostsInDc = getDirectAgentHostsInDc(fromMsId, dc.getId(), excludeHostsInMaintenance);

Check warning on line 1423 in engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java#L1423

Added line #L1423 was not covered by tests
if (CollectionUtils.isEmpty(directAgentHostsInDc)) {
continue;
}
Expand Down Expand Up @@ -1455,9 +1454,10 @@
return (agentTransferFailedCount == 0);
}

private List<HostVO> getDirectAgentHosts(long msId) {
private List<HostVO> getDirectAgentHosts(long msId, boolean excludeHostsInMaintenance) {

Check warning on line 1457 in engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java#L1457

Added line #L1457 was not covered by tests
List<HostVO> directAgentHosts = new ArrayList<>();
List<HostVO> hosts = _hostDao.listHostsByMs(msId);
List<ResourceState> statesToExclude = excludeHostsInMaintenance ? ResourceState.s_maintenanceStates : List.of();
List<HostVO> hosts = _hostDao.listHostsByMsResourceState(msId, statesToExclude);

Check warning on line 1460 in engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java#L1460

Added line #L1460 was not covered by tests
for (HostVO host : hosts) {
AgentAttache agent = findAttache(host.getId());
if (agent instanceof DirectAgentAttache) {
Expand All @@ -1468,9 +1468,11 @@
return directAgentHosts;
}

private List<HostVO> getDirectAgentHostsInDc(long msId, long dcId) {
private List<HostVO> getDirectAgentHostsInDc(long msId, long dcId, boolean excludeHostsInMaintenance) {

Check warning on line 1471 in engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java#L1471

Added line #L1471 was not covered by tests
List<HostVO> directAgentHosts = new ArrayList<>();
List<HostVO> hosts = _hostDao.listHostsByMsAndDc(msId, dcId);
// To exclude maintenance states use values from ResourceState as source of truth
List<ResourceState> statesToExclude = excludeHostsInMaintenance ? ResourceState.s_maintenanceStates : List.of();
List<HostVO> hosts = _hostDao.listHostsByMsDcResourceState(msId, dcId, statesToExclude);

Check warning on line 1475 in engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java#L1475

Added line #L1475 was not covered by tests
for (HostVO host : hosts) {
AgentAttache agent = findAttache(host.getId());
if (agent instanceof DirectAgentAttache) {
Expand Down Expand Up @@ -1506,6 +1508,10 @@
public void onManagementServerCancelPreparingForMaintenance() {
logger.debug("Management server cancel preparing for maintenance");
super.onManagementServerPreparingForMaintenance();

// needed for the case when Management Server in Preparing For Maintenance but didn't go to Maintenance state
// (where this variable will be reset)
_agentLbHappened = false;

Check warning on line 1514 in engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java

View check run for this annotation

Codecov / codecov/patch

engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java#L1514

Added line #L1514 was not covered by tests
}

@Override
Expand Down
18 changes: 14 additions & 4 deletions engine/schema/src/main/java/com/cloud/host/dao/HostDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,24 @@ public interface HostDao extends GenericDao<HostVO, Long>, StateDao<Status, Stat

List<HostVO> listHostsByMsAndDc(long msId, long dcId);

List<HostVO> listHostsByMsDcResourceState(long msId, long dcId, List<ResourceState> excludedResourceStates);

List<HostVO> listHostsByMs(long msId);

List<HostVO> listHostsByMsResourceState(long msId, List<ResourceState> excludedResourceStates);

/**
* Retrieves the number of hosts/agents this {@see ManagementServer} has responsibility over.
* @param msId the id of the {@see ManagementServer}
* @return the number of hosts/agents this {@see ManagementServer} has responsibility over
* Count Hosts by given Management Server, Host and Hypervisor Types,
* and exclude Hosts with given Resource States.
*
* @param msId Management Server Id
* @param excludedResourceStates Resource States to be excluded
* @param hostTypes Host Types
* @param hypervisorTypes Hypervisor Types
* @return Hosts count
*/
int countByMs(long msId);
int countHostsByMsResourceStateTypeAndHypervisorType(long msId, List<ResourceState> excludedResourceStates,
List<Type> hostTypes, List<HypervisorType> hypervisorTypes);

/**
* Retrieves the host ids/agents this {@see ManagementServer} has responsibility over.
Expand Down
Loading
Loading