Re: [PATCH 5/5] vz: get disks statistics for CTs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 09.12.2016 17:36, Maxim Nestratov wrote:
> A CT disk statistics is reported with prefix "hdd" and we should use
> it to extract data.
> 
> Signed-off-by: Maxim Nestratov <mnestratov@xxxxxxxxxxxxx>
> ---
>  src/vz/vz_driver.c | 10 ++++++++--
>  src/vz/vz_sdk.c    |  5 +++--
>  src/vz/vz_sdk.h    |  2 +-
>  3 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
> index a634ed2..3a22b07 100644
> --- a/src/vz/vz_driver.c
> +++ b/src/vz/vz_driver.c
> @@ -1743,7 +1743,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;
> @@ -1756,7 +1759,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)        \
> diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
> index 9b8b48e..dff531f 100644
> --- a/src/vz/vz_sdk.c
> +++ b/src/vz/vz_sdk.c
> @@ -4360,7 +4360,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;
> @@ -4379,7 +4380,7 @@ prlsdkGetBlockStats(PRL_HANDLE sdkstats,
>          idx = address->unit;
>          break;
>      case VIR_DOMAIN_DISK_BUS_SCSI:
> -        prefix = "scsi";
> +        prefix = isCt ? "hdd" : "scsi";

I would calculate prefix for containers outside the scope of this switch.
Even if it means bigger diff, the switch deserves its own function anyway.

Otherwise ACK.

>          idx = address->unit;
>          break;
>      default:
> diff --git a/src/vz/vz_sdk.h b/src/vz/vz_sdk.h
> index ef789ab..e4e46dc 100644
> --- a/src/vz/vz_sdk.h
> +++ b/src/vz/vz_sdk.h
> @@ -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
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux