提交 438c2047 编写于 作者: D Derbyshev Dmitry 提交者: Pavel Hrdina

qemu: return balloon statistics when all domain statistics reported

To collect all balloon statistics for all guests it was necessary to make
several libvirt requests. Now it's possible to get all balloon statiscs via
single connectGetAllDomainStats call.
Signed-off-by: NDerbyshev Dmitry <dderbyshev@virtuozzo.com>
上级 c3e3227a
......@@ -18529,14 +18529,17 @@ qemuDomainGetStatsCpu(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
}
static int
qemuDomainGetStatsBalloon(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
qemuDomainGetStatsBalloon(virQEMUDriverPtr driver,
virDomainObjPtr dom,
virDomainStatsRecordPtr record,
int *maxparams,
unsigned int privflags ATTRIBUTE_UNUSED)
unsigned int privflags)
{
qemuDomainObjPrivatePtr priv = dom->privateData;
virDomainMemoryStatStruct stats[VIR_DOMAIN_MEMORY_STAT_NR];
int nr_stats;
unsigned long long cur_balloon = 0;
size_t i;
int err = 0;
if (!virDomainDefHasMemballoon(dom->def)) {
......@@ -18561,6 +18564,37 @@ qemuDomainGetStatsBalloon(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainDefGetMemoryTotal(dom->def)) < 0)
return -1;
if (!HAVE_JOB(privflags) || !virDomainObjIsActive(dom))
return 0;
nr_stats = qemuDomainMemoryStatsInternal(driver, dom, stats,
VIR_DOMAIN_MEMORY_STAT_NR);
if (nr_stats < 0)
return 0;
#define STORE_MEM_RECORD(TAG, NAME) \
if (stats[i].tag == VIR_DOMAIN_MEMORY_STAT_ ##TAG) \
if (virTypedParamsAddULLong(&record->params, \
&record->nparams, \
maxparams, \
"balloon." NAME, \
stats[i].val) < 0) \
return -1;
for (i = 0; i < nr_stats; i++) {
STORE_MEM_RECORD(SWAP_IN, "swap_in")
STORE_MEM_RECORD(SWAP_OUT, "swap_out")
STORE_MEM_RECORD(MAJOR_FAULT, "major_fault")
STORE_MEM_RECORD(MINOR_FAULT, "minor_fault")
STORE_MEM_RECORD(UNUSED, "unused")
STORE_MEM_RECORD(AVAILABLE, "available")
STORE_MEM_RECORD(RSS, "rss")
STORE_MEM_RECORD(LAST_UPDATE, "last-update")
STORE_MEM_RECORD(USABLE, "usable")
}
#undef STORE_MEM_RECORD
return 0;
}
......
......@@ -899,7 +899,17 @@ I<--cpu-total> returns:
I<--balloon> returns:
"balloon.current" - the memory in kiB currently used,
"balloon.maximum" - the maximum memory in kiB allowed
"balloon.maximum" - the maximum memory in kiB allowed,
"balloon.swap_in" - the amount of data read from swap space (in kB),
"balloon.swap_out" - the amount of memory written out to swap space (in kB),
"balloon.major_fault" - the number of page faults then disk IO was required,
"balloon.minor_fault" - the number of other page faults,
"balloon.unused" - the amount of memory left unused by the system (in kB),
"balloon.available" - the amount of usable memory as seen by the domain (in kB),
"balloon.rss" - Resident Set Size of running domain's process (in kB),
"balloon.usable" - the amount of memory which can be reclaimed by balloon
without causing host swapping (in KB),
"balloon.last-update" - timestamp of the last update of statistics (in seconds),
I<--vcpu> returns:
"vcpu.current" - current number of online virtual CPUs,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册