com.cloud.resource.ResourceManager.listAllUpAndEnabledHosts()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中com.cloud.resource.ResourceManager.listAllUpAndEnabledHosts方法的一些代码示例,展示了ResourceManager.listAllUpAndEnabledHosts的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceManager.listAllUpAndEnabledHosts方法的具体详情如下:
包路径:com.cloud.resource.ResourceManager
类名称:ResourceManager
方法名:listAllUpAndEnabledHosts

ResourceManager.listAllUpAndEnabledHosts介绍

暂无

代码示例

代码示例来源:origin: apache/cloudstack

private HostVO waitForHostConnect(long dcId, long podId, long clusterId, String guid) {
  for (int i = 0; i < _waitTime * 2; i++) {
    List<HostVO> hosts = _resourceMgr.listAllUpAndEnabledHosts(Host.Type.Routing, clusterId, podId, dcId);
    for (HostVO host : hosts) {
      if (host.getGuid().toLowerCase().startsWith(guid.toLowerCase())) {
        return host;
      }
    }
    try {
      Thread.sleep(30000);
    } catch (InterruptedException e) {
      s_logger.debug("Failed to sleep: " + e.toString());
    }
  }
  s_logger.debug("Timeout, to wait for the host connecting to mgt svr, assuming it is failed");
  List<HostVO> hosts = _resourceMgr.findHostByGuid(dcId, guid);
  if (hosts.size() == 1) {
    return hosts.get(0);
  } else {
    return null;
  }
}

代码示例来源:origin: apache/cloudstack

hostsCopy.retainAll(_hostDao.listByHostTag(type, clusterId, podId, dcId, hostTag));
} else {
  hostsCopy.retainAll(_resourceMgr.listAllUpAndEnabledHosts(type, clusterId, podId, dcId));

代码示例来源:origin: apache/cloudstack

hosts = _hostDao.listByHostTag(type, clusterId, podId, dcId, hostTag);
} else {
  hosts = _resourceMgr.listAllUpAndEnabledHosts(type, clusterId, podId, dcId);

代码示例来源:origin: apache/cloudstack

@Override
public boolean attachCluster(DataStore dataStore, ClusterScope scope) {
  PrimaryDataStoreInfo primarystore = (PrimaryDataStoreInfo)dataStore;
  List<HostVO> hosts =
      _resourceMgr.listAllUpAndEnabledHosts(Host.Type.Routing, primarystore.getClusterId(), primarystore.getPodId(), primarystore.getDataCenterId());
  for (HostVO host : hosts) {
    try {
      _storageMgr.connectHostToSharedPool(host.getId(), dataStore.getId());
    } catch (Exception e) {
      s_logger.warn("Unable to establish a connection between " + host + " and " + dataStore, e);
    }
  }
  _dataStoreHelper.attachCluster(dataStore);
  return true;
}

代码示例来源:origin: apache/cloudstack

@Override
public Answer sendTo(final Long dcId, final HypervisorType type, final Command cmd) {
  final List<ClusterVO> clusters = _clusterDao.listByDcHyType(dcId, type.toString());
  int retry = 0;
  for (final ClusterVO cluster : clusters) {
    final List<HostVO> hosts = _resourceMgr.listAllUpAndEnabledHosts(Host.Type.Routing, cluster.getId(), null, dcId);
    for (final HostVO host : hosts) {
      retry++;
      if (retry > _retry) {
        return null;
      }
      Answer answer = null;
      try {
        final long targetHostId = _hvGuruMgr.getGuruProcessedCommandTargetHost(host.getId(), cmd);
        answer = easySend(targetHostId, cmd);
      } catch (final Exception e) {
      }
      if (answer != null) {
        return answer;
      }
    }
  }
  return null;
}

代码示例来源:origin: apache/cloudstack

List<HostVO> pxes = _resourceMgr.listAllUpAndEnabledHosts(Host.Type.BaremetalPxe, null, cmd.getPodId(), zoneId);
if (pxes.size() != 0) {
  throw new IllegalArgumentException("Already had a PXE server in Pod: " + cmd.getPodId() + " zone: " + zoneId);

代码示例来源:origin: apache/cloudstack

List<HostVO> dhcps = _resourceMgr.listAllUpAndEnabledHosts(Host.Type.BaremetalDhcp, null, null, zoneId);
if (dhcps.size() != 0) {
  throw new IllegalArgumentException("Already had a DHCP server in zone: " + zoneId);

代码示例来源:origin: apache/cloudstack

Long zoneId = profile.getVirtualMachine().getDataCenterId();
Long podId = profile.getVirtualMachine().getPodIdToDeployIn();
List<HostVO> hosts = _resourceMgr.listAllUpAndEnabledHosts(Type.BaremetalDhcp, null, podId, zoneId);
if (hosts.size() == 0) {
  throw new CloudRuntimeException("No external Dhcp found in zone " + zoneId + " pod " + podId);

代码示例来源:origin: apache/cloudstack

List<HostVO> hosts;
for (ClusterVO cluster : clusters) {
  hosts = _resourceMgr.listAllUpAndEnabledHosts(Host.Type.Routing, cluster.getId(), cluster.getPodId(), cluster.getDataCenterId());
  if (hostTag != null) {
    for (HostVO h : hosts) {

相关文章