qapi examples fixes, simplified version
v2 cover qapi examples fixes, simplified version
Hi,
This is the follow up from v1. I've dropped a few patches that need further discussion. I plan to revisit those when submiting the generator again at a later time.
v1: https://lists.gnu.org/archive/html/qemu-devel/2022-08/msg04525.html
Changes in v2:
* Dropped "qapi: fix example of blockdev-add command". It was wrong.
* Dropped patches with too long examples as we might want to cut them short. I've also dropped the patches that fixes examples with comments on them as we might want to have a way to do that.
* Fixed style in:
- qapi: fix example of NIC_RX_FILTER_CHANGED event
- qapi: fix example of query-dump-guest-memory-capability command
* Dropped the generator (rfc) as I'll submit it again later, improved.
Cheers,
Victor
Victor Toso (10):
qapi: fix example of query-ballon command
qapi: fix example of query-vnc command
qapi: fix example of query-dump-guest-memory-capability command
qapi: fix example of BLOCK_JOB_READY event
qapi: fix example of NIC_RX_FILTER_CHANGED event
qapi: fix example of DEVICE_UNPLUG_GUEST_ERROR event
qapi: fix example of MEM_UNPLUG_ERROR event
qapi: fix examples of blockdev-add with qcow2
qapi: fix example of query-hotpluggable-cpus command
qapi: fix examples of events missing timestamp
qapi/block-core.json | 12 ++++++------ qapi/dump.json | 2 +- qapi/machine.json | 8 ++++---- qapi/migration.json | 27 +++++++++++++++++++++++---- qapi/net.json | 1 - qapi/qdev.json | 3 +-- qapi/ui.json | 4 ++-- 7 files changed, 37 insertions(+), 20 deletions(-)
Signature · 1 line
2.37.2
PATCH v2 1/10 qapi: fix example of query-ballon command
Example output has an extra ',' delimiter. Fix it.
Problem was noticed when trying to load the example into python's json library.
--- qapi/machine.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qapi/machine.json +1 -1
@@ -1074,7 +1074,7 @@ # # -> { "execute": "query-balloon" } # <- { "return": { -# "actual": 1073741824, +# "actual": 1073741824 # } # } #
Signature · 1 line
2.37.2
PATCH v2 2/10 qapi: fix example of query-vnc command
In reply to Victor TosoExample output has an extra ',' delimiter in member "websocket" and it lacks it in "family" member. Fix it.
Problem was noticed when trying to load the example into python's json library.
--- qapi/ui.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
qapi/ui.json +2 -2
@@ -667,8 +667,8 @@ # { # "host":"127.0.0.1", # "service":"50401", -# "family":"ipv4" -# "websocket":false, +# "family":"ipv4", +# "websocket":false # } # ] # }
Signature · 1 line
2.37.2
PATCH v2 3/10 qapi: fix example of query-dump-guest-memory-capability command
In reply to Victor TosoExample output is missing closing curly brackets. Fix it.
Problem was noticed when trying to load the example into python's json library.
--- qapi/dump.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qapi/dump.json +1 -1
@@ -195,7 +195,7 @@ # # -> { "execute": "query-dump-guest-memory-capability" } # <- { "return": { "formats": -# ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] } +# ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] } } # ## { 'command': 'query-dump-guest-memory-capability',
Signature · 1 line
2.37.2
PATCH v2 4/10 qapi: fix example of BLOCK_JOB_READY event
In reply to Victor TosoExample output is missing ',' delimiter. Fix it.
Problem was noticed when trying to load the example into python's json library.
--- qapi/block-core.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qapi/block-core.json +1 -1
@@ -5252,7 +5252,7 @@ # # <- { "event": "BLOCK_JOB_READY", # "data": { "device": "drive0", "type": "mirror", "speed": 0, -# "len": 2097152, "offset": 2097152 } +# "len": 2097152, "offset": 2097152 }, # "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } # ##
Signature · 1 line
2.37.2
PATCH v2 5/10 qapi: fix example of NIC_RX_FILTER_CHANGED event
In reply to Victor TosoExample output has an extra ending curly bracket. Fix it.
Problem was noticed when trying to load the example into python's json library.
--- qapi/net.json | 1 - 1 file changed, 1 deletion(-)
qapi/net.json +0 -1
@@ -757,7 +757,6 @@ # "data": { "name": "vnet0", # "path": "/machine/peripheral/vnet0/virtio-backend" }, # "timestamp": { "seconds": 1368697518, "microseconds": 326866 } } -# } # ## { 'event': 'NIC_RX_FILTER_CHANGED',
Signature · 1 line
2.37.2
PATCH v2 6/10 qapi: fix example of DEVICE_UNPLUG_GUEST_ERROR event
In reply to Victor TosoExample output is missing a ',' delimiter and it has an extra ending curly bracket. Fix it.
Problem was noticed when trying to load the example into python's json library.
--- qapi/qdev.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
qapi/qdev.json +1 -2
@@ -150,10 +150,9 @@ # # Example: # -# <- { "event": "DEVICE_UNPLUG_GUEST_ERROR" +# <- { "event": "DEVICE_UNPLUG_GUEST_ERROR", # "data": { "device": "core1", # "path": "/machine/peripheral/core1" }, -# }, # "timestamp": { "seconds": 1615570772, "microseconds": 202844 } } # ##
Signature · 1 line
2.37.2
PATCH v2 7/10 qapi: fix example of MEM_UNPLUG_ERROR event
In reply to Victor TosoExample output was missing ',' delimiter. Fix it.
Problem was noticed when trying to load the example into python's json library.
--- qapi/machine.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qapi/machine.json +1 -1
@@ -1416,7 +1416,7 @@ # # Example: # -# <- { "event": "MEM_UNPLUG_ERROR" +# <- { "event": "MEM_UNPLUG_ERROR", # "data": { "device": "dimm1", # "msg": "acpi: device unplug for unsupported device" # },
Signature · 1 line
2.37.2
PATCH v2 8/10 qapi: fix examples of blockdev-add with qcow2
In reply to Victor TosoThe examples use "qcow2" driver with the wrong member name for BlockdevRef alternate type. This patch changes all wrong member names from "file" to "data-file" which is the correct member name in BlockdevOptionsQcow2 for the BlockdevRef field.
Problem was noticed when using the example as a test case for Go bindings.
--- qapi/block-core.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
qapi/block-core.json +5 -5
@@ -1541,8 +1541,8 @@ # -> { "execute": "blockdev-add", # "arguments": { "driver": "qcow2", # "node-name": "node1534", -# "file": { "driver": "file", -# "filename": "hd1.qcow2" }, +# "data-file": { "driver": "file", +# "filename": "hd1.qcow2" }, # "backing": null } } # # <- { "return": {} }
@@ -4378,7 +4378,7 @@ # "arguments": { # "driver": "qcow2", # "node-name": "test1", -# "file": { +# "data-file": { # "driver": "file", # "filename": "test.qcow2" # }
@@ -4395,7 +4395,7 @@ # "cache": { # "direct": true # }, -# "file": { +# "data-file": { # "driver": "file", # "filename": "/tmp/test.qcow2" # },
@@ -4477,7 +4477,7 @@ # "arguments": { # "driver": "qcow2", # "node-name": "node0", -# "file": { +# "data-file": { # "driver": "file", # "filename": "test.qcow2" # }
Signature · 1 line
2.37.2
PATCH v2 9/10 qapi: fix example of query-hotpluggable-cpus command
In reply to Victor TosoThe example return type has the wrong member name. Fix it.
Problem was noticed when using the example as a test case for Go bindings.
--- qapi/machine.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
qapi/machine.json +2 -2
@@ -958,9 +958,9 @@ # # -> { "execute": "query-hotpluggable-cpus" } # <- {"return": [ -# { "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core", +# { "props": { "core-id": 8 }, "type": "POWER8-spapr-cpu-core", # "vcpus-count": 1 }, -# { "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core", +# { "props": { "core-id": 0 }, "type": "POWER8-spapr-cpu-core", # "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"} # ]}' #
Signature · 1 line
2.37.2
PATCH v2 10/10 qapi: fix examples of events missing timestamp
In reply to Victor TosoI've used real timestamp and changing them one by one so they would not be all equal.
Problem was noticed when using the example as a test case for Go bindings.
--- qapi/migration.json | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-)
qapi/migration.json +23 -4
@@ -1995,16 +1995,23 @@ # } # <- { "return": { } } # <- {"event": "JOB_STATUS_CHANGE", +# "timestamp": {"seconds": 1432121972, "microseconds": 744001}, # "data": {"status": "created", "id": "snapsave0"}} # <- {"event": "JOB_STATUS_CHANGE", +# "timestamp": {"seconds": 1432122172, "microseconds": 744001}, # "data": {"status": "running", "id": "snapsave0"}} -# <- {"event": "STOP"} -# <- {"event": "RESUME"} +# <- {"event": "STOP", +# "timestamp": {"seconds": 1432122372, "microseconds": 744001} } +# <- {"event": "RESUME", +# "timestamp": {"seconds": 1432122572, "microseconds": 744001} } # <- {"event": "JOB_STATUS_CHANGE", +# "timestamp": {"seconds": 1432122772, "microseconds": 744001}, # "data": {"status": "waiting", "id": "snapsave0"}} # <- {"event": "JOB_STATUS_CHANGE", +# "timestamp": {"seconds": 1432122972, "microseconds": 744001}, # "data": {"status": "pending", "id": "snapsave0"}} # <- {"event": "JOB_STATUS_CHANGE", +# "timestamp": {"seconds": 1432123172, "microseconds": 744001}, # "data": {"status": "concluded", "id": "snapsave0"}} # -> {"execute": "query-jobs"} # <- {"return": [{"current-progress": 1,
@@ -2056,16 +2063,23 @@ # } # <- { "return": { } } # <- {"event": "JOB_STATUS_CHANGE", +# "timestamp": {"seconds": 1472124172, "microseconds": 744001}, # "data": {"status": "created", "id": "snapload0"}} # <- {"event": "JOB_STATUS_CHANGE", +# "timestamp": {"seconds": 1472125172, "microseconds": 744001}, # "data": {"status": "running", "id": "snapload0"}} -# <- {"event": "STOP"} -# <- {"event": "RESUME"} +# <- {"event": "STOP", +# "timestamp": {"seconds": 1472125472, "microseconds": 744001} } +# <- {"event": "RESUME", +# "timestamp": {"seconds": 1472125872, "microseconds": 744001} } # <- {"event": "JOB_STATUS_CHANGE", +# "timestamp": {"seconds": 1472126172, "microseconds": 744001}, # "data": {"status": "waiting", "id": "snapload0"}} # <- {"event": "JOB_STATUS_CHANGE", +# "timestamp": {"seconds": 1472127172, "microseconds": 744001}, # "data": {"status": "pending", "id": "snapload0"}} # <- {"event": "JOB_STATUS_CHANGE", +# "timestamp": {"seconds": 1472128172, "microseconds": 744001}, # "data": {"status": "concluded", "id": "snapload0"}} # -> {"execute": "query-jobs"} # <- {"return": [{"current-progress": 1,
@@ -2108,14 +2122,19 @@ # } # <- { "return": { } } # <- {"event": "JOB_STATUS_CHANGE", +# "timestamp": {"seconds": 1442124172, "microseconds": 744001}, # "data": {"status": "created", "id": "snapdelete0"}} # <- {"event": "JOB_STATUS_CHANGE", +# "timestamp": {"seconds": 1442125172, "microseconds": 744001}, # "data": {"status": "running", "id": "snapdelete0"}} # <- {"event": "JOB_STATUS_CHANGE", +# "timestamp": {"seconds": 1442126172, "microseconds": 744001}, # "data": {"status": "waiting", "id": "snapdelete0"}} # <- {"event": "JOB_STATUS_CHANGE", +# "timestamp": {"seconds": 1442127172, "microseconds": 744001}, # "data": {"status": "pending", "id": "snapdelete0"}} # <- {"event": "JOB_STATUS_CHANGE", +# "timestamp": {"seconds": 1442128172, "microseconds": 744001}, # "data": {"status": "concluded", "id": "snapdelete0"}} # -> {"execute": "query-jobs"} # <- {"return": [{"current-progress": 1,
Signature · 1 line
2.37.2
Quoted 5 lines · Victor Toso
Hi,
This is the follow up from v1. I've dropped a few patches that need further discussion. I plan to revisit those when submiting the generator again at a later time.
and queued. Thanks!
[...]