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: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
28c4fa32bd
commit
e5ecec7bad
@ -101,6 +101,11 @@ class QMPShell(qmp.QEMUMonitorProtocol):
|
|||||||
try:
|
try:
|
||||||
value = int(opt[1])
|
value = int(opt[1])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
if opt[1] == 'true':
|
||||||
|
value = True
|
||||||
|
elif opt[1] == 'false':
|
||||||
|
value = False
|
||||||
|
else:
|
||||||
value = opt[1]
|
value = opt[1]
|
||||||
qmpcmd['arguments'][opt[0]] = value
|
qmpcmd['arguments'][opt[0]] = value
|
||||||
return qmpcmd
|
return qmpcmd
|
||||||
|
Loading…
Reference in New Issue
Block a user