Signed-off-by: Wenchao Xia <xiawenc(a)linux.vnet.ibm.com>
---
libxkutil/device_parsing.c | 9 ++++++++-
src/Virt_ComputerSystem.c | 7 ++++++-
src/Virt_VirtualSystemManagementService.c | 6 ++++++
3 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/libxkutil/device_parsing.c b/libxkutil/device_parsing.c
index 2841662..83d4590 100644
--- a/libxkutil/device_parsing.c
+++ b/libxkutil/device_parsing.c
@@ -34,6 +34,8 @@
#include "xmlgen.h"
#include "../src/svpc_types.h"
+#include "config.h"
+
#define DISK_XPATH (xmlChar *)"/domain/devices/disk | "\
"/domain/devices/filesystem"
#define VCPU_XPATH (xmlChar *)"/domain/vcpu"
@@ -1407,7 +1409,9 @@ static int change_vcpus(virDomainPtr dom, struct virt_device *dev)
strncpy(param.field, "cpu_shares",
VIR_DOMAIN_SCHED_FIELD_LENGTH);
param.type = VIR_DOMAIN_SCHED_FIELD_ULLONG;
param.value.ul = dev->dev.vcpu.weight;
-
+
+ /* skip cgroup setting */
+#ifdef SUPPORT_CGROUP_CPU
if (virDomainSetSchedulerParameters(dom, ¶m, 1) != 0) {
CU_DEBUG("Failed to set scheduler params for domain");
return 0;
@@ -1416,6 +1420,9 @@ static int change_vcpus(virDomainPtr dom, struct virt_device *dev)
CU_DEBUG("Changed %s vcpu cgroup cpu_shares to %i",
virDomainGetName(dom),
dev->dev.vcpu.weight);
+#else
+ CU_DEBUG("Skipped setting cpu cgroup.");
+#endif
}
if (dev->dev.vcpu.quantity <= 0) {
diff --git a/src/Virt_ComputerSystem.c b/src/Virt_ComputerSystem.c
index adef85e..c422e3b 100644
--- a/src/Virt_ComputerSystem.c
+++ b/src/Virt_ComputerSystem.c
@@ -935,8 +935,13 @@ static void set_scheduler_params(virDomainPtr dom)
goto out;
}
- if (count > 0)
+ if (count > 0) {
+#ifdef SUPPORT_CGROUP_CPU
virDomainSetSchedulerParameters(dom, params, count);
+#else
+ CU_DEBUG("Skipped setting cpu cgroup.");
+#endif
+ }
else
CU_DEBUG("No sched parameters to set");
out:
diff --git a/src/Virt_VirtualSystemManagementService.c
b/src/Virt_VirtualSystemManagementService.c
index 059b852..9a9b635 100644
--- a/src/Virt_VirtualSystemManagementService.c
+++ b/src/Virt_VirtualSystemManagementService.c
@@ -1778,11 +1778,17 @@ static CMPIStatus update_dominfo(const struct domain *dominfo,
params.type = VIR_DOMAIN_SCHED_FIELD_ULLONG;
params.value.ul = dev->dev.vcpu.weight;
+#ifdef SUPPORT_CGROUP_CPU
CU_DEBUG("setting %s scheduler param cpu_shares=%d",
dominfo->name,
dev->dev.vcpu.weight);
ret = virDomainSetSchedulerParametersFlags(dom, ¶ms, 1,
VIR_DOMAIN_AFFECT_CONFIG);
+#else
+ CU_DEBUG("Skipped cgroup cpu setting.");
+ ret = 0;
+#endif
+
if (ret != 0) {
CU_DEBUG("Failed to set config scheduler param");
cu_statusf(_BROKER, &s,
--
1.7.1
Show replies by date