On 08/03/2012 12:36 AM, Hu Tao wrote:
From: Wen Congyang <wency(a)cn.fujitsu.com>
allow the user change/get hypervisor's period and quota when the vm is running.
---
include/libvirt/libvirt.h.in | 16 +++++
src/qemu/qemu_driver.c | 133 +++++++++++++++++++++++++++++++++++++++++-
2 files changed, 148 insertions(+), 1 deletion(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 15c08c1..dd34295 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -692,6 +692,22 @@ typedef virTypedParameter *virTypedParameterPtr;
#define VIR_DOMAIN_SCHEDULER_VCPU_QUOTA "vcpu_quota"
/**
+ * VIR_DOMAIN_SCHEDULER_HYPERVISOR_PERIOD:
more of the s/hypervisor/emulator/ renaming
+ *
+ * Macro represents the enforcement period for a quota, in microseconds,
+ * when using the posix scheduler, as a ullong.
Enforcement period for what? I would suggest:
Macro represents the enforcement period for a quota in microseconds,
when using the posix scheduler, for all emulator activity not tied to
vcpus, as a ullong.
+ */
+#define VIR_DOMAIN_SCHEDULER_HYPERVISOR_PERIOD "hypervisor_period"
+
+/**
+ * VIR_DOMAIN_SCHEDULER_HYPERVISOR_QUOTA:
+ *
+ * Macro represents the maximum bandwidth to be used within a period,
+ * when using the posix scheduler, as an llong.
and similarly. It may mean rewording the existing descriptions of vcpu
quota to be more obvious that they limit only vcpu activity.
@@ -7420,6 +7420,40 @@ cleanup:
}
static int
+qemuSetHypervisorBWLive(virDomainObjPtr vm, virCgroupPtr cgroup,
Probably copying from existing naming, but BW looks awkward to me (I
first read it as black/white, not bandwidth); spelling it out would help.
static int
+qemuGetHypervisorBWLive(virDomainObjPtr vm, virCgroupPtr cgroup,
+ unsigned long long *period, long long *quota)
Same comment about spelling out BW as Bandwidth.
+{
+ virCgroupPtr cgroup_hypervisor = NULL;
+ qemuDomainObjPrivatePtr priv = NULL;
+ int rc;
+ int ret = -1;
+
+ priv = vm->privateData;
+ if (priv->nvcpupids == 0 || priv->vcpupids[0] == vm->pid) {
+ /* We donot create sub dir for each vcpu */
s/donot/don't/
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org