[libvirt] [PATCH 1/8] Add new API virDomain{Set, Get}BlockIoTune

Xu He Jie xuhj at linux.vnet.ibm.com
Thu Nov 10 06:11:46 UTC 2011


于 2011年11月10日 13:41, Lei Li 写道:
> On 11/10/2011 04:43 AM, Eric Blake wrote:
>> On 11/09/2011 01:32 PM, Lei Li wrote:
>>> This patch add new pulic API virDomainSetBlockIoTune and
>>> virDomainGetBlockIoTune.
>>>
>>>
>>> Signed-off-by: Zhi Yong Wu<wuzhy at linux.vnet.ibm.com>
>>> Signed-off-by: Lei Li<lilei at linux.vnet.ibm.com>
>>> ---
>>> include/libvirt/libvirt.h.in | 26 +++++++++
>>> src/driver.h | 19 +++++++
>>> src/libvirt.c | 115 ++++++++++++++++++++++++++++++++++++++++++
>>> src/libvirt_public.syms | 2 +
>>> 4 files changed, 162 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/include/libvirt/libvirt.h.in 
>>> b/include/libvirt/libvirt.h.in
>>> index aa320b6..a79c35e 100644
>>> --- a/include/libvirt/libvirt.h.in
>>> +++ b/include/libvirt/libvirt.h.in
>>> @@ -1640,6 +1640,32 @@ int virDomainBlockJobSetSpeed(virDomainPtr 
>>> dom, const char *path,
>>> int virDomainBlockPull(virDomainPtr dom, const char *path,
>>> unsigned long bandwidth, unsigned int flags);
>>>
>>> +/*
>>> + * Block I/O throttling support
>>> + */
>>> +
>>> +typedef struct _virDomainBlockIoTuneInfo virDomainBlockIoTuneInfo;
>>> +struct _virDomainBlockIoTuneInfo {
>>> + unsigned long long total_bytes_sec;
>>> + unsigned long long read_bytes_sec;
>>> + unsigned long long write_bytes_sec;
>>> + unsigned long long total_iops_sec;
>>> + unsigned long long read_iops_sec;
>>> + unsigned long long write_iops_sec;
>>> +};
>>> +typedef virDomainBlockIoTuneInfo *virDomainBlockIoTuneInfoPtr;
>>
>> This is not extensible. We've already learned the hard way that this 
>> MUST use virTypedParameter to make future additions painless, rather 
>> than hard-coding a particular structure.
>>
> Hi Eric,
>
> We consider using virTypeParameter as Adam suggested at first, but 
> when I dig into the code, I found
> struct virTypedParameter is mainly used by memtune, blkiotune...etc, 
> supported by cgroup mechanism,
> different from Block I/O throttling which is supported through qemu 
> monitor command 'block_set_io_throttle'.
>
virTypedParameter is used between libvirt client and libvirtd. It isn't 
used between libvirtd and qemu.

> Qemu monitor send all the setting parameters at one time within qmp 
> command made by qemuMonitorJSONMakeCommand,
> the union struct virTypeParameter is not very suitable for it. So we 
> still use struct virDomainBlockIoTuneInfo
> to keep consistent for qemu monitor command.
>




More information about the libvir-list mailing list