Fix VM stats inconsistencies (#6245)

* Fix VM stats inconsistencies

* Address reviews

* Address review

Co-authored-by: João Paraquetti <joao@scclouds.com.br>
Co-authored-by: Joao <JoaoJandre@gitlab.com>
This commit is contained in:
JoaoJandre 2022-04-22 08:52:57 -03:00 committed by GitHub
parent 545e89c1cb
commit f4e95e3105
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 137 additions and 90 deletions

View File

@ -35,51 +35,51 @@ public class StatsResponse extends BaseResponse {
private String cpuUsed;
@SerializedName(ApiConstants.DISK_IO_READ)
@Param(description = "the VM's disk read (IO)")
@Param(description = "the VM's disk number of read requests (IO) made in the last collection cycle as defined by vm.stats.interval configuration")
protected Long diskIORead;
@SerializedName(ApiConstants.DISK_IO_WRITE)
@Param(description = "the VM's disk write (IO)")
@Param(description = "the VM's disk number of write requests (IO) made in the last collection cycle as defined by vm.stats.interval configuration")
protected Long diskIOWrite;
@SerializedName(ApiConstants.DISK_IO_PSTOTAL)
@Param(description = "the total disk iops")
@Param(description = "the total disk iops since the last stats retrieval")
protected Long diskIopsTotal = 0L;
@SerializedName(ApiConstants.DISK_KBS_READ)
@Param(description = "the VM's disk read (bytes)")
@Param(description = "the VM's disk read in KiB")
private Long diskKbsRead;
@SerializedName(ApiConstants.DISK_KBS_WRITE)
@Param(description = "the VM's disk write (bytes)")
@Param(description = "the VM's disk write in KiB")
private Long diskKbsWrite;
@SerializedName("memoryintfreekbs")
@Param(description = "the internal memory free of the VM or zero if it cannot be calculated")
@Param(description = "the VM's free memory in KB or -1 if it cannot be gathered")
private Long memoryIntFreeKBs;
@SerializedName("memorykbs")
@Param(description = "the memory used by the VM in Kbps")
@Param(description = "the memory used by the VM in KB")
private Long memoryKBs;
@SerializedName("memorytargetkbs")
@Param(description = "the target memory in VM in Kbps")
@Param(description = "the target memory in VM (KB)")
private Long memoryTargetKBs;
@SerializedName("networkkbsread")
@Param(description = "the incoming network traffic on the VM")
@Param(description = "the incoming network traffic on the VM in KiB")
protected Long networkKbsRead;
@SerializedName("networkkbswrite")
@Param(description = "the outgoing network traffic on the host")
@Param(description = "the outgoing network traffic on the host in KiB")
protected Long networkKbsWrite;
@SerializedName("networkread")
@Param(description = "the network read in MiB")
@Param(description = "the amount of downloaded data by the VM in MiB")
protected String networkRead;
@SerializedName("networkwrite")
@Param(description = "the network write in MiB")
@Param(description = "the amount of uploaded data by the VM in MiB")
protected String networkWrite;
public void setTimestamp(Date timestamp) {
@ -123,14 +123,14 @@ public class StatsResponse extends BaseResponse {
public void setNetworkKbsRead(Long networkKbsRead) {
this.networkKbsRead = networkKbsRead;
if (networkKbsRead != null) {
this.networkRead = String.format("%.2f MB", networkKbsRead / 1024.0);
this.networkRead = String.format("%.2f MiB", networkKbsRead / 1024.0);
}
}
public void setNetworkKbsWrite(Long networkKbsWrite) {
this.networkKbsWrite = networkKbsWrite;
if (networkKbsWrite != null) {
this.networkWrite = String.format("%.2f MB", networkKbsWrite / 1024.0);
this.networkWrite = String.format("%.2f MiB", networkKbsWrite / 1024.0);
}
}

View File

@ -175,11 +175,11 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
private Boolean forVirtualNetwork;
@SerializedName(ApiConstants.CPU_NUMBER)
@Param(description = "the number of cpu this virtual machine is running with")
@Param(description = "the number of vCPUs this virtual machine is using")
private Integer cpuNumber;
@SerializedName(ApiConstants.CPU_SPEED)
@Param(description = "the speed of each cpu")
@Param(description = "the speed of each vCPU")
private Integer cpuSpeed;
@SerializedName(ApiConstants.MEMORY)
@ -187,7 +187,7 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
private Integer memory;
@SerializedName(ApiConstants.VGPU)
@Param(description = "the vgpu type used by the virtual machine", since = "4.4")
@Param(description = "the vGPU type used by the virtual machine", since = "4.4")
private String vgpu;
@SerializedName("cpuused")
@ -195,39 +195,39 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
private String cpuUsed;
@SerializedName("networkkbsread")
@Param(description = "the incoming network traffic on the vm")
@Param(description = "the incoming network traffic on the VM in KiB")
private Long networkKbsRead;
@SerializedName("networkkbswrite")
@Param(description = "the outgoing network traffic on the host")
@Param(description = "the outgoing network traffic on the host in KiB")
private Long networkKbsWrite;
@SerializedName(ApiConstants.DISK_KBS_READ)
@Param(description = "the read (bytes) of disk on the vm")
@Param(description = "the VM's disk read in KiB")
private Long diskKbsRead;
@SerializedName(ApiConstants.DISK_KBS_WRITE)
@Param(description = "the write (bytes) of disk on the vm")
@Param(description = "the VM's disk write in KiB")
private Long diskKbsWrite;
@SerializedName("memorykbs")
@Param(description = "the memory used by the vm")
@Param(description = "the memory used by the VM in KiB")
private Long memoryKBs;
@SerializedName("memoryintfreekbs")
@Param(description = "the internal memory that's free in vm or zero if it can not be calculated")
@Param(description = "the internal memory (KiB) that's free in VM or zero if it can not be calculated")
private Long memoryIntFreeKBs;
@SerializedName("memorytargetkbs")
@Param(description = "the target memory in vm")
@Param(description = "the target memory in VM (KiB)")
private Long memoryTargetKBs;
@SerializedName(ApiConstants.DISK_IO_READ)
@Param(description = "the read (io) of disk on the vm")
@Param(description = "the read (IO) of disk on the VM")
private Long diskIORead;
@SerializedName(ApiConstants.DISK_IO_WRITE)
@Param(description = "the write (io) of disk on the vm")
@Param(description = "the write (IO) of disk on the VM")
private Long diskIOWrite;
@SerializedName("guestosid")

View File

@ -153,27 +153,27 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co
private Long bytesWriteRate;
@SerializedName("diskIopsReadRate")
@Param(description = "io requests read rate of the disk volume per the disk offering")
@Param(description = "IO requests read rate of the disk volume per the disk offering")
private Long iopsReadRate;
@SerializedName("diskIopsWriteRate")
@Param(description = "io requests write rate of the disk volume per the disk offering")
@Param(description = "IO requests write rate of the disk volume per the disk offering")
private Long iopsWriteRate;
@SerializedName(ApiConstants.DISK_KBS_READ)
@Param(description = "the read (bytes) of disk on the vm")
@Param(description = "the VM's disk read in KiB")
private Long diskKbsRead;
@SerializedName(ApiConstants.DISK_KBS_WRITE)
@Param(description = "the write (bytes) of disk on the vm")
@Param(description = "the VM's disk write in KiB")
private Long diskKbsWrite;
@SerializedName(ApiConstants.DISK_IO_READ)
@Param(description = "the read (io) of disk on the vm")
@Param(description = "the read (IO) of disk on the vm")
private Long diskIORead;
@SerializedName(ApiConstants.DISK_IO_WRITE)
@Param(description = "the write (io) of disk on the vm")
@Param(description = "the write (IO) of disk on the vm")
private Long diskIOWrite;
@SerializedName(ApiConstants.HYPERVISOR)

View File

@ -106,7 +106,7 @@ public class StatsResponseTest {
@Test
public void setNetworkKbsReadTestWithInputNotNull() {
Long expectedNetworkKbsRead = Long.valueOf("100");
String expectedNetworkRead = String.format("0%s10 MB", decimalSeparator); // the actual result is 0.097 but the value is rounded to 0.10
String expectedNetworkRead = String.format("0%s10 MiB", decimalSeparator); // the actual result is 0.097 but the value is rounded to 0.10
statsResponseMock.setNetworkKbsRead(expectedNetworkKbsRead);
@ -125,7 +125,7 @@ public class StatsResponseTest {
@Test
public void setNetworkKbsWriteTestWithInputNotNull() {
Long expectedNetworkKbsWrite = Long.valueOf("100");
String expectedNetworkWrite = String.format("0%s10 MB", decimalSeparator); // the actual result is 0.097 but the value is rounded to 0.10
String expectedNetworkWrite = String.format("0%s10 MiB", decimalSeparator); // the actual result is 0.097 but the value is rounded to 0.10
statsResponseMock.setNetworkKbsWrite(expectedNetworkKbsWrite);

View File

@ -37,11 +37,11 @@ public class VmStatsEntry extends VmStatsEntryBase {
* @param intFreeMemoryKBs the internal free memory (in KBs).
* @param targetMemoryKBs the target memory (in KBs).
* @param cpuUtilization the CPU utilization.
* @param networkReadKBs the network read (in KBs).
* @param networkWriteKBs the network write (in KBs).
* @param networkReadKBs the network read (in KiBs).
* @param networkWriteKBs the network write (in KiBs).
* @param numCPUs the number of CPUs.
* @param diskReadKBs the disk read (in KBs).
* @param diskWriteKBs the disk write (in KBs).
* @param diskReadKBs the disk read (in KiBs).
* @param diskWriteKBs the disk write (in KiBs).
* @param diskReadIOs the disk read I/O.
* @param diskWriteIOs the disk write I/O.
* @param entityType the entity type.

View File

@ -48,11 +48,11 @@ public class VmStatsEntryBase implements VmStats {
* @param intFreeMemoryKBs the internal free memory (in KBs).
* @param targetMemoryKBs the target memory (in KBs).
* @param cpuUtilization the CPU utilization.
* @param networkReadKBs the network read (in KBs).
* @param networkWriteKBs the network write (in KBs).
* @param networkReadKBs the network read (in KiBs).
* @param networkWriteKBs the network write (in KiBs).
* @param numCPUs the number of CPUs.
* @param diskReadKBs the disk read (in KBs).
* @param diskWriteKBs the disk write (in KBs).
* @param diskReadKBs the disk read (in KiBs).
* @param diskWriteKBs the disk write (in KiBs).
* @param diskReadIOs the disk read I/O.
* @param diskWriteIOs the disk write I/O.
* @param entityType the entity type.

View File

@ -307,7 +307,16 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
private long _hvVersion;
private Duration _timeout;
private static final int NUMMEMSTATS =2;
/**
* Since the memoryStats method returns an array that isn't ordered, we pass a big number to get all the array and then search for the information we want.
* */
private static final int NUMMEMSTATS = 20;
/**
* Unused memory's tag to search in the array returned by the Domain.memoryStats() method.
* */
private static final int UNUSEDMEMORY = 4;
private KVMHAMonitor _monitor;
public static final String SSHPUBKEYPATH = SSHKEYSPATH + File.separator + "id_rsa.pub.cloud";
@ -4050,17 +4059,35 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
/**
* This method retrieves the memory statistics from the domain given as parameters.
* If no memory statistic is found, it will return {@link NumberUtils#LONG_ZERO} as the value of free memory in the domain.
* If no memory statistic is found, it will return {@link NumberUtils#LONG_MINUS_ONE} as the value of free memory in the domain.
* If it can retrieve the domain memory statistics, it will return the free memory statistic; that means, it returns the value at the first position of the array returned by {@link Domain#memoryStats(int)}.
*
* @return the amount of free memory in KBs
*/
protected long getMemoryFreeInKBs(Domain dm) throws LibvirtException {
MemoryStatistic[] mems = dm.memoryStats(NUMMEMSTATS);
if (ArrayUtils.isEmpty(mems)) {
return NumberUtils.LONG_ZERO;
MemoryStatistic[] memoryStats = dm.memoryStats(NUMMEMSTATS);
if(s_logger.isTraceEnabled()){
s_logger.trace(String.format("Retrieved memory statistics (information about tags can be found on the libvirt documentation):", ArrayUtils.toString(memoryStats)));
}
return mems[0].getValue();
long freeMemory = NumberUtils.LONG_MINUS_ONE;
if (ArrayUtils.isEmpty(memoryStats)){
return freeMemory;
}
for (int i = 0; i < memoryStats.length; i++) {
if(memoryStats[i].getTag() == UNUSEDMEMORY) {
freeMemory = memoryStats[i].getValue();
break;
}
}
if (freeMemory == NumberUtils.LONG_MINUS_ONE){
s_logger.warn("Couldn't retrieve free memory, returning -1.");
}
return freeMemory;
}
private boolean canBridgeFirewall(final String prvNic) {

View File

@ -907,7 +907,8 @@ public class LibvirtComputingResourceTest {
final MemoryStatistic[] domainMem = new MemoryStatistic[2];
domainMem[0] = Mockito.mock(MemoryStatistic.class);
Mockito.when(domain.getInfo()).thenReturn(domainInfo);
Mockito.when(domain.memoryStats(2)).thenReturn(domainMem);
Mockito.when(domain.memoryStats(20)).thenReturn(domainMem);
Mockito.when(domainMem[0].getTag()).thenReturn(4);
Mockito.when(connect.domainLookupByName(VMNAME)).thenReturn(domain);
final NodeInfo nodeInfo = new NodeInfo();
nodeInfo.cpus = 8;
@ -5585,21 +5586,34 @@ public class LibvirtComputingResourceTest {
Domain domainMock = getDomainConfiguredToReturnMemoryStatistic(null);
long memoryFreeInKBs = libvirtComputingResource.getMemoryFreeInKBs(domainMock);
Assert.assertEquals(0, memoryFreeInKBs);
Assert.assertEquals(-1, memoryFreeInKBs);
}
@Test
public void getMemoryFreeInKBsTestDomainReturningIncompleteArray() throws LibvirtException {
LibvirtComputingResource libvirtComputingResource = new LibvirtComputingResource();
MemoryStatistic[] mem = createMemoryStatisticFreeMemory100();
mem[0].setTag(0);
Domain domainMock = getDomainConfiguredToReturnMemoryStatistic(mem);
long memoryFreeInKBs = libvirtComputingResource.getMemoryFreeInKBs(domainMock);
Assert.assertEquals(-1, memoryFreeInKBs);
}
private MemoryStatistic[] createMemoryStatisticFreeMemory100() {
virDomainMemoryStats stat = new virDomainMemoryStats();
stat.val = 100;
stat.tag = 4;
MemoryStatistic[] mem = new MemoryStatistic[2];
MemoryStatistic[] mem = new MemoryStatistic[1];
mem[0] = new MemoryStatistic(stat);
return mem;
}
private Domain getDomainConfiguredToReturnMemoryStatistic(MemoryStatistic[] mem) throws LibvirtException {
Domain domainMock = Mockito.mock(Domain.class);
when(domainMock.memoryStats(2)).thenReturn(mem);
when(domainMock.memoryStats(20)).thenReturn(mem);
return domainMock;
}

View File

@ -340,7 +340,7 @@ public class MetricsServiceImpl extends MutualExclusiveIdsManagerBase implements
response.setDiskIOWrite((long)statsEntry.getDiskWriteIOs());
long totalMemory = (long)statsEntry.getMemoryKBs();
long freeMemory = (long)statsEntry.getIntFreeMemoryKBs();
long correctedFreeMemory = freeMemory >= totalMemory ? 0 : freeMemory;
long correctedFreeMemory = freeMemory >= totalMemory ? -1 : freeMemory;
response.setMemoryKBs(totalMemory);
response.setMemoryIntFreeKBs(correctedFreeMemory);
response.setMemoryTargetKBs((long)statsEntry.getTargetMemoryKBs());

View File

@ -73,31 +73,31 @@ public class VmMetricsResponse extends UserVmResponse {
public void setMemTotal(final Integer memory) {
if (memory != null) {
this.memTotal = String.format("%.2f GB", memory / 1024.0);
this.memTotal = String.format("%.2f GiB", memory / 1024.0);
}
}
public void setNetworkRead(final Long networkReadKbs) {
if (networkReadKbs != null) {
this.networkRead = String.format("%.2f MB", networkReadKbs / 1024.0);
this.networkRead = String.format("%.2f MiB", networkReadKbs / 1024.0);
}
}
public void setNetworkWrite(final Long networkWriteKbs) {
if (networkWriteKbs != null) {
this.networkWrite = String.format("%.2f MB", networkWriteKbs / 1024.0);
this.networkWrite = String.format("%.2f MiB", networkWriteKbs / 1024.0);
}
}
public void setDiskRead(final Long diskReadKbs) {
if (diskReadKbs != null) {
this.networkRead = String.format("%.2f MB", diskReadKbs / 1024.0);
this.diskRead = String.format("%.2f MiB", diskReadKbs / 1024.0);
}
}
public void setDiskWrite(final Long diskWriteKbs) {
if (diskWriteKbs != null) {
this.networkWrite = String.format("%.2f MB", diskWriteKbs / 1024.0);
this.diskWrite = String.format("%.2f MiB", diskWriteKbs / 1024.0);
}
}

View File

@ -41,7 +41,7 @@ public class VolumeMetricsResponse extends VolumeResponse {
public void setDiskSizeGB(final Long size) {
if (size != null) {
this.diskSizeGB = String.format("%.2f GB", size / (1024.0 * 1024.0 * 1024.0));
this.diskSizeGB = String.format("%.2f GiB", size / (1024.0 * 1024.0 * 1024.0));
}
}

View File

@ -623,8 +623,8 @@
"label.diskiopswriterate": "Disk Write Rate (IOPS)",
"label.diskioread": "Disk Read (IO)",
"label.diskiowrite": "Disk Write (IO)",
"label.diskkbsread": "Disk Read (Bytes)",
"label.diskkbswrite": "Disk Write (Bytes)",
"label.diskkbsread": "Disk Read (KiB)",
"label.diskkbswrite": "Disk Write (KiB)",
"label.diskoffering": "diskoffering",
"label.diskofferingdisplaytext": "Disk Offering",
"label.diskofferingid": "Disk Offering",

View File

@ -623,8 +623,8 @@
"label.diskiopswriterate": "Disk Write Rate (IOPS)",
"label.diskioread": "Disk Read (IO)",
"label.diskiowrite": "Disk Write (IO)",
"label.diskkbsread": "Disk Read (Bytes)",
"label.diskkbswrite": "Disk Write (Bytes)",
"label.diskkbsread": "Disk Read (KiB)",
"label.diskkbswrite": "Disk Write (KiB)",
"label.diskoffering": "diskoffering",
"label.diskofferingdisplaytext": "Disk Offering",
"label.diskofferingid": "Disk Offering",

View File

@ -741,8 +741,8 @@
"label.diskiopswriterate": "Festplatten-Schreibrate (IOPS)",
"label.diskioread": "Festplatte Lesen (EA)",
"label.diskiowrite": "Festplatte Schreiben (EA)",
"label.diskkbsread": "Festplatte Lesen (Bytes)",
"label.diskkbswrite": "Festplatte Schreiben (Bytes)",
"label.diskkbsread": "Festplatte Lesen (KiB)",
"label.diskkbswrite": "Festplatte Schreiben (KiB)",
"label.diskoffering": "Festplattenangebot",
"label.diskofferingdisplaytext": "Festplattenangebot",
"label.diskofferingid": "Festplattenangebot",

View File

@ -768,8 +768,8 @@
"label.diskiopswriterate" : "Ρυθμός εγγραφής δίσκου (IOPS)",
"label.diskioread" : "Ανάγνωση δίσκου (IO)",
"label.diskiowrite" : "Εγγραφή δίσκου (IO)",
"label.diskkbsread" : "Ανάγνωση δίσκου (byte)",
"label.diskkbswrite" : "Εγγραφή δίσκου (byte)",
"label.diskkbsread" : "Ανάγνωση δίσκου (KiB)",
"label.diskkbswrite" : "Εγγραφή δίσκου (KiB)",
"label.diskoffering" : "Προσφορά δίσκου",
"label.diskofferingdisplaytext" : "Προσφορά δίσκου",
"label.diskofferingid" : "Προσφορά δίσκου",

View File

@ -836,8 +836,10 @@
"label.diskiopswriterate": "Disk Write Rate (IOPS)",
"label.diskioread": "Disk Read (IO)",
"label.diskiowrite": "Disk Write (IO)",
"label.diskkbsread": "Disk Read (Bytes)",
"label.diskkbswrite": "Disk Write (Bytes)",
"label.diskkbsread": "Disk Read (KiB)",
"label.diskkbswrite": "Disk Write (KiB)",
"label.diskread": "Disk Read",
"label.diskwrite": "Disk Write",
"label.diskoffering": "Disk Offering",
"label.diskofferingdisplaytext": "Disk Offering",
"label.diskofferingid": "Disk Offering",

View File

@ -634,8 +634,8 @@
"label.diskiopswriterate": "Tasa Escritura de Disco (IOPS)",
"label.diskioread": "Lectura Disco (IO)",
"label.diskiowrite": "Escritura Disco (IO)",
"label.diskkbsread": "Lectura Disco (Bytes)",
"label.diskkbswrite": "Escritura Disco (Bytes)",
"label.diskkbsread": "Lectura Disco (KiB)",
"label.diskkbswrite": "Escritura Disco (KiB)",
"label.diskoffering": "Oferta de Disco",
"label.diskofferingdisplaytext": "Oferta de Disco",
"label.diskofferingid": "Oferta de Disco",

View File

@ -623,8 +623,8 @@
"label.diskiopswriterate": "D\u00e9bit \u00e9criture disque (IOPS)",
"label.diskioread": "Lecture Disque (IO)",
"label.diskiowrite": "\u00c9criture Disque (IO)",
"label.diskkbsread": "Lecture Disque (Octets)",
"label.diskkbswrite": "\u00c9criture Disque (Octets)",
"label.diskkbsread": "Lecture Disque (KiB)",
"label.diskkbswrite": "\u00c9criture Disque (KiB)",
"label.diskoffering": "diskoffering",
"label.diskofferingdisplaytext": "Offre de Disque",
"label.diskofferingid": "Offre de Disque",

View File

@ -623,8 +623,8 @@
"label.diskiopswriterate": "\u00cdr\u00e1si r\u00e1ta (IOPS)",
"label.diskioread": "Merevlemez \u00edr\u00e1s (IO)",
"label.diskiowrite": "Merevlemez \u00edr\u00e1s (IO)",
"label.diskkbsread": "Merevlemez olvas\u00e1s (Byte)",
"label.diskkbswrite": "Merevlemez \u00edr\u00e1s (byte)",
"label.diskkbsread": "Merevlemez olvas\u00e1s (KiB)",
"label.diskkbswrite": "Merevlemez \u00edr\u00e1s (KiB)",
"label.diskoffering": "diskoffering",
"label.diskofferingdisplaytext": "Merevlemez aj\u00e1nlat",
"label.diskofferingid": "Merevlemez aj\u00e1nlat",

View File

@ -623,8 +623,8 @@
"label.diskiopswriterate": "Disk Write Rate (IOPS)",
"label.diskioread": "Disk Read (IO)",
"label.diskiowrite": "Disk Write (IO)",
"label.diskkbsread": "Disk Read (Bytes)",
"label.diskkbswrite": "Disk Write (Bytes)",
"label.diskkbsread": "Disk Read (KiB)",
"label.diskkbswrite": "Disk Write (KiB)",
"label.diskoffering": "diskoffering",
"label.diskofferingdisplaytext": "Offerta Disco",
"label.diskofferingid": "Offerta Disco",

View File

@ -767,8 +767,8 @@
"label.diskiopswriterate": "\ub514\uc2a4\ud06c \uc4f0\uae30 \uc18d\ub3c4(IOPS)",
"label.diskioread": "\ub514\uc2a4\ud06c \uc77d\uae30(IO)",
"label.diskiowrite": "\ub514\uc2a4\ud06c \uc4f0\uae30(IO)",
"label.diskkbsread": "\ub514\uc2a4\ud06c \uc77d\uae30(Bytes)",
"label.diskkbswrite": "\ub514\uc2a4\ud06c \uc4f0\uae30(Bytes)",
"label.diskkbsread": "\ub514\uc2a4\ud06c \uc77d\uae30 (KiB)",
"label.diskkbswrite": "\ub514\uc2a4\ud06c \uc4f0\uae30 (KiB)",
"label.diskoffering": "\ub514\uc2a4\ud06c \uc624\ud37c\ub9c1",
"label.diskofferingdisplaytext": "\ub514\uc2a4\ud06c \uc624\ud37c\ub9c1",
"label.diskofferingid": "\ub514\uc2a4\ud06c \uc624\ud37c\ub9c1",

View File

@ -623,8 +623,8 @@
"label.diskiopswriterate": "Diskskrivehastighet (IOPS)",
"label.diskioread": "Disk lese (IO)",
"label.diskiowrite": "Disk skrive (IO)",
"label.diskkbsread": "Disk lese (Bytes)",
"label.diskkbswrite": "Disk skrive (Bytes)",
"label.diskkbsread": "Disk lese (KiB)",
"label.diskkbswrite": "Disk skrive (KiB)",
"label.diskoffering": "diskoffering",
"label.diskofferingdisplaytext": "Disktilbud",
"label.diskofferingid": "Disktilbud",

View File

@ -623,8 +623,8 @@
"label.diskiopswriterate": "Schrijf snelheid Schijf (IOPS)",
"label.diskioread": "Schijf Lezen (IO)",
"label.diskiowrite": "Schijf Schrijven (IO)",
"label.diskkbsread": "Schijf lezen (Bytes)",
"label.diskkbswrite": "Schijf Schrijven (Bytes)",
"label.diskkbsread": "Schijf lezen (KiB)",
"label.diskkbswrite": "Schijf Schrijven (KiB)",
"label.diskoffering": "opslagaanbieding",
"label.diskofferingdisplaytext": "Schijf Aanbieding",
"label.diskofferingid": "Schijf Aanbieding",

View File

@ -623,8 +623,8 @@
"label.diskiopswriterate": "Disk Write Rate (IOPS)",
"label.diskioread": "Disk Read (IO)",
"label.diskiowrite": "Disk Write (IO)",
"label.diskkbsread": "Disk Read (Bytes)",
"label.diskkbswrite": "Disk Write (Bytes)",
"label.diskkbsread": "Disk Read (KiB)",
"label.diskkbswrite": "Disk Write (KiB)",
"label.diskoffering": "diskoffering",
"label.diskofferingdisplaytext": "Disk Offering",
"label.diskofferingid": "Disk Offering",

View File

@ -623,8 +623,10 @@
"label.diskiopswriterate": "Taxa de Escrita no Disco (IOPS)",
"label.diskioread": "Leitura do Disk (I/O)",
"label.diskiowrite": "Escrita no Disco (I/O)",
"label.diskkbsread": "Leitura do Disco (Bytes)",
"label.diskkbswrite": "Escrita no Disco (Bytes)",
"label.diskkbsread": "Leitura do Disco (KiB)",
"label.diskkbswrite": "Escrita no Disco (KiB)",
"label.diskread": "Leitura do Disco",
"label.diskwrite": "Escrita no Disco",
"label.diskoffering": "diskoffering",
"label.diskofferingdisplaytext": "Oferta de Disco",
"label.diskofferingid": "Oferta de Disco",

View File

@ -50,11 +50,13 @@ export default {
const metricsFields = ['cpunumber', 'cpuused', 'cputotal',
{
memoryused: (record) => {
return record.memorykbs && record.memoryintfreekbs ? parseFloat(100.0 * (record.memorykbs - record.memoryintfreekbs) / record.memorykbs).toFixed(2) + '%' : '0.0%'
if (record.memoryintfreekbs <= 0 || record.memorykbs <= 0) {
return '-'
}
return parseFloat(100.0 * (record.memorykbs - record.memoryintfreekbs) / record.memorykbs).toFixed(2) + '%'
}
},
'memorytotal', 'networkread', 'networkwrite', 'diskkbsread', 'diskkbswrite', 'diskiopstotal'
]
'memorytotal', 'networkread', 'networkwrite', 'diskread', 'diskwrite', 'diskiopstotal']
if (store.getters.metrics) {
fields.push(...metricsFields)