summary refs log tree commit diff stats
path: root/scripts/probe-gdb-support.py
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2024-03-06 15:28:31 +0100
committerKevin Wolf <kwolf@redhat.com>2024-03-18 13:13:08 +0100
commit7fcb8c89f063122864bd274fd673a70a0a802d93 (patch)
treeadf12b537f3603b83fe0f3bdf9209130668a5f9b /scripts/probe-gdb-support.py
parente8fce34eccf68a32f4ecf2c6f121ff2ac383d6bf (diff)
downloadfocaccia-qemu-7fcb8c89f063122864bd274fd673a70a0a802d93.tar.gz
focaccia-qemu-7fcb8c89f063122864bd274fd673a70a0a802d93.zip
blockdev: Fix blockdev-snapshot-sync error reporting for no medium
When external_snapshot_abort() rejects a BlockDriverState without a
medium, it creates an error like this:

        error_setg(errp, "Device '%s' has no medium", device);

Trouble is @device can be null.  My system formats null as "(null)",
but other systems might crash.  Reproducer:

1. Create a block device without a medium

    -> {"execute": "blockdev-add", "arguments": {"driver": "host_cdrom", "node-name": "blk0", "filename": "/dev/sr0"}}
    <- {"return": {}}

3. Attempt to snapshot it

    -> {"execute":"blockdev-snapshot-sync", "arguments": { "node-name": "blk0", "snapshot-file":"/tmp/foo.qcow2","format":"qcow2"}}
    <- {"error": {"class": "GenericError", "desc": "Device '(null)' has no medium"}}

Broken when commit 0901f67ecdb made @device optional.

Use bdrv_get_device_or_node_name() instead.  Now it fails as it
should:

    <- {"error": {"class": "GenericError", "desc": "Device 'blk0' has no medium"}}

Fixes: 0901f67ecdb7 ("qmp: Allow to take external snapshots on bs graphs node.")
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240306142831.2514431-1-armbru@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'scripts/probe-gdb-support.py')
0 files changed, 0 insertions, 0 deletions