From: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Introduce virDomainDirtyRateCalcFlags and
virDomainDirtyRateCalcMode to get ready for adding mode
parameter to qemuDomainStartDirtyRateCalc.
Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
---
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 374859f..722a310 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -5257,8 +5257,32 @@ typedef enum {
# endif
} virDomainDirtyRateStatus;
+/**
+ * virDomainDirtyRateCalcFlags:
+ *
+ * Flags OR'ed together to provide specific behaviour when calculating dirty page
+ * rate for a Domain
+ *
+ */
+typedef enum {
+ VIR_DOMAIN_DIRTYRATE_MODE_PAGE_SAMPLING = 0, /* default mode - page-sampling */
+ VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_BITMAP = 1 << 0, /* dirty-bitmap mode */
+ VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_RING = 1 << 1, /* dirty-ring mode */
+} virDomainDirtyRateCalcFlags;
+
int virDomainStartDirtyRateCalc(virDomainPtr domain,
int seconds,
unsigned int flags);
+/**
+ * virDomainDirtyRateCalcMode:
+ *
+ * Dirty page rate calculation mode used during measurement.
+ */
+typedef enum {
+ VIR_DOMAIN_DIRTYRATE_CALC_MODE_PAGE_SAMPLING = 0,
+ VIR_DOMAIN_DIRTYRATE_CALC_MODE_DIRTY_BITMAP,
+ VIR_DOMAIN_DIRTYRATE_CALC_MODE_DIRTY_RING,
+ VIR_DOMAIN_DIRTYRATE_CALC_MODE_LAST,
+} virDomainDirtyRateCalcMode;
#endif /* LIBVIRT_DOMAIN_H */
--
1.8.3.1
On 1/28/22 08:35, huangy81@chinatelecom.cn wrote:
> From: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
>
> Introduce virDomainDirtyRateCalcFlags and
> virDomainDirtyRateCalcMode to get ready for adding mode
> parameter to qemuDomainStartDirtyRateCalc.
>
> Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
> ---
> 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 374859f..722a310 100644
> --- a/include/libvirt/libvirt-domain.h
> +++ b/include/libvirt/libvirt-domain.h
> @@ -5257,8 +5257,32 @@ typedef enum {
> # endif
> } virDomainDirtyRateStatus;
>
> +/**
> + * virDomainDirtyRateCalcFlags:
> + *
> + * Flags OR'ed together to provide specific behaviour when calculating dirty page
> + * rate for a Domain
> + *
> + */
> +typedef enum {
> + VIR_DOMAIN_DIRTYRATE_MODE_PAGE_SAMPLING = 0, /* default mode - page-sampling */
> + VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_BITMAP = 1 << 0, /* dirty-bitmap mode */
> + VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_RING = 1 << 1, /* dirty-ring mode */
> +} virDomainDirtyRateCalcFlags;
> +
> int virDomainStartDirtyRateCalc(virDomainPtr domain,
> int seconds,
> unsigned int flags);
Up until here it's okay.
> +/**
> + * virDomainDirtyRateCalcMode:
> + *
> + * Dirty page rate calculation mode used during measurement.
> + */
> +typedef enum {
> + VIR_DOMAIN_DIRTYRATE_CALC_MODE_PAGE_SAMPLING = 0,
> + VIR_DOMAIN_DIRTYRATE_CALC_MODE_DIRTY_BITMAP,
> + VIR_DOMAIN_DIRTYRATE_CALC_MODE_DIRTY_RING,
> + VIR_DOMAIN_DIRTYRATE_CALC_MODE_LAST,
> +} virDomainDirtyRateCalcMode;
>
> #endif /* LIBVIRT_DOMAIN_H */
But this doesn't belong here. These flags are used only internally. Why
they need to be exposed?
Michal
在 2022/2/14 18:13, Michal Prívozník 写道:
> On 1/28/22 08:35, huangy81@chinatelecom.cn wrote:
>> From: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
>>
>> Introduce virDomainDirtyRateCalcFlags and
>> virDomainDirtyRateCalcMode to get ready for adding mode
>> parameter to qemuDomainStartDirtyRateCalc.
>>
>> Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
>> ---
>> 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 374859f..722a310 100644
>> --- a/include/libvirt/libvirt-domain.h
>> +++ b/include/libvirt/libvirt-domain.h
>> @@ -5257,8 +5257,32 @@ typedef enum {
>> # endif
>> } virDomainDirtyRateStatus;
>>
>> +/**
>> + * virDomainDirtyRateCalcFlags:
>> + *
>> + * Flags OR'ed together to provide specific behaviour when calculating dirty page
>> + * rate for a Domain
>> + *
>> + */
>> +typedef enum {
>> + VIR_DOMAIN_DIRTYRATE_MODE_PAGE_SAMPLING = 0, /* default mode - page-sampling */
>> + VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_BITMAP = 1 << 0, /* dirty-bitmap mode */
>> + VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_RING = 1 << 1, /* dirty-ring mode */
>> +} virDomainDirtyRateCalcFlags;
>> +
>> int virDomainStartDirtyRateCalc(virDomainPtr domain,
>> int seconds,
>> unsigned int flags);
>
> Up until here it's okay.
>
>> +/**
>> + * virDomainDirtyRateCalcMode:
>> + *
>> + * Dirty page rate calculation mode used during measurement.
>> + */
>> +typedef enum {
>> + VIR_DOMAIN_DIRTYRATE_CALC_MODE_PAGE_SAMPLING = 0,
>> + VIR_DOMAIN_DIRTYRATE_CALC_MODE_DIRTY_BITMAP,
>> + VIR_DOMAIN_DIRTYRATE_CALC_MODE_DIRTY_RING,
>> + VIR_DOMAIN_DIRTYRATE_CALC_MODE_LAST,
>> +} virDomainDirtyRateCalcMode;
>>
>> #endif /* LIBVIRT_DOMAIN_H */
>
> But this doesn't belong here. These flags are used only internally. Why
> they need to be exposed?
>
When displaying the dirtyrate info in 'virsh domstats --dirtyrate' api,
we introduce the 'mode' field to show what mode used last calculation.
Whose meanings can be refered to the virDomainDirtyRateCalcMode
> Michal
>
--
Best regard
Hyman Huang(黄勇)
On 2/14/22 12:21, Hyman Huang wrote: > > > When displaying the dirtyrate info in 'virsh domstats --dirtyrate' api, > we introduce the 'mode' field to show what mode used last calculation. > Whose meanings can be refered to the virDomainDirtyRateCalcMode Oh, I did not realize that. In that case it's okay if this stays here. Michal
On Mon, Feb 14, 2022 at 07:21:58PM +0800, Hyman Huang wrote:
>
>
> 在 2022/2/14 18:13, Michal Prívozník 写道:
> > On 1/28/22 08:35, huangy81@chinatelecom.cn wrote:
> > > From: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
> > >
> > > Introduce virDomainDirtyRateCalcFlags and
> > > virDomainDirtyRateCalcMode to get ready for adding mode
> > > parameter to qemuDomainStartDirtyRateCalc.
> > >
> > > Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
> > > ---
> > > 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 374859f..722a310 100644
> > > --- a/include/libvirt/libvirt-domain.h
> > > +++ b/include/libvirt/libvirt-domain.h
> > > @@ -5257,8 +5257,32 @@ typedef enum {
> > > # endif
> > > } virDomainDirtyRateStatus;
> > > +/**
> > > + * virDomainDirtyRateCalcFlags:
> > > + *
> > > + * Flags OR'ed together to provide specific behaviour when calculating dirty page
> > > + * rate for a Domain
> > > + *
> > > + */
> > > +typedef enum {
> > > + VIR_DOMAIN_DIRTYRATE_MODE_PAGE_SAMPLING = 0, /* default mode - page-sampling */
> > > + VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_BITMAP = 1 << 0, /* dirty-bitmap mode */
> > > + VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_RING = 1 << 1, /* dirty-ring mode */
> > > +} virDomainDirtyRateCalcFlags;
> > > +
> > > int virDomainStartDirtyRateCalc(virDomainPtr domain,
> > > int seconds,
> > > unsigned int flags);
> >
> > Up until here it's okay.
> >
> > > +/**
> > > + * virDomainDirtyRateCalcMode:
> > > + *
> > > + * Dirty page rate calculation mode used during measurement.
> > > + */
> > > +typedef enum {
> > > + VIR_DOMAIN_DIRTYRATE_CALC_MODE_PAGE_SAMPLING = 0,
> > > + VIR_DOMAIN_DIRTYRATE_CALC_MODE_DIRTY_BITMAP,
> > > + VIR_DOMAIN_DIRTYRATE_CALC_MODE_DIRTY_RING,
> > > + VIR_DOMAIN_DIRTYRATE_CALC_MODE_LAST,
> > > +} virDomainDirtyRateCalcMode;
> > > #endif /* LIBVIRT_DOMAIN_H */
> >
> > But this doesn't belong here. These flags are used only internally. Why
> > they need to be exposed?
> >
>
> When displaying the dirtyrate info in 'virsh domstats --dirtyrate' api, we
> introduce the 'mode' field to show what mode used last calculation. Whose
> meanings can be refered to the virDomainDirtyRateCalcMode
The 'mode' should be exposed in string format. We don't put enum integer
values into virTypedParameter fields normally, because we expect clients
to be robust against new enum values being added at a later date.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
在 2022/2/14 19:31, Daniel P. Berrangé 写道:
> On Mon, Feb 14, 2022 at 07:21:58PM +0800, Hyman Huang wrote:
>>
>>
>> 在 2022/2/14 18:13, Michal Prívozník 写道:
>>> On 1/28/22 08:35, huangy81@chinatelecom.cn wrote:
>>>> From: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
>>>>
>>>> Introduce virDomainDirtyRateCalcFlags and
>>>> virDomainDirtyRateCalcMode to get ready for adding mode
>>>> parameter to qemuDomainStartDirtyRateCalc.
>>>>
>>>> Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
>>>> ---
>>>> 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 374859f..722a310 100644
>>>> --- a/include/libvirt/libvirt-domain.h
>>>> +++ b/include/libvirt/libvirt-domain.h
>>>> @@ -5257,8 +5257,32 @@ typedef enum {
>>>> # endif
>>>> } virDomainDirtyRateStatus;
>>>> +/**
>>>> + * virDomainDirtyRateCalcFlags:
>>>> + *
>>>> + * Flags OR'ed together to provide specific behaviour when calculating dirty page
>>>> + * rate for a Domain
>>>> + *
>>>> + */
>>>> +typedef enum {
>>>> + VIR_DOMAIN_DIRTYRATE_MODE_PAGE_SAMPLING = 0, /* default mode - page-sampling */
>>>> + VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_BITMAP = 1 << 0, /* dirty-bitmap mode */
>>>> + VIR_DOMAIN_DIRTYRATE_MODE_DIRTY_RING = 1 << 1, /* dirty-ring mode */
>>>> +} virDomainDirtyRateCalcFlags;
>>>> +
>>>> int virDomainStartDirtyRateCalc(virDomainPtr domain,
>>>> int seconds,
>>>> unsigned int flags);
>>>
>>> Up until here it's okay.
>>>
>>>> +/**
>>>> + * virDomainDirtyRateCalcMode:
>>>> + *
>>>> + * Dirty page rate calculation mode used during measurement.
>>>> + */
>>>> +typedef enum {
>>>> + VIR_DOMAIN_DIRTYRATE_CALC_MODE_PAGE_SAMPLING = 0,
>>>> + VIR_DOMAIN_DIRTYRATE_CALC_MODE_DIRTY_BITMAP,
>>>> + VIR_DOMAIN_DIRTYRATE_CALC_MODE_DIRTY_RING,
>>>> + VIR_DOMAIN_DIRTYRATE_CALC_MODE_LAST,
>>>> +} virDomainDirtyRateCalcMode;
>>>> #endif /* LIBVIRT_DOMAIN_H */
>>>
>>> But this doesn't belong here. These flags are used only internally. Why
>>> they need to be exposed?
>>>
>>
>> When displaying the dirtyrate info in 'virsh domstats --dirtyrate' api, we
>> introduce the 'mode' field to show what mode used last calculation. Whose
>> meanings can be refered to the virDomainDirtyRateCalcMode
>
> The 'mode' should be exposed in string format. We don't put enum integer
> values into virTypedParameter fields normally, because we expect clients
> to be robust against new enum values being added at a later date.
>
Indeed, originally i think it seems werid, but since
dirtyrate.calc_status alrealy implemented the same way, i didn't think
about this more carefully.
"dirtyrate.calc_status" - the status of last memory dirty rate calculation.
I'll modify this next version and more importantly, it will be
consistent with virsh domdirtyrate-calc parameter
"--mode=[page-samling|dirty-bitmap|dirty-ring]"
>
> Regards,
> Daniel
--
Best regard
Hyman Huang(黄勇)
© 2016 - 2026 Red Hat, Inc.