使用libvirt JAVA API 获取KVM 内存数据错误
使用libvirt JAVA API 获取远程主机上KVM 内存数据,测试多个kvm,均显示内存利用率100%,而且横低恒定不变。相关java api(http://libvirt.org/sources/java/javadoc/)::
CLASS: DomainInfo
Field:
long maxMem
the maximum memory in KBytes allowed
long memory
the memory in KBytes used by the domain
代码:
Domain currentDomain;
currentDomain = kVMConnect.domainLookupByName((String)kvmList.getSelectedValue());
DomainInfo dinfo=currentDomain.getInfo();
System.out.println("Allowed Memory: "+dinfo.maxMem+"\n");
System.out.println("Used Memory: "+dinfo.memory+"\n");
输出结果:
Allowed Memory: 2048000
Used Memory: 2048000
ps:利用率100%,
补充:云计算 , Cloud Foundry