提交 e5ecec7b 编写于 作者: I Igor Mammedov 提交者: Luiz Capitulino

qmp: fix handling of boolean values in qmp-shell

qmp-shell converts only integer arguments and the rest
is assumed to be strings which are faithfully sent as
quoted strings by json. But QEMU refuses to accept qmp
command with boolean argument whose value is escaped
as string.

Fix it by special-casing true/false keywords and store
value as corresponding boolean.
Signed-off-by: NIgor Mammedov <imammedo@redhat.com>
Signed-off-by: NLuiz Capitulino <lcapitulino@redhat.com>
上级 28c4fa32
......@@ -101,7 +101,12 @@ class QMPShell(qmp.QEMUMonitorProtocol):
try:
value = int(opt[1])
except ValueError:
value = opt[1]
if opt[1] == 'true':
value = True
elif opt[1] == 'false':
value = False
else:
value = opt[1]
qmpcmd['arguments'][opt[0]] = value
return qmpcmd
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册