Package com.cloud.agent.api

Examples of com.cloud.agent.api.GetHostStatsAnswer


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

        HostStatsEntry hostStats = new HostStatsEntry(cmd.getHostId(), cpuUtil,
                nicStats.first() / 1000, nicStats.second() / 1000, "host",
                totMem, freeMem, 0, 0);
        return new GetHostStatsAnswer(cmd, hostStats);
    }
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

     */
    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

        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

            hostStats.setNetworkReadKBs(32768);
            hostStats.setNetworkWriteKBs(16384);
            hostStats.setCpuUtilization(usedCpu / (host.getCpuCount() * host.getCpuSpeed()));
            hostStats.setEntityType("simulator-host");
            hostStats.setHostId(cmd.getHostId());
            return new GetHostStatsAnswer(cmd, hostStats);
        } catch (Exception ex) {
            vmtxn.rollback();
            throw new CloudRuntimeException("Unable to get Vms on host " + host.getGuid() + " due to "
                    + ex.getMessage(), ex);
        } finally {
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

        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

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

        HostStatsEntry hostStats = new HostStatsEntry(cmd.getHostId(), cpuUtil,
                nicStats.first() / 1000, nicStats.second() / 1000, "host",
                totMem, freeMem, 0, 0);
        return new GetHostStatsAnswer(cmd, hostStats);
    }
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.