vz: get disks statistics for CTs

A CT disk statistics is reported with prefix "hdd" and we should use
it to extract data.

Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
This commit is contained in:
Maxim Nestratov 2016-12-05 16:52:56 +03:00
parent 7eda8369fc
commit e4aa80dfde
3 changed files with 33 additions and 20 deletions

View File

@ -1746,7 +1746,10 @@ vzDomainBlockStatsImpl(virDomainObjPtr dom,
virReportError(VIR_ERR_INVALID_ARG, _("invalid path: %s"), path);
return -1;
}
if (prlsdkGetBlockStats(privdom->stats, dom->def->disks[idx], stats) < 0)
if (prlsdkGetBlockStats(privdom->stats,
dom->def->disks[idx],
stats,
IS_CT(dom->def)) < 0)
return -1;
} else {
virDomainBlockStatsStruct s;
@ -1759,7 +1762,10 @@ vzDomainBlockStatsImpl(virDomainObjPtr dom,
#undef PARALLELS_ZERO_STATS
for (i = 0; i < dom->def->ndisks; i++) {
if (prlsdkGetBlockStats(privdom->stats, dom->def->disks[i], &s) < 0)
if (prlsdkGetBlockStats(privdom->stats,
dom->def->disks[i],
&s,
IS_CT(dom->def)) < 0)
return -1;
#define PARALLELS_SUM_STATS(VAR, TYPE, NAME) \

View File

@ -4367,7 +4367,8 @@ prlsdkExtractStatsParam(PRL_HANDLE sdkstats, const char *name, long long *val)
int
prlsdkGetBlockStats(PRL_HANDLE sdkstats,
virDomainDiskDefPtr disk,
virDomainBlockStatsPtr stats)
virDomainBlockStatsPtr stats,
bool isCt)
{
virDomainDeviceDriveAddressPtr address;
int idx;
@ -4376,6 +4377,11 @@ prlsdkGetBlockStats(PRL_HANDLE sdkstats,
char *name = NULL;
address = &disk->info.addr.drive;
if (isCt) {
prefix = "hdd";
idx = address->unit;
} else {
switch (disk->bus) {
case VIR_DOMAIN_DISK_BUS_IDE:
prefix = "ide";
@ -4394,6 +4400,7 @@ prlsdkGetBlockStats(PRL_HANDLE sdkstats,
_("Unknown disk bus: %X"), disk->bus);
goto cleanup;
}
}
#define PRLSDK_GET_STAT_PARAM(VAL, TYPE, NAME) \

View File

@ -63,7 +63,7 @@ prlsdkDetachDevice(vzDriverPtr driver, virDomainObjPtr dom, virDomainDeviceDefPt
int
prlsdkUpdateDevice(vzDriverPtr driver, virDomainObjPtr dom, virDomainDeviceDefPtr dev);
int
prlsdkGetBlockStats(PRL_HANDLE sdkstats, virDomainDiskDefPtr disk, virDomainBlockStatsPtr stats);
prlsdkGetBlockStats(PRL_HANDLE sdkstats, virDomainDiskDefPtr disk, virDomainBlockStatsPtr stats, bool isCt);
int
prlsdkGetNetStats(PRL_HANDLE sdkstas, PRL_HANDLE sdkdom, const char *path, virDomainInterfaceStatsPtr stats);
int