This function sets cpu bandwidth, not only for vcpu. so rename it.
---
src/qemu/qemu_cgroup.c | 9 +++++----
src/qemu/qemu_cgroup.h | 6 +++---
src/qemu/qemu_driver.c | 6 +++---
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index f8f375f..91dcedd 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -431,8 +431,9 @@ cleanup:
return -1;
}
-int qemuSetupCgroupVcpuBW(virCgroupPtr cgroup, unsigned long long period,
- long long quota)
+int qemuSetupCgroupCpuBandwidth(virCgroupPtr cgroup,
+ unsigned long long period,
+ long long quota)
{
int rc;
unsigned long long old_period;
@@ -517,7 +518,7 @@ int qemuSetupCgroupForVcpu(struct qemud_driver *driver,
virDomainObjPtr vm)
vm_quota = quota * vm->def->vcpus;
else
vm_quota = quota;
- if (qemuSetupCgroupVcpuBW(cgroup, period, vm_quota) < 0)
+ if (qemuSetupCgroupCpuBandwidth(cgroup, period, vm_quota) < 0)
goto cleanup;
}
}
@@ -551,7 +552,7 @@ int qemuSetupCgroupForVcpu(struct qemud_driver *driver,
virDomainObjPtr vm)
if (period || quota) {
if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
- if (qemuSetupCgroupVcpuBW(cgroup_vcpu, period, quota) < 0)
+ if (qemuSetupCgroupCpuBandwidth(cgroup_vcpu, period, quota) < 0)
goto cleanup;
}
}
diff --git a/src/qemu/qemu_cgroup.h b/src/qemu/qemu_cgroup.h
index c1023b3..780b4a0 100644
--- a/src/qemu/qemu_cgroup.h
+++ b/src/qemu/qemu_cgroup.h
@@ -50,9 +50,9 @@ int qemuSetupHostUsbDeviceCgroup(usbDevice *dev,
int qemuSetupCgroup(struct qemud_driver *driver,
virDomainObjPtr vm,
char *nodemask);
-int qemuSetupCgroupVcpuBW(virCgroupPtr cgroup,
- unsigned long long period,
- long long quota);
+int qemuSetupCgroupCpuBandwidth(virCgroupPtr cgroup,
+ unsigned long long period,
+ long long quota);
int qemuSetupCgroupForVcpu(struct qemud_driver *driver, virDomainObjPtr vm);
int qemuRemoveCgroup(struct qemud_driver *driver,
virDomainObjPtr vm,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2177c30..b0b7816 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -7184,7 +7184,7 @@ qemuSetVcpusBWLive(virDomainObjPtr vm, virCgroupPtr cgroup,
if (((vm_quota != 0) && (vm_quota > old_quota)) ||
((period != 0) && (period < old_period)))
/* Set cpu bandwidth for the vm */
- if (qemuSetupCgroupVcpuBW(cgroup, period, vm_quota) < 0)
+ if (qemuSetupCgroupCpuBandwidth(cgroup, period, vm_quota) < 0)
goto cleanup;
/* If we does not know VCPU<->PID mapping or all vcpu runs in the same
@@ -7202,7 +7202,7 @@ qemuSetVcpusBWLive(virDomainObjPtr vm, virCgroupPtr cgroup,
goto cleanup;
}
- if (qemuSetupCgroupVcpuBW(cgroup_vcpu, period, quota) < 0)
+ if (qemuSetupCgroupCpuBandwidth(cgroup_vcpu, period, quota) < 0)
goto cleanup;
virCgroupFree(&cgroup_vcpu);
@@ -7212,7 +7212,7 @@ qemuSetVcpusBWLive(virDomainObjPtr vm, virCgroupPtr cgroup,
if (((vm_quota != 0) && (vm_quota <= old_quota)) ||
((period != 0) && (period >= old_period)))
/* Set cpu bandwidth for the vm */
- if (qemuSetupCgroupVcpuBW(cgroup, period, vm_quota) < 0)
+ if (qemuSetupCgroupCpuBandwidth(cgroup, period, vm_quota) < 0)
goto cleanup;
return 0;
--
1.7.4.4