[PATCH v4 1/7] migration/dirtyrate: Introduce virDomainDirtyRateInfo structure
Peter Krempa
pkrempa at redhat.com
Wed Nov 11 10:06:30 UTC 2020
On Tue, Nov 10, 2020 at 21:12:33 +0100, Michal Privoznik wrote:
> On 11/7/20 10:41 AM, Hao Wang wrote:
> > Introduce virDomainDirtyRateInfo structure used for domain's memory dirty rate query.
> >
> > Signed-off-by: Hao Wang <wanghao232 at huawei.com>
> > Reviewed-by: Chuan Zheng <zhengchuan at huawei.com>
> > ---
> > include/libvirt/libvirt-domain.h | 24 ++++++++++++++++++++++++
> > 1 file changed, 24 insertions(+)
> >
> > diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
> > index b3310729bf..145f517068 100644
> > --- a/include/libvirt/libvirt-domain.h
> > +++ b/include/libvirt/libvirt-domain.h
> > @@ -5096,4 +5096,28 @@ int virDomainBackupBegin(virDomainPtr domain,
> > char *virDomainBackupGetXMLDesc(virDomainPtr domain,
> > unsigned int flags);
> > +/**
> > + * virDomainDirtyRateInfo:
> > + *
> > + * a virDomainDirtyRateInfo is a structure filled by virDomainGetDirtyRate() and
> > + * extracting dirty rate infomation for a given active Domain.
> > + */
> > +
> > +typedef struct _virDomainDirtyRateInfo virDomainDirtyRateInfo;
> > +
> > +struct _virDomainDirtyRateInfo {
> > + int status; /* the status of dirtyrate calculation */
> > + long long dirtyRate; /* the dirtyrate in MB/s */
> > + long long startTime; /* the start time of dirtyrate calculation */
> > + long long calcTime; /* the period of dirtyrate calculation */
> > +};
> > +
> > +/**
> > + * virDomainDirtyRateInfoPtr:
> > + *
> > + * a virDomainDirtyRateInfoPtr is a pointer to a virDomainDirtyRateInfo structure.
> > + */
> > +
> > +typedef virDomainDirtyRateInfo *virDomainDirtyRateInfoPtr;
> > +
> > #endif /* LIBVIRT_DOMAIN_H */
> >
>
> This should be squashed with 2/7 and bits of 5/7 and 6/7 which modify this
> file. The key here is that public API should go into one patch, driver
> implementation into other - it's easier to backport patches this way.
Additionally I'm not sure how likely is that the data will be extened at
some point in the future, but using a struct is not extensible.
I'd suggest that this gets reported in the domain stats API
More information about the libvir-list
mailing list