本文整理汇总了Java中com.cloud.host.Status.Up方法的典型用法代码示例。如果您正苦于以下问题:Java Status.Up方法的具体用法?Java Status.Up怎么用?Java Status.Up使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.cloud.host.Status
的用法示例。
在下文中一共展示了Status.Up方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: investigate
import com.cloud.host.Status; //导入方法依赖的package包/类
protected Status investigate(final AgentAttache agent) {
final Long hostId = agent.getId();
final HostVO host = _hostDao.findById(hostId);
if (host != null && host.getType() != null && !host.getType().isVirtual()) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("checking if agent (" + hostId + ") is alive");
}
final Answer answer = easySend(hostId, new CheckHealthCommand());
if (answer != null && answer.getResult()) {
final Status status = Status.Up;
if (s_logger.isDebugEnabled()) {
s_logger.debug("agent (" + hostId + ") responded to checkHeathCommand, reporting that agent is " + status);
}
return status;
}
return _haMgr.investigate(hostId);
}
return Status.Alert;
}
示例2: reconnect
import com.cloud.host.Status; //导入方法依赖的package包/类
@Override
public boolean reconnect(final long hostId) {
final HostVO host;
host = _hostDao.findById(hostId);
if (host == null || host.getRemoved() != null) {
s_logger.warn("Unable to find host " + hostId);
return false;
}
if (host.getStatus() == Status.Disconnected) {
s_logger.info("Host is already disconnected, no work to be done");
return true;
}
if (host.getStatus() != Status.Up && host.getStatus() != Status.Alert && host.getStatus() != Status.Rebalancing) {
s_logger.info("Unable to disconnect host because it is not in the correct state: host=" + hostId + "; Status=" + host.getStatus());
return false;
}
final AgentAttache attache = findAttache(hostId);
if (attache == null) {
s_logger.info("Unable to disconnect host because it is not connected to this server: " + hostId);
return false;
}
disconnectWithoutInvestigation(attache, Event.ShutdownRequested);
return true;
}
示例3: startRouters
import com.cloud.host.Status; //导入方法依赖的package包/类
@Override
public List<DomainRouterVO> startRouters(final RouterDeploymentDefinition routerDeploymentDefinition) throws StorageUnavailableException, InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException {
final List<DomainRouterVO> runningRouters = new ArrayList<>();
for (DomainRouterVO router : routerDeploymentDefinition.getRouters()) {
boolean skip = false;
final State state = router.getState();
if (router.getHostId() != null && state != State.Running) {
final HostVO host = _hostDao.findById(router.getHostId());
if (host == null || host.getState() != Status.Up) {
skip = true;
}
}
if (!skip) {
if (state != State.Running) {
final Account caller = CallContext.current().getCallingAccount();
final User callerUser = _accountMgr.getActiveUser(CallContext.current().getCallingUserId());
router = startVirtualRouter(router, callerUser, caller, routerDeploymentDefinition.getParams());
}
if (router != null) {
runningRouters.add(router);
}
}
}
return runningRouters;
}
示例4: isVmAlive
import com.cloud.host.Status; //导入方法依赖的package包/类
@Override
public boolean isVmAlive(final VirtualMachine vm, final Host host) throws UnknownVM {
final Status status = isAgentAlive(host);
if (status == null) {
throw new UnknownVM();
}
if (status == Status.Up) {
return true;
} else {
throw new UnknownVM();
}
}
示例5: isVmAlive
import com.cloud.host.Status; //导入方法依赖的package包/类
@Override
public boolean isVmAlive(final com.cloud.vm.VirtualMachine vm, final Host host) throws UnknownVM {
final Status status = isAgentAlive(host);
if (status == null) {
throw new UnknownVM();
}
if (status == Status.Up) {
return true;
} else {
throw new UnknownVM();
}
}
示例6: checkPlanWithHostInDC
import com.cloud.host.Status; //导入方法依赖的package包/类
@Test
public void checkPlanWithHostInDC() throws InsufficientServerCapacityException {
ContainerClusterVO containerCluster = new ContainerClusterVO();
containerCluster.setServiceOfferingId(1L);
containerCluster.setNodeCount(0);
when(containerClusterDao.findById(1L)).thenReturn(containerCluster);
ServiceOfferingVO offering = new ServiceOfferingVO("test", 1, 500, 512, 0, 0, true, "test", null, false, true, "", true, null, true);
when(srvOfferingDao.findById(1L)).thenReturn(offering);
List<HostVO> hl = new ArrayList<HostVO>();
HostVO h1 = new HostVO(1L, "testHost1", Type.Routing, "", "", "", "", "", "", "", "", "", "", "", "", "", Status.Up, "1.0", "", new Date(), 1L, 1L, 1L, 1L, "", 1L,
StoragePoolType.Filesystem);
h1.setClusterId(1L);
h1.setUuid("uuid-test");
hl.add(h1);
when(resourceMgr.listAllHostsInOneZoneByType(Type.Routing, 1)).thenReturn(hl);
ClusterVO cluster = new ClusterVO(1L);
when(clusterDao.findById(1L)).thenReturn(cluster);
ClusterDetailsVO cluster_detail_cpu = new ClusterDetailsVO(1L, "cpuOvercommitRatio", "1");
when(clusterDetailsDao.findDetail(cluster.getId(), "cpuOvercommitRatio")).thenReturn(cluster_detail_cpu);
ClusterDetailsVO cluster_detail_ram = new ClusterDetailsVO(1L, "memoryOvercommitRatio", "1");
when(clusterDetailsDao.findDetail(cluster.getId(), "memoryOvercommitRatio")).thenReturn(cluster_detail_ram);
when(capacityMgr.checkIfHostHasCapacity(anyLong(), anyInt(), anyInt(), anyBoolean(), anyFloat(), anyFloat(), anyBoolean())).thenReturn(true);
when(dcDao.findById(1L)).thenReturn(new DataCenterVO(1L, "test-dc", "test-desc", "", "", "", "", "", "", 1L, NetworkType.Advanced, "", ""));
DeployDestination dd = ccManager.plan(1, 1);
Assert.assertEquals(dd.getDataCenter().getId(), 1L);
}
示例7: checkPlanWithHostInDCNoCapacity
import com.cloud.host.Status; //导入方法依赖的package包/类
@Test(expected = InsufficientServerCapacityException.class)
public void checkPlanWithHostInDCNoCapacity() throws InsufficientServerCapacityException {
ContainerClusterVO containerCluster = new ContainerClusterVO();
containerCluster.setServiceOfferingId(1L);
containerCluster.setNodeCount(0);
when(containerClusterDao.findById(1L)).thenReturn(containerCluster);
ServiceOfferingVO offering = new ServiceOfferingVO("test", 1, 500, 512, 0, 0, true, "test", null, false, true, "", true, VirtualMachine.Type.User, true);
when(srvOfferingDao.findById(1L)).thenReturn(offering);
List<HostVO> hl = new ArrayList<HostVO>();
HostVO h1 = new HostVO(1L, "testHost1", Type.Routing, "", "", "", "", "", "", "", "", "", "", "", "", "", Status.Up, "1.0", "", new Date(), 1L, 1L, 1L, 1L, "", 1L,
StoragePoolType.Filesystem);
h1.setClusterId(1L);
h1.setUuid("uuid-test");
hl.add(h1);
when(resourceMgr.listAllHostsInAllZonesByType(Type.Routing)).thenReturn(hl);
ClusterVO cluster = new ClusterVO(1L);
when(clusterDao.findById(1L)).thenReturn(cluster);
ClusterDetailsVO cluster_detail_cpu = new ClusterDetailsVO(1L, "cpuOvercommitRatio", "1");
when(clusterDetailsDao.findDetail(cluster.getId(), "cpuOvercommitRatio")).thenReturn(cluster_detail_cpu);
ClusterDetailsVO cluster_detail_ram = new ClusterDetailsVO(1L, "memoryOvercommitRatio", "1");
when(clusterDetailsDao.findDetail(cluster.getId(), "memoryOvercommitRatio")).thenReturn(cluster_detail_ram);
when(capacityMgr.checkIfHostHasCapacity(anyLong(), anyInt(), anyInt(), anyBoolean(), anyFloat(), anyFloat(), anyBoolean())).thenReturn(false);
when(dcDao.findById(1L)).thenReturn(new DataCenterVO(1L, "test-dc", "test-desc", "", "", "", "", "", "", 1L, NetworkType.Advanced, "", ""));
DeployDestination dd = ccManager.plan(1, 1);
}
示例8: isHostOwnerSwitched
import com.cloud.host.Status; //导入方法依赖的package包/类
protected boolean isHostOwnerSwitched(final HostVO host) {
if (host.getStatus() == Status.Up && host.getManagementServerId() != null && host.getManagementServerId() != _nodeId) {
return true;
}
return false;
}
示例9: ready
import com.cloud.host.Status; //导入方法依赖的package包/类
public void ready() {
_status = Status.Up;
}
示例10: isReady
import com.cloud.host.Status; //导入方法依赖的package包/类
public boolean isReady() {
return _status == Status.Up;
}
示例11: getState
import com.cloud.host.Status; //导入方法依赖的package包/类
@Override
public Status getState() {
return Status.Up;
}
示例12: getStatus
import com.cloud.host.Status; //导入方法依赖的package包/类
@Override
public Status getStatus() {
return Status.Up;
}
示例13: updateRoutersRedundantState
import com.cloud.host.Status; //导入方法依赖的package包/类
protected void updateRoutersRedundantState(final DomainRouterVO router) {
boolean updated;
updated = false;
final RedundantState prevState = router.getRedundantState();
if (router.getState() != VirtualMachine.State.Running) {
router.setRedundantState(RedundantState.UNKNOWN);
updated = true;
} else {
final String privateIP = router.getPrivateIpAddress();
final HostVO host = _hostDao.findById(router.getHostId());
if (host == null || host.getState() != Status.Up) {
router.setRedundantState(RedundantState.UNKNOWN);
updated = true;
} else if (privateIP != null) {
final CheckRouterCommand command = new CheckRouterCommand();
command.setAccessDetail(NetworkElementCommand.ROUTER_IP, _routerControlHelper.getRouterControlIp(router.getId()));
command.setAccessDetail(NetworkElementCommand.ROUTER_NAME, router.getInstanceName());
command.setWait(30);
final Answer origAnswer = _agentMgr.easySend(router.getHostId(), command);
CheckRouterAnswer answer = null;
if (origAnswer instanceof CheckRouterAnswer) {
answer = (CheckRouterAnswer) origAnswer;
} else {
s_logger.warn("Unable to update router " + router.getHostName() + "'s status");
}
RedundantState state = RedundantState.UNKNOWN;
if (answer != null) {
if (answer.getResult()) {
state = answer.getState();
} else {
s_logger.info("Agent response doesn't seem to be correct ==> " + answer.getResult());
}
}
router.setRedundantState(state);
updated = true;
}
}
if (updated) {
_routerDao.update(router.getId(), router);
}
final RedundantState currState = router.getRedundantState();
if (prevState != currState) {
final String title = "Virtual router " + router.getInstanceName() + " just switch from " + prevState + " to " + currState;
final String context = "Virtual router (name: " + router.getHostName() + ", id: " + router.getId() + ") " + " just switch from " + prevState + " to "
+ currState;
s_logger.info(context);
if (currState == RedundantState.MASTER) {
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_DOMAIN_ROUTER, router.getDataCenterId(), router.getPodIdToDeployIn(), title, context);
}
}
}
示例14: isHostStatusUpInDataBase
import com.cloud.host.Status; //导入方法依赖的package包/类
/**
* If the host status in database is Up then returns true.
*/
public boolean isHostStatusUpInDataBase(HostVO hostVO) {
return hostDaoJdbc.getStatus(hostVO.getId()) == Status.Up;
}