当前位置: 首页>>代码示例>>Java>>正文


Java Status类代码示例

本文整理汇总了Java中com.cloud.host.Status的典型用法代码示例。如果您正苦于以下问题:Java Status类的具体用法?Java Status怎么用?Java Status使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Status类属于com.cloud.host包,在下文中一共展示了Status类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testWithTimeoutingFence

import com.cloud.host.Status; //导入依赖的package包/类
@Test
public void testWithTimeoutingFence() throws AgentUnavailableException, OperationTimedoutException {
    final HostVO host = Mockito.mock(HostVO.class);
    Mockito.when(host.getClusterId()).thenReturn(1l);
    Mockito.when(host.getHypervisorType()).thenReturn(HypervisorType.KVM);
    Mockito.when(host.getStatus()).thenReturn(Status.Up);
    Mockito.when(host.getDataCenterId()).thenReturn(1l);
    Mockito.when(host.getPodId()).thenReturn(1l);
    Mockito.when(host.getId()).thenReturn(1l);

    final HostVO secondHost = Mockito.mock(HostVO.class);
    Mockito.when(secondHost.getClusterId()).thenReturn(1l);
    Mockito.when(secondHost.getHypervisorType()).thenReturn(HypervisorType.KVM);
    Mockito.when(secondHost.getStatus()).thenReturn(Status.Up);
    Mockito.when(secondHost.getDataCenterId()).thenReturn(1l);
    Mockito.when(secondHost.getPodId()).thenReturn(1l);
    Mockito.when(host.getId()).thenReturn(2l);

    final VirtualMachine virtualMachine = Mockito.mock(VirtualMachine.class);

    Mockito.when(resourceManager.listAllHostsInCluster(1l)).thenReturn(Arrays.asList(host, secondHost));

    Mockito.when(agentManager.send(Matchers.anyLong(), Matchers.any(FenceCommand.class))).thenThrow(new OperationTimedoutException(null, 2l, 0l, 0, false));

    Assert.assertFalse(fencer.fenceOff(virtualMachine, host));
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:27,代码来源:KVMFencerTest.java

示例2: orchestrateMigrateAway

import com.cloud.host.Status; //导入依赖的package包/类
@ReflectionUse
private Pair<JobInfo.Status, String> orchestrateMigrateAway(final VmWorkMigrateAway work) throws Exception {
    final VMInstanceVO vm = _entityMgr.findById(VMInstanceVO.class, work.getVmId());
    if (vm == null) {
        s_logger.info("Unable to find vm " + work.getVmId());
    }
    assert vm != null;

    try {
        orchestrateMigrateAway(vm.getUuid(), work.getSrcHostId(), null);
    } catch (final InsufficientServerCapacityException e) {
        s_logger.warn("Failed to deploy vm " + vm.getId() + " with original planner, sending HAPlanner");
        orchestrateMigrateAway(vm.getUuid(), work.getSrcHostId(), _haMgr.getHAPlanner());
    }

    return new Pair<>(JobInfo.Status.SUCCEEDED, null);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:18,代码来源:VirtualMachineManagerImpl.java

示例3: 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;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:20,代码来源:AgentManagerImpl.java

示例4: disconnectInternal

import com.cloud.host.Status; //导入依赖的package包/类
private void disconnectInternal(final long hostId, final Status.Event event, final boolean invstigate) {
    final AgentAttache attache = findAttache(hostId);

    if (attache != null) {
        if (!invstigate) {
            disconnectWithoutInvestigation(attache, event);
        } else {
            disconnectWithInvestigation(attache, event);
        }
    } else {
        /* Agent is still in connecting process, don't allow to disconnect right away */
        if (tapLoadingAgents(hostId, TapAgentsAction.Contains)) {
            s_logger.info("Host " + hostId + " is being loaded so no disconnects needed.");
            return;
        }

        final HostVO host = _hostDao.findById(hostId);
        if (host != null && host.getRemoved() == null) {
            disconnectAgent(host, event, _nodeId);
        }
    }
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:23,代码来源:AgentManagerImpl.java

示例5: testWithFailingFence

import com.cloud.host.Status; //导入依赖的package包/类
@Test
public void testWithFailingFence() throws AgentUnavailableException, OperationTimedoutException {
    final HostVO host = Mockito.mock(HostVO.class);
    Mockito.when(host.getClusterId()).thenReturn(1l);
    Mockito.when(host.getHypervisorType()).thenReturn(HypervisorType.KVM);
    Mockito.when(host.getStatus()).thenReturn(Status.Up);
    Mockito.when(host.getDataCenterId()).thenReturn(1l);
    Mockito.when(host.getPodId()).thenReturn(1l);
    Mockito.when(host.getId()).thenReturn(1l);

    final HostVO secondHost = Mockito.mock(HostVO.class);
    Mockito.when(secondHost.getClusterId()).thenReturn(1l);
    Mockito.when(secondHost.getHypervisorType()).thenReturn(HypervisorType.KVM);
    Mockito.when(secondHost.getStatus()).thenReturn(Status.Up);
    Mockito.when(secondHost.getDataCenterId()).thenReturn(1l);
    Mockito.when(secondHost.getPodId()).thenReturn(1l);
    Mockito.when(host.getId()).thenReturn(2l);

    final VirtualMachine virtualMachine = Mockito.mock(VirtualMachine.class);

    Mockito.when(resourceManager.listAllHostsInCluster(1l)).thenReturn(Arrays.asList(host, secondHost));

    Mockito.when(agentManager.send(Matchers.anyLong(), Matchers.any(FenceCommand.class))).thenThrow(new AgentUnavailableException(2l));

    Assert.assertFalse(fencer.fenceOff(virtualMachine, host));
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:27,代码来源:KVMFencerTest.java

示例6: createAttache

import com.cloud.host.Status; //导入依赖的package包/类
protected AgentAttache createAttache(final long id) {
    s_logger.debug("create forwarding ClusteredAgentAttache for " + id);
    final HostVO host = _hostDao.findById(id);
    final AgentAttache attache = new ClusteredAgentAttache(this, id, host.getName());
    AgentAttache old = null;
    synchronized (_agents) {
        old = _agents.get(id);
        _agents.put(id, attache);
    }
    if (old != null) {
        if (s_logger.isDebugEnabled()) {
            s_logger.debug("Remove stale agent attache from current management server");
        }
        removeAgent(old, Status.Removed);
    }
    return attache;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:18,代码来源:ClusteredAgentManagerImpl.java

示例7: disconnect

import com.cloud.host.Status; //导入依赖的package包/类
@Override
public void disconnect(final Status state) {
    if (s_logger.isDebugEnabled()) {
        s_logger.debug("Processing disconnect " + _id + "(" + _name + ")");
    }

    for (final ScheduledFuture<?> future : _futures) {
        future.cancel(false);
    }

    synchronized (this) {
        if (_resource != null) {
            _resource.disconnected();
            _resource = null;
        }
    }
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:18,代码来源:DirectAgentAttache.java

示例8: markHostsAsDisconnected

import com.cloud.host.Status; //导入依赖的package包/类
@Override
public void markHostsAsDisconnected(final long msId, final long lastPing) {
    SearchCriteria<HostVO> sc = MsStatusSearch.create();
    sc.setParameters("ms", msId);

    HostVO host = createForUpdate();
    host.setLastPinged(lastPing);
    host.setDisconnectedOn(new Date());
    UpdateBuilder ub = getUpdateBuilder(host);
    ub.set(host, "status", Status.Disconnected);

    update(ub, sc, null);

    sc = MsStatusSearch.create();
    sc.setParameters("ms", msId);

    host = createForUpdate();
    host.setManagementServerId(null);
    host.setLastPinged(lastPing);
    host.setDisconnectedOn(new Date());
    ub = getUpdateBuilder(host);
    update(ub, sc, null);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:24,代码来源:HostDaoImpl.java

示例9: testPrepareTemplateNoHostConnectedToPool

import com.cloud.host.Status; //导入依赖的package包/类
@Test(expected = CloudRuntimeException.class)
public void testPrepareTemplateNoHostConnectedToPool() {
    final VMTemplateVO mockTemplate = mock(VMTemplateVO.class);
    when(mockTemplate.getId()).thenReturn(202l);

    final StoragePoolVO mockPool = mock(StoragePoolVO.class);
    when(mockPool.getId()).thenReturn(2l);

    final PrimaryDataStore mockPrimaryDataStore = mock(PrimaryDataStore.class);
    when(mockPrimaryDataStore.getId()).thenReturn(2l);
    when(mockPrimaryDataStore.getDataCenterId()).thenReturn(1l);

    final TemplateDataStoreVO mockTemplateDataStore = mock(TemplateDataStoreVO.class);

    when(dataStoreManager.getPrimaryDataStore(anyLong())).thenReturn(mockPrimaryDataStore);
    when(vmTemplateDao.findById(anyLong(), anyBoolean())).thenReturn(mockTemplate);
    when(vmTemplatePoolDao.findByPoolTemplate(anyLong(), anyLong())).thenReturn(null);
    when(templateDataStoreDao.findByTemplateZoneDownloadStatus(202l, 1l, VMTemplateStorageResourceAssoc.Status.DOWNLOADED)).thenReturn(mockTemplateDataStore);
    when(storagePoolHostDao.listByHostStatus(2l, Status.Up)).thenReturn(null);

    templateManager.prepareTemplateForCreate(mockTemplate, (StoragePool) mockPrimaryDataStore);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:23,代码来源:TemplateManagerImplTest.java

示例10: findHostByPod

import com.cloud.host.Status; //导入依赖的package包/类
protected List<Long> findHostByPod(final long podId, final Long excludeHostId) {
    final QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class);
    sc.and(sc.entity().getType(), Op.EQ, Type.Routing);
    sc.and(sc.entity().getPodId(), Op.EQ, podId);
    sc.and(sc.entity().getStatus(), Op.EQ, Status.Up);
    final List<HostVO> hosts = sc.list();

    final List<Long> hostIds = new ArrayList<>(hosts.size());
    for (final HostVO h : hosts) {
        hostIds.add(h.getId());
    }

    if (excludeHostId != null) {
        hostIds.remove(excludeHostId);
    }

    return hostIds;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:19,代码来源:AbstractInvestigatorImpl.java

示例11: testPrepareTemplateNotDownloaded

import com.cloud.host.Status; //导入依赖的package包/类
@Test
public void testPrepareTemplateNotDownloaded() {
    final VMTemplateVO mockTemplate = mock(VMTemplateVO.class);
    when(mockTemplate.getId()).thenReturn(202l);

    final StoragePoolVO mockPool = mock(StoragePoolVO.class);
    when(mockPool.getId()).thenReturn(2l);

    final PrimaryDataStore mockPrimaryDataStore = mock(PrimaryDataStore.class);
    when(mockPrimaryDataStore.getId()).thenReturn(2l);
    when(mockPrimaryDataStore.getDataCenterId()).thenReturn(1l);

    when(dataStoreManager.getPrimaryDataStore(anyLong())).thenReturn(mockPrimaryDataStore);
    when(vmTemplateDao.findById(anyLong(), anyBoolean())).thenReturn(mockTemplate);
    when(vmTemplatePoolDao.findByPoolTemplate(anyLong(), anyLong())).thenReturn(null);
    when(templateDataStoreDao.findByTemplateZoneDownloadStatus(202l, 1l, VMTemplateStorageResourceAssoc.Status.DOWNLOADED)).thenReturn(null);

    final VMTemplateStoragePoolVO returnObject = templateManager.prepareTemplateForCreate(mockTemplate, (StoragePool) mockPrimaryDataStore);
    assertTrue("Test template is not ready", returnObject == null);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:21,代码来源:TemplateManagerImplTest.java

示例12: listAllUpAndEnabledHosts

import com.cloud.host.Status; //导入依赖的package包/类
@Override
public List<HostVO> listAllUpAndEnabledHosts(final Type type, final Long clusterId, final Long podId, final long dcId) {
    final QueryBuilder<HostVO> sc = QueryBuilder.create(HostVO.class);
    if (type != null) {
        sc.and(sc.entity().getType(), Op.EQ, type);
    }
    if (clusterId != null) {
        sc.and(sc.entity().getClusterId(), Op.EQ, clusterId);
    }
    if (podId != null) {
        sc.and(sc.entity().getPodId(), Op.EQ, podId);
    }
    sc.and(sc.entity().getDataCenterId(), Op.EQ, dcId);
    sc.and(sc.entity().getStatus(), Op.EQ, Status.Up);
    sc.and(sc.entity().getResourceState(), Op.EQ, ResourceState.Enabled);
    return sc.list();
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:18,代码来源:ResourceManagerImpl.java

示例13: markHostAsDisconnected

import com.cloud.host.Status; //导入依赖的package包/类
private void markHostAsDisconnected(HostVO host, final StartupCommand[] cmds) {
    if (host == null) { // in case host is null due to some errors, try
        // reloading the host from db
        if (cmds != null) {
            final StartupCommand firstCmd = cmds[0];
            host = findHostByGuid(firstCmd.getGuid());
            if (host == null) {
                host = findHostByGuid(firstCmd.getGuidWithoutResource());
            }
        }
    }

    if (host != null) {
        // Change agent status to Alert, so that host is considered for
        // reconnection next time
        _agentMgr.agentStatusTransitTo(host, Status.Event.AgentDisconnected, _nodeId);
    }
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:19,代码来源:ResourceManagerImpl.java

示例14: listStalledVMInTransitionStateOnUpHost

import com.cloud.host.Status; //导入依赖的package包/类
private List<Long> listStalledVMInTransitionStateOnUpHost(final long hostId, final Date cutTime) {
    final String sql = "SELECT i.* FROM vm_instance as i, host as h WHERE h.status = 'UP' " +
            "AND h.id = ? AND i.power_state_update_time < ? AND i.host_id = h.id " +
            "AND i.state IN ('Starting', 'Stopping', 'Migrating', 'Paused') " +
            "AND i.id NOT IN (SELECT w.vm_instance_id FROM vm_work_job AS w JOIN async_job AS j ON w.id = j.id WHERE j.job_status = ?)" +
            "AND i.removed IS NULL";

    final List<Long> l = new ArrayList<>();
    TransactionLegacy txn = null;
    try {
        txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);

        PreparedStatement pstmt = null;
        try {
            pstmt = txn.prepareAutoCloseStatement(sql);

            pstmt.setLong(1, hostId);
            pstmt.setString(2, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutTime));
            pstmt.setInt(3, JobInfo.Status.IN_PROGRESS.ordinal());
            final ResultSet rs = pstmt.executeQuery();
            while (rs.next()) {
                l.add(rs.getLong(1));
            }
        } catch (final SQLException e) {
            s_logger.warn("Caught (previously ignored) SQLException", e);
        }
    } finally {
        if (txn != null) {
            txn.close();
        }
    }
    return l;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:34,代码来源:VirtualMachineManagerImpl.java

示例15: listStalledVMInTransitionStateOnDisconnectedHosts

import com.cloud.host.Status; //导入依赖的package包/类
private List<Long> listStalledVMInTransitionStateOnDisconnectedHosts(final Date cutTime) {
    final String sql = "SELECT i.* FROM vm_instance as i, host as h WHERE h.status != 'UP' " +
            "AND i.power_state_update_time < ? AND i.host_id = h.id " +
            "AND i.state IN ('Starting', 'Stopping', 'Migrating', 'Paused') " +
            "AND i.id NOT IN (SELECT w.vm_instance_id FROM vm_work_job AS w JOIN async_job AS j ON w.id = j.id WHERE j.job_status = ?)" +
            "AND i.removed IS NULL";

    final List<Long> l = new ArrayList<>();
    TransactionLegacy txn = null;
    try {
        txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
        PreparedStatement pstmt = null;
        try {
            pstmt = txn.prepareAutoCloseStatement(sql);

            pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutTime));
            pstmt.setInt(2, JobInfo.Status.IN_PROGRESS.ordinal());
            final ResultSet rs = pstmt.executeQuery();
            while (rs.next()) {
                l.add(rs.getLong(1));
            }
        } catch (final SQLException e) {
            s_logger.warn("Caught (previously ignored) SQLException", e);
        }
        return l;
    } finally {
        if (txn != null) {
            txn.close();
        }
    }
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:32,代码来源:VirtualMachineManagerImpl.java


注:本文中的com.cloud.host.Status类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。