[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 8/9] QMP: add set-numa-node command
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH v3 8/9] QMP: add set-numa-node command |
Date: |
Fri, 16 Feb 2018 13:37:20 +0100 |
Command is allowed to run only in preconfig stage and
will allow to configure numa mapping for CPUs depending
on possible CPUs layout (query-hotpluggable-cpus) for
given machine instance.
Signed-off-by: Igor Mammedov <address@hidden>
---
numa.c | 5 +++++
qapi-schema.json | 14 ++++++++++++++
tests/qmp-test.c | 6 ++++++
3 files changed, 25 insertions(+)
diff --git a/numa.c b/numa.c
index 04e34eb..e3b7f15 100644
--- a/numa.c
+++ b/numa.c
@@ -446,6 +446,11 @@ void parse_numa_opts(MachineState *ms)
}
}
+void qmp_set_numa_node(NumaOptions *cmd, Error **errp)
+{
+ parse_NumaOptions(MACHINE(qdev_get_machine()), cmd, errp);
+}
+
void numa_cpu_pre_plug(const CPUArchId *slot, DeviceState *dev, Error **errp)
{
int node_id = object_property_get_int(OBJECT(dev), "node-id",
&error_abort);
diff --git a/qapi-schema.json b/qapi-schema.json
index 4365dfe..a96c31f 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3201,3 +3201,17 @@
# Since: 2.11
##
{ 'command': 'watchdog-set-action', 'data' : {'action': 'WatchdogAction'} }
+
+##
+# @set-numa-node:
+#
+# Runtime equivalent of '-numa' CLI option, available at
+# preconfigure stage to configure numa mapping before initializing
+# machine.
+#
+# Since 2.12
+##
+{ 'command': 'set-numa-node', 'boxed': true,
+ 'data': 'NumaOptions',
+ 'runstates': [ 'preconfig' ]
+}
diff --git a/tests/qmp-test.c b/tests/qmp-test.c
index 4ab0b7c..b0de2b1 100644
--- a/tests/qmp-test.c
+++ b/tests/qmp-test.c
@@ -324,6 +324,8 @@ static void test_qmp_preconfig(void)
/* enabled commands, no error expected */
g_assert(!is_err(qtest_qmp(qs, "{ 'execute': 'query-commands' }")));
g_assert(!is_err(qtest_qmp(qs, "{ 'execute':
'query-hotpluggable-cpus'}")));
+ g_assert(!is_err(qtest_qmp(qs, "{ 'execute': 'set-numa-node',"
+ " 'arguments': { 'type': 'node', 'nodeid': 0 } }")));
/* forbidden commands, expected error */
g_assert(is_err(qtest_qmp(qs, "{ 'execute': 'query-cpus' }")));
@@ -347,6 +349,10 @@ static void test_qmp_preconfig(void)
/* enabled commands, no error expected */
g_assert(!is_err(qtest_qmp(qs, "{ 'execute': 'query-cpus' }")));
+ /* forbidden commands, expected error */
+ g_assert(is_err(qtest_qmp(qs, "{ 'execute': 'set-numa-node',"
+ " 'arguments': { 'type': 'node', 'nodeid': 1 } }")));
+
qtest_quit(qs);
}
--
2.7.4
- [Qemu-devel] [PATCH v3 0/9] enable numa configuration before machine_init() from QMP, Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 1/9] numa: postpone options post-processing till machine_run_board_init(), Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 2/9] numa: split out NumaOptions parsing into parse_NumaOptions(), Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 4/9] HMP: disable monitor in preconfig state, Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 3/9] CLI: add -preconfig option, Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 5/9] QAPI: allow to specify valid runstates per command, Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 6/9] tests: extend qmp test with pereconfig checks, Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 8/9] QMP: add set-numa-node command,
Igor Mammedov <=
- [Qemu-devel] [PATCH v3 7/9] QMP: permit query-hotpluggable-cpus in preconfig state, Igor Mammedov, 2018/02/16
- [Qemu-devel] [PATCH v3 9/9] tests: functional tests for QMP command set-numa-node, Igor Mammedov, 2018/02/16
- Re: [Qemu-devel] [PATCH v3 0/9] enable numa configuration before machine_init() from QMP, Igor Mammedov, 2018/02/27