return 0;
}
+static int
+lxcSetCpuTune(virDomainDefPtr def, virConfPtr properties)
+{
+ virConfValuePtr value;
+
+ if ((value = virConfGetValue(properties, "lxc.cgroup.cpu.shares")) &&
+ value->str && virStrToLong_ul(value->str, NULL, 10,
+ &def->cputune.shares) < 0)
+ goto error;
+
+ if ((value = virConfGetValue(properties,
+ "lxc.cgroup.cpu.cfs_quota_us")) &&
+ value->str && virStrToLong_ll(value->str, NULL, 10,
+ &def->cputune.quota) < 0)
+ goto error;
+
+ if ((value = virConfGetValue(properties,
+ "lxc.cgroup.cpu.cfs_period_us")) &&
+ value->str && virStrToLong_ull(value->str, NULL, 10,
+ &def->cputune.period) < 0)
+ goto error;
+
+ return 0;
+
+error:
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to parse integer: '%s'"), value->str);
+ return -1;
+}
+
virDomainDefPtr
lxcParseConfigString(const char *config)
{
if (lxcSetMemTune(vmdef, properties) < 0)
goto error;
+ /* lxc.cgroup.cpu.* */
+ if (lxcSetCpuTune(vmdef, properties) < 0)
+ goto error;
+
goto cleanup;
error:
--- /dev/null
+lxc.rootfs = /var/lib/lxc/migrate_test/rootfs
+lxc.utsname = migrate_test
+lxc.autodev=1
+
+lxc.cgroup.cpu.shares = 1024
+lxc.cgroup.cpu.cfs_quota_us = -1
+lxc.cgroup.cpu.cfs_period_us = 500000
--- /dev/null
+<domain type='lxc'>
+ <name>migrate_test</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>65536</memory>
+ <currentMemory unit='KiB'>0</currentMemory>
+ <vcpu placement='static' current='0'>1</vcpu>
+ <cputune>
+ <shares>1024</shares>
+ <period>500000</period>
+ <quota>-1</quota>
+ </cputune>
+ <os>
+ <type>exe</type>
+ <init>/sbin/init</init>
+ </os>
+ <features>
+ <privnet/>
+ </features>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <filesystem type='mount' accessmode='passthrough'>
+ <source dir='/var/lib/lxc/migrate_test/rootfs'/>
+ <target dir='/'/>
+ </filesystem>
+ </devices>
+</domain>