On 02/21/2011 02:24 AM, Gui Jianfeng wrote:
Implement domainSetBlkioParamters and domainGetBlkioParamters for
QEmu
Signed-off-by: Gui Jianfeng <guijianfeng(a)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(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org