Search in sources :

Example 16 with VmStatsEntry

use of com.cloud.agent.api.VmStatsEntry in project cloudstack by apache.

the class MockVmManagerImpl method getVmStats.

@Override
public Answer getVmStats(final GetVmStatsCommand cmd) {
    final HashMap<String, VmStatsEntry> vmStatsNameMap = new HashMap<String, VmStatsEntry>();
    final List<String> vmNames = cmd.getVmNames();
    for (final String vmName : vmNames) {
        final VmStatsEntry entry = new VmStatsEntry(0, 0, 0, 0, 0, 0, 0, "vm");
        // default values 256 KBps
        entry.setNetworkReadKBs(32768);
        entry.setNetworkWriteKBs(16384);
        entry.setCPUUtilization(10);
        entry.setNumCPUs(1);
        vmStatsNameMap.put(vmName, entry);
    }
    return new GetVmStatsAnswer(cmd, vmStatsNameMap);
}
Also used : ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) VmStatsEntry(com.cloud.agent.api.VmStatsEntry) GetVmStatsAnswer(com.cloud.agent.api.GetVmStatsAnswer)

Aggregations

VmStatsEntry (com.cloud.agent.api.VmStatsEntry)16 HashMap (java.util.HashMap)10 GetVmStatsAnswer (com.cloud.agent.api.GetVmStatsAnswer)9 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)7 ArrayList (java.util.ArrayList)4 Connect (org.libvirt.Connect)3 Answer (com.cloud.agent.api.Answer)2 GetVmDiskStatsAnswer (com.cloud.agent.api.GetVmDiskStatsAnswer)2 StartAnswer (com.cloud.agent.api.StartAnswer)2 Map (java.util.Map)2 Domain (org.libvirt.Domain)2 DomainInfo (org.libvirt.DomainInfo)2 DomainInterfaceStats (org.libvirt.DomainInterfaceStats)2 LibvirtException (org.libvirt.LibvirtException)2 NodeInfo (org.libvirt.NodeInfo)2 BackupSnapshotAnswer (com.cloud.agent.api.BackupSnapshotAnswer)1 CheckHealthAnswer (com.cloud.agent.api.CheckHealthAnswer)1 CheckNetworkAnswer (com.cloud.agent.api.CheckNetworkAnswer)1 CheckOnHostAnswer (com.cloud.agent.api.CheckOnHostAnswer)1 CheckVirtualMachineAnswer (com.cloud.agent.api.CheckVirtualMachineAnswer)1