[libvirt] [PATCH 3/6] qemu: Implement domainSetBlkioParamters and domainGetBlkioParamters for QEmu

Eric Blake eblake at redhat.com
Mon Feb 21 22:39:12 UTC 2011


On 02/21/2011 02:24 AM, Gui Jianfeng wrote:
> Implement domainSetBlkioParamters and domainGetBlkioParamters for QEmu
> 
> Signed-off-by: Gui Jianfeng <guijianfeng at cn.fujitsu.com>
> ---
>  src/qemu/qemu_driver.c |  162 +++++++++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 160 insertions(+), 2 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 6b63ca1..7e5e00d 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -110,6 +110,7 @@
>  # define KVM_CAP_NR_VCPUS 9       /* returns max vcpus per vm */
>  #endif
>  
> +#define QEMU_NB_BLKIO_PARAM  1
>  
>  #define timeval_to_ms(tv)       (((tv).tv_sec * 1000ull) + ((tv).tv_usec / 1000))
>  
> @@ -4435,6 +4436,163 @@ cleanup:
>      return ret;
>  }
>  
> +static int qemuDomainSetBlkioParameters(virDomainPtr dom,
> +                                         virBlkioParameterPtr params,
> +                                         int nparams,
> +                                         unsigned int flags ATTRIBUTE_UNUSED)

New API should _not_ mark flags ATTRIBUTE_UNUSED.  Rather, you should add...

> +{
> +    struct qemud_driver *driver = dom->conn->privateData;
> +    int i;
> +    virCgroupPtr group = NULL;
> +    virDomainObjPtr vm = NULL;
> +    int ret = -1;
> +

virCheckFlags(0, -1);

That way, if we do add a flag in the future, then a new client that
knows about the flag but talks to an older server that doesn't know
about the flag will be properly rejected, rather than silently ignoring
the unknown flag.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110221/d92164f9/attachment-0001.sig>


More information about the libvir-list mailing list