From 8d26a7fd4e3f1f3410d9bd5eef071351190068ca Mon Sep 17 00:00:00 2001 From: Osier Yang Date: Wed, 9 May 2012 00:04:35 +0800 Subject: [PATCH] numad: Copy 'placement' of to by default With this patch, one can also fully drive numad by: 2 New tests are added. --- src/conf/domain_conf.c | 10 ++++++ ...ml2argv-numad-auto-memory-vcpu-cpuset.args | 4 +++ ...xml2argv-numad-auto-memory-vcpu-cpuset.xml | 31 ++++++++++++++++++ ...o-memory-vcpu-no-cpuset-and-placement.args | 4 +++ ...to-memory-vcpu-no-cpuset-and-placement.xml | 31 ++++++++++++++++++ ...ml2argv-numad-static-memory-auto-vcpu.args | 4 +++ ...xml2argv-numad-static-memory-auto-vcpu.xml | 31 ++++++++++++++++++ .../qemuxml2argv-numatune-memory.xml | 2 +- tests/qemuxml2argvtest.c | 3 ++ ...l2xmlout-numad-auto-memory-vcpu-cpuset.xml | 32 +++++++++++++++++++ ...to-memory-vcpu-no-cpuset-and-placement.xml | 32 +++++++++++++++++++ tests/qemuxml2xmltest.c | 2 ++ 12 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-cpuset.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-cpuset.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-no-cpuset-and-placement.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-no-cpuset-and-placement.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numad-static-memory-auto-vcpu.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-numad-static-memory-auto-vcpu.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-cpuset.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-no-cpuset-and-placement.xml diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f684ea1649..cd6d73b4c7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8124,6 +8124,16 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps, if (placement_mode == VIR_DOMAIN_NUMATUNE_MEM_PLACEMENT_MODE_AUTO) VIR_FREE(def->numatune.memory.nodemask); + /* Copy 'placement' of to if its 'placement' + * is not specified and 'placement' of is specified. + */ + if (def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_DEFAULT && + placement_mode != VIR_DOMAIN_NUMATUNE_MEM_PLACEMENT_MODE_DEFAULT) { + if (placement_mode == VIR_DOMAIN_NUMATUNE_MEM_PLACEMENT_MODE_STATIC) + def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC; + else + def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO; + } def->numatune.memory.placement_mode = placement_mode; } else { virDomainReportError(VIR_ERR_XML_ERROR, diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-cpuset.args b/tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-cpuset.args new file mode 100644 index 0000000000..23bcb70000 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-cpuset.args @@ -0,0 +1,4 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ +pc -m 214 -smp 2 -nographic -monitor \ +unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda \ +/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-cpuset.xml b/tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-cpuset.xml new file mode 100644 index 0000000000..e2507e4b79 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-cpuset.xml @@ -0,0 +1,31 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 2 + + + + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu + + + +
+ + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-no-cpuset-and-placement.args b/tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-no-cpuset-and-placement.args new file mode 100644 index 0000000000..23bcb70000 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-no-cpuset-and-placement.args @@ -0,0 +1,4 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ +pc -m 214 -smp 2 -nographic -monitor \ +unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda \ +/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-no-cpuset-and-placement.xml b/tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-no-cpuset-and-placement.xml new file mode 100644 index 0000000000..2988be4686 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-numad-auto-memory-vcpu-no-cpuset-and-placement.xml @@ -0,0 +1,31 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 2 + + + + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu + + + +
+ + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numad-static-memory-auto-vcpu.args b/tests/qemuxml2argvdata/qemuxml2argv-numad-static-memory-auto-vcpu.args new file mode 100644 index 0000000000..23bcb70000 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-numad-static-memory-auto-vcpu.args @@ -0,0 +1,4 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ +pc -m 214 -smp 2 -nographic -monitor \ +unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda \ +/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numad-static-memory-auto-vcpu.xml b/tests/qemuxml2argvdata/qemuxml2argv-numad-static-memory-auto-vcpu.xml new file mode 100644 index 0000000000..e2507e4b79 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-numad-static-memory-auto-vcpu.xml @@ -0,0 +1,31 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 2 + + + + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu + + + +
+ + + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memory.xml b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memory.xml index e91307c3c3..bcc9739232 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-numatune-memory.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-numatune-memory.xml @@ -3,7 +3,7 @@ c7a5fdbd-edaf-9455-926a-d65c16db1809 219136 219136 - 2 + 2 diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 40471d4809..c0734291b0 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -740,6 +740,9 @@ mymain(void) DO_TEST("numatune-memory", false, NONE); DO_TEST("numad", false, NONE); DO_TEST("numad-auto-vcpu-static-numatune", false, NONE); + DO_TEST("numad-auto-memory-vcpu-cpuset", false, NONE); + DO_TEST("numad-auto-memory-vcpu-no-cpuset-and-placement", false, NONE); + DO_TEST("numad-static-memory-auto-vcpu", false, NONE); DO_TEST("blkdeviotune", false, QEMU_CAPS_NAME, QEMU_CAPS_DEVICE, QEMU_CAPS_DRIVE, QEMU_CAPS_DRIVE_IOTUNE); diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-cpuset.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-cpuset.xml new file mode 100644 index 0000000000..ffca2a9193 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-cpuset.xml @@ -0,0 +1,32 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 2 + + + + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu + + + +
+ + + + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-no-cpuset-and-placement.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-no-cpuset-and-placement.xml new file mode 100644 index 0000000000..28ec59fded --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-numad-auto-memory-vcpu-no-cpuset-and-placement.xml @@ -0,0 +1,32 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 2 + + + + + hvm + + + + + + + destroy + restart + destroy + + /usr/bin/qemu + + + +
+ + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 256eed7e39..5b6a216bb2 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -230,6 +230,8 @@ mymain(void) DO_TEST_DIFFERENT("graphics-listen-network2"); DO_TEST_DIFFERENT("graphics-spice-timeout"); DO_TEST_DIFFERENT("numad-auto-vcpu-no-numatune"); + DO_TEST_DIFFERENT("numad-auto-memory-vcpu-no-cpuset-and-placement"); + DO_TEST_DIFFERENT("numad-auto-memory-vcpu-cpuset"); DO_TEST_DIFFERENT("metadata");