Package com.cloud.agent.api

Examples of com.cloud.agent.api.GetHostStatsAnswer


     */
    protected GetHostStatsAnswer execute(GetHostStatsCommand cmd) {
        Connection conn = getConnection();
        try {
            HostStatsEntry hostStats = getHostStats(conn, cmd, cmd.getHostGuid(), cmd.getHostId());
            return new GetHostStatsAnswer(cmd, hostStats);
        } catch (Exception e) {
            String msg = "Unable to get Host stats" + e.toString();
            s_logger.warn(msg, e);
            return new GetHostStatsAnswer(cmd, null);
        }
    }
View Full Code Here


            Double rxBytes = Double.parseDouble(res.get("rxBytes"));
            Double txBytes = Double.parseDouble(res.get("txBytes"));
            Double totalMemory = Double.parseDouble(res.get("totalMemory"));
            Double freeMemory = Double.parseDouble(res.get("freeMemory"));
            HostStatsEntry hostStats = new HostStatsEntry(cmd.getHostId(), cpuUtil, rxBytes, txBytes, "host", totalMemory, freeMemory, 0, 0);
            return new GetHostStatsAnswer(cmd, hostStats);
        } catch (Exception e) {
            s_logger.debug("Get host stats of " + cmd.getHostName() + " failed", e);
            return new Answer(cmd, false, e.getMessage());
        }
View Full Code Here

     */
    protected GetHostStatsAnswer execute(GetHostStatsCommand cmd) {
        Connection conn = getConnection();
        try {
            HostStatsEntry hostStats = getHostStats(conn, cmd, cmd.getHostGuid(), cmd.getHostId());
            return new GetHostStatsAnswer(cmd, hostStats);
        } catch (Exception e) {
            String msg = "Unable to get Host stats" + e.toString();
            s_logger.warn(msg, e);
            return new GetHostStatsAnswer(cmd, null);
        }
    }
View Full Code Here

        VmwareContext context = getServiceContext();
        VmwareHypervisorHost hyperHost = getHyperHost(context);

        HostStatsEntry hostStats = new HostStatsEntry(cmd.getHostId(), 0, 0, 0, "host", 0, 0, 0, 0);
        Answer answer = new GetHostStatsAnswer(cmd, hostStats);
        try {
            HostStatsEntry entry = getHyperHostStats(hyperHost);
            if (entry != null) {
                entry.setHostId(cmd.getHostId());
                answer = new GetHostStatsAnswer(cmd, entry);
            }
        } catch (Exception e) {
            if (e instanceof RemoteException) {
                s_logger.warn("Encounter remote exception to vCenter, invalidate VMware session context");
                invalidateServiceContext();
View Full Code Here

        long totMem = Long.parseLong(totMemparser.getLine());

        Pair<Double, Double> nicStats = getNicStats(_publicBridgeName);

        HostStatsEntry hostStats = new HostStatsEntry(cmd.getHostId(), cpuUtil, nicStats.first() / 1024, nicStats.second() / 1024, "host", totMem, freeMem, 0, 0);
        return new GetHostStatsAnswer(cmd, hostStats);
    }
View Full Code Here

      Double txBytes = Double.parseDouble(res.get("txBytes"));
      Double totalMemory = Double.parseDouble(res.get("totalMemory"));
      Double freeMemory = Double.parseDouble(res.get("freeMemory"));
      HostStatsEntry hostStats = new HostStatsEntry(cmd.getHostId(), cpuUtil, rxBytes,
          txBytes, "host", totalMemory, freeMemory, 0, 0);
      return new GetHostStatsAnswer(cmd, hostStats);
    } catch (Exception e) {
      s_logger.debug("Get host stats of " + cmd.getHostName() + " failed", e);
      return new Answer(cmd, false, e.getMessage());
    }
   
View Full Code Here

        // Arrange
        long hostIdVal = 123;
        GetHostStatsCommand cmd = new GetHostStatsCommand("1", "testHost", hostIdVal);

        // Act
        GetHostStatsAnswer ans = (GetHostStatsAnswer)s_hypervresource.executeRequest(cmd);

        // Assert
        Assert.assertTrue(ans.getResult());
        Assert.assertTrue(0.0 < ans.getTotalMemoryKBs());
        Assert.assertTrue(0.0 < ans.getFreeMemoryKBs());
        Assert.assertTrue(0.0 <= ans.getNetworkReadKBs());
        Assert.assertTrue(0.0 <= ans.getNetworkWriteKBs());
        Assert.assertTrue(0.0 <= ans.getCpuUtilization());
        Assert.assertTrue(100 >= ans.getCpuUtilization());
        Assert.assertTrue(ans.getEntityType().equals("host"));
        Assert.assertTrue(ans.getDetails() == null);
    }
View Full Code Here

        Pair<Double, Double> nicStats = getNicStats(_publicBridgeName);

        HostStatsEntry hostStats = new HostStatsEntry(cmd.getHostId(), cpuUtil,
                nicStats.first() / 1024, nicStats.second() / 1024, "host",
                totMem, freeMem, 0, 0);
        return new GetHostStatsAnswer(cmd, hostStats);
    }
View Full Code Here

     */
    protected GetHostStatsAnswer execute(GetHostStatsCommand cmd) {
        Connection conn = getConnection();
        try {
            HostStatsEntry hostStats = getHostStats(conn, cmd, cmd.getHostGuid(), cmd.getHostId());
            return new GetHostStatsAnswer(cmd, hostStats);
        } catch (Exception e) {
            String msg = "Unable to get Host stats" + e.toString();
            s_logger.warn(msg, e);
            return new GetHostStatsAnswer(cmd, null);
        }
    }
View Full Code Here

        VmwareContext context = getServiceContext();
        VmwareHypervisorHost hyperHost = getHyperHost(context);

        HostStatsEntry hostStats = new HostStatsEntry(cmd.getHostId(), 0, 0, 0, "host", 0, 0, 0, 0);
        Answer answer = new GetHostStatsAnswer(cmd, hostStats);
        try {
            HostStatsEntry entry = getHyperHostStats(hyperHost);
            if(entry != null) {
                entry.setHostId(cmd.getHostId());
                answer = new GetHostStatsAnswer(cmd, entry);
            }
        } catch (Exception e) {
            if (e instanceof RemoteException) {
                s_logger.warn("Encounter remote exception to vCenter, invalidate VMware session context");
                invalidateServiceContext();
View Full Code Here

TOP

Related Classes of com.cloud.agent.api.GetHostStatsAnswer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.