Re: [PATCH v4 1/7] migration/dirtyrate: Introduce virDomainDirtyRateInfo structure
Do you mean embed this api into domstats like "virsh domstats --dirtyrate"? It's indeed a good idea in consideration of extensibility. I will try that in my next version, however, I have no idea about where to place my secondary options (--second, --calculate and --query). Any suggestion? PS: Here is my original design: virsh getdirtyrate --domain [--calculate] [--query] [--seconds ] BR, Hao >> >> 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 > > . >
Re: [PATCH v4 1/7] migration/dirtyrate: Introduce virDomainDirtyRateInfo structure
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 > > Reviewed-by: Chuan Zheng > > --- > > 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
Re: [PATCH v4 1/7] migration/dirtyrate: Introduce virDomainDirtyRateInfo structure
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 Reviewed-by: Chuan Zheng --- 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. Michal
[PATCH v4 1/7] migration/dirtyrate: Introduce virDomainDirtyRateInfo structure
Introduce virDomainDirtyRateInfo structure used for domain's memory dirty rate query. Signed-off-by: Hao Wang Reviewed-by: Chuan Zheng --- 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 */ -- 2.23.0