Search in sources :

Example 11 with GetVmStatsAnswer

use of com.cloud.agent.api.GetVmStatsAnswer 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

GetVmStatsAnswer (com.cloud.agent.api.GetVmStatsAnswer)11 VmStatsEntry (com.cloud.agent.api.VmStatsEntry)9 HashMap (java.util.HashMap)8 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)6 ArrayList (java.util.ArrayList)5 GetVmStatsCommand (com.cloud.agent.api.GetVmStatsCommand)3 Answer (com.cloud.agent.api.Answer)2 GetVmDiskStatsAnswer (com.cloud.agent.api.GetVmDiskStatsAnswer)2 StartAnswer (com.cloud.agent.api.StartAnswer)2 Test (org.junit.Test)2 Connect (org.libvirt.Connect)2 LibvirtException (org.libvirt.LibvirtException)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 CreateVMSnapshotAnswer (com.cloud.agent.api.CreateVMSnapshotAnswer)1 CreateVolumeFromSnapshotAnswer (com.cloud.agent.api.CreateVolumeFromSnapshotAnswer)1 DeleteVMSnapshotAnswer (com.cloud.agent.api.DeleteVMSnapshotAnswer)1