mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
LXC from native: map lxc.cgroup.cpuset.*
This commit is contained in:
parent
4f3f7aea6c
commit
281e2990ee
@ -673,6 +673,32 @@ error:
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
lxcSetCpusetTune(virDomainDefPtr def, virConfPtr properties)
|
||||||
|
{
|
||||||
|
virConfValuePtr value;
|
||||||
|
|
||||||
|
if ((value = virConfGetValue(properties, "lxc.cgroup.cpuset.cpus")) &&
|
||||||
|
value->str) {
|
||||||
|
if (virBitmapParse(value->str, 0, &def->cpumask,
|
||||||
|
VIR_DOMAIN_CPUMASK_LEN) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((value = virConfGetValue(properties, "lxc.cgroup.cpuset.mems")) &&
|
||||||
|
value->str) {
|
||||||
|
def->numatune.memory.placement_mode = VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC;
|
||||||
|
def->numatune.memory.mode = VIR_DOMAIN_NUMATUNE_MEM_STRICT;
|
||||||
|
if (virBitmapParse(value->str, 0, &def->numatune.memory.nodemask,
|
||||||
|
VIR_DOMAIN_CPUMASK_LEN) < 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
virDomainDefPtr
|
virDomainDefPtr
|
||||||
lxcParseConfigString(const char *config)
|
lxcParseConfigString(const char *config)
|
||||||
{
|
{
|
||||||
@ -753,6 +779,10 @@ lxcParseConfigString(const char *config)
|
|||||||
if (lxcSetCpuTune(vmdef, properties) < 0)
|
if (lxcSetCpuTune(vmdef, properties) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
/* lxc.cgroup.cpuset.* */
|
||||||
|
if (lxcSetCpusetTune(vmdef, properties) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
6
tests/lxcconf2xmldata/lxcconf2xml-cpusettune.config
Normal file
6
tests/lxcconf2xmldata/lxcconf2xml-cpusettune.config
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
lxc.rootfs = /var/lib/lxc/migrate_test/rootfs
|
||||||
|
lxc.utsname = migrate_test
|
||||||
|
lxc.autodev=1
|
||||||
|
|
||||||
|
lxc.cgroup.cpuset.cpus = 1,2,5-7
|
||||||
|
lxc.cgroup.cpuset.mems = 1-4
|
27
tests/lxcconf2xmldata/lxcconf2xml-cpusettune.xml
Normal file
27
tests/lxcconf2xmldata/lxcconf2xml-cpusettune.xml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<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' cpuset='1-2,5-7' current='0'>1</vcpu>
|
||||||
|
<numatune>
|
||||||
|
<memory mode='strict' nodeset='1-4'/>
|
||||||
|
</numatune>
|
||||||
|
<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>
|
@ -111,6 +111,7 @@ mymain(void)
|
|||||||
DO_TEST("idmap", false);
|
DO_TEST("idmap", false);
|
||||||
DO_TEST("memtune", false);
|
DO_TEST("memtune", false);
|
||||||
DO_TEST("cputune", false);
|
DO_TEST("cputune", false);
|
||||||
|
DO_TEST("cpusettune", false);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user