qemu-iotests: migrate away from HMP ("make HMP optional" follow-up)
Subsystems (7)
cover qemu-iotests: migrate away from HMP ("make HMP optional" follow-up)
Hi,
This series migrates all qemu-iotests away from HMP, so that the test framework no longer depends on it and can execute with --disable-hmp. This can simplify the tests, as they don't need to check/grep on stdout, HMP & QMP but can rely increasingly on QMP alone.
The series is organized as follows: preparatory patches, monitor infrastructure, test infrastructure, test migrations, cleanup.
x-query-qtree (info qtree) is introduced to make test 172 migration easier, but arguably, qom-list could be extended instead.
All migrated tests have been verified to pass.
---
Marc-André Lureau (88):
scripts/checkpatch: skip trailer checks inside patch diff
build-sys: bump minimum glib version to v2.68 docs/devel: minor fix in qom documentation
qom: auto-terminate interfaces array in OBJECT_DEFINE_TYPE macros
qemu-io: drop "qemu-io:" prefix in error-report
monitor: allow a bare Monitor
qemu-print: use monitor_puts() for any non-QMP monitor block/monitor: capture x-qemu-io output qemu-iotests/iotests: filter x-qemu-io messages tests/qemu-iotests: do no interpret backslash as escape tests/qemu-iotests: filter all generated node ids qemu-iotests/216: migrate away from HMP qemu-iotests/310: migrate away from HMP qemu-iotests/283: migrate away from HMP qemu-iotests/281: migrate away from HMP qemu-iotests/reopen-file: migrate away from HMP qemu-iotests/mirror-ready-cancel-error: migrate away from HMP qemu-iotests/copy-before-write: migrate away from HMP qemu-iotests/132: migrate away from HMP qemu-iotests/152: migrate away from HMP qemu-iotests/254: migrate away from HMP qemu-iotests/264: migrate away from HMP qemu-iotests/304: migrate away from HMP qemu-iotests/300: replace hmp_qemu_io with qmp qemu-iotests/298: migrate away from HMP qemu-iotests/056: migrate away from HMP qemu-iotests/093: migrate away from HMP qemu-iotests/124: migrate away from HMP qemu-iotests/136: migrate away from HMP qemu-iotests/148: migrate away from HMP qemu-iotests/151: migrate away from HMP qemu-iotests/236: migrate away from HMP qemu-iotests/245: migrate away from HMP qemu-iotests/255: migrate away from HMP qemu-iotests/257: migrate away from HMP qemu-iotests/260: migrate away from HMP qemu-iotests/280: migrate away from HMP qemu-iotests/backup-discard-source: migrate away from HMP qemu-iotests/qsd-migrate: migrate away from HMP qemu-iotests/mirror-change-copy-mode: migrate away from HMP qemu-iotests/migrate-bitmaps-test: migrate away from HMP qemu-iotests/image-fleecing: migrate away from HMP qemu-iotests/migrate-bitmaps-postcopy: migrate away from HMP qemu-iotests/165: migrate away from HMP qemu-iotests/iothreads-create: doesn't actually depend on HMP qemu-iotests/045: remove HMP monitor dependency qemu-iotests/common: add _run_qmp_job helper qemu-iotests/007: migrate away from HMP qemu-iotests/028: migrate away from HMP qemu-iotests/225: migrate away from HMP qemu-iotests/300: migrate away from HMP qemu-iotests/286: migrate away from HMP qemu-iotests/142: migrate away from HMP qemu-iotests/146: migrate away from HMP qemu-iotests/117: migrate away from HMP qemu-iotests/119: migrate away from HMP qemu-iotests/060: migrate away from HMP qemu-iotests/071: migrate away from HMP qemu-iotests/081: migrate away from HMP qemu-iotests/102: migrate away from HMP qemu-iotests/091: migrate away from HMP qemu-iotests/120: migrate away from HMP qemu-iotests/161: migrate away from HMP qemu-iotests/249: migrate away from HMP qemu-iotests/156: migrate away from HMP qemu-iotests/write-zeroes-unmap: migrate away from HMP qemu-iotests/luks-detached-header: migrate away from HMP qemu-iotests/qcow2-internal-snapshots: migrate away from HMP qemu-iotests/185: migrate away from HMP qemu-iotests/246: migrate away from HMP qemu-iotests/274: migrate away from HMP qemu-iotests/145: migrate away from HMP qemu-iotests/068: migrate away from HMP qemu-iotests/130: migrate away from HMP qemu-iotests/153: migrate away from HMP qemu-iotests/157: migrate away from HMP qemu-iotests/181: migrate away from HMP qemu-iotests/182: migrate away from HMP qemu-iotests/186: migrate away from HMP qemu-iotests/192: migrate away from HMP qemu-iotests/201: migrate away from HMP qemu-iotests/232: migrate away from HMP qemu-iotests/267: migrate away from HMP qemu-iotests/051: migrate away from HMP
qdev: add x-query-qtree QMP command
qemu-iotests/172: migrate away from HMP
qemu-iotests: remove HMP framework support block/monitor: redirect HMP qemu-io to HMP stream
accel/tcg/cputlb.c | 4 +- backends/igvm-cfg.c | 3 +- block/monitor/block-hmp-cmds.c | 13 +- block/monitor/qmp-cmds.c | 49 +- contrib/plugins/lockstep.c | 25 - docs/devel/qom.rst | 2 +- hw/9pfs/9p-synth.c | 2 +- hw/9pfs/9p-util.h | 2 +- hw/9pfs/9p.c | 2 +- hw/acpi/core.c | 2 +- hw/acpi/pci.c | 6 +- hw/char/virtio-serial-bus.c | 23 +- hw/core/machine.c | 2 +- hw/core/reset.c | 4 +- hw/core/resetcontainer.c | 5 +- hw/core/sysbus.c | 17 +- hw/hyperv/hv-balloon.c | 2 +- hw/i386/multiboot.c | 2 +- hw/misc/auxbus.c | 22 +- hw/net/eepro100.c | 2 +- hw/nvram/fw_cfg.c | 8 +- hw/pci/pci-hmp-cmds.c | 38 -- hw/pci/pci-internal.h | 2 +- hw/pci/pci.c | 40 +- hw/ppc/pef.c | 3 +- hw/scsi/mptsas.c | 5 +- hw/usb/bus.c | 23 +- hw/vfio/pci.c | 2 +- hw/virtio/virtio-mem.c | 6 +- hw/xen/xen-bus.c | 12 +- include/glib-compat.h | 41 +- include/hw/core/qdev.h | 4 +- include/monitor/monitor.h | 2 + include/qom/object.h | 6 +- linux-user/syscall.c | 2 +- linux-user/uaccess.c | 2 +- meson.build | 2 +- monitor/hmp.c | 12 +- monitor/monitor.c | 28 +- monitor/qmp.c | 12 +- net/colo.c | 4 +- python/qemu/machine/machine.py | 7 - qapi/block.json | 3 + qapi/qapi-clone-visitor.c | 16 +- qapi/qapi-visit-core.c | 6 +- qapi/qdev.json | 31 ++ qemu-io-cmds.c | 74 +-- qemu-io.c | 4 + rust/bindings/hwcore-sys/lib.rs | 2 +- scripts/checkpatch.pl | 7 +- stubs/meson.build | 1 + stubs/monitor-puts.c | 9 + system/memory.c | 2 +- system/qdev-monitor.c | 42 +- system/qtest.c | 4 +- system/ram-block-attributes.c | 3 +- system/vl.c | 2 +- target/i386/kvm/tdx.c | 3 +- target/s390x/kvm/pv.c | 3 +- tests/qemu-iotests/004.out | 20 +- tests/qemu-iotests/007 | 25 +- tests/qemu-iotests/021.out | 60 +-- tests/qemu-iotests/026.out | 396 +++++++------- tests/qemu-iotests/026.out.nocache | 168 +++--- tests/qemu-iotests/028 | 27 +- tests/qemu-iotests/028.out | 17 +- tests/qemu-iotests/045 | 6 +- tests/qemu-iotests/051 | 75 ++- tests/qemu-iotests/051.out | 241 +++------ tests/qemu-iotests/051.pc.out | 311 +++++------ tests/qemu-iotests/056 | 21 +- tests/qemu-iotests/059.out | 6 +- tests/qemu-iotests/060 | 9 +- tests/qemu-iotests/060.out | 48 +- tests/qemu-iotests/061.out | 4 +- tests/qemu-iotests/068 | 56 +- tests/qemu-iotests/068.out | 26 +- tests/qemu-iotests/069.out | 2 +- tests/qemu-iotests/070.out | 2 +- tests/qemu-iotests/071 | 31 +- tests/qemu-iotests/071.out | 16 +- tests/qemu-iotests/072.out | 2 +- tests/qemu-iotests/075.out | 14 +- tests/qemu-iotests/076.out | 6 +- tests/qemu-iotests/078.out | 12 +- tests/qemu-iotests/080.out | 44 +- tests/qemu-iotests/081 | 11 +- tests/qemu-iotests/081.out | 12 +- tests/qemu-iotests/083.out | 104 ++-- tests/qemu-iotests/088.out | 12 +- tests/qemu-iotests/089.out | 4 +- tests/qemu-iotests/091 | 45 +- tests/qemu-iotests/092.out | 24 +- tests/qemu-iotests/093 | 15 +- tests/qemu-iotests/102 | 21 +- tests/qemu-iotests/102.out | 12 +- tests/qemu-iotests/103.out | 14 +- tests/qemu-iotests/114.out | 4 +- tests/qemu-iotests/116.out | 14 +- tests/qemu-iotests/117 | 5 +- tests/qemu-iotests/117.out | 8 +- tests/qemu-iotests/119 | 5 +- tests/qemu-iotests/119.out | 4 +- tests/qemu-iotests/120 | 5 +- tests/qemu-iotests/120.out | 4 +- tests/qemu-iotests/124 | 33 +- tests/qemu-iotests/130 | 53 +- tests/qemu-iotests/130.out | 8 +- tests/qemu-iotests/132 | 5 +- tests/qemu-iotests/133.out | 30 +- tests/qemu-iotests/134.out | 2 +- tests/qemu-iotests/136 | 7 +- tests/qemu-iotests/137.out | 30 +- tests/qemu-iotests/140.out | 2 +- tests/qemu-iotests/142 | 233 ++++---- tests/qemu-iotests/142.out | 30 +- tests/qemu-iotests/143.out | 4 +- tests/qemu-iotests/145 | 8 +- tests/qemu-iotests/145.out | 6 +- tests/qemu-iotests/146 | 5 - tests/qemu-iotests/148 | 13 +- tests/qemu-iotests/151 | 51 +- tests/qemu-iotests/152 | 5 +- tests/qemu-iotests/153 | 37 +- tests/qemu-iotests/153.out | 86 +-- tests/qemu-iotests/156 | 37 +- tests/qemu-iotests/156.out | 60 +-- tests/qemu-iotests/157 | 10 +- tests/qemu-iotests/157.out | 16 +- tests/qemu-iotests/161 | 19 +- tests/qemu-iotests/161.out | 24 +- tests/qemu-iotests/165 | 10 +- tests/qemu-iotests/171.out | 68 +-- tests/qemu-iotests/172 | 76 ++- tests/qemu-iotests/172.out | 305 +---------- tests/qemu-iotests/181 | 86 ++- tests/qemu-iotests/181.out | 36 +- tests/qemu-iotests/182 | 5 +- tests/qemu-iotests/185 | 15 +- tests/qemu-iotests/185.out | 10 +- tests/qemu-iotests/186 | 12 +- tests/qemu-iotests/186.out | 590 +++++++++------------ tests/qemu-iotests/187.out | 6 +- tests/qemu-iotests/188.out | 2 +- tests/qemu-iotests/192 | 25 +- tests/qemu-iotests/192.out | 17 +- tests/qemu-iotests/197.out | 2 +- tests/qemu-iotests/201 | 75 ++- tests/qemu-iotests/201.out | 10 +- tests/qemu-iotests/205 | 4 +- tests/qemu-iotests/214.out | 2 +- tests/qemu-iotests/215.out | 2 +- tests/qemu-iotests/216 | 6 +- tests/qemu-iotests/216.out | 3 +- tests/qemu-iotests/220.out | 2 +- tests/qemu-iotests/225 | 28 +- tests/qemu-iotests/225.out | 25 +- tests/qemu-iotests/226.out | 16 +- tests/qemu-iotests/232 | 32 +- tests/qemu-iotests/232.out | 216 ++++++-- tests/qemu-iotests/236 | 7 +- tests/qemu-iotests/236.out | 8 - tests/qemu-iotests/244.out | 22 +- tests/qemu-iotests/245 | 28 +- tests/qemu-iotests/246 | 11 +- tests/qemu-iotests/246.out | 8 +- tests/qemu-iotests/249 | 19 +- tests/qemu-iotests/249.out | 18 +- tests/qemu-iotests/254 | 4 +- tests/qemu-iotests/255 | 7 +- tests/qemu-iotests/257 | 7 +- tests/qemu-iotests/257.out | 315 ----------- tests/qemu-iotests/260 | 9 +- tests/qemu-iotests/264 | 5 +- tests/qemu-iotests/267 | 139 +++-- tests/qemu-iotests/267.out | 447 ++++++++++++---- tests/qemu-iotests/271.out | 14 +- tests/qemu-iotests/274 | 14 +- tests/qemu-iotests/274.out | 26 - tests/qemu-iotests/280 | 3 +- tests/qemu-iotests/280.out | 3 +- tests/qemu-iotests/281 | 11 +- tests/qemu-iotests/283 | 4 +- tests/qemu-iotests/283.out | 4 +- tests/qemu-iotests/286 | 15 +- tests/qemu-iotests/286.out | 8 +- tests/qemu-iotests/289.out | 2 +- tests/qemu-iotests/293.out | 30 +- tests/qemu-iotests/294.out | 4 +- tests/qemu-iotests/298 | 9 +- tests/qemu-iotests/300 | 34 +- tests/qemu-iotests/304 | 7 +- tests/qemu-iotests/305.out | 2 +- tests/qemu-iotests/307.out | 2 +- tests/qemu-iotests/310 | 6 +- tests/qemu-iotests/310.out | 3 +- tests/qemu-iotests/common.filter | 9 +- tests/qemu-iotests/common.qemu | 58 +- tests/qemu-iotests/common.rc | 8 - tests/qemu-iotests/iotests.py | 40 +- tests/qemu-iotests/tests/backup-discard-source | 15 +- tests/qemu-iotests/tests/copy-before-write | 130 +++-- tests/qemu-iotests/tests/file-io-error.out | 2 +- tests/qemu-iotests/tests/image-fleecing | 5 +- tests/qemu-iotests/tests/image-fleecing.out | 32 +- tests/qemu-iotests/tests/inactive-node-nbd.out | 10 +- tests/qemu-iotests/tests/iothreads-create | 3 +- tests/qemu-iotests/tests/luks-detached-header | 49 +- .../tests/migrate-bitmaps-postcopy-test | 5 +- tests/qemu-iotests/tests/migrate-bitmaps-test | 7 +- tests/qemu-iotests/tests/mirror-change-copy-mode | 15 +- tests/qemu-iotests/tests/mirror-ready-cancel-error | 7 +- tests/qemu-iotests/tests/nbd-reconnect-on-open.out | 4 +- tests/qemu-iotests/tests/parallels-bitmap.out | 4 +- tests/qemu-iotests/tests/parallels-checks.out | 4 +- tests/qemu-iotests/tests/qcow2-internal-snapshots | 226 ++++++-- .../tests/qcow2-internal-snapshots.out | 175 +++--- tests/qemu-iotests/tests/qsd-migrate | 23 +- tests/qemu-iotests/tests/qsd-migrate.out | 44 +- tests/qemu-iotests/tests/reopen-file | 12 +- tests/qemu-iotests/tests/write-zeroes-unmap | 42 +- tests/qemu-iotests/tests/write-zeroes-unmap.out | 80 +-- util/error-report.c | 2 +- util/qemu-print.c | 16 +- 224 files changed, 3658 insertions(+), 3754 deletions(-)
---
base-commit: 67166d97a3269285aa68c489f85c9ccdf78495e1
change-id: 20260921-nohmp-e0dff1582929
Best regards,
Signature · 1 line
Marc-André Lureau <[email protected]>
PATCH 1/88 scripts/checkpatch: skip trailer checks inside patch diff
The duplicate-trailer and self-review checks matched trailer-like lines inside the diff body, not just in the commit message. Gate the check on !$is_patch so it only runs before the diff starts.
--- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
@@ -1834,7 +1834,7 @@ sub process { } # Check for duplicate trailers and self-review - if (!$in_header_lines && + if (!$in_header_lines && !$is_patch && $line =~ /^\s*([A-Z][a-zA-Z]*(?:-[a-zA-Z]+)*):\s*(.+)/) { my $trailer_type = $1; my $trailer_value = $2;
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 2/88 build-sys: bump minimum glib version to v2.68
In reply to Marc-André LureauCentOS Stream 9 bumped glib to 2.68, according to repology, this is the floor version:
centos_stream_9 9 2.68.4 debian_12 12 2.74.6 fedora_43 43 2.86.5 freebsd 15.1 2.88.3 openbsd 7.8 2.88.3 opensuse_leap_15_6 15.6 2.78.6 ubuntu_24_04 24.04 2.80.0 homebrew rolling 2.90.0 msys2_mingw rolling 2.90.0
2.68 brings g_memdup2() for which we had a compat, but also has GStrvBuilder, g_string_replace(), g_test_get_path() among other nice API additions.
Replace deprecate g_memdup() usage, and checkpatch check is now redundant with compile-time deprecation error.
--- accel/tcg/cputlb.c | 4 ++-- contrib/plugins/lockstep.c | 25 ------------------------- hw/9pfs/9p-synth.c | 2 +- hw/9pfs/9p-util.h | 2 +- hw/9pfs/9p.c | 2 +- hw/acpi/core.c | 2 +- hw/core/machine.c | 2 +- hw/i386/multiboot.c | 2 +- hw/net/eepro100.c | 2 +- hw/nvram/fw_cfg.c | 8 ++++---- hw/scsi/mptsas.c | 5 +++-- hw/vfio/pci.c | 2 +- include/glib-compat.h | 41 ++--------------------------------------- linux-user/syscall.c | 2 +- linux-user/uaccess.c | 2 +- meson.build | 2 +- net/colo.c | 4 ++-- qapi/qapi-clone-visitor.c | 16 ++++++++-------- qapi/qapi-visit-core.c | 6 ++++-- scripts/checkpatch.pl | 5 ----- system/memory.c | 2 +- system/vl.c | 2 +- 22 files changed, 38 insertions(+), 102 deletions(-)
accel/tcg/cputlb.c +2 -2
@@ -833,13 +833,13 @@ void tlb_flush_range_by_mmuidx_all_cpus_synced(CPUState *src_cpu,/* Allocate a separate data block for each destination cpu. */ CPU_FOREACH (dst_cpu) {if (dst_cpu != src_cpu) { - p =g_memdup (&d,sizeof (d)); + p =g_memdup2 (&d,sizeof (d));async_run_on_cpu (dst_cpu, tlb_flush_range_by_mmuidx_async_1,RUN_ON_CPU_HOST_PTR (p)); } } - p =g_memdup (&d,sizeof (d)); + p =g_memdup2 (&d,sizeof (d));async_safe_run_on_cpu (src_cpu, tlb_flush_range_by_mmuidx_async_1,RUN_ON_CPU_HOST_PTR (p)); }
contrib/plugins/lockstep.c +0 -25
@@ -101,31 +101,6 @@ static void plugin_exit(void *p)plugin_cleanup (NULL ); } -/* -* g_memdup has been deprecated in Glib since 2.68 and -* will complain about it if you try to use it. However until -* glib_req_ver for QEMU is bumped we make a copy of the glib-compat -* handler. -*/ -static inline gpointer g_memdup2_qemu (gconstpointer mem,gsize byte_size) -{ -#if GLIB_CHECK_VERSION (2 ,68 ,0 ) -return g_memdup2 (mem, byte_size); -#else -gpointer new_mem; - -if (mem && byte_size !=0 ) { - new_mem =g_malloc (byte_size); -memcpy (new_mem, mem, byte_size); - }else { - new_mem =NULL ; - } - -return new_mem; -#endif -} -#define g_memdup2 (m, s) g_memdup2_qemu(m, s) -static void report_divergance (ExecState *us,ExecState *them) {DivergeState divrec = { log,0 };
hw/9pfs/9p-synth.c +1 -1
@@ -525,7 +525,7 @@ static int synth_name_to_path(FsContext *ctx, V9fsPath *dir_path, out:/* Copy the node pointer to fid */ g_free (target->data); - target->data =g_memdup (&node,sizeof (void *)); + target->data =g_memdup2 (&node,sizeof (void *)); target->size =sizeof (void *);return 0 ; }
hw/9pfs/9p-util.h +1 -1
@@ -265,7 +265,7 @@ static inline struct dirent *qemu_dirent_dup(struct dirent *dent) sz = offsetof(struct dirent , d_name) +strlen (dent->d_name) +1 ; } -return g_memdup (dent, sz); +return g_memdup2 (dent, sz); }/*
hw/9pfs/9p.c +1 -1
@@ -229,7 +229,7 @@ void v9fs_path_copy(V9fsPath *dst, const V9fsPath *src) {v9fs_path_free (dst); dst->size = src->size; - dst->data =g_memdup (src->data, src->size); + dst->data =g_memdup2 (src->data, src->size); } int v9fs_name_to_path(V9fsState *s, V9fsPath *dirpath,
hw/acpi/core.c +1 -1
@@ -647,7 +647,7 @@ void acpi_pm1_cnt_init(ACPIREGS *ar, MemoryRegion *parent, suspend[3 ] =1 | ((!disable_s3) <<7 ); suspend[4 ] = s4_val | ((!disable_s4) <<7 ); -fw_cfg_add_file (fw_cfg,"etc/system-states" ,g_memdup (suspend,6 ),6 ); +fw_cfg_add_file (fw_cfg,"etc/system-states" ,g_memdup2 (suspend,6 ),6 ); } }
hw/core/machine.c +1 -1
@@ -739,7 +739,7 @@ HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine) cpu_item->type =g_strdup (machine->possible_cpus->cpus[i].type); cpu_item->vcpus_count = machine->possible_cpus->cpus[i].vcpus_count; - cpu_item->props =g_memdup (&machine->possible_cpus->cpus[i].props, + cpu_item->props =g_memdup2 (&machine->possible_cpus->cpus[i].props,sizeof (*cpu_item->props)); cpu = machine->possible_cpus->cpus[i].cpu;
hw/i386/multiboot.c +1 -1
@@ -387,7 +387,7 @@ int load_multiboot(X86MachineState *x86ms,mb_debug (" mb_mods_count = %d" , mbs.mb_mods_count);/* save bootinfo off the stack */ - mb_bootinfo_data =g_memdup (bootinfo,sizeof (bootinfo)); + mb_bootinfo_data =g_memdup2 (bootinfo,sizeof (bootinfo));/* Pass variables to option rom */ fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_ENTRY , mh_entry_addr);
hw/net/eepro100.c +1 -1
@@ -1883,7 +1883,7 @@ static void e100_nic_realize(PCIDevice *pci_dev, Error **errp)qemu_register_reset (nic_reset, s); - s->vmstate =g_memdup (&vmstate_eepro100,sizeof (vmstate_eepro100)); + s->vmstate =g_memdup2 (&vmstate_eepro100,sizeof (vmstate_eepro100)); s->vmstate->name =qemu_get_queue (s->nic)->model;vmstate_register_any (VMSTATE_IF (&pci_dev->qdev), s->vmstate, s); }
hw/nvram/fw_cfg.c +4 -4
@@ -197,7 +197,7 @@ static void fw_cfg_bootsplash(FWCfgState *s)/* use little endian format */ bst_le16 =cpu_to_le16 (bst_val);fw_cfg_add_file (s,"etc/boot-menu-wait" , -g_memdup (&bst_le16,sizeof bst_le16),sizeof bst_le16); +g_memdup2 (&bst_le16,sizeof bst_le16),sizeof bst_le16); }/* insert splash file if user configurated */
@@ -247,7 +247,7 @@ static void fw_cfg_reboot(FWCfgState *s) } rt_le32 =cpu_to_le32 (rt_val); -fw_cfg_add_file (s,"etc/boot-fail-wait" ,g_memdup (&rt_le32,4 ),4 ); +fw_cfg_add_file (s,"etc/boot-fail-wait" ,g_memdup2 (&rt_le32,4 ),4 ); }static void fw_cfg_write (FWCfgState *s,uint8_t value)
@@ -745,7 +745,7 @@ void fw_cfg_add_string(FWCfgState *s, uint16_t key, const char *value)size_t sz =strlen (value) +1 ;trace_fw_cfg_add_string (key,trace_key_name (key), value); -fw_cfg_add_bytes (s, key,g_memdup (value, sz), sz); +fw_cfg_add_bytes (s, key,g_memdup2 (value, sz), sz); }void fw_cfg_modify_string (FWCfgState *s,uint16_t key,const char *value)
@@ -753,7 +753,7 @@ void fw_cfg_modify_string(FWCfgState *s, uint16_t key, const char *value)size_t sz =strlen (value) +1 ;char *old; - old =fw_cfg_modify_bytes_read (s, key,g_memdup (value, sz), sz); + old =fw_cfg_modify_bytes_read (s, key,g_memdup2 (value, sz), sz);g_free (old); }
hw/scsi/mptsas.c +3 -2
@@ -458,7 +458,8 @@ static void mptsas_process_scsi_task_mgmt(MPTSASState *s, MPIMsgSCSITaskMgmt *re }else {MPTSASCancelNotifier *notifier; - reply_async =g_memdup (&reply,sizeof (MPIMsgSCSITaskMgmtReply)); + reply_async =g_memdup2 (&reply, +sizeof (MPIMsgSCSITaskMgmtReply)); reply_async->IOCLogInfo =INT_MAX ; count =1 ;
@@ -485,7 +486,7 @@ static void mptsas_process_scsi_task_mgmt(MPTSASState *s, MPIMsgSCSITaskMgmt *re goto out; } - reply_async =g_memdup (&reply,sizeof (MPIMsgSCSITaskMgmtReply)); + reply_async =g_memdup2 (&reply,sizeof (MPIMsgSCSITaskMgmtReply)); reply_async->IOCLogInfo =INT_MAX ; count =0 ;
hw/vfio/pci.c +1 -1
@@ -2646,7 +2646,7 @@ static void vfio_add_ext_cap(VFIOPCIDevice *vdev, bool ats_needed)* physical device, we cache the config space to avoid overwriting * the original config space when we parse the extended capabilities. */ - config =g_memdup (pdev->config, vdev->config_size); + config =g_memdup2 (pdev->config, vdev->config_size);/* * Extended capabilities are chained with each pointing to the next, so we
include/glib-compat.h +2 -39
57 lines not on this page · raw message
linux-user/syscall.c +1 -1
@@ -8373,7 +8373,7 @@ static abi_long do_open_by_handle_at(abi_long mount_fd, abi_long handle,return -TARGET_EFAULT ; } - fh =g_memdup (target_fh, total_size); + fh =g_memdup2 (target_fh, total_size); fh->handle_bytes = size; fh->handle_type =tswap32 (target_fh->handle_type);
linux-user/uaccess.c +1 -1
@@ -16,7 +16,7 @@ void *lock_user(int type, abi_ulong guest_addr, ssize_t len, bool copy) host_addr =g2h_untagged (guest_addr);#ifdef CONFIG_DEBUG_REMAP if (copy) { - host_addr =g_memdup (host_addr, len); + host_addr =g_memdup2 (host_addr, len); }else { host_addr =g_malloc0 (len); }
meson.build +1 -1
@@ -1058,7 +1058,7 @@ have_xen_pci_passthrough = get_option('xen_pci_passthrough') \ # the _WIN32_WINNT setting in osdep.h according to the value from glib. # You should also check if any of the glib.version() checks # below can also be removed. -glib_req_ver = '>=2.66.0' +glib_req_ver = '>=2.68.0' glib_pc = dependency('glib-2.0', version: glib_req_ver, required: true, method: 'pkg-config') glib_cflags = []
net/colo.c +2 -2
@@ -166,7 +166,7 @@ Packet *packet_new(const void *data, int size, int vnet_hdr_len) {Packet *pkt =g_slice_new0 (Packet); - pkt->data =g_memdup (data, size); + pkt->data =g_memdup2 (data, size); pkt->size = size; pkt->creation_ms =qemu_clock_get_ms (QEMU_CLOCK_HOST ); pkt->vnet_hdr_len = vnet_hdr_len;
@@ -221,7 +221,7 @@ Connection *connection_get(GHashTable *connection_track_table,Connection *conn =g_hash_table_lookup (connection_track_table, key);if (conn ==NULL ) { -ConnectionKey *new_key =g_memdup (key,sizeof (*key)); +ConnectionKey *new_key =g_memdup2 (key,sizeof (*key)); conn =connection_new (key);
qapi/qapi-clone-visitor.c +8 -8
@@ -37,7 +37,7 @@ static bool qapi_clone_start_struct(Visitor *v, const char *name, void **obj,return true; } - *obj =g_memdup (*obj, size); + *obj =g_memdup2 (*obj, size); qcv->depth++;return true; }
@@ -65,8 +65,8 @@ static GenericList *qapi_clone_next_list(Visitor *v, GenericList *tail,QapiCloneVisitor *qcv =to_qcv (v);assert (qcv->depth); -/* Unshare the tail of the list cloned by g_memdup() */ - tail->next =g_memdup (tail->next, size); +/* Unshare the tail of the list cloned by g_memdup2() */ + tail->next =g_memdup2 (tail->next, size);return tail->next; }
@@ -83,7 +83,7 @@ static bool qapi_clone_type_int64(Visitor *v, const char *name, int64_t *obj,QapiCloneVisitor *qcv =to_qcv (v);assert (qcv->depth); -/* Value was already cloned by g_memdup() */ +/* Value was already cloned by g_memdup2() */ return true; }
@@ -93,7 +93,7 @@ static bool qapi_clone_type_uint64(Visitor *v, const char *name,QapiCloneVisitor *qcv =to_qcv (v);assert (qcv->depth); -/* Value was already cloned by g_memdup() */ +/* Value was already cloned by g_memdup2() */ return true; }
@@ -103,7 +103,7 @@ static bool qapi_clone_type_bool(Visitor *v, const char *name, bool *obj,QapiCloneVisitor *qcv =to_qcv (v);assert (qcv->depth); -/* Value was already cloned by g_memdup() */ +/* Value was already cloned by g_memdup2() */ return true; }
@@ -114,7 +114,7 @@ static bool qapi_clone_type_str(Visitor *v, const char *name, char **obj,assert (qcv->depth);/* -* Pointer was already cloned by g_memdup; create fresh copy. +* Pointer was already cloned by g_memdup2; create fresh copy. * Note that as long as qobject-output-visitor accepts NULL instead of * "", then we must do likewise. However, we want to obey the * input visitor semantics of never producing NULL when the empty
@@ -130,7 +130,7 @@ static bool qapi_clone_type_number(Visitor *v, const char *name, double *obj,QapiCloneVisitor *qcv =to_qcv (v);assert (qcv->depth); -/* Value was already cloned by g_memdup() */ +/* Value was already cloned by g_memdup2() */ return true; }
qapi/qapi-visit-core.c +4 -2
@@ -432,8 +432,10 @@ bool visit_type_enum(Visitor *v, const char *name, int *obj,case VISITOR_OUTPUT :return output_type_enum (v, name, obj, lookup, errp);case VISITOR_CLONE : -/* nothing further to do, scalar value was already copied by -* g_memdup() during visit_start_*() */ +/* +* nothing further to do, scalar value was already copied by +* g_memdup2() during visit_start_*() +*/ return true;case VISITOR_DEALLOC :/* nothing to deallocate for a scalar */
scripts/checkpatch.pl +0 -5
@@ -3253,11 +3253,6 @@ sub process { WARN("consider using g_path_get_$1() in preference to g_strdup($1())\n" . $herecurr); } -# enforce g_memdup2() over g_memdup() - if ($line =~ /\bg_memdup\s*\(/) { - ERROR("use g_memdup2() instead of unsafe g_memdup()\n" . $herecurr); - } - # recommend qemu_strto* over strto* for numeric conversions if ($line =~ /\b(strto[^kd].*?)\s*\(/) { ERROR("consider using qemu_$1 in preference to $1\n" . $herecurr);
system/memory.c +1 -1
@@ -1198,7 +1198,7 @@ static char *memory_region_escape_name(const char *name) bytes +=memory_region_need_escape (*p) ?4 :1 ; }if (bytes == p - name) { -return g_memdup (name, bytes +1 ); +return g_memdup2 (name, bytes +1 ); } escaped =g_malloc (bytes +1 );
system/vl.c +1 -1
@@ -1186,7 +1186,7 @@ static int parse_fw_cfg(void *opaque, QemuOpts *opts, Error **errp) }if (nonempty_str (str)) { size =strlen (str);/* NUL terminator NOT included in fw_cfg blob */ - buf =g_memdup (str, size); + buf =g_memdup2 (str, size); }else if (nonempty_str (gen_id)) {if (!fw_cfg_add_file_from_generator (fw_cfg,object_get_objects_root (), gen_id, name, errp)) {
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 3/88 docs/devel: minor fix in qom documentation
In reply to Marc-André LureauIt declares an autoptr for the instance.
--- docs/devel/qom.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
docs/devel/qom.rst +1 -1
@@ -328,7 +328,7 @@ This is equivalent to the following: typedef struct MyDevice MyDevice; typedef struct MyDeviceClass MyDeviceClass; - G_DEFINE_AUTOPTR_CLEANUP_FUNC(MyDeviceClass, object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(MyDevice, object_unref) #define MY_DEVICE_GET_CLASS(void *obj) \ OBJECT_GET_CLASS(MyDeviceClass, obj, TYPE_MY_DEVICE)
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 4/88 qom: auto-terminate interfaces array in OBJECT_DEFINE_TYPE macros
In reply to Marc-André LureauThe DO_OBJECT_DEFINE_TYPE_EXTENDED macro requires callers to manually append a NULL sentinel to the interfaces list. Forgetting it causes out-of-bounds reads during type registration, leading to run-time crashes.
Append an empty initializer in the base macro so the sentinel is always present, and drop the now-redundant manual terminators from all callers.
--- backends/igvm-cfg.c | 3 +-- hw/acpi/pci.c | 6 ++---- hw/core/reset.c | 4 +++- hw/core/resetcontainer.c | 5 ++++- hw/hyperv/hv-balloon.c | 2 +- hw/ppc/pef.c | 3 +-- hw/virtio/virtio-mem.c | 6 +++++- include/qom/object.h | 6 +++--- system/ram-block-attributes.c | 3 +-- target/i386/kvm/tdx.c | 3 +-- target/s390x/kvm/pv.c | 3 +-- 11 files changed, 23 insertions(+), 21 deletions(-)
backends/igvm-cfg.c +1 -2
@@ -72,8 +72,7 @@ static void igvm_complete(UserCreatable *uc, Error **errp)OBJECT_DEFINE_TYPE_WITH_INTERFACES (IgvmCfg, igvm_cfg,IGVM_CFG ,OBJECT , { TYPE_USER_CREATABLE }, - { TYPE_RESETTABLE_INTERFACE }, - { NULL }) + { TYPE_RESETTABLE_INTERFACE })static void igvm_cfg_class_init (ObjectClass *oc,const void *data) {
hw/acpi/pci.c +2 -4
@@ -83,8 +83,7 @@ typedef struct AcpiGenericInitiatorClass {OBJECT_DEFINE_TYPE_WITH_INTERFACES (AcpiGenericInitiator, acpi_generic_initiator,ACPI_GENERIC_INITIATOR ,OBJECT , - { TYPE_USER_CREATABLE }, - { NULL }) + { TYPE_USER_CREATABLE })OBJECT_DECLARE_SIMPLE_TYPE (AcpiGenericInitiator,ACPI_GENERIC_INITIATOR )
@@ -199,8 +198,7 @@ typedef struct AcpiGenericPortClass {OBJECT_DEFINE_TYPE_WITH_INTERFACES (AcpiGenericPort, acpi_generic_port,ACPI_GENERIC_PORT ,OBJECT , - { TYPE_USER_CREATABLE }, - { NULL }) + { TYPE_USER_CREATABLE })OBJECT_DECLARE_SIMPLE_TYPE (AcpiGenericPort,ACPI_GENERIC_PORT )
hw/core/reset.c +3 -1
@@ -58,7 +58,9 @@ struct LegacyReset {bool skip_on_snapshot_load; }; -OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(LegacyReset, legacy_reset, LEGACY_RESET, OBJECT, { TYPE_RESETTABLE_INTERFACE }, { }) +OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES (LegacyReset, legacy_reset, +LEGACY_RESET ,OBJECT , + { TYPE_RESETTABLE_INTERFACE })static ResettableState *legacy_reset_get_state (Object *obj) {
hw/core/resetcontainer.c +4 -1
@@ -24,7 +24,10 @@ struct ResettableContainer {GPtrArray *children; }; -OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(ResettableContainer, resettable_container, RESETTABLE_CONTAINER, OBJECT, { TYPE_RESETTABLE_INTERFACE }, { }) +OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES (ResettableContainer, + resettable_container, +RESETTABLE_CONTAINER ,OBJECT , + { TYPE_RESETTABLE_INTERFACE })void resettable_container_add (ResettableContainer *rc,Object *obj) {
hw/hyperv/hv-balloon.c +1 -1
@@ -160,7 +160,7 @@ typedef struct HvBalloon {OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES (HvBalloon, hv_balloon, \HV_BALLOON ,VMBUS_DEVICE , \ - { TYPE_MEMORY_DEVICE }, { }) + { TYPE_MEMORY_DEVICE })#define HV_BALLOON_SET_STATE (hvb, news) \ do { \
hw/ppc/pef.c +1 -2
@@ -124,8 +124,7 @@ OBJECT_DEFINE_TYPE_WITH_INTERFACES(PefGuest, pef_guest,PEF_GUEST ,CONFIDENTIAL_GUEST_SUPPORT , - { TYPE_USER_CREATABLE }, - { NULL }) + { TYPE_USER_CREATABLE }) static void pef_guest_class_init(ObjectClass *oc, const void *data) {
hw/virtio/virtio-mem.c +5 -1
@@ -1681,7 +1681,11 @@ static void virtio_register_types(void) type_init(virtio_register_types) -OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(VirtioMemSystemReset, virtio_mem_system_reset, VIRTIO_MEM_SYSTEM_RESET, OBJECT, { TYPE_RESETTABLE_INTERFACE }, { }) +OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(VirtioMemSystemReset, + virtio_mem_system_reset, + VIRTIO_MEM_SYSTEM_RESET, + OBJECT, + { TYPE_RESETTABLE_INTERFACE }) static void virtio_mem_system_reset_init(Object *obj) {
include/qom/object.h +3 -3
@@ -294,7 +294,7 @@ struct Object .class_size = CLASS_SIZE, \ .class_init = module_obj_name##_class_init, \ .abstract = ABSTRACT, \ - .interfaces = (const InterfaceInfo[]) { __VA_ARGS__ } , \ + .interfaces = (const InterfaceInfo[]) { __VA_ARGS__, { } } , \ }; \ \ static void \
@@ -365,8 +365,8 @@ struct Object* for the common case of a non-abstract type, with one or more implemented * interfaces. * -* Note when passing the list of interfaces, be sure to include the final -* NULL entry, e.g. { TYPE_USER_CREATABLE }, { NULL } +* The NULL terminator is added automatically by the macro, so only +* the actual interfaces need to be listed, e.g. { TYPE_USER_CREATABLE } */ #define OBJECT_DEFINE_TYPE_WITH_INTERFACES(ModuleObjName, module_obj_name, \ MODULE_OBJ_NAME, \
system/ram-block-attributes.c +1 -2
@@ -18,8 +18,7 @@ OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES(RamBlockAttributes, ram_block_attributes,RAM_BLOCK_ATTRIBUTES ,OBJECT , - { TYPE_RAM_DISCARD_SOURCE }, - { }) + { TYPE_RAM_DISCARD_SOURCE }) static size_tram_block_attributes_get_block_size (void)
target/i386/kvm/tdx.c +1 -2
@@ -1559,8 +1559,7 @@ OBJECT_DEFINE_TYPE_WITH_INTERFACES(TdxGuest,TDX_GUEST ,X86_CONFIDENTIAL_GUEST , { TYPE_USER_CREATABLE }, - { TYPE_RESETTABLE_INTERFACE }, - { NULL }) + { TYPE_RESETTABLE_INTERFACE }) static void tdx_guest_init(Object *obj) {
target/s390x/kvm/pv.c +1 -2
@@ -402,8 +402,7 @@ OBJECT_DEFINE_TYPE_WITH_INTERFACES(S390PVGuest, s390_pv_guest,S390_PV_GUEST ,CONFIDENTIAL_GUEST_SUPPORT , - { TYPE_USER_CREATABLE }, - { NULL }) + { TYPE_USER_CREATABLE }) static void s390_pv_guest_class_init(ObjectClass *oc, const void *data) {
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
Re: [PATCH 04/88] qom: auto-terminate interfaces array in OBJECT_DEFINE_TYPE macros
Quoted 7 lines · Marc-André Lureau
The
DO_OBJECT_DEFINE_TYPE_EXTENDEDmacro requires callers to manually append a NULL sentinel to the interfaces list. Forgetting it causes out-of-bounds reads during type registration, leading to run-time crashes.Append an empty initializer in the base macro so the sentinel is always present, and drop the now-redundant manual terminators from all callers.
This is nice however another similar common list, the TypeInfo.interfaces still requires explicit NULL termination and now these are inconsistent which can also lead to people get confused where to add NULL element and where can it be omitted. Maybe we should consider adding a macro to make interface lists that adds the terminating element and use that everywhere or just stick to require explicit NULL at the end of interfaces list everywhere?
Regards,
BALATON Zoltan
PATCH 5/88 qemu-io: drop "qemu-io:" prefix in error-report
In reply to Marc-André Lureauqemu-io is still primarily an interactive program, and constantly printing the name of the program you're interacting with has little value.
--- qemu-io.c | 4 + tests/qemu-iotests/004.out | 20 +- tests/qemu-iotests/021.out | 60 ++-- tests/qemu-iotests/026.out | 396 ++++++++++----------- tests/qemu-iotests/026.out.nocache | 168 ++++----- tests/qemu-iotests/059.out | 6 +- tests/qemu-iotests/060.out | 46 +-- tests/qemu-iotests/061.out | 4 +- tests/qemu-iotests/069.out | 2 +- tests/qemu-iotests/070.out | 2 +- tests/qemu-iotests/071.out | 4 +- tests/qemu-iotests/072.out | 2 +- tests/qemu-iotests/075.out | 14 +- tests/qemu-iotests/076.out | 6 +- tests/qemu-iotests/078.out | 12 +- tests/qemu-iotests/080.out | 44 +-- tests/qemu-iotests/081.out | 4 +- tests/qemu-iotests/083.out | 104 +++--- tests/qemu-iotests/088.out | 12 +- tests/qemu-iotests/089.out | 4 +- tests/qemu-iotests/092.out | 24 +- tests/qemu-iotests/103.out | 14 +- tests/qemu-iotests/114.out | 4 +- tests/qemu-iotests/116.out | 14 +- tests/qemu-iotests/133.out | 30 +- tests/qemu-iotests/134.out | 2 +- tests/qemu-iotests/137.out | 30 +- tests/qemu-iotests/140.out | 2 +- tests/qemu-iotests/143.out | 4 +- tests/qemu-iotests/153.out | 42 +-- tests/qemu-iotests/171.out | 68 ++-- tests/qemu-iotests/187.out | 6 +- tests/qemu-iotests/188.out | 2 +- tests/qemu-iotests/197.out | 2 +- tests/qemu-iotests/205 | 4 +- tests/qemu-iotests/214.out | 2 +- tests/qemu-iotests/215.out | 2 +- tests/qemu-iotests/220.out | 2 +- tests/qemu-iotests/226.out | 16 +- tests/qemu-iotests/244.out | 22 +- tests/qemu-iotests/271.out | 14 +- tests/qemu-iotests/289.out | 2 +- tests/qemu-iotests/293.out | 30 +- tests/qemu-iotests/294.out | 4 +- tests/qemu-iotests/305.out | 2 +- tests/qemu-iotests/307.out | 2 +- tests/qemu-iotests/tests/file-io-error.out | 2 +- tests/qemu-iotests/tests/image-fleecing.out | 12 +- tests/qemu-iotests/tests/inactive-node-nbd.out | 10 +- tests/qemu-iotests/tests/nbd-reconnect-on-open.out | 4 +- tests/qemu-iotests/tests/parallels-bitmap.out | 4 +- tests/qemu-iotests/tests/parallels-checks.out | 4 +- util/error-report.c | 2 +- 53 files changed, 651 insertions(+), 647 deletions(-)
qemu-io.c +4 -0
@@ -628,6 +628,10 @@ int main(int argc, char **argv)exit (1 ); } +/* Compute the prompt before clearing prgname */ +get_prompt (); +g_set_prgname ("" ); +qemu_init_main_loop (&error_fatal);if (!trace_init_backends ()) {
tests/qemu-iotests/004.out +10 -10
@@ -6,36 +6,36 @@ wrote 1048576/1048576 bytes at offset 133169152 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) write into image boundary -qemu-io: write failed: Input/output error +write failed: Input/output error write at image boundary -qemu-io: write failed: Input/output error +write failed: Input/output error write past image boundary -qemu-io: write failed: Input/output error +write failed: Input/output error pwrite past image boundary -qemu-io: write failed: Input/output error +write failed: Input/output error writev past image boundary -qemu-io: writev failed: Input/output error +writev failed: Input/output error read before image boundary read 1048576/1048576 bytes at offset 133169152 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read into image boundary -qemu-io: read failed: Input/output error +read failed: Input/output error read at image boundary -qemu-io: read failed: Input/output error +read failed: Input/output error read past image boundary -qemu-io: read failed: Input/output error +read failed: Input/output error pread past image boundary -qemu-io: read failed: Input/output error +read failed: Input/output error readv past image boundary -qemu-io: readv failed: Input/output error +readv failed: Input/output error *** done
tests/qemu-iotests/021.out +30 -30
122 lines not on this page · raw message
tests/qemu-iotests/026.out +198 -198
844 lines not on this page · raw message
tests/qemu-iotests/026.out.nocache +84 -84
403 lines not on this page · raw message
tests/qemu-iotests/059.out +3 -3
@@ -2,15 +2,15 @@ QA output created by 059 === Testing invalid granularity === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 -qemu-io: can't open device TEST_DIR/t.vmdk: Invalid granularity, image may be corrupt +can't open device TEST_DIR/t.vmdk: Invalid granularity, image may be corrupt === Testing too big L2 table size === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 -qemu-io: can't open device TEST_DIR/t.vmdk: L2 table size too big +can't open device TEST_DIR/t.vmdk: L2 table size too big === Testing too big L1 table size === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 -qemu-io: can't open device TEST_DIR/t.vmdk: L1 size too big +can't open device TEST_DIR/t.vmdk: L1 size too big === Testing monolithicFlat creation and opening === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648
tests/qemu-iotests/060.out +23 -23
166 lines not on this page · raw message
tests/qemu-iotests/061.out +2 -2
@@ -545,7 +545,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 qemu-img: data-file can only be set for images that use an external data file Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 data_file=TEST_DIR/t.IMGFMT.data -qemu-io: can't open device TEST_DIR/t.IMGFMT: Could not open 'foo': No such file or directory +can't open device TEST_DIR/t.IMGFMT: Could not open 'foo': No such file or directory read 4096/4096 bytes at offset 0 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) image: TEST_DIR/t.IMGFMT
@@ -562,7 +562,7 @@ Format specific information: corrupt: false extended l2: false -qemu-io: can't open device TEST_DIR/t.IMGFMT: 'data-file' is required for this image +can't open device TEST_DIR/t.IMGFMT: 'data-file' is required for this image read 4096/4096 bytes at offset 0 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) image: TEST_DIR/t.IMGFMT
tests/qemu-iotests/069.out +1 -1
@@ -4,5 +4,5 @@ QA output created by 069 Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=131072 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=131072 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=IMGFMT -qemu-io: can't open device TEST_DIR/t.IMGFMT: Could not open backing file: Could not open 'TEST_DIR/t.IMGFMT.base': No such file or directory +can't open device TEST_DIR/t.IMGFMT: Could not open backing file: Could not open 'TEST_DIR/t.IMGFMT.base': No such file or directory *** done
tests/qemu-iotests/070.out +1 -1
@@ -1,7 +1,7 @@ QA output created by 070 === Verify open image read-only fails, due to dirty log === -qemu-io: can't open device TEST_DIR/iotest-dirtylog-10G-4M.vhdx: VHDX image file 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' opened read-only, but contains a log that needs to be replayed +can't open device TEST_DIR/iotest-dirtylog-10G-4M.vhdx: VHDX image file 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' opened read-only, but contains a log that needs to be replayed To replay the log, run: qemu-img check -r all 'TEST_DIR/iotest-dirtylog-10G-4M.vhdx' === Verify open image replays log ===
tests/qemu-iotests/071.out +2 -2
@@ -30,11 +30,11 @@ blkverify: read offset=0 bytes=512 contents mismatch at offset 0 === Testing blkdebug through filename === -qemu-io: read failed: Input/output error +read failed: Input/output error === Testing blkdebug through file blockref === -qemu-io: read failed: Input/output error +read failed: Input/output error === Testing blkdebug on existing block device ===
tests/qemu-iotests/072.out +1 -1
@@ -15,7 +15,7 @@ read 512/512 bytes at offset 512 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 512/512 bytes at offset 1024 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -qemu-io: Pattern verification failed at offset 0, 512 bytes +Pattern verification failed at offset 0, 512 bytes read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) *** done
tests/qemu-iotests/075.out +7 -7
@@ -9,23 +9,23 @@ read 512/512 bytes at offset 1048064 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == block_size must be a multiple of 512 == -qemu-io: can't open device TEST_DIR/simple-pattern.cloop: block_size 513 must be a multiple of 512 +can't open device TEST_DIR/simple-pattern.cloop: block_size 513 must be a multiple of 512 == block_size cannot be zero == -qemu-io: can't open device TEST_DIR/simple-pattern.cloop: block_size cannot be zero +can't open device TEST_DIR/simple-pattern.cloop: block_size cannot be zero == huge block_size === -qemu-io: can't open device TEST_DIR/simple-pattern.cloop: block_size 4294966784 must be 64 MB or less +can't open device TEST_DIR/simple-pattern.cloop: block_size 4294966784 must be 64 MB or less == offsets_size overflow === -qemu-io: can't open device TEST_DIR/simple-pattern.cloop: n_blocks 4294967295 must be 536870911 or less +can't open device TEST_DIR/simple-pattern.cloop: n_blocks 4294967295 must be 536870911 or less == refuse images that require too many offsets === -qemu-io: can't open device TEST_DIR/simple-pattern.cloop: image requires too many offsets, try increasing block size +can't open device TEST_DIR/simple-pattern.cloop: image requires too many offsets, try increasing block size == refuse images with non-monotonically increasing offsets == -qemu-io: can't open device TEST_DIR/simple-pattern.cloop: offsets not monotonically increasing at index 1, image file is corrupt +can't open device TEST_DIR/simple-pattern.cloop: offsets not monotonically increasing at index 1, image file is corrupt == refuse images with invalid compressed block size == -qemu-io: can't open device TEST_DIR/simple-pattern.cloop: invalid compressed block size at index 1, image file is corrupt +can't open device TEST_DIR/simple-pattern.cloop: invalid compressed block size at index 1, image file is corrupt *** done
tests/qemu-iotests/076.out +3 -3
@@ -5,13 +5,13 @@ read 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == Negative catalog size == -qemu-io: can't open device TEST_DIR/parallels-v1: Catalog too large +can't open device TEST_DIR/parallels-v1: Catalog too large == Overflow in catalog allocation == -qemu-io: can't open device TEST_DIR/parallels-v1: Catalog too large +can't open device TEST_DIR/parallels-v1: Catalog too large == Zero sectors per track == -qemu-io: can't open device TEST_DIR/parallels-v1: Invalid image: Zero sectors per track +can't open device TEST_DIR/parallels-v1: Invalid image: Zero sectors per track == Read from a valid v2 image == read 65536/65536 bytes at offset 0
tests/qemu-iotests/078.out +6 -6
@@ -5,18 +5,18 @@ read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == Negative catalog size == -qemu-io: can't open device TEST_DIR/empty.bochs: Catalog size is too large +can't open device TEST_DIR/empty.bochs: Catalog size is too large == Overflow for catalog size * sizeof(uint32_t) == -qemu-io: can't open device TEST_DIR/empty.bochs: Catalog size is too large +can't open device TEST_DIR/empty.bochs: Catalog size is too large == Too small catalog bitmap for image size == -qemu-io: can't open device TEST_DIR/empty.bochs: Catalog size is too small for this disk size -qemu-io: can't open device TEST_DIR/empty.bochs: Catalog size is too small for this disk size +can't open device TEST_DIR/empty.bochs: Catalog size is too small for this disk size +can't open device TEST_DIR/empty.bochs: Catalog size is too small for this disk size == Negative extent size == -qemu-io: can't open device TEST_DIR/empty.bochs: Extent size 2147483648 is too large +can't open device TEST_DIR/empty.bochs: Extent size 2147483648 is too large == Zero extent size == -qemu-io: can't open device TEST_DIR/empty.bochs: Extent size must be at least 512 +can't open device TEST_DIR/empty.bochs: Extent size must be at least 512 *** done
tests/qemu-iotests/080.out +22 -22
89 lines not on this page · raw message
tests/qemu-iotests/081.out +2 -2
@@ -81,7 +81,7 @@ wrote 10485760/10485760 bytes at offset 0 10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == checking that quorum is broken == -qemu-io: read failed: Input/output error +read failed: Input/output error == checking the blkverify mode with broken content == quorum: offset=0 bytes=10485760 contents mismatch at offset 0
@@ -97,7 +97,7 @@ read 10485760/10485760 bytes at offset 0 10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == checking the blkverify mode with invalid settings == -qemu-io: can't open: blkverify=on can only be set if there are exactly two files and vote-threshold is 2 +can't open: blkverify=on can only be set if there are exactly two files and vote-threshold is 2 == dynamically adding a child to a quorum == Testing:
tests/qemu-iotests/083.out +52 -52
268 lines not on this page · raw message
tests/qemu-iotests/088.out +6 -6
@@ -2,10 +2,10 @@ QA output created by 088 == Invalid block size == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 -qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 0 -qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 0 -qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 128 -qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 128 -qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 305419896 -qemu-io: can't open device TEST_DIR/t.vpc: Invalid block size 305419896 +can't open device TEST_DIR/t.vpc: Invalid block size 0 +can't open device TEST_DIR/t.vpc: Invalid block size 0 +can't open device TEST_DIR/t.vpc: Invalid block size 128 +can't open device TEST_DIR/t.vpc: Invalid block size 128 +can't open device TEST_DIR/t.vpc: Invalid block size 305419896 +can't open device TEST_DIR/t.vpc: Invalid block size 305419896 *** done
tests/qemu-iotests/089.out +2 -2
@@ -16,7 +16,7 @@ read 512/512 bytes at offset 512 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 512/512 bytes at offset 1024 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -qemu-io: Pattern verification failed at offset 0, 512 bytes +Pattern verification failed at offset 0, 512 bytes read 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
@@ -33,7 +33,7 @@ read 512/512 bytes at offset 0 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 wrote 512/512 bytes at offset 229376 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -qemu-io: read failed: Input/output error +read failed: Input/output error === Testing qemu-img info output ===
tests/qemu-iotests/092.out +12 -12
@@ -2,25 +2,25 @@ QA output created by 092 == Invalid cluster size == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 -qemu-io: can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k -qemu-io: can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k -qemu-io: can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k -qemu-io: can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k +can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k +can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k +can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k +can't open device TEST_DIR/t.qcow: Cluster size must be between 512 and 64k == Invalid L2 table size == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 -qemu-io: can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k -qemu-io: can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k -qemu-io: can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k -qemu-io: can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k +can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k +can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k +can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k +can't open device TEST_DIR/t.qcow: L2 table size must be between 512 and 64k == Invalid size == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 -qemu-io: can't open device TEST_DIR/t.qcow: Image too large -qemu-io: can't open device TEST_DIR/t.qcow: Image too large +can't open device TEST_DIR/t.qcow: Image too large +can't open device TEST_DIR/t.qcow: Image too large == Invalid backing file length == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 -qemu-io: can't open device TEST_DIR/t.qcow: Backing file name too long -qemu-io: can't open device TEST_DIR/t.qcow: Backing file name too long +can't open device TEST_DIR/t.qcow: Backing file name too long +can't open device TEST_DIR/t.qcow: Backing file name too long *** done
tests/qemu-iotests/103.out +7 -7
@@ -5,13 +5,13 @@ wrote 65536/65536 bytes at offset 0 === Testing invalid option combinations === -qemu-io: can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcount-cache-size may not be set at the same time -qemu-io: can't open device TEST_DIR/t.IMGFMT: l2-cache-size may not exceed cache-size -qemu-io: can't open device TEST_DIR/t.IMGFMT: refcount-cache-size may not exceed cache-size -qemu-io: can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcount-cache-size may not be set at the same time -qemu-io: can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) -qemu-io: can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) -qemu-io: can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) +can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcount-cache-size may not be set at the same time +can't open device TEST_DIR/t.IMGFMT: l2-cache-size may not exceed cache-size +can't open device TEST_DIR/t.IMGFMT: refcount-cache-size may not exceed cache-size +can't open device TEST_DIR/t.IMGFMT: cache-size, l2-cache-size and refcount-cache-size may not be set at the same time +can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) +can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) +can't open device TEST_DIR/t.IMGFMT: L2 cache entry size must be a power of two between 512 and the cluster size (65536) === Testing valid option combinations ===
tests/qemu-iotests/114.out +2 -2
@@ -10,8 +10,8 @@ virtual size: 64 MiB (67108864 bytes) cluster_size: 65536 backing file: TEST_DIR/t.IMGFMT.base backing file format: foo -qemu-io: can't open device TEST_DIR/t.qcow2: Could not open backing file: Unknown driver 'foo' -qemu-io: no file open, try 'help open' +can't open device TEST_DIR/t.qcow2: Could not open backing file: Unknown driver 'foo' +no file open, try 'help open' read 4096/4096 bytes at offset 0 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) qemu-img: Could not change the backing file to 'TEST_DIR/t.qcow2.base': backing format must be specified
tests/qemu-iotests/116.out +7 -7
@@ -2,29 +2,29 @@ QA output created by 116 == truncated header cluster == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 -qemu-io: can't open device TEST_DIR/t.qed: QED table offset is invalid +can't open device TEST_DIR/t.qed: QED table offset is invalid == invalid header magic == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 -qemu-io: can't open device TEST_DIR/t.qed: Image not in QED format +can't open device TEST_DIR/t.qed: Image not in QED format == invalid cluster size == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 -qemu-io: can't open device TEST_DIR/t.qed: QED cluster size is invalid +can't open device TEST_DIR/t.qed: QED cluster size is invalid == invalid table size == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 -qemu-io: can't open device TEST_DIR/t.qed: QED table size is invalid +can't open device TEST_DIR/t.qed: QED table size is invalid == invalid header size == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 -qemu-io: can't open device TEST_DIR/t.qed: QED table offset is invalid +can't open device TEST_DIR/t.qed: QED table offset is invalid == invalid L1 table offset == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 -qemu-io: can't open device TEST_DIR/t.qed: QED table offset is invalid +can't open device TEST_DIR/t.qed: QED table offset is invalid == invalid image size == Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 -qemu-io: can't open device TEST_DIR/t.qed: QED image size is invalid +can't open device TEST_DIR/t.qed: QED image size is invalid *** done
tests/qemu-iotests/133.out +15 -15
@@ -4,18 +4,18 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t === Check that node-name can't be changed === -qemu-io: Cannot change the option 'node-name' -qemu-io: Cannot change the option 'node-name' -qemu-io: Cannot change the option 'node-name' +Cannot change the option 'node-name' +Cannot change the option 'node-name' +Cannot change the option 'node-name' === Check that unchanged node-name is okay === === Check that driver can't be changed === -qemu-io: Cannot change the option 'driver' -qemu-io: Cannot change the option 'driver' -qemu-io: Cannot change the option 'driver' +Cannot change the option 'driver' +Cannot change the option 'driver' +Cannot change the option 'driver' === Check that unchanged driver is okay ===
@@ -27,16 +27,16 @@ format name: null-co === Check that mixing -c/-r/-w and their corresponding options is forbidden === -qemu-io: Cannot set both -r/-w and 'read-only' -qemu-io: Cannot set both -r/-w and 'read-only' -qemu-io: Cannot set both -c and the cache options -qemu-io: Cannot set both -c and the cache options -qemu-io: Cannot set both -c and the cache options +Cannot set both -r/-w and 'read-only' +Cannot set both -r/-w and 'read-only' +Cannot set both -c and the cache options +Cannot set both -c and the cache options +Cannot set both -c and the cache options === Check that invalid options are handled correctly === -qemu-io: Parameter 'read-only' expects 'on' or 'off' -qemu-io: Parameter 'cache.no-flush' expects 'on' or 'off' -qemu-io: Parameter 'cache.direct' expects 'on' or 'off' -qemu-io: Parameter 'auto-read-only' expects 'on' or 'off' +Parameter 'read-only' expects 'on' or 'off' +Parameter 'cache.no-flush' expects 'on' or 'off' +Parameter 'cache.direct' expects 'on' or 'off' +Parameter 'auto-read-only' expects 'on' or 'off' *** done
tests/qemu-iotests/134.out +1 -1
@@ -24,7 +24,7 @@ read 134217728/134217728 bytes at offset 0 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == verify pattern failure with wrong password == -qemu-io: Pattern verification failed at offset 0, 134217728 bytes +Pattern verification failed at offset 0, 134217728 bytes read 134217728/134217728 bytes at offset 0 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) *** done
tests/qemu-iotests/137.out +15 -15
@@ -15,30 +15,30 @@ read 33554432/33554432 bytes at offset 0 === Try setting some invalid values === -qemu-io: Parameter 'lazy-refcounts' expects 'on' or 'off' -qemu-io: cache-size, l2-cache-size and refcount-cache-size may not be set at the same time -qemu-io: l2-cache-size may not exceed cache-size -qemu-io: refcount-cache-size may not exceed cache-size -qemu-io: L2 cache entry size must be a power of two between 512 and the cluster size (65536) -qemu-io: L2 cache entry size must be a power of two between 512 and the cluster size (65536) -qemu-io: Refcount cache size too big -qemu-io: Conflicting values for qcow2 options 'overlap-check' ('constant') and 'overlap-check.template' ('all') -qemu-io: Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all -qemu-io: Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all -qemu-io: Cache clean interval too big +Parameter 'lazy-refcounts' expects 'on' or 'off' +cache-size, l2-cache-size and refcount-cache-size may not be set at the same time +l2-cache-size may not exceed cache-size +refcount-cache-size may not exceed cache-size +L2 cache entry size must be a power of two between 512 and the cluster size (65536) +L2 cache entry size must be a power of two between 512 and the cluster size (65536) +Refcount cache size too big +Conflicting values for qcow2 options 'overlap-check' ('constant') and 'overlap-check.template' ('all') +Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all +Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all +Cache clean interval too big Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=36028797018963968 -qemu-io: L2 cache size too big +L2 cache size too big Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 === Test transaction semantics === -qemu-io: Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all +Unsupported value 'blubb' for qcow2 option 'overlap-check'. Allowed are any of the following: none, constant, cached, all wrote 512/512 bytes at offset 0 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) ./common.rc: Killed ( VALGRIND_QEMU="${VALGRIND_QEMU_IO}" _qemu_proc_exec "${VALGRIND_LOGFILE}" "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@" ) OK: Dirty bit not set Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 -qemu-io: Parameter 'lazy-refcounts' expects 'on' or 'off' +Parameter 'lazy-refcounts' expects 'on' or 'off' qcow2: Marking image as corrupt: Preventing invalid allocation of L2 table at offset 0; further corruption events will be suppressed -qemu-io: write failed: Input/output error +write failed: Input/output error *** done
tests/qemu-iotests/140.out +1 -1
@@ -16,7 +16,7 @@ read 65536/65536 bytes at offset 0 { 'execute': 'eject', 'arguments': { 'device': 'drv' }} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "drv"}} -qemu-io: can't open device nbd+unix:///drv?socket=SOCK_DIR/nbd: Requested export not available +can't open device nbd+unix:///drv?socket=SOCK_DIR/nbd: Requested export not available server reported: export 'drv' not present { 'execute': 'quit' } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
tests/qemu-iotests/143.out +2 -2
@@ -5,9 +5,9 @@ QA output created by 143 'arguments': { 'addr': { 'type': 'unix', 'data': { 'path': 'SOCK_DIR/nbd' }}}} {"return": {}} -qemu-io: can't open device nbd+unix:///no_such_export?socket=SOCK_DIR/nbd: Requested export not available +can't open device nbd+unix:///no_such_export?socket=SOCK_DIR/nbd: Requested export not available server reported: export 'no_such_export' not present -qemu-io: can't open device nbd+unix:///aa--aa1?socket=SOCK_DIR/nbd: Requested export not available +can't open device nbd+unix:///aa--aa1?socket=SOCK_DIR/nbd: Requested export not available server reported: export 'aa--aa...' not present { 'execute': 'quit' } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
tests/qemu-iotests/153.out +21 -21
116 lines not on this page · raw message
tests/qemu-iotests/171.out +34 -34
198 lines not on this page · raw message
tests/qemu-iotests/187.out +3 -3
@@ -3,16 +3,16 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 Start from read-only -qemu-io: Block node is read-only +Block node is read-only wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -qemu-io: Block node is read-only +Block node is read-only Start from read-write wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -qemu-io: Block node is read-only +Block node is read-only wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) *** done
tests/qemu-iotests/188.out +1 -1
@@ -14,7 +14,7 @@ read 16777216/16777216 bytes at offset 0 16 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == verify open failure with wrong password == -qemu-io: can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot == verify that has_zero_init returns false when preallocating == Formatting 'TEST_DIR/t.IMGFMT.orig', fmt=IMGFMT size=16777216
tests/qemu-iotests/197.out +1 -1
@@ -16,7 +16,7 @@ read 2147483136/2147483136 bytes at offset 1024 2 GiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 1024/1024 bytes at offset 3221226496 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -qemu-io: can't open device TEST_DIR/t.wrap.qcow2: Can't use copy-on-read on read-only device +can't open device TEST_DIR/t.wrap.qcow2: Can't use copy-on-read on read-only device 2 GiB (0x80010000) bytes allocated at offset 0 bytes (0x0) 1023.938 MiB (0x3fff0000) bytes not allocated at offset 2 GiB (0x80010000) 64 KiB (0x10000) bytes allocated at offset 3 GiB (0xc0000000)
tests/qemu-iotests/205 +2 -2
@@ -75,11 +75,11 @@ class TestNbdServerRemove(iotests.QMPTestCase): def assertReadFailed(self, qemu_io_output): self.assertEqual(filter_qemu_io(qemu_io_output).strip(), - 'qemu-io: read failed: Input/output error') + 'read failed: Input/output error') def assertConnectFailed(self, qemu_io_output): self.assertEqual(filter_qemu_io(qemu_io_output).strip(), - "qemu-io: can't open device " + nbd_uri + + "can't open device " + nbd_uri + ": Requested export not available\n" "server reported: export 'exp' not present")
tests/qemu-iotests/214.out +1 -1
@@ -7,7 +7,7 @@ wrote 2097152/2097152 bytes at offset 0 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) wrote 2097152/2097152 bytes at offset 2097152 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -qemu-io: read failed: Input/output error +read failed: Input/output error No errors were found on the image. read 4194304/4194304 bytes at offset 0 4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
tests/qemu-iotests/215.out +1 -1
@@ -16,7 +16,7 @@ read 2147483136/2147483136 bytes at offset 1024 2 GiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 1024/1024 bytes at offset 3221226496 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -qemu-io: can't open device TEST_DIR/t.wrap.qcow2: Block node is read-only +can't open device TEST_DIR/t.wrap.qcow2: Block node is read-only 2 GiB (0x80010000) bytes allocated at offset 0 bytes (0x0) 1023.938 MiB (0x3fff0000) bytes not allocated at offset 2 GiB (0x80010000) 64 KiB (0x10000) bytes allocated at offset 3 GiB (0xc0000000)
tests/qemu-iotests/220.out +1 -1
@@ -38,7 +38,7 @@ wrote 2097152/2097152 bytes at offset 37748736 No errors were found on the image. image size 39845888 == Trying to write compressed cluster == -qemu-io: write failed: File too large +write failed: File too large image size 562949957615616 == Writing normal cluster == wrote 2097152/2097152 bytes at offset 0
tests/qemu-iotests/226.out +8 -8
@@ -3,24 +3,24 @@ QA output created by 226 === Testing with driver:file === == Testing RO == -qemu-io: can't open: 'file' driver requires 'TEST_DIR/t.IMGFMT' to be a regular file -qemu-io: can't open: 'file' driver requires '/dev/null' to be a regular file +can't open: 'file' driver requires 'TEST_DIR/t.IMGFMT' to be a regular file +can't open: 'file' driver requires '/dev/null' to be a regular file == Testing RW == -qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory -qemu-io: can't open: 'file' driver requires '/dev/null' to be a regular file +can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory +can't open: 'file' driver requires '/dev/null' to be a regular file === Testing with driver:host_device === == Testing RO == -qemu-io: can't open: 'host_device' driver requires 'TEST_DIR/t.IMGFMT' to be either a character or block device +can't open: 'host_device' driver requires 'TEST_DIR/t.IMGFMT' to be either a character or block device == Testing RW == -qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory +can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory === Testing with driver:host_cdrom === == Testing RO == -qemu-io: can't open: 'host_cdrom' driver requires 'TEST_DIR/t.IMGFMT' to be either a character or block device +can't open: 'host_cdrom' driver requires 'TEST_DIR/t.IMGFMT' to be either a character or block device == Testing RW == -qemu-io: can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory +can't open: Could not open 'TEST_DIR/t.IMGFMT': Is a directory *** done
tests/qemu-iotests/244.out +11 -11
@@ -9,23 +9,23 @@ read 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) read 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -qemu-io: can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory -qemu-io: no file open, try 'help open' +can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory +no file open, try 'help open' Data file required, but without data file name in the image: -qemu-io: can't open device TEST_DIR/t.qcow2: 'data-file' is required for this image -qemu-io: no file open, try 'help open' +can't open device TEST_DIR/t.qcow2: 'data-file' is required for this image +no file open, try 'help open' read 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -qemu-io: can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory -qemu-io: no file open, try 'help open' +can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory +no file open, try 'help open' Setting data-file for an image with internal data: Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 -qemu-io: can't open device TEST_DIR/t.qcow2: 'data-file' can only be set for images with an external data file -qemu-io: no file open, try 'help open' -qemu-io: can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory -qemu-io: no file open, try 'help open' +can't open device TEST_DIR/t.qcow2: 'data-file' can only be set for images with an external data file +no file open, try 'help open' +can't open device TEST_DIR/t.qcow2: Could not open 'inexistent': No such file or directory +no file open, try 'help open' === Conflicting features ===
@@ -37,7 +37,7 @@ qemu-img: error while writing at byte 0: Operation not supported Convert uncompressed, then write compressed data manually: Images are identical. -qemu-io: write failed: Operation not supported +write failed: Operation not supported No errors were found on the image. Take an internal snapshot:
tests/qemu-iotests/271.out +7 -7
@@ -456,7 +456,7 @@ L2 entry #0: 0x8000000000050001 0000000000000001 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 L2 entry #1: 0x8000000000060000 00000001ffffffff qcow2: Marking image as corrupt: Invalid cluster entry found (L2 offset: 0x40000, L2 index: 0x1); further corruption events will be suppressed -qemu-io: read failed: Input/output error +read failed: Input/output error ### Corrupted L2 entries - read test (unallocated) ###
@@ -471,14 +471,14 @@ L2 entry #0: 0x0000000000000001 0000000000000000 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 L2 entry #0: 0x0000000000000000 0000000000000001 qcow2: Marking image as corrupt: Invalid cluster entry found (L2 offset: 0x40000, L2 index: 0); further corruption events will be suppressed -qemu-io: read failed: Input/output error +read failed: Input/output error # Both 'subcluster is zero' and 'subcluster is allocated' bits set Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 L2 entry #1: 0x0000000000000000 0000000100000001 qcow2: Marking image as corrupt: Invalid cluster entry found (L2 offset: 0x40000, L2 index: 0x1); further corruption events will be suppressed -qemu-io: read failed: Input/output error +read failed: Input/output error ### Compressed cluster with subcluster bitmap != 0 - read test ###
@@ -501,7 +501,7 @@ L2 entry #0: 0x8000000000050001 0000000000000001 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 L2 entry #1: 0x8000000000060000 00000001ffffffff qcow2: Marking image as corrupt: Invalid cluster entry found (L2 offset: 0x40000, L2 index: 0x1); further corruption events will be suppressed -qemu-io: write failed: Input/output error +write failed: Input/output error ### Corrupted L2 entries - write test (unallocated) ###
@@ -516,14 +516,14 @@ L2 entry #0: 0x8000000000060000 0000000000000001 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 L2 entry #0: 0x0000000000000000 0000000000000001 qcow2: Marking image as corrupt: Invalid cluster entry found (L2 offset: 0x40000, L2 index: 0); further corruption events will be suppressed -qemu-io: write failed: Input/output error +write failed: Input/output error # Both 'subcluster is zero' and 'subcluster is allocated' bits set Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 L2 entry #1: 0x0000000000000000 0000000100000001 qcow2: Marking image as corrupt: Invalid cluster entry found (L2 offset: 0x40000, L2 index: 0x1); further corruption events will be suppressed -qemu-io: write failed: Input/output error +write failed: Input/output error ### Compressed cluster with subcluster bitmap != 0 - write test ###
@@ -555,7 +555,7 @@ Double checking the fixed image now... 1 errors were found on the image. Data may be corrupted, or further writes to the image may corrupt it. qcow2: Marking image as corrupt: Cluster allocation offset 0x50200 unaligned (L2 offset: 0x40000, L2 index: 0); further corruption events will be suppressed -qemu-io: read failed: Input/output error +read failed: Input/output error # Corrupted L2 entry, no allocated subclusters # Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=131072 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=raw Repairing offset=50200: Preallocated cluster is not properly aligned; L2 entry corrupted.
tests/qemu-iotests/289.out +1 -1
@@ -3,6 +3,6 @@ QA output created by 289 === Avoid freeing external data clusters on failure === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65536 data_file=TEST_DIR/t.IMGFMT.data_file -qemu-io: write failed: Input/output error +write failed: Input/output error No errors were found on the image. *** done
tests/qemu-iotests/293.out +15 -15
@@ -23,10 +23,10 @@ read 4096/4096 bytes at offset 0 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) == erase slot 0 and try it == -qemu-io: can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot == erase slot 2 and try it == -qemu-io: can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot == filling 4 slots with secret 2 ==
@@ -54,9 +54,9 @@ read 4096/4096 bytes at offset 0 qemu-img: All the active keyslots match the (old) password that was given and erasing them will erase all the data in the image irreversibly - refusing operation == only secret3 should work now == -qemu-io: can't open: Invalid password, cannot unlock any keyslot -qemu-io: can't open: Invalid password, cannot unlock any keyslot -qemu-io: can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot read 4096/4096 bytes at offset 0 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
@@ -66,9 +66,9 @@ read 4096/4096 bytes at offset 0 == only secret0 should work now == read 4096/4096 bytes at offset 0 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -qemu-io: can't open: Invalid password, cannot unlock any keyslot -qemu-io: can't open: Invalid password, cannot unlock any keyslot -qemu-io: can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot == replace secret0 with secret1 (should fail) == qemu-img: Refusing to overwrite active keyslot 0 - please erase it first
@@ -76,11 +76,11 @@ qemu-img: Refusing to overwrite active keyslot 0 - please erase it first == replace secret0 with secret1 with force (should work) == == only secret1 should work now == -qemu-io: can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot read 4096/4096 bytes at offset 0 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -qemu-io: can't open: Invalid password, cannot unlock any keyslot -qemu-io: can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot == erase last secret (should fail) == qemu-img: Attempt to erase the only active keyslot 0 which will erase all the data in the image irreversibly - refusing operation
@@ -92,8 +92,8 @@ qemu-img: No keyslots match given (old) password for erase operation == erase last secret with force by slot (should work) == == we have no secrets now, data is lost forever == -qemu-io: can't open: Invalid password, cannot unlock any keyslot -qemu-io: can't open: Invalid password, cannot unlock any keyslot -qemu-io: can't open: Invalid password, cannot unlock any keyslot -qemu-io: can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot *** done
tests/qemu-iotests/294.out +2 -2
@@ -15,14 +15,14 @@ read 4096/4096 bytes at offset 0 == erase slot 0 == == test that key 0 doesn't open the image == -qemu-io: can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot == 'restore' the image header == 1+0 records in 1+0 records out == test that key 0 still doesn't open the image (key material is erased) == -qemu-io: can't open: Invalid password, cannot unlock any keyslot +can't open: Invalid password, cannot unlock any keyslot == test that key 1 still works == read 4096/4096 bytes at offset 0
tests/qemu-iotests/305.out +1 -1
@@ -12,5 +12,5 @@ discard 1024/1024 bytes at offset 125952 ### Corrupt the offset of the second refcount block ### Try to allocate the discarded clusters again qcow2: Marking image as corrupt: Refblock offset 0x20600 unaligned (reftable index: 0x1); further corruption events will be suppressed -qemu-io: write failed: Input/output error +write failed: Input/output error *** done
tests/qemu-iotests/307.out +1 -1
@@ -127,7 +127,7 @@ exports available: 1 {"error": {"class": "GenericError", "desc": "export 'export1' still in use"}} {"execute": "block-export-del", "arguments": {"id": "export1", "mode": "hard"}} {"return": {}} -qemu-io: read failed: Input/output error +read failed: Input/output error {"execute": "query-block-exports", "arguments": {}} {"return": []}
tests/qemu-iotests/tests/file-io-error.out +1 -1
@@ -21,7 +21,7 @@ QA output created by file-io-error }} {"return": {}} -qemu-io: write failed: Input/output error +write failed: Input/output error {'execute': 'block-export-del', 'arguments': {'id': 'exp0'}}
tests/qemu-iotests/tests/image-fleecing.out +6 -6
@@ -238,13 +238,13 @@ read -P0xd5 1M 64k read -P0xdc 32M 64k read -P0xcd 0x3ff0000 64k read -P0 0x00f8000 32k -qemu-io: read failed: Invalid argument +read failed: Invalid argument read -P0 0x2010000 32k -qemu-io: read failed: Invalid argument +read failed: Invalid argument read -P0 0x3fe0000 64k -qemu-io: read failed: Invalid argument +read failed: Invalid argument --- Testing COW ---
@@ -265,13 +265,13 @@ read -P0xd5 1M 64k read -P0xdc 32M 64k read -P0xcd 0x3ff0000 64k read -P0 0x00f8000 32k
Lines of this file are not shown. View the raw message.
tests/qemu-iotests/tests/inactive-node-nbd.out +5 -5
Lines of this file are not shown. View the raw message.
tests/qemu-iotests/tests/nbd-reconnect-on-open.out +2 -2
Lines of this file are not shown. View the raw message.
tests/qemu-iotests/tests/parallels-bitmap.out +2 -2
Lines of this file are not shown. View the raw message.
tests/qemu-iotests/tests/parallels-checks.out +2 -2
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
Part of the diff is not shown here. View the raw message.
Re: [PATCH 05/88] qemu-io: drop "qemu-io:" prefix in error-report
Quoted 6 lines · Marc-André Lureau
qemu-io is still primarily an interactive program, and constantly printing the name of the program you're interacting with has little value.
Suggested-by Kevin Wolf<[email protected]>Signed-off-by Marc-André Lureau<[email protected]>
Signature · 2 lines
Best regards, Vladimir
PATCH 6/88 monitor: allow a bare Monitor
In reply to Marc-André LureauFor qemu-io commands, we want to capture qemu_printf() output. Let's allow to instantiate a bare monitor and steal its output.
We move UserCreatable to the leaf HMP & QMP monitors, to only allow -object on these.
--- include/monitor/monitor.h | 2 ++ monitor/hmp.c | 12 ++++-------- monitor/monitor.c | 28 ++++++++++++++++------------ monitor/qmp.c | 12 ++++-------- 4 files changed, 26 insertions(+), 28 deletions(-)
include/monitor/monitor.h +2 -0
@@ -29,6 +29,7 @@ void monitor_new_qmp(const char *id, const char *chardev_id, bool pretty, Error **errp);int monitor_new (MonitorOptions *opts,bool allow_hmp,Error **errp);int monitor_new_opts (QemuOpts *opts,Error **errp); +bool monitor_complete (Monitor *mon,Error **errp);void monitor_cleanup (void );void monitor_suspend (Monitor *mon);
@@ -39,6 +40,7 @@ int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp);int monitor_puts (Monitor *mon,const char *str);void monitor_flush (Monitor *mon); +GString *monitor_steal_output (Monitor *mon);int monitor_puts_locked (Monitor *mon,const char *str);void monitor_flush_locked (Monitor *mon);
monitor/hmp.c +4 -8
@@ -46,7 +46,9 @@#include "system/block-backend.h" #include "trace.h" -OBJECT_DEFINE_TYPE (MonitorHMP, monitor_hmp,MONITOR_HMP ,MONITOR ); +OBJECT_DEFINE_TYPE_WITH_INTERFACES (MonitorHMP, monitor_hmp, +MONITOR_HMP ,MONITOR , + { TYPE_USER_CREATABLE });MonitorHMP *monitor_cur_hmp (void ) {
@@ -1629,17 +1631,11 @@ void monitor_new_hmp(const char *id, const char *chardev_id,static void monitor_hmp_complete (UserCreatable *uc,Error **errp) {MonitorHMP *hmp =MONITOR_HMP (uc); -UserCreatableClass *ucc_parent = -USER_CREATABLE_CLASS ( -object_class_get_parent ( -OBJECT_CLASS (MONITOR_HMP_GET_CLASS (hmp))));ERRP_GUARD (); - ucc_parent->complete (uc, errp); -if (*errp) { +if (!monitor_complete (MONITOR (uc), errp)) {return ; } -if (hmp->parent_obj.chardev_id) {if (hmp->use_readline) { hmp->rs = readline_init(monitor_readline_printf,
monitor/monitor.c +16 -12
@@ -79,8 +79,7 @@ static bool monitor_destroyed;int monitor_device_index; -OBJECT_DEFINE_TYPE_EXTENDED (Monitor, monitor,MONITOR ,OBJECT , true, - { TYPE_USER_CREATABLE }, {}); +OBJECT_DEFINE_TYPE(Monitor, monitor, MONITOR, OBJECT)static void monitor_finalize (Object *obj) {
@@ -110,17 +109,11 @@ static void monitor_set_chardev_id(Object *obj, const char *str, Error **errp) mon->chardev_id =g_strdup (str); } -static void monitor_complete (UserCreatable *uc,Error **errp); -static void monitor_class_init (ObjectClass *cls,const void *data) { -UserCreatableClass *ucc =USER_CREATABLE_CLASS (cls); -object_class_property_add_str (cls,"chardev" , monitor_get_chardev_id, monitor_set_chardev_id); - - ucc->complete = monitor_complete; }static void monitor_init (Object *obj)
@@ -273,6 +266,16 @@ int monitor_puts(Monitor *mon, const char *str)return monitor_puts_locked (mon, str); } +GString *monitor_steal_output (Monitor *mon) +{ +GString *output; + +QEMU_LOCK_GUARD (&mon->mon_lock); + output = mon->outbuf; + mon->outbuf =g_string_new (NULL ); +return output; +} +static MonitorQAPIEventConf monitor_qapi_event_conf[QAPI_EVENT__MAX ] = {/* Limit guest-triggerable events to 1 per second */ [QAPI_EVENT_RTC_CHANGE ] = {1000 *SCALE_MS },
@@ -658,20 +661,20 @@ char *monitor_compat_id(void)return g_strdup_printf ("compat_monitor%d" , monitor_device_index++); } -static void monitor_complete (UserCreatable *uc,Error **errp) +bool monitor_complete (Monitor *mon,Error **errp) { -Monitor *mon =MONITOR (uc);AioContext *ctx; +assert (!mon->accept_input_bh);if (mon->chardev_id) {Chardev *chr =qemu_chr_find (mon->chardev_id);if (chr ==NULL ) {error_setg (errp,"chardev \"%s\" not found" , mon->chardev_id); -return ; +return false; }if (!qemu_chr_fe_init (&mon->chr, chr, errp)) { -return ; +return false; } }
@@ -685,6 +688,7 @@ static void monitor_complete(UserCreatable *uc, Error **errp) ctx =qemu_get_aio_context (); } mon->accept_input_bh =aio_bh_new (ctx, monitor_accept_input, mon); +return true; }int monitor_new (MonitorOptions *opts,bool allow_hmp,Error **errp)
monitor/qmp.c +4 -8
@@ -77,7 +77,9 @@ QmpCommandList qmp_commands, qmp_cap_negotiation_commands;/* Monitor being serviced by the dispatcher. Protected by BQL. */ static MonitorQMP *qmp_dispatcher_current_mon; -OBJECT_DEFINE_TYPE (MonitorQMP, monitor_qmp,MONITOR_QMP ,MONITOR ); +OBJECT_DEFINE_TYPE_WITH_INTERFACES (MonitorQMP, monitor_qmp, +MONITOR_QMP ,MONITOR , + { TYPE_USER_CREATABLE });static void monitor_qmp_cleanup_req_queue_locked (MonitorQMP *mon);
@@ -704,17 +706,11 @@ void monitor_new_qmp(const char *id, const char *chardev_id,static void monitor_qmp_complete (UserCreatable *uc,Error **errp) {MonitorQMP *mon =MONITOR_QMP (uc); -UserCreatableClass *ucc_parent = -USER_CREATABLE_CLASS ( -object_class_get_parent ( -OBJECT_CLASS (MONITOR_QMP_GET_CLASS (mon))));ERRP_GUARD (); - ucc_parent->complete (uc, errp); -if (*errp) { +if (!monitor_complete (MONITOR (uc), errp)) {return ; } -qemu_chr_fe_set_echo (&mon->parent_obj.chr, true);if (monitor_requires_iothread (MONITOR (mon))) {
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 7/88 qemu-print: use monitor_puts() for any non-QMP monitor
In reply to Marc-André LureauInstead of requiring a MonitorHMP and going through monitor_hmp_vprintf(), use monitor_puts() on the base Monitor class. This allows qemu_printf() to work with any monitor type that isn't QMP, which will be needed to capture output via a bare Monitor used as a buffer.
Add monitor_puts() since qemu_printf() is in libqemuutil.
--- stubs/meson.build | 1 + stubs/monitor-puts.c | 9 +++++++++ util/qemu-print.c | 16 +++++----------- 3 files changed, 15 insertions(+), 11 deletions(-)
stubs/meson.build +1 -0
@@ -9,6 +9,7 @@ stub_ss.add(files('is-daemonized.c')) stub_ss.add(files('monitor-core.c')) stub_ss.add(files('monitor-cur.c')) stub_ss.add(files('monitor-hmp.c')) +stub_ss.add(files('monitor-puts.c')) stub_ss.add(files('qapi-event-emit.c')) stub_ss.add(files('replay-mode.c')) stub_ss.add(files('trace-control.c'))
stubs/monitor-puts.c new file +9 -0
@@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "monitor/monitor.h" + +int monitor_puts (Monitor *mon,const char *str) +{ +abort (); +}
util/qemu-print.c +5 -11
@@ -19,25 +19,19 @@/* * Print like vprintf(). * Print to current monitor if we have one, else to stdout. -* (if the monitor is QMP, fail without printing anything) +* QMP monitors are rejected (return -1) since they don't accept +* free-form text output. */ int qemu_vprintf (const char *fmt,va_list ap) {Monitor *cur_mon =monitor_cur (); -/* for all monitors: QMP & HMP */ if (cur_mon) { -#ifdef CONFIG_HMP -/* don't use monitor_cur_hmp(), to avoid a second lookup */ -MonitorHMP *hmp = (MonitorHMP *) -object_dynamic_cast (OBJECT (cur_mon),TYPE_MONITOR_HMP ); -if (!hmp) { +if (object_dynamic_cast (OBJECT (cur_mon),TYPE_MONITOR_QMP )) {return -1 ; } -return monitor_hmp_vprintf (hmp, fmt, ap); -#else -return -1 ; -#endif + g_autofree char *buf = g_strdup_vprintf(fmt, ap); +return monitor_puts (cur_mon, buf); }return vprintf (fmt, ap); }
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 8/88 block/monitor: capture x-qemu-io output
In reply to Marc-André LureauUse a bare monitor to capture qemuio_command() printf output. Return it as HumanReadableText.
--- block/monitor/block-hmp-cmds.c | 14 +++++--- block/monitor/qmp-cmds.c | 49 +++++++++++++++++++++++----- qapi/block.json | 3 ++ qemu-io-cmds.c | 74 ++++++++++++++++++++++-------------------- system/qtest.c | 4 ++- tests/qemu-iotests/iotests.py | 2 +- 6 files changed, 95 insertions(+), 51 deletions(-)
block/monitor/block-hmp-cmds.c +10 -4
@@ -543,12 +543,18 @@ void hmp_qemu_io(MonitorHMP *hmp, const QDict *qdict)bool qdev =qdict_get_try_bool (qdict,"qdev" , false);const char *device =qdict_get_str (qdict,"device" );const char *command =qdict_get_str (qdict,"command" ); +g_autoptr (HumanReadableText) out =NULL ;Error *err =NULL ; -qmp_x_qemu_io (qdev ?NULL : device, - qdev ? device :NULL , - command, &err); -hmp_handle_error (hmp, err); + out =qmp_x_qemu_io (qdev ?NULL : device, + qdev ? device :NULL , + command, &err); +if (hmp_handle_error (hmp, err)) { +return ; + } + +/* use stdout and not monitor_puts() for compatiblity reasons */ +printf ("%s" , out->human_readable_text); } static void print_block_info(MonitorHMP *hmp, BlockInfo *info,
block/monitor/qmp-cmds.c +40 -9
92 lines not on this page · raw message
qapi/block.json +3 -0
@@ -618,6 +618,8 @@ # # @command: the qemu-io command string to execute. # +# Returns: qemu-io output as a string +# # Features: # # @unstable: This command is for testing only.
@@ -635,5 +637,6 @@ 'data': { '*device': 'str', '*qdev': 'str', 'command': 'str' }, + 'returns': 'HumanReadableText', 'features': [ 'unstable' ], 'allow-preconfig': true }
qemu-io-cmds.c +38 -36
239 lines not on this page · raw message
system/qtest.c +3 -1
@@ -801,13 +801,15 @@ static void qtest_process_command(CharFrontend *chr, gchar **words) }else if (strcmp (words[0 ],"qemu-io" ) ==0 ) {const char *io_dev; g_autofree char *io_cmd = NULL; +/* ignore multi-line output for now */ +g_autoptr (HumanReadableText) out =NULL ;Error *err =NULL ;g_assert (words[1 ] && words[2 ]); io_dev = words[1 ]; io_cmd =g_strjoinv (" " , &words[2 ]); -qmp_x_qemu_io (io_dev,NULL , io_cmd, &err); + out =qmp_x_qemu_io (io_dev,NULL , io_cmd, &err);qtest_sendf (chr, err ?"FAIL %s\n" :"OK\n" , err ?error_get_pretty (err) :NULL );error_free (err);
tests/qemu-iotests/iotests.py +1 -1
@@ -965,7 +965,7 @@ def qmp_qemu_io(self, drive: str, cmd: str, res = self.qmp_log('x-qemu-io', **kwargs) else: res = self.qmp('x-qemu-io', **kwargs) - return res.get('error', {}).get('desc', '') + return res.get('return', {}).get('human-readable-text', '') def flatten_qmp_object(self, obj, output=None, basestr=''): if output is None:
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 9/88 qemu-iotests/iotests: filter x-qemu-io messages
In reply to Marc-André Lureau--- tests/qemu-iotests/iotests.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
tests/qemu-iotests/iotests.py +9 -1
@@ -708,6 +708,13 @@ def _filter(_key, value): return value return filter_qmp(qmsg, _filter) +def filter_x_qemu_io(qmsg): + def _filter(_key, value): + if is_str(value): + return filter_qemu_io(value) + return value + return filter_qmp(qmsg, _filter) + def filter_nbd_exports(output: str) -> str: return re.sub(r'((min|opt|max) block): [0-9]+', r'\1: XXX', output)
@@ -962,7 +969,8 @@ def qmp_qemu_io(self, drive: str, cmd: str, else: kwargs['device'] = drive if use_log: - res = self.qmp_log('x-qemu-io', **kwargs) + res = self.qmp_log('x-qemu-io', + filters=(filter_x_qemu_io,), **kwargs) else: res = self.qmp('x-qemu-io', **kwargs) return res.get('return', {}).get('human-readable-text', '')
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 10/88 tests/qemu-iotests: do no interpret backslash as escape
In reply to Marc-André Lureau\n in the JSON becomes just n. Fix read command output using -r.
--- tests/qemu-iotests/common.qemu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/common.qemu +1 -1
@@ -90,7 +90,7 @@ _timed_wait_for() read_timeout= fi - while IFS= read ${read_timeout} resp <&${QEMU_OUT[$h]} + while IFS= read -r ${read_timeout} resp <&${QEMU_OUT[$h]} do if [ -n "$capture_events" ]; then capture=0
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 11/88 tests/qemu-iotests: filter all generated node ids
In reply to Marc-André Lureau--- tests/qemu-iotests/common.filter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/common.filter +1 -1
@@ -32,7 +32,7 @@ _filter_vmstate_size() _filter_generated_node_ids() { - sed -Ee 's/\#block[0-9]{3,}/NODE_NAME/' + sed -Ee 's/\#block[0-9]{3,}/NODE_NAME/g' } _filter_qom_path()
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 12/88 qemu-iotests/216: migrate away from HMP
In reply to Marc-André LureauLog command, although this is not strictly needed.
--- tests/qemu-iotests/216 | 6 ++---- tests/qemu-iotests/216.out | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-)
tests/qemu-iotests/216 +2 -4
@@ -25,8 +25,7 @@ from iotests import log, qemu_img, qemu_io # Need backing file support iotests.script_initialize(supported_fmts=['qcow2', 'qcow', 'qed', 'vmdk'], - supported_platforms=['linux'], - require_hmp=True) + supported_platforms=['linux']) log('') log('=== Copy-on-read across nodes ===')
@@ -102,8 +101,7 @@ with iotests.FilePath('base.img') as base_img_path, \ })) # Trigger COR - log(vm.qmp('human-monitor-command', - command_line='qemu-io node0 "read 0 64M"')) + vm.qmp_qemu_io('node0', 'read 0 64M', use_log=True) vm.shutdown()
tests/qemu-iotests/216.out +2 -1
@@ -8,7 +8,8 @@ Done --- Doing COR --- {"return": {}} -{"return": ""} +{"execute": "x-qemu-io", "arguments": {"command": "read 0 64M", "device": "node0"}} +{"return": {"human-readable-text": "read 67108864/67108864 bytes at offset 0\n64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} --- Checking COR result ---
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 13/88 qemu-iotests/310: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/310 | 6 ++---- tests/qemu-iotests/310.out | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-)
tests/qemu-iotests/310 +2 -4
@@ -25,8 +25,7 @@ from iotests import log, qemu_img, qemu_io # Need backing file support iotests.script_initialize(supported_fmts=['qcow2'], - supported_platforms=['linux'], - require_hmp=True) + supported_platforms=['linux']) log('') log('=== Copy-on-read across nodes ===')
@@ -96,8 +95,7 @@ with iotests.FilePath('base.img') as base_img_path, \ })) # Trigger COR - log(vm.qmp('human-monitor-command', - command_line='qemu-io node0 "read 0 5M"')) + vm.qmp_qemu_io('node0', 'read 0 5M', use_log=True) vm.shutdown()
tests/qemu-iotests/310.out +2 -1
@@ -8,7 +8,8 @@ Done --- Doing COR --- {"return": {}} -{"return": ""} +{"execute": "x-qemu-io", "arguments": {"command": "read 0 5M", "device": "node0"}} +{"return": {"human-readable-text": "read 5242880/5242880 bytes at offset 0\n5 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} --- Checking COR result ---
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 14/88 qemu-iotests/283: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/283 | 4 +--- tests/qemu-iotests/283.out | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-)
tests/qemu-iotests/283 +1 -3
@@ -24,7 +24,6 @@ import iotests # The test is unrelated to formats, restrict it to qcow2 to avoid extra runs iotests.script_initialize( supported_fmts=['qcow2'], - require_hmp=True, ) size = 1024 * 1024
@@ -137,8 +136,7 @@ vm.event_wait('BLOCK_JOB_COMPLETED', 5.0) # The filter should be gone now. Check that by trying to access it # with qemu-io (which will most likely crash qemu if it is still # there.). -vm.qmp_log('human-monitor-command', - command_line='qemu-io backup-filter "write 0 1M"') +vm.qmp_log('x-qemu-io', device='backup-filter', command='write 0 1M') # (Also, do an explicit check.) assert vm.node_info('backup-filter') is None
tests/qemu-iotests/283.out +2 -2
@@ -17,7 +17,7 @@ {"return": {}} {"execute": "job-finalize", "arguments": {"id": "backup"}} {"return": {}} -{"execute": "human-monitor-command", "arguments": {"command-line": "qemu-io backup-filter \"write 0 1M\""}} -{"return": "Error: Cannot find device='' nor node-name='backup-filter'\r\n"} +{"execute": "x-qemu-io", "arguments": {"command": "write 0 1M", "device": "backup-filter"}} +{"error": {"class": "GenericError", "desc": "Cannot find device='' nor node-name='backup-filter'"}} {"execute": "job-dismiss", "arguments": {"id": "backup"}} {"return": {}}
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 15/88 qemu-iotests/281: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/281 | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
tests/qemu-iotests/281 +3 -8
@@ -273,9 +273,7 @@ class TestYieldingAndTimers(iotests.QMPTestCase): self.stop_nbd_export() self.create_nbd_export() - result = self.vm.qmp('human-monitor-command', - command_line='qemu-io nbd "write 0 512"') - self.assert_qmp(result, 'return', '') + self.vm.qmp_qemu_io('nbd', 'write 0 512') # Reconnect is done, so the reconnect delay timer should be gone. # (This is similar to how the open timer should be gone after open,
@@ -303,9 +301,7 @@ class TestYieldingAndTimers(iotests.QMPTestCase): # Do some I/O that will be throttled by the QSD, so that the network # connection hopefully will yield here. When it is resumed, it must # then be resumed in the I/O thread's AioContext. - result = self.vm.qmp('human-monitor-command', - command_line='qemu-io nbd "read 0 128K"') - self.assert_qmp(result, 'return', '') + self.vm.qmp_qemu_io('nbd', 'read 0 128K') def create_nbd_export(self): assert self.qsd is None
@@ -336,5 +332,4 @@ class TestYieldingAndTimers(iotests.QMPTestCase): if __name__ == '__main__': iotests.main(supported_fmts=['qcow2'], supported_protocols=['file'], - unsupported_imgopts=['compat'], - require_hmp=True) + unsupported_imgopts=['compat'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 16/88 qemu-iotests/reopen-file: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/tests/reopen-file | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
tests/qemu-iotests/tests/reopen-file +3 -9
@@ -72,18 +72,12 @@ class TestReopenFile(QMPTestCase): # Do some I/O to the image to see whether it still works # (Pattern verification will be checked by tearDown()) - result = self.vm.qmp('human-monitor-command', - command_line='qemu-io format "write -P 42 0 64k"') - self.assert_qmp(result, 'return', '') - - result = self.vm.qmp('human-monitor-command', - command_line='qemu-io format "read -P 42 0 64k"') - self.assert_qmp(result, 'return', '') + self.vm.qmp_qemu_io('format', 'write -P 42 0 64k') + self.vm.qmp_qemu_io('format', 'read -P 42 0 64k') if __name__ == '__main__': # Must support creating images and reopen iotests.main(supported_fmts=['qcow', 'qcow2', 'qed', 'raw', 'vdi', 'vhdx', 'vmdk', 'vpc'], - supported_protocols=['file'], - require_hmp=True) + supported_protocols=['file'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 17/88 qemu-iotests/mirror-ready-cancel-error: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/tests/mirror-ready-cancel-error | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
tests/qemu-iotests/tests/mirror-ready-cancel-error +2 -5
@@ -96,9 +96,7 @@ class TestMirrorReadyCancelError(iotests.QMPTestCase): # Write something so will not leave the job immediately, but # flush first (which will fail, thanks to blkdebug) - res = self.vm.qmp('human-monitor-command', - command_line='qemu-io mirror-top "write -P 2 0 64k"') - self.assert_qmp(res, 'return', '') + self.vm.qmp_qemu_io('mirror-top', 'write -P 2 0 64k') # Drain status change events while self.vm.event_wait('JOB_STATUS_CHANGE', timeout=0.0) is not None:
@@ -139,5 +137,4 @@ if __name__ == '__main__': # LUKS would require special key-secret handling in add_blockdevs() iotests.main(supported_fmts=['generic'], unsupported_fmts=['luks'], - supported_protocols=['file'], - require_hmp=True) + supported_protocols=['file'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 18/88 qemu-iotests/copy-before-write: migrate away from HMP
In reply to Marc-André LureauThis test doesn't use iotests.VM presumably because it sets up qtest, conflicting with -machine none.
--- tests/qemu-iotests/tests/copy-before-write | 130 +++++++++++++---------------- 1 file changed, 59 insertions(+), 71 deletions(-)
tests/qemu-iotests/tests/copy-before-write +59 -71
@@ -32,6 +32,9 @@ size = '1M' class TestCbwError(iotests.QMPTestCase): + def qemu_io_result(self, res): + return iotests.filter_qemu_io(res['return']['human-readable-text']) + def tearDown(self): self.vm.shutdown() os.remove(temp_img)
@@ -85,19 +88,14 @@ class TestCbwError(iotests.QMPTestCase): 'file': 'cbw' }) - result = self.vm.qmp('human-monitor-command', - command_line='qemu-io cbw "write 0 1M"') - write_res = result['return'] - - result = self.vm.qmp('human-monitor-command', - command_line='qemu-io access "read 0 1M"') - read_res = result['return'] + write_res = self.vm.qmp('x-qemu-io', device='cbw', + command='write 0 1M') + read_res = self.vm.qmp('x-qemu-io', device='access', + command='read 0 1M') self.vm.shutdown() - log = self.vm.get_log() - log = iotests.filter_qtest(log) - log = iotests.filter_qemu_io(log) - return log, write_res, read_res + self.assertEqual(self.vm.get_log(), '') + return write_res, read_res def do_cbw_error_via_blockdev_backup(self, on_cbw_error=None): self.vm.cmd('blockdev-add', {
@@ -148,43 +146,37 @@ class TestCbwError(iotests.QMPTestCase): 'file': 'cbw' }) - result = self.vm.qmp('human-monitor-command', - command_line='qemu-io cbw "write 0 1M"') - write_res = result['return'] - - result = self.vm.qmp('human-monitor-command', - command_line='qemu-io access "read 0 1M"') - read_res = result['return'] + write_res = self.vm.qmp('x-qemu-io', device='cbw', + command='write 0 1M') + read_res = self.vm.qmp('x-qemu-io', device='access', + command='read 0 1M') self.vm.shutdown() - log = self.vm.get_log() - log = iotests.filter_qemu_io(log) - return log, write_res, read_res + self.assertEqual(self.vm.get_log(), '') + return write_res, read_res def test_break_snapshot_on_cbw_error(self): """break-snapshot behavior: Guest write succeed, but further snapshot-read fails, as snapshot is broken. """ - log, write_res, read_res = self.do_cbw_error('break-snapshot') - self.assertEqual(write_res, '') - self.assertIn('read failed: Permission denied', read_res) - - self.assertEqual(log, """\ + write_res, read_res = self.do_cbw_error('break-snapshot') + self.assertEqual(self.qemu_io_result(write_res), """\ wrote 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) """) + self.assertIn('read failed: Permission denied', + read_res['error']['desc']) def test_break_guest_write_on_cbw_error(self): """break-guest-write behavior: Guest write fails, but snapshot-access continues working and further snapshot-read succeeds. """ - log, write_res, read_res = self.do_cbw_error('break-guest-write') - self.assertIn('write failed: Input/output error', write_res) - self.assertEqual(read_res, '') - - self.assertEqual(log, """\ + write_res, read_res = self.do_cbw_error('break-guest-write') + self.assertIn('write failed: Input/output error', + write_res['error']['desc']) + self.assertEqual(self.qemu_io_result(read_res), """\ read 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) """)
@@ -193,24 +185,24 @@ read 1048576/1048576 bytes at offset 0 """Ensure CBW filter accepts break-snapshot policy specified in blockdev-backup QMP command. """ - log, write_res, read_res = \ + write_res, read_res = \ self.do_cbw_error_via_blockdev_backup('break-snapshot') - self.assertEqual(write_res, '') - self.assertIn('read failed: Permission denied', read_res) - self.assertEqual(log, """\ + self.assertEqual(self.qemu_io_result(write_res), """\ wrote 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) """) + self.assertIn('read failed: Permission denied', + read_res['error']['desc']) def test_break_guest_write_policy_forwarding(self): """Ensure CBW filter accepts break-guest-write policy specified in blockdev-backup QMP command. """ - log, write_res, read_res = \ + write_res, read_res = \ self.do_cbw_error_via_blockdev_backup('break-guest-write') - self.assertIn('write failed: Input/output error', write_res) - self.assertEqual(read_res, '') - self.assertEqual(log, """\ + self.assertIn('write failed: Input/output error', + write_res['error']['desc']) + self.assertEqual(self.qemu_io_result(read_res), """\ read 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) """)
@@ -219,11 +211,11 @@ read 1048576/1048576 bytes at offset 0 """Ensure break-guest-write policy is used by default when on-cbw-error is not explicitly specified. """ - log, write_res, read_res = \ + write_res, read_res = \ self.do_cbw_error_via_blockdev_backup() - self.assertIn('write failed: Input/output error', write_res) - self.assertEqual(read_res, '') - self.assertEqual(log, """\ + self.assertIn('write failed: Input/output error', + write_res['error']['desc']) + self.assertEqual(self.qemu_io_result(read_res), """\ read 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) """)
@@ -266,60 +258,56 @@ read 1048576/1048576 bytes at offset 0 'file': 'cbw' }) - result = self.vm.qmp('human-monitor-command', - command_line='qemu-io cbw "write 0 512K"') - write1_res = result['return'] + write1_res = self.vm.qmp('x-qemu-io', device='cbw', + command='write 0 512K') # We need second write to trigger throttling - result = self.vm.qmp('human-monitor-command', - command_line='qemu-io cbw "write 512K 512K"') - write2_res = result['return'] - - result = self.vm.qmp('human-monitor-command', - command_line='qemu-io access "read 0 1M"') - read_res = result['return'] + write2_res = self.vm.qmp('x-qemu-io', device='cbw', + command='write 512K 512K') + read_res = self.vm.qmp('x-qemu-io', device='access', + command='read 0 1M') self.vm.shutdown() log = self.vm.get_log() log = re.sub(r'^\[I \d+\.\d+\] OPENED\n', '', log) log = re.sub(r'\[I \+\d+\.\d+\] CLOSED\n?$', '', log) - log = iotests.filter_qemu_io(log) - return log, write1_res, write2_res, read_res + self.assertEqual(log, '') + return write1_res, write2_res, read_res def test_timeout_break_guest(self): - log, write1_res, write2_res, read_res = \ + write1_res, write2_res, read_res = \ self.do_cbw_timeout('break-guest-write') - self.assertEqual(write1_res, '') + self.assertEqual(self.qemu_io_result(write1_res), """\ +wrote 524288/524288 bytes at offset 0 +512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +""") # macOS and FreeBSD tend to represent ETIMEDOUT as # "Operation timed out", when Linux prefer # "Connection timed out" - write2_res = write2_res.replace('Operation timed out', - 'Connection timed out') - self.assertIn('write failed: Connection timed out', write2_res) - self.assertEqual(read_res, '') - self.assertEqual(log, """\ -wrote 524288/524288 bytes at offset 0 -512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + write2_err = write2_res['error']['desc'].replace( + 'Operation timed out', 'Connection timed out') + self.assertIn('write failed: Connection timed out', write2_err) + self.assertEqual(self.qemu_io_result(read_res), """\ read 1048576/1048576 bytes at offset 0 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) """) def test_timeout_break_snapshot(self): - log, write1_res, write2_res, read_res = \ + write1_res, write2_res, read_res = \ self.do_cbw_timeout('break-snapshot') - self.assertEqual(write1_res, '') - self.assertEqual(write2_res, '') - self.assertIn('read failed: Permission denied', read_res) - self.assertEqual(log, """\ + self.assertEqual(self.qemu_io_result(write1_res), """\ wrote 524288/524288 bytes at offset 0 512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +""") + self.assertEqual(self.qemu_io_result(write2_res), """\ wrote 524288/524288 bytes at offset 524288 512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) """) + self.assertIn('read failed: Permission denied', + read_res['error']['desc']) if __name__ == '__main__': iotests.main(supported_fmts=['qcow2'], supported_protocols=['file'], - required_fmts=['copy-before-write'], - require_hmp=True) + required_fmts=['copy-before-write'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 19/88 qemu-iotests/132: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/132 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
tests/qemu-iotests/132 +2 -3
@@ -49,7 +49,7 @@ class TestSingleDrive(iotests.QMPTestCase): def test_mirror_discard(self): self.vm.cmd('drive-mirror', device='drive0', sync='full', target=target_img) - self.vm.hmp_qemu_io('drive0', 'discard 0 64k') + self.vm.qmp_qemu_io('drive0', 'discard 0 64k') self.complete_and_wait('drive0') self.vm.shutdown() self.assertTrue(iotests.compare_images(test_img, target_img),
@@ -57,5 +57,4 @@ class TestSingleDrive(iotests.QMPTestCase): if __name__ == '__main__': iotests.main(supported_fmts=['raw', 'qcow2'], - supported_protocols=['file'], - require_hmp=True) + supported_protocols=['file'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 20/88 qemu-iotests/152: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/152 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
tests/qemu-iotests/152 +2 -3
@@ -52,7 +52,7 @@ class TestUnaligned(iotests.QMPTestCase): self.vm.cmd('drive-mirror', device='drive0', sync='full', granularity=65536, target=target_img) self.wait_ready() - self.vm.hmp_qemu_io('drive0', 'write 0 512') + self.vm.qmp_qemu_io('drive0', 'write 0 512') self.complete_and_wait(wait_ready=False) self.vm.shutdown() self.assertEqual(iotests.image_size(test_img), iotests.image_size(target_img),
@@ -61,5 +61,4 @@ class TestUnaligned(iotests.QMPTestCase): if __name__ == '__main__': iotests.main(supported_fmts=['raw', 'qcow2'], - supported_protocols=['file'], - require_hmp=True) + supported_protocols=['file'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 21/88 qemu-iotests/254: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/254 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qemu-iotests/254 +2 -2
@@ -24,7 +24,7 @@ from iotests import qemu_img_create, file_path, log iotests.script_initialize(supported_fmts=['qcow2'], unsupported_imgopts=['compat'], - require_hmp=True) +) disk, top = file_path('disk', 'top') size = 1024 * 1024
@@ -40,7 +40,7 @@ vm.qmp_log('block-dirty-bitmap-add', node='drive0', name='bitmap1', vm.qmp_log('block-dirty-bitmap-add', node='drive0', name='bitmap2', persistent=True) -vm.hmp_qemu_io('drive0', 'write 0 512K') +vm.qmp_qemu_io('drive0', 'write 0 512K') vm.qmp_log('transaction', indent=2, actions=[ {'type': 'blockdev-snapshot-sync',
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 22/88 qemu-iotests/264: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/264 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
tests/qemu-iotests/264 +2 -3
@@ -38,7 +38,7 @@ class TestNbdReconnect(iotests.QMPTestCase): qemu_img_create('-f', iotests.imgfmt, disk_b, str(disk_size)) self.vm = iotests.VM().add_drive(disk_a) self.vm.launch() - self.vm.hmp_qemu_io('drive0', 'write 0 {}'.format(disk_size)) + self.vm.qmp_qemu_io('drive0', 'write 0 {}'.format(disk_size)) def tearDown(self): self.vm.shutdown()
@@ -114,5 +114,4 @@ class TestNbdReconnect(iotests.QMPTestCase): if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2'], - require_hmp=True) + iotests.main(supported_fmts=['qcow2'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 23/88 qemu-iotests/304: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/304 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
tests/qemu-iotests/304 +3 -4
@@ -24,8 +24,7 @@ import iotests from iotests import qemu_img_create, qemu_img_log, file_path iotests.script_initialize(supported_fmts=['qcow2', 'parallels'], - supported_protocols=['file'], - require_hmp=True) + supported_protocols=['file']) test_img = file_path('test.qcow2') target_img = file_path('target.qcow2')
@@ -41,8 +40,8 @@ vm = iotests.VM().add_drive(test_img) vm.launch() # write to the entire image -vm.hmp_qemu_io('drive0', 'write -P0x16 0 4096'); -vm.hmp_qemu_io('drive0', 'write -P0x17 4096 1'); +vm.qmp_qemu_io('drive0', 'write -P0x16 0 4096'); +vm.qmp_qemu_io('drive0', 'write -P0x17 4096 1'); # do backup and wait for completion vm.qmp('drive-backup', **{
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 24/88 qemu-iotests/300: replace hmp_qemu_io with qmp
In reply to Marc-André LureauThere is still HMP usage left, addressed later.
--- tests/qemu-iotests/300 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/300 +1 -1
@@ -57,7 +57,7 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): # Dirty some random megabytes for _ in range(9): mb_ofs = random.randrange(1024) - self.vm_a.hmp_qemu_io(self.src_node_name, f'discard {mb_ofs}M 1M') + self.vm_a.qmp_qemu_io(self.src_node_name, f'discard {mb_ofs}M 1M') result = self.vm_a.qmp('x-debug-block-dirty-bitmap-sha256', node=self.src_node_name,
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 25/88 qemu-iotests/298: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/298 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
tests/qemu-iotests/298 +4 -5
@@ -74,7 +74,7 @@ class TestPreallocateFilter(TestPreallocateBase): super().tearDown() def test_prealloc(self): - self.vm.hmp_qemu_io('drive0', 'write 0 1M') + self.vm.qmp_qemu_io('drive0', 'write 0 1M') self.check_big() def test_external_snapshot(self):
@@ -87,7 +87,7 @@ class TestPreallocateFilter(TestPreallocateBase): # on reopen to r-o base preallocation should be dropped self.check_small() - self.vm.hmp_qemu_io('drive0', 'write 1M 1M') + self.vm.qmp_qemu_io('drive0', 'write 1M 1M') self.vm.cmd('block-commit', device='overlay') self.complete_and_wait()
@@ -112,7 +112,7 @@ class TestPreallocateFilter(TestPreallocateBase): } }]) - self.vm.hmp_qemu_io('drive0', 'write 0 1M') + self.vm.qmp_qemu_io('drive0', 'write 0 1M') self.assertTrue(os.path.getsize(disk) == 25 * MiB)
@@ -177,5 +177,4 @@ class TestTruncate(iotests.QMPTestCase): if __name__ == '__main__': - iotests.main(supported_fmts=['qcow2'], required_fmts=['preallocate'], - require_hmp=True) + iotests.main(supported_fmts=['qcow2'], required_fmts=['preallocate'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 26/88 qemu-iotests/056: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/056 | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
tests/qemu-iotests/056 +10 -11
@@ -91,8 +91,8 @@ class TestSyncModesNoneAndTop(iotests.QMPTestCase): self.vm.cmd('drive-backup', device='drive0', sync='none', target=target_img) time.sleep(1) - self.vm.hmp_qemu_io('drive0', 'write -P0x5e 0 512') - self.vm.hmp_qemu_io('drive0', 'aio_flush') + self.vm.qmp_qemu_io('drive0', 'write -P0x5e 0 512') + self.vm.qmp_qemu_io('drive0', 'aio_flush') # Verify that the original contents exist in the target image. event = self.cancel_and_wait()
@@ -119,7 +119,7 @@ class TestBeforeWriteNotifier(iotests.QMPTestCase): self.vm.cmd('block-job-pause', device="drive0") # Speed is low enough that this must be an uncopied range, which will # trigger the before write notifier - self.vm.hmp_qemu_io('drive0', 'aio_write -P 1 512512 512') + self.vm.qmp_qemu_io('drive0', 'aio_write -P 1 512512 512') self.vm.resume_drive("drive0") self.vm.cmd('block-job-resume', device="drive0") event = self.cancel_and_wait()
@@ -142,10 +142,10 @@ class BackupTest(iotests.QMPTestCase): try_remove(self.dest_img2) try_remove(self.ref_img) - def hmp_io_writes(self, drive, patterns): + def qmp_io_writes(self, drive, patterns): for pattern in patterns: - self.vm.hmp_qemu_io(drive, 'write -P%s %s %s' % pattern) - self.vm.hmp_qemu_io(drive, 'flush') + self.vm.qmp_qemu_io(drive, 'write -P%s %s %s' % pattern) + self.vm.qmp_qemu_io(drive, 'flush') def qmp_backup_and_wait(self, cmd='drive-backup', serror=None, aerror=None, **kwargs):
@@ -180,7 +180,7 @@ class BackupTest(iotests.QMPTestCase): def test_overlapping_writes(self): # Write something to back up - self.hmp_io_writes('drive0', [('42', '0M', '2M')]) + self.qmp_io_writes('drive0', [('42', '0M', '2M')]) # Create a reference backup self.qmp_backup_and_wait(device='drive0', format=iotests.imgfmt,
@@ -201,7 +201,7 @@ class BackupTest(iotests.QMPTestCase): self.qmp_backup(device='drive0', format=iotests.imgfmt, sync='full', target=self.dest_img, speed=1, auto_dismiss=False) - self.hmp_io_writes('drive0', [('23', '%ik' % (1024 + 64), '64k'), + self.qmp_io_writes('drive0', [('23', '%ik' % (1024 + 64), '64k'), ('66', '1M', '1M')]) # Let the job complete
@@ -266,7 +266,7 @@ class BackupTest(iotests.QMPTestCase): res = self.vm.qmp('query-block-jobs') self.assert_qmp(res, 'return', []) # Give blkdebug something to chew on - self.hmp_io_writes('drive0', + self.qmp_io_writes('drive0', (('0x9a', 0, 512), ('0x55', '8M', '352k'), ('0x78', '15872k', '1M')))
@@ -332,5 +332,4 @@ class BackupTest(iotests.QMPTestCase): if __name__ == '__main__': iotests.main(supported_fmts=['qcow2', 'qed'], - supported_protocols=['file'], - require_hmp=True) + supported_protocols=['file'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 27/88 qemu-iotests/093: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/093 | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
tests/qemu-iotests/093 +7 -8
@@ -90,13 +90,13 @@ class ThrottleTestCase(iotests.QMPTestCase): for i in range(rd_nr): for drive in range(0, ndrives): idx = first_drive + drive - self.vm.hmp_qemu_io("drive%d" % idx, "aio_read %d %d" % + self.vm.qmp_qemu_io("drive%d" % idx, "aio_read %d %d" % (i * rq_size, rq_size)) for i in range(wr_nr): for drive in range(0, ndrives): idx = first_drive + drive - self.vm.hmp_qemu_io("drive%d" % idx, "aio_write %d %d" % + self.vm.qmp_qemu_io("drive%d" % idx, "aio_write %d %d" % (i * rq_size, rq_size)) # We'll store the I/O stats for each drive in these arrays
@@ -227,21 +227,21 @@ class ThrottleTestCase(iotests.QMPTestCase): self.configure_throttle(2, params) # Read 4KB from drive0. This is performed immediately. - self.vm.hmp_qemu_io("drive0", "aio_read 0 4096") + self.vm.qmp_qemu_io("drive0", "aio_read 0 4096") # Read 2KB. The I/O limit has been exceeded so this # request is throttled and a timer is set to wake it up. - self.vm.hmp_qemu_io("drive0", "aio_read 0 2048") + self.vm.qmp_qemu_io("drive0", "aio_read 0 2048") # Read 2KB again. We're still over the I/O limit so this is # request is also throttled, but no new timer is set since # there's already one. - self.vm.hmp_qemu_io("drive0", "aio_read 0 2048") + self.vm.qmp_qemu_io("drive0", "aio_read 0 2048") # Read from drive1. This request is also throttled, and no # timer is set in drive1 because there's already one in # drive0. - self.vm.hmp_qemu_io("drive1", "aio_read 0 4096") + self.vm.qmp_qemu_io("drive1", "aio_read 0 4096") # At this point only the first 4KB have been read from drive0. # The other requests are throttled.
@@ -419,5 +419,4 @@ class ThrottleTestRemovableMedia(iotests.QMPTestCase): if __name__ == '__main__': if 'null-co' not in iotests.supported_formats(): iotests.notrun('null-co driver support missing') - iotests.main(supported_fmts=["raw"], - require_hmp=True) + iotests.main(supported_fmts=["raw"])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 28/88 qemu-iotests/124: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/124 | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-)
tests/qemu-iotests/124 +16 -17
@@ -249,10 +249,10 @@ class TestIncrementalBackupBase(iotests.QMPTestCase): self.assertTrue(iotests.compare_images(last, bitmap.drive['file'])) - def hmp_io_writes(self, drive, patterns): + def qmp_io_writes(self, drive, patterns): for pattern in patterns: - self.vm.hmp_qemu_io(drive, 'write -P%s %s %s' % pattern) - self.vm.hmp_qemu_io(drive, 'flush') + self.vm.qmp_qemu_io(drive, 'write -P%s %s %s' % pattern) + self.vm.qmp_qemu_io(drive, 'flush') def do_incremental_simple(self, **kwargs):
@@ -263,12 +263,12 @@ class TestIncrementalBackupBase(iotests.QMPTestCase): self.create_incremental() # Three writes: One complete overwrite, one new segment, # and one partial overlap. - self.hmp_io_writes(self.drives[0]['id'], (('0xab', 0, 512), + self.qmp_io_writes(self.drives[0]['id'], (('0xab', 0, 512), ('0xfe', '16M', '256k'), ('0x64', '32736k', '64k'))) self.create_incremental() # Three more writes, one of each kind, like above - self.hmp_io_writes(self.drives[0]['id'], (('0x9a', 0, 512), + self.qmp_io_writes(self.drives[0]['id'], (('0x9a', 0, 512), ('0x55', '8M', '352k'), ('0x78', '15872k', '1M'))) self.create_incremental()
@@ -337,7 +337,7 @@ class TestIncrementalBackup(TestIncrementalBackupBase): # overwrite [32736, 32799] which will dirty bitmap clusters at # 32M-64K and 32M. 32M+64K will be left undirtied. bitmap0 = self.add_bitmap('bitmap0', drive0) - self.hmp_io_writes(drive0['id'], + self.qmp_io_writes(drive0['id'], (('0xab', 0, 512), ('0xfe', '16M', '256k'), ('0x64', '32736k', '64k')))
@@ -382,7 +382,7 @@ class TestIncrementalBackup(TestIncrementalBackupBase): drive0 = self.drives[0] bitmap0 = self.add_bitmap('bitmap0', drive0) - self.hmp_io_writes(drive0['id'], (('0xab', 0, 512), + self.qmp_io_writes(drive0['id'], (('0xab', 0, 512), ('0xfe', '16M', '256k'), ('0x64', '32736k', '64k'))) bitmap1 = self.add_bitmap('bitmap1', drive0)
@@ -396,7 +396,7 @@ class TestIncrementalBackup(TestIncrementalBackupBase): self.wait_until_completed(drive0['id']) self.files.append(drive0['backup']) - self.hmp_io_writes(drive0['id'], (('0x9a', 0, 512), + self.qmp_io_writes(drive0['id'], (('0x9a', 0, 512), ('0x55', '8M', '352k'), ('0x78', '15872k', '1M'))) # Both bitmaps should be correctly in sync.
@@ -450,10 +450,10 @@ class TestIncrementalBackup(TestIncrementalBackupBase): # Emulate some writes if not race: - self.hmp_io_writes(drive0['id'], (('0xab', 0, 512), + self.qmp_io_writes(drive0['id'], (('0xab', 0, 512), ('0xfe', '16M', '256k'), ('0x64', '32736k', '64k'))) - self.hmp_io_writes(drive1['id'], (('0xba', 0, 512), + self.qmp_io_writes(drive1['id'], (('0xba', 0, 512), ('0xef', '16M', '256k'), ('0x46', '32736k', '64k')))
@@ -584,7 +584,7 @@ class TestIncrementalBackup(TestIncrementalBackupBase): size=(65 * 1048576)) # Dirty the image past the old end - self.vm.hmp_qemu_io(self.drives[0]['id'], 'write 64M 64k') + self.vm.qmp_qemu_io(self.drives[0]['id'], 'write 64M 64k') target = self.prepare_backup(size='65M') self.create_incremental(target=target)
@@ -640,13 +640,13 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBackupBase): # Note: at this point, during a normal execution, # Assume that the VM resumes and begins issuing IO requests here. - self.hmp_io_writes(drive0['id'], (('0xab', 0, 512), + self.qmp_io_writes(drive0['id'], (('0xab', 0, 512), ('0xfe', '16M', '256k'), ('0x64', '32736k', '64k'))) result = self.create_incremental(validate=False) self.assertFalse(result) - self.hmp_io_writes(drive0['id'], (('0x9a', 0, 512), + self.qmp_io_writes(drive0['id'], (('0x9a', 0, 512), ('0x55', '8M', '352k'), ('0x78', '15872k', '1M'))) self.create_incremental()
@@ -660,7 +660,7 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBackupBase): drive0 = self.drives[0] # NB: The blkdebug script here looks for a "flush, read" pattern. - # The flush occurs in hmp_io_writes, and the read during the block job. + # The flush occurs in qmp_io_writes, and the read during the block job. self.vm.cmd('blockdev-add', node_name=drive0['id'], driver=drive0['fmt'],
@@ -687,7 +687,7 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBackupBase): bitmap = self.add_bitmap('bitmap0', drive0) # Emulate guest activity - self.hmp_io_writes(drive0['id'], (('0xab', 0, 512), + self.qmp_io_writes(drive0['id'], (('0xab', 0, 512), ('0xfe', '16M', '256k'), ('0x64', '32736k', '64k')))
@@ -750,5 +750,4 @@ class TestIncrementalBackupBlkdebug(TestIncrementalBackupBase): if __name__ == '__main__': iotests.main(supported_fmts=['qcow2'], - supported_protocols=['file'], - require_hmp=True) + supported_protocols=['file'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 29/88 qemu-iotests/136: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/136 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
tests/qemu-iotests/136 +3 -4
@@ -58,9 +58,9 @@ class BlockDeviceStatsTestCase(iotests.QMPTestCase): def qemu_io(self, cmd): if self.use_blockdev: - self.vm.hmp_qemu_io("virtio0/virtio-backend", cmd, qdev=True) + self.vm.qmp_qemu_io("virtio0/virtio-backend", cmd, qdev=True) else: - self.vm.hmp_qemu_io("drive0", cmd) + self.vm.qmp_qemu_io("drive0", cmd) def create_blkdebug_file(self): file = open(blkdebug_file, 'w')
@@ -410,5 +410,4 @@ class BlockDeviceStatsTestCoroutine(BlockDeviceStatsTestCase): if __name__ == '__main__': if 'null-co' not in iotests.supported_formats(): iotests.notrun('null-co driver support missing') - iotests.main(supported_fmts=["raw"], - require_hmp=True) + iotests.main(supported_fmts=["raw"])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 30/88 qemu-iotests/148: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/148 | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
tests/qemu-iotests/148 +6 -7
@@ -82,7 +82,7 @@ sector = "%d" def testQuorum(self): # Generate an error and get an event - self.vm.hmp_qemu_io("drive0", "aio_read %d %d" % + self.vm.qmp_qemu_io("drive0", "aio_read %d %d" % (offset * sector_size, sector_size)) self.vm.qtest("clock_step 10") self.do_check_event('img0', offset)
@@ -90,7 +90,7 @@ sector = "%d" # I/O errors in the same child: only one event is emitted delay = 10 for i in range(3): - self.vm.hmp_qemu_io("drive0", "aio_read %d %d" % + self.vm.qmp_qemu_io("drive0", "aio_read %d %d" % (offset * sector_size, sector_size)) self.vm.qtest("clock_step %d" % delay) self.do_check_event(None)
@@ -102,7 +102,7 @@ sector = "%d" # I/O errors in the same child: all events are emitted delay = 2 * event_rate for i in range(3): - self.vm.hmp_qemu_io("drive0", "aio_read %d %d" % + self.vm.qmp_qemu_io("drive0", "aio_read %d %d" % (offset * sector_size, sector_size)) self.vm.qtest("clock_step %d" % delay) self.do_check_event('img0', offset)
@@ -110,7 +110,7 @@ sector = "%d" # I/O errors in different children: all events are emitted delay = 10 for i in range(len(imgs)): - self.vm.hmp_qemu_io("drive0", "aio_read %d %d" % + self.vm.qmp_qemu_io("drive0", "aio_read %d %d" % ((offset + i) * sector_size, sector_size)) self.vm.qtest("clock_step %d" % delay) # In fifo mode only errors in the first child are detected
@@ -122,7 +122,7 @@ sector = "%d" # I/O errors in different children: all events are emitted delay = 2 * event_rate for i in range(len(imgs)): - self.vm.hmp_qemu_io("drive0", "aio_read %d %d" % + self.vm.qmp_qemu_io("drive0", "aio_read %d %d" % ((offset + i) * sector_size, sector_size)) self.vm.qtest("clock_step %d" % delay) # In fifo mode only errors in the first child are detected
@@ -140,5 +140,4 @@ class TestFifoQuorumEvents(TestQuorumEvents): if __name__ == '__main__': iotests.verify_quorum() iotests.main(supported_fmts=["raw"], - supported_protocols=["file"], - require_hmp=True) + supported_protocols=["file"])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 31/88 qemu-iotests/151: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/151 | 51 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 26 deletions(-)
tests/qemu-iotests/151 +25 -26
@@ -69,14 +69,14 @@ class TestActiveMirror(iotests.QMPTestCase): def doActiveIO(self, sync_source_and_target): # Fill the source image - self.vm.hmp_qemu_io('source', + self.vm.qmp_qemu_io('source', 'write -P 1 0 %i' % self.image_len); # Start some background requests for offset in range(1 * self.image_len // 8, 3 * self.image_len // 8, 1024 * 1024): - self.vm.hmp_qemu_io('source', 'aio_write -P 2 %i 1M' % offset) + self.vm.qmp_qemu_io('source', 'aio_write -P 2 %i 1M' % offset) for offset in range(2 * self.image_len // 8, 3 * self.image_len // 8, 1024 * 1024): - self.vm.hmp_qemu_io('source', 'aio_write -z %i 1M' % offset) + self.vm.qmp_qemu_io('source', 'aio_write -z %i 1M' % offset) # Start the block job self.vm.cmd('blockdev-mirror',
@@ -89,9 +89,9 @@ class TestActiveMirror(iotests.QMPTestCase): # Start some more requests for offset in range(3 * self.image_len // 8, 5 * self.image_len // 8, 1024 * 1024): - self.vm.hmp_qemu_io('source', 'aio_write -P 3 %i 1M' % offset) + self.vm.qmp_qemu_io('source', 'aio_write -P 3 %i 1M' % offset) for offset in range(4 * self.image_len // 8, 5 * self.image_len // 8, 1024 * 1024): - self.vm.hmp_qemu_io('source', 'aio_write -z %i 1M' % offset) + self.vm.qmp_qemu_io('source', 'aio_write -z %i 1M' % offset) # Wait for the READY event self.wait_ready(drive='mirror')
@@ -101,14 +101,14 @@ class TestActiveMirror(iotests.QMPTestCase): # The mirror code itself asserts that the source BDS's dirty # bitmap will stay clean between READY and COMPLETED. for offset in range(5 * self.image_len // 8, 7 * self.image_len // 8, 1024 * 1024): - self.vm.hmp_qemu_io('source', 'aio_write -P 3 %i 1M' % offset) + self.vm.qmp_qemu_io('source', 'aio_write -P 3 %i 1M' % offset) for offset in range(6 * self.image_len // 8, 7 * self.image_len // 8, 1024 * 1024): - self.vm.hmp_qemu_io('source', 'aio_write -z %i 1M' % offset) + self.vm.qmp_qemu_io('source', 'aio_write -z %i 1M' % offset) if sync_source_and_target: # If source and target should be in sync after the mirror, # we have to flush before completion - self.vm.hmp_qemu_io('source', 'aio_flush') + self.vm.qmp_qemu_io('source', 'aio_flush') self.potential_writes_in_flight = False self.complete_and_wait(drive='mirror', wait_ready=False)
@@ -121,7 +121,7 @@ class TestActiveMirror(iotests.QMPTestCase): def testUnalignedActiveIO(self): # Fill the source image - result = self.vm.hmp_qemu_io('source', 'write -P 1 0 2M') + result = self.vm.qmp_qemu_io('source', 'write -P 1 0 2M') # Start the block job (very slowly) self.vm.cmd('blockdev-mirror',
@@ -135,7 +135,7 @@ class TestActiveMirror(iotests.QMPTestCase): speed=1) # Start an unaligned request to a dirty area - result = self.vm.hmp_qemu_io('source', 'write -P 2 %i 1' % (1048576 + 42)) + result = self.vm.qmp_qemu_io('source', 'write -P 2 %i 1' % (1048576 + 42)) # Let the job finish self.vm.cmd('block-job-set-speed', device='mirror', speed=0)
@@ -145,7 +145,7 @@ class TestActiveMirror(iotests.QMPTestCase): def testIntersectingActiveIO(self): # Fill the source image - result = self.vm.hmp_qemu_io('source', 'write -P 1 0 2M') + result = self.vm.qmp_qemu_io('source', 'write -P 1 0 2M') # Start the block job (very slowly) self.vm.cmd('blockdev-mirror',
@@ -157,23 +157,23 @@ class TestActiveMirror(iotests.QMPTestCase): copy_mode='write-blocking', speed=1) - self.vm.hmp_qemu_io('source', 'break write_aio A') - self.vm.hmp_qemu_io('source', 'aio_write 0 1M') # 1 - self.vm.hmp_qemu_io('source', 'wait_break A') - self.vm.hmp_qemu_io('source', 'aio_write 0 2M') # 2 - self.vm.hmp_qemu_io('source', 'aio_write 0 2M') # 3 + self.vm.qmp_qemu_io('source', 'break write_aio A') + self.vm.qmp_qemu_io('source', 'aio_write 0 1M') # 1 + self.vm.qmp_qemu_io('source', 'wait_break A') + self.vm.qmp_qemu_io('source', 'aio_write 0 2M') # 2 + self.vm.qmp_qemu_io('source', 'aio_write 0 2M') # 3 # Now 2 and 3 are in mirror_wait_on_conflicts, waiting for 1 - self.vm.hmp_qemu_io('source', 'break write_aio B') - self.vm.hmp_qemu_io('source', 'aio_write 1M 2M') # 4 - self.vm.hmp_qemu_io('source', 'wait_break B') + self.vm.qmp_qemu_io('source', 'break write_aio B') + self.vm.qmp_qemu_io('source', 'aio_write 1M 2M') # 4 + self.vm.qmp_qemu_io('source', 'wait_break B') # 4 doesn't wait for 2 and 3, because they didn't yet set # in_flight_bitmap. So, nothing prevents 4 to go except for our # break-point B. - self.vm.hmp_qemu_io('source', 'resume A') + self.vm.qmp_qemu_io('source', 'resume A') # Now we resumed 1, so 2 and 3 goes to the next iteration of while loop # in mirror_wait_on_conflicts(). They don't exit, as bitmap is dirty
@@ -181,7 +181,7 @@ class TestActiveMirror(iotests.QMPTestCase): # In the past at that point 2 and 3 would wait for each other producing # a dead-lock. Now this is fixed and they will wait for request 4. - self.vm.hmp_qemu_io('source', 'resume B') + self.vm.qmp_qemu_io('source', 'resume B') # After resuming 4, one of 2 and 3 goes first and set in_flight_bitmap, # so the other will wait for it.
@@ -193,7 +193,7 @@ class TestActiveMirror(iotests.QMPTestCase): def testUnalignedSmallerThanGranularityWriteZeroes(self): # Fill the source image - self.vm.hmp_qemu_io('source', 'write -P 1 0 %i' % self.image_len); + self.vm.qmp_qemu_io('source', 'write -P 1 0 %i' % self.image_len); # Start the block job self.vm.cmd('blockdev-mirror',
@@ -208,7 +208,7 @@ class TestActiveMirror(iotests.QMPTestCase): self.wait_ready(drive='mirror') for offset in range(6 * self.image_len // 8, 7 * self.image_len // 8, 1024 * 1024): - self.vm.hmp_qemu_io('source', 'aio_write -z %i 512' % (offset + 512)) + self.vm.qmp_qemu_io('source', 'aio_write -z %i 512' % (offset + 512)) self.complete_and_wait(drive='mirror', wait_ready=False)
@@ -323,7 +323,7 @@ class TestLowThrottledWithNbdExport(TestThrottledWithNbdExportBase): # progress (because when the job was started, those areas were not # intended to be copied, so active mirroring will only lead to not # losing progress, but also not making any). - self.vm.hmp_qemu_io('source-node', + self.vm.qmp_qemu_io('source-node', f'aio_write -P 1 0 {self.image_len // 2}') self.vm.qtest(f'clock_step {1 * 1000 * 1000 * 1000}')
@@ -434,5 +434,4 @@ class TestHighThrottledWithNbdExport(TestThrottledWithNbdExportBase): if __name__ == '__main__': iotests.main(supported_fmts=['qcow2', 'raw'], - supported_protocols=['file'], - require_hmp=True) + supported_protocols=['file'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 32/88 qemu-iotests/236: migrate away from HMP
In reply to Marc-André LureauNo need to log empty results, qmp_qemu_io() already checks for success.
--- tests/qemu-iotests/236 | 7 +++---- tests/qemu-iotests/236.out | 8 -------- 2 files changed, 3 insertions(+), 12 deletions(-)
tests/qemu-iotests/236 +3 -4
@@ -23,8 +23,7 @@ import iotests from iotests import log -iotests.script_initialize(supported_fmts=['generic'], - require_hmp=True) +iotests.script_initialize(supported_fmts=['generic']) size = 64 * 1024 * 1024 granularity = 64 * 1024
@@ -62,7 +61,7 @@ with iotests.FilePath('img') as img_path, \ for p in patterns: cmd = "write -P%s %s %s" % p log(cmd) - log(vm.hmp_qemu_io("drive0", cmd)) + vm.qmp_qemu_io("drive0", cmd) log(query_bitmaps(vm), indent=2)
@@ -100,7 +99,7 @@ with iotests.FilePath('img') as img_path, \ for p in overwrite: cmd = "write -P%s %s %s" % p log(cmd) - log(vm.hmp_qemu_io("drive0", cmd)) + vm.qmp_qemu_io("drive0", cmd) log('\n--- Disabling A & C ---\n') vm.qmp_log("transaction", indent=2, actions=[
tests/qemu-iotests/236.out +0 -8
@@ -11,13 +11,9 @@ --- Emulating writes --- write -P0x5d 0 64k -{"return": ""} write -P0xd5 1M 64k -{"return": ""} write -P0xdc 32M 64k -{"return": ""} write -P0xcd 0x3ff0000 64k -{"return": ""} { "bitmaps": { "drive0": [
@@ -150,13 +146,9 @@ write -P0xcd 0x3ff0000 64k --- Emulating further writes --- write -P0xab 0 64k -{"return": ""} write -P0xad 0x00f8000 64k -{"return": ""} write -P0x1d 0x2008000 64k -{"return": ""} write -P0xea 0x3fe0000 64k -{"return": ""} --- Disabling A & C ---
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 33/88 qemu-iotests/245: migrate away from HMP
In reply to Marc-André LureauNo need to wait until the VM is shut down to verify the output.
--- tests/qemu-iotests/245 | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-)
tests/qemu-iotests/245 +3 -25
@@ -58,34 +58,13 @@ class TestBlockdevReopen(iotests.QMPTestCase): def tearDown(self): self.vm.shutdown() - self.check_qemu_io_errors() os.remove(hd_path[0]) os.remove(hd_path[1]) os.remove(hd_path[2]) - # The output of qemu-io is not returned by vm.hmp_qemu_io() but - # it's stored in the log and can only be read when the VM has been - # shut down. This function runs qemu-io and keeps track of the - # number of times it's been called. def run_qemu_io(self, img, cmd): - result = self.vm.hmp_qemu_io(img, cmd) - self.assert_qmp(result, 'return', '') - self.total_io_cmds += 1 - - # Once the VM is shut down we can parse the log and see if qemu-io - # ran without errors. - def check_qemu_io_errors(self): - self.assertFalse(self.vm.is_running()) - found = 0 - log = self.vm.get_log() - for line in log.split("\n"): - if line.startswith("Pattern verification failed"): - raise Exception("%s (command #%d)" % (line, found)) - if re.match("(read|wrote) .*/.* bytes at offset", line): - found += 1 - self.assertEqual(found, self.total_io_cmds, - "Expected output of %d qemu-io commands, found %d" % - (found, self.total_io_cmds)) + result = self.vm.qmp('x-qemu-io', device=img, command=cmd) + self.assert_qmp_absent(result, 'error') # Run blockdev-reopen on a list of block devices def reopenMultiple(self, opts, errmsg = None):
@@ -1160,5 +1139,4 @@ class TestBlockdevReopen(iotests.QMPTestCase): if __name__ == '__main__': iotests.activate_logging() iotests.main(supported_fmts=["qcow2"], - supported_protocols=["file"], - require_hmp=True) + supported_protocols=["file"])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 34/88 qemu-iotests/255: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/255 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
tests/qemu-iotests/255 +3 -4
@@ -24,8 +24,7 @@ import iotests from iotests import imgfmt -iotests.script_initialize(supported_fmts=['qcow2'], - require_hmp=True) +iotests.script_initialize(supported_fmts=['qcow2']) iotests.log('Finishing a commit job with background reads') iotests.log('============================================')
@@ -62,8 +61,8 @@ with iotests.FilePath('t.qcow2') as disk_path, \ iotests.log("") def start_requests(): - vm.hmp_qemu_io('overlay', 'aio_read 0 4k') - vm.hmp_qemu_io('overlay', 'aio_read 0 4k') + vm.qmp_qemu_io('overlay', 'aio_read 0 4k') + vm.qmp_qemu_io('overlay', 'aio_read 0 4k') start_requests()
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 35/88 qemu-iotests/257: migrate away from HMP
In reply to Marc-André LureauNo need to log success, the qmp_qemu_io() command already checks for it.
--- tests/qemu-iotests/257 | 7 +- tests/qemu-iotests/257.out | 315 --------------------------------------------- 2 files changed, 3 insertions(+), 319 deletions(-)
tests/qemu-iotests/257 +3 -4
@@ -227,7 +227,7 @@ def perform_writes(drive, n, filter_node_name=None): pattern.offset, pattern.size) log(cmd) - log(drive.vm.hmp_qemu_io(filter_node_name or drive.node, cmd)) + drive.vm.qmp_qemu_io(filter_node_name or drive.node, cmd) bitmaps = drive.vm.query_bitmaps() log({'bitmaps': bitmaps}, indent=2) log('')
@@ -354,7 +354,7 @@ def test_bitmap_sync(bsync_mode, msync_mode='bitmap', failure=None): # 1 - Test Backup (w/ Optional induced failure) if failure == 'intermediate': # Activate blkdebug induced failure for second-to-next read - log(vm.hmp_qemu_io(drive0.node, 'flush')) + vm.qmp_qemu_io(drive0.node, 'flush') log('') job = backup(drive0, 1, bsync1, msync_mode, bitmap="bitmap0", bitmap_mode=bsync_mode)
@@ -533,5 +533,4 @@ def main(): if __name__ == '__main__': iotests.script_main(main, supported_fmts=['qcow2'], - supported_protocols=['file'], - require_hmp=True) + supported_protocols=['file'])
tests/qemu-iotests/257.out +0 -315
1,050 lines not on this page · raw message
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 36/88 qemu-iotests/260: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/260 | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
tests/qemu-iotests/260 +4 -5
@@ -24,8 +24,7 @@ from iotests import qemu_img_create, file_path, log, filter_qmp_event iotests.script_initialize( supported_fmts=['qcow2'], - unsupported_imgopts=['compat'], - require_hmp=True, + unsupported_imgopts=['compat'] ) base, top = file_path('base', 'top')
@@ -55,12 +54,12 @@ def test(persistent, restart): vm.qmp_log('block-dirty-bitmap-add', node='drive0', name='bitmap0', persistent=persistent) - vm.hmp_qemu_io('drive0', 'write 0 64K') + vm.qmp_qemu_io('drive0', 'write 0 64K') print_bitmap('initial bitmap', vm) vm.qmp_log('blockdev-snapshot-sync', device='drive0', snapshot_file=top, format=iotests.imgfmt, filters=[iotests.filter_qmp_testfiles]) - vm.hmp_qemu_io('drive0', 'write 64K 512') + vm.qmp_qemu_io('drive0', 'write 64K 512') print_bitmap('check that no bitmaps are in snapshot', vm) if restart:
@@ -84,7 +83,7 @@ def test(persistent, restart): log(filter_qmp_event(ev)) print_bitmap('check bitmap after commit', vm) - vm.hmp_qemu_io('drive0', 'write 128K 64K') + vm.qmp_qemu_io('drive0', 'write 128K 64K') print_bitmap('check updated bitmap', vm) vm.shutdown()
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 37/88 qemu-iotests/280: migrate away from HMP
In reply to Marc-André LureauFor consistency with the rest of the test, we use use_log=True, although it is not stricly necessary.
--- tests/qemu-iotests/280 | 3 +-- tests/qemu-iotests/280.out | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-)
tests/qemu-iotests/280 +1 -2
@@ -27,7 +27,6 @@ iotests.script_initialize( supported_fmts=['qcow2'], supported_protocols=['file'], supported_platforms=['linux'], - require_hmp=True, ) with iotests.FilePath('base') as base_path , \
@@ -77,7 +76,7 @@ with iotests.FilePath('base') as base_path , \ iotests.log('\n=== Resume the VM and simulate a write request ===') vm.qmp_log('cont') - iotests.log(vm.hmp_qemu_io('-d vda/virtio-backend', 'write 4k 4k')) + vm.qmp_qemu_io('vda/virtio-backend', 'write 4k 4k', use_log=True, qdev=True) iotests.log('\n=== Commit it to the backing file ===') result = vm.qmp_log('block-commit', job_id='job0', auto_dismiss=False,
tests/qemu-iotests/280.out +2 -1
@@ -36,7 +36,8 @@ completed === Resume the VM and simulate a write request === {"execute": "cont", "arguments": {}} {"return": {}} -{"return": ""} +{"execute": "x-qemu-io", "arguments": {"command": "write 4k 4k", "qdev": "vda/virtio-backend"}} +{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 4096\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} === Commit it to the backing file === {"execute": "block-commit", "arguments": {"auto-dismiss": false, "device": "top-fmt", "job-id": "job0", "top-node": "top-fmt"}}
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 38/88 qemu-iotests/backup-discard-source: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/tests/backup-discard-source | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
tests/qemu-iotests/tests/backup-discard-source +7 -8
@@ -87,11 +87,13 @@ class TestBackup(iotests.QMPTestCase): def tearDown(self): # That should fail, because region is discarded - result = self.vm.hmp_qemu_io('access', 'read 0 1M') + result = self.vm.qmp('x-qemu-io', device='access', + command='read 0 1M') self.vm.shutdown() - self.assertIn('read failed: Permission denied', result['return']) + self.assertIn('read failed: Permission denied', + result['error']['desc']) # Final check that temp image is empty mapping = qemu_img_map(temp_img)
@@ -127,8 +129,7 @@ class TestBackup(iotests.QMPTestCase): removed from temp """ # Trigger copy-before-write operation - result = self.vm.hmp_qemu_io('cbw', 'write 0 1M') - self.assert_qmp(result, 'return', '') + self.vm.qmp_qemu_io('cbw', 'write 0 1M') # Check that data is written to temporary image self.assertEqual(self.get_bitmap_count(), size)
@@ -150,8 +151,7 @@ class TestBackup(iotests.QMPTestCase): self.vm.cmd('block-dirty-bitmap-clear', self.bitmap) # Try trigger copy-before-write operation - result = self.vm.hmp_qemu_io('cbw', 'write 0 1M') - self.assert_qmp(result, 'return', '') + self.vm.qmp_qemu_io('cbw', 'write 0 1M') # Check that data is not written to temporary image, as region # is discarded from copy-before-write process
@@ -160,5 +160,4 @@ class TestBackup(iotests.QMPTestCase): if __name__ == '__main__': iotests.main(supported_fmts=['qcow2'], - supported_protocols=['file'], - require_hmp=True) + supported_protocols=['file'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 39/88 qemu-iotests/qsd-migrate: migrate away from HMP
In reply to Marc-André LureauKeep the vm_src/vm_dst log, even if they should be empty now.
--- tests/qemu-iotests/tests/qsd-migrate | 23 ++++++++--------- tests/qemu-iotests/tests/qsd-migrate.out | 44 ++++++++++++-------------------- 2 files changed, 27 insertions(+), 40 deletions(-)
tests/qemu-iotests/tests/qsd-migrate +11 -12
@@ -20,12 +20,11 @@ import iotests -from iotests import filter_qemu_io, filter_qtest +from iotests import filter_qtest iotests.script_initialize(supported_fmts=['qcow2', 'qed', 'raw'], supported_protocols=['file'], - supported_platforms=['linux'], - require_hmp=True) + supported_platforms=['linux']) with iotests.FilePath('disk.img') as path, \ iotests.FilePath('nbd-src.sock', base_dir=iotests.sock_dir) as nbd_src, \
@@ -75,9 +74,9 @@ with iotests.FilePath('disk.img') as path, \ vm_dst.launch() iotests.log('\nTest I/O on the source') - vm_src.hmp_qemu_io('virtio0/virtio-backend', 'write -P 0x11 0 4k', + vm_src.qmp_qemu_io('virtio0/virtio-backend', 'write -P 0x11 0 4k', use_log=True, qdev=True) - vm_src.hmp_qemu_io('virtio0/virtio-backend', 'read -P 0x11 0 4k', + vm_src.qmp_qemu_io('virtio0/virtio-backend', 'read -P 0x11 0 4k', use_log=True, qdev=True) iotests.log('\nStarting migration...')
@@ -100,9 +99,9 @@ with iotests.FilePath('disk.img') as path, \ # Reading is okay from both sides while the image is inactive. Note that # the destination may have stale data until it activates the image, though. - vm_src.hmp_qemu_io('virtio0/virtio-backend', 'read -P 0x11 0 4k', + vm_src.qmp_qemu_io('virtio0/virtio-backend', 'read -P 0x11 0 4k', use_log=True, qdev=True) - vm_dst.hmp_qemu_io('virtio0/virtio-backend', 'read 0 4k', + vm_dst.qmp_qemu_io('virtio0/virtio-backend', 'read 0 4k', use_log=True, qdev=True) iotests.log(qsd_dst.qmp('blockdev-set-active', {'active': True}))
@@ -115,13 +114,13 @@ with iotests.FilePath('disk.img') as path, \ iotests.log('\nTest I/O on the destination') # Now the destination must see what the source wrote - vm_dst.hmp_qemu_io('virtio0/virtio-backend', 'read -P 0x11 0 4k', + vm_dst.qmp_qemu_io('virtio0/virtio-backend', 'read -P 0x11 0 4k', use_log=True, qdev=True) # And be able to overwrite it - vm_dst.hmp_qemu_io('virtio0/virtio-backend', 'write -P 0x22 0 4k', + vm_dst.qmp_qemu_io('virtio0/virtio-backend', 'write -P 0x22 0 4k', use_log=True, qdev=True) - vm_dst.hmp_qemu_io('virtio0/virtio-backend', 'read -P 0x22 0 4k', + vm_dst.qmp_qemu_io('virtio0/virtio-backend', 'read -P 0x22 0 4k', use_log=True, qdev=True) iotests.log('\nDone')
@@ -130,12 +129,12 @@ with iotests.FilePath('disk.img') as path, \ iotests.log('\n--- vm_src log ---') log = vm_src.get_log() if log: - iotests.log(log, [filter_qtest, filter_qemu_io]) + iotests.log(log, [filter_qtest]) qsd_src.stop() vm_dst.shutdown() iotests.log('\n--- vm_dst log ---') log = vm_dst.get_log() if log: - iotests.log(log, [filter_qtest, filter_qemu_io]) + iotests.log(log, [filter_qtest]) qsd_dst.stop()
tests/qemu-iotests/tests/qsd-migrate.out +16 -28
65 lines not on this page · raw message
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 40/88 qemu-iotests/mirror-change-copy-mode: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/tests/mirror-change-copy-mode | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
tests/qemu-iotests/tests/mirror-change-copy-mode +7 -8
@@ -119,8 +119,8 @@ class TestMirrorChangeCopyMode(iotests.QMPTestCase): copy_mode='background') def test_background_to_active(self): - self.vm.hmp_qemu_io('source', f'write 0 {image_size}') - self.vm.hmp_qemu_io('target', f'write 0 {image_size}') + self.vm.qmp_qemu_io('source', f'write 0 {image_size}') + self.vm.qmp_qemu_io('target', f'write 0 {image_size}') self.start_mirror()
@@ -137,7 +137,7 @@ class TestMirrorChangeCopyMode(iotests.QMPTestCase): req_size = image_size // reqs for i in range(0, reqs): req = f'aio_write -P 7 {req_size * i} {req_size}' - self.vm.hmp_qemu_io('source', req) + self.vm.qmp_qemu_io('source', req) # Wait for the first few requests. time.sleep(1)
@@ -174,15 +174,15 @@ class TestMirrorChangeCopyMode(iotests.QMPTestCase): req_size = image_size // 2 // reqs for i in range(0, reqs): req = f'aio_write -P 19 {req_size * i} {req_size}' - self.vm.hmp_qemu_io('source', req) + self.vm.qmp_qemu_io('source', req) # Now issue a synchronous write in the second half of the image and # immediately verify that it was written to the target too. This would # fail without switching the copy mode. Note that this only produces a # log line and the actual checking happens during tearDown(). req_args = f'-P 37 {3 * (image_size // 4)} {req_size}' - self.vm.hmp_qemu_io('source', f'write {req_args}') - self.vm.hmp_qemu_io('target', f'read {req_args}') + self.vm.qmp_qemu_io('source', f'write {req_args}') + self.vm.qmp_qemu_io('target', f'read {req_args}') self.vm.cmd('block-job-cancel', device='mirror') while len(self.vm.cmd('query-block-jobs')) > 0:
@@ -190,5 +190,4 @@ class TestMirrorChangeCopyMode(iotests.QMPTestCase): if __name__ == '__main__': iotests.main(supported_fmts=['qcow2', 'raw'], - supported_protocols=['file'], - require_hmp=True) + supported_protocols=['file'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 41/88 qemu-iotests/migrate-bitmaps-test: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/tests/migrate-bitmaps-test | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
tests/qemu-iotests/tests/migrate-bitmaps-test +3 -4
@@ -95,7 +95,7 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): self.add_bitmap(self.vm_a, granularity, persistent) for r in regions: - self.vm_a.hmp_qemu_io('drive0', 'write %d %d' % r) + self.vm_a.qmp_qemu_io('drive0', 'write %d %d' % r) sha256 = get_bitmap_hash(self.vm_a) self.vm_a.cmd('migrate', uri=mig_cmd)
@@ -159,7 +159,7 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): self.add_bitmap(self.vm_a, granularity, persistent) for r in regions: - self.vm_a.hmp_qemu_io('drive0', 'write %d %d' % r) + self.vm_a.qmp_qemu_io('drive0', 'write %d %d' % r) sha256 = get_bitmap_hash(self.vm_a) if pre_shutdown:
@@ -215,7 +215,7 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): self.vm_b.add_drive(disk_b, 'read-only=on') self.add_bitmap(self.vm_a, granularity, True) - self.vm_a.hmp_qemu_io('drive0', 'write 0 4096') + self.vm_a.qmp_qemu_io('drive0', 'write 0 4096') self.vm_a.cmd('migrate-set-capabilities', capabilities=mig_caps) self.vm_a.cmd('migrate', uri=mig_cmd)
@@ -330,7 +330,6 @@ def main() -> None: supported_fmts=['qcow2'], supported_protocols=['file'], unsupported_imgopts=['compat'], - require_hmp=True, )
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 42/88 qemu-iotests/image-fleecing: migrate away from HMP
In reply to Marc-André LureauNo need to log success.
--- tests/qemu-iotests/tests/image-fleecing | 5 ++--- tests/qemu-iotests/tests/image-fleecing.out | 20 -------------------- 2 files changed, 2 insertions(+), 23 deletions(-)
tests/qemu-iotests/tests/image-fleecing +2 -3
@@ -32,7 +32,6 @@ iotests.script_initialize( supported_platforms=['linux'], required_fmts=['copy-before-write'], unsupported_imgopts=['compat'], - require_hmp=True, ) patterns = [('0x5d', '0', '64k'),
@@ -209,12 +208,12 @@ def do_test(vm, use_cbw, use_snapshot_access_filter, base_img_path, for p in overwrite: cmd = 'write -P%s %s %s' % p log(cmd) - log(vm.hmp_qemu_io(qom_path, cmd, qdev=True)) + vm.qmp_qemu_io(qom_path, cmd, qdev=True) if push_backup: # Check that previous operations were done during backup, not after # If backup is already finished, it's possible that it was finished - # even before hmp qemu_io write, and we didn't actually test + # even before qemu_io write, and we didn't actually test # copy-before-write operation. This should not happen, as we use # speed=1. But worth checking. result = vm.qmp('query-block-jobs')
tests/qemu-iotests/tests/image-fleecing.out +0 -20
@@ -31,13 +31,9 @@ read -P0 0x3fe0000 64k --- Testing COW --- write -P0xab 0 64k -{"return": ""} write -P0xad 0x00f8000 64k -{"return": ""} write -P0x1d 0x2008000 64k -{"return": ""} write -P0xea 0x3fe0000 64k -{"return": ""} --- Verifying Data ---
@@ -101,13 +97,9 @@ read -P0 0x3fe0000 64k --- Testing COW --- write -P0xab 0 64k -{"return": ""} write -P0xad 0x00f8000 64k -{"return": ""} write -P0x1d 0x2008000 64k -{"return": ""} write -P0xea 0x3fe0000 64k -{"return": ""} --- Verifying Data ---
@@ -172,13 +164,9 @@ read -P0 0x3fe0000 64k --- Testing COW --- write -P0xab 0 64k -{"return": ""} write -P0xad 0x00f8000 64k -{"return": ""} write -P0x1d 0x2008000 64k -{"return": ""} write -P0xea 0x3fe0000 64k -{"return": ""} --- Verifying Data ---
@@ -250,13 +238,9 @@ read failed: Invalid argument --- Testing COW --- write -P0xab 0 64k -{"return": ""} write -P0xad 0x00f8000 64k -{"return": ""} write -P0x1d 0x2008000 64k -{"return": ""} write -P0xea 0x3fe0000 64k -{"return": ""} --- Verifying Data ---
@@ -318,13 +302,9 @@ Done --- Testing COW --- write -P0xab 0 64k -{"return": ""} write -P0xad 0x00f8000 64k -{"return": ""} write -P0x1d 0x2008000 64k -{"return": ""} write -P0xea 0x3fe0000 64k -{"return": ""} {"data": {"device": "push-backup", "len": 67108864, "offset": 67108864, "speed": 0, "type": "backup"}, "event": "BLOCK_JOB_COMPLETED", "timestamp": {"microseconds": "USECS", "seconds": "SECS"}} {"return": {}}
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 43/88 qemu-iotests/migrate-bitmaps-postcopy: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test +2 -3
@@ -52,7 +52,7 @@ discards2 = ( def apply_discards(vm, discards): for d in discards: - vm.hmp_qemu_io('drive0', 'discard {} {}'.format(*d)) + vm.qmp_qemu_io('drive0', 'discard {} {}'.format(*d)) def event_seconds(event):
@@ -279,5 +279,4 @@ class TestDirtyBitmapPostcopyMigration(iotests.QMPTestCase): if __name__ == '__main__': iotests.main(supported_fmts=['qcow2'], - unsupported_imgopts=['compat'], - require_hmp=True) + unsupported_imgopts=['compat'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 44/88 qemu-iotests/165: migrate away from HMP
In reply to Marc-André LureauFor the read-only write test, call qmp() directly and assert the expected GenericError, since qmp_qemu_io() assumes success.
--- tests/qemu-iotests/165 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
tests/qemu-iotests/165 +6 -4
@@ -66,7 +66,7 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): def writeRegions(self, regions): for r in regions: - self.vm.hmp_qemu_io('drive0', + self.vm.qmp_qemu_io('drive0', 'write %d %d' % r) def qmpAddBitmap(self):
@@ -138,7 +138,10 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): assert sha256_1 == self.getSha256() # Check that we are in RO mode and can't modify bitmap. - self.writeRegions(regions2) + for r in regions2: + result = self.vm.qmp('x-qemu-io', device='drive0', + command='write %d %d' % r) + self.assert_qmp(result, 'error/class', 'GenericError') assert sha256_1 == self.getSha256() # Reopen to RW
@@ -162,5 +165,4 @@ class TestPersistentDirtyBitmap(iotests.QMPTestCase): if __name__ == '__main__': iotests.main(supported_fmts=['qcow2', 'parallels'], supported_protocols=['file'], - unsupported_imgopts=['compat'], - require_hmp=True) + unsupported_imgopts=['compat'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 45/88 qemu-iotests/iothreads-create: doesn't actually depend on HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/tests/iothreads-create | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tests/qemu-iotests/tests/iothreads-create +1 -2
@@ -22,8 +22,7 @@ import asyncio import iotests iotests.script_initialize(supported_fmts=['qcow2', 'qcow', 'qed', 'vdi', - 'vmdk', 'parallels'], - require_hmp=True) + 'vmdk', 'parallels']) iotests.verify_virtio_scsi_pci_or_ccw() with iotests.FilePath('disk.img') as img_path, \
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 46/88 qemu-iotests/045: remove HMP monitor dependency
In reply to Marc-André LureauTest 045 (TestSCMFd) is adding a null HMP monitor via add_monitor_null() to exercise fd operations with two monitors present. With HMP disabled, -monitor null is no longer valid.
Remove the add_monitor_null() call and the now-unused method from the Python machine module.
--- python/qemu/machine/machine.py | 7 ------- tests/qemu-iotests/045 | 6 +----- 2 files changed, 1 insertion(+), 12 deletions(-)
python/qemu/machine/machine.py +0 -7
@@ -202,13 +202,6 @@ def __exit__(self, exc_tb: Optional[TracebackType]) -> None: self.shutdown() - def add_monitor_null(self) -> None: - """ - This can be used to add an unused monitor instance. - """ - self._args.append('-monitor') - self._args.append('null') - def add_fd(self: _T, fd: int, fdset: int, opaque: str, opts: str = '') -> _T: """
tests/qemu-iotests/045 +1 -5
@@ -129,9 +129,6 @@ class TestSCMFd(iotests.QMPTestCase): def setUp(self): self.vm = iotests.VM() qemu_img('create', '-f', iotests.imgfmt, image0, '128K') - # Add an unused monitor, to verify it works fine when two monitor - # instances present - self.vm.add_monitor_null() self.vm.launch() def tearDown(self):
@@ -172,5 +169,4 @@ class TestSCMFd(iotests.QMPTestCase): if __name__ == '__main__': iotests.main(supported_fmts=['raw'], - supported_protocols=['file'], - require_hmp=True) + supported_protocols=['file'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
Re: [PATCH 46/88] qemu-iotests/045: remove HMP monitor dependency
Quoted 22 lines · Marc-André Lureau
Test 045 (TestSCMFd) is adding a null HMP monitor via
add_monitor_null()to exercise fd operations with two monitors present. With HMP disabled, -monitor null is no longer valid.Remove the
add_monitor_null()call and the now-unused method from the Python machine module.Signed-off-by Marc-André Lureau <[email protected]>--- python/qemu/machine/machine.py | 7 ------- tests/qemu-iotests/045 | 6 +----- 2 files changed, 1 insertion(+), 12 deletions(-)python/qemu/machine/machine.py +0
-0@@ -202,13 +202,6 @@ def __exit__(self, exc_tb: Optional[TracebackType]) -> None: self.shutdown()
python/qemu/machine/machine.py def __exit__(self, · line 207
Quoted 10 lines
python/qemu/machine/machine.py +0
-7- def add_monitor_null(self) -> None: - """ - This can be used to add an unused monitor instance. - """ - self._args.append('-monitor') - self._args.append('null') - def add_fd(self: _T, fd: int, fdset: int, opaque: str, opts: str = '') -> _T: """
Fine by me so long as block folks are okay with dropping that part of the test.
ACK
Quoted 25 lines
tests/qemu-iotests/045 +1
-6@@ -129,9 +129,6 @@ class TestSCMFd(iotests.QMPTestCase): def setUp(self): self.vm = iotests.VM() qemu_img('create', '-f', iotests.imgfmt, image0, '128K') - # Add an unused monitor, to verify it works fine when two monitor - # instances present - self.vm.add_monitor_null() self.vm.launch() def tearDown(self):@@ -172,5 +169,4 @@ class TestSCMFd(iotests.QMPTestCase): if __name__ == '__main__': iotests.main(supported_fmts=['raw'], - supported_protocols=['file'], - require_hmp=True) + supported_protocols=['file']) --2.56.0.rc0.29.g47ce80527c56
PATCH 47/88 qemu-iotests/common: add _run_qmp_job helper
In reply to Marc-André Lureau--- tests/qemu-iotests/common.qemu | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
tests/qemu-iotests/common.qemu +22 -0
@@ -287,6 +287,28 @@ _wait_event() done } +# Run a QMP job command and wait for it to complete +# +# Sends the given QMP command, waits for the job to reach +# "concluded" status, then dismisses it. +# +# $1: QEMU handle +# $2: Job ID (must match the job-id in the command) +# $3: QMP command string to send +_run_qmp_job() +{ + local h=${1} + local job_id=${2} + local cmd=${3} + + _send_qemu_cmd $h "$cmd" 'return' + _send_qemu_cmd $h '' '"concluded"' + _send_qemu_cmd $h \ + "{ 'execute': 'job-dismiss', + 'arguments': { 'id': '$job_id' } }" 'return' +} + + # Launch a QEMU process. # # Input parameters:
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 48/88 qemu-iotests/007: migrate away from HMP
In reply to Marc-André LureauReplace HMP 'savevm' with QMP 'snapshot-save' job-based API. Use _launch_qemu/_send_qemu_cmd for proper QMP interaction.
--- tests/qemu-iotests/007 | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
tests/qemu-iotests/007 +19 -6
@@ -29,6 +29,7 @@ status=1 # failure is the default! _cleanup() { + _cleanup_qemu _cleanup_test_img true }
@@ -37,6 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 # get standard environment, filters and checks . ./common.rc . ./common.filter +. ./common.qemu # currently only qcow2 allows for consistency checks using qemu-img _supported_fmt qcow2
@@ -50,12 +52,23 @@ echo echo "creating image" _make_test_img 1M -for ((i=1;i<=10;i++)); do - echo "savevm $i" - $QEMU -nographic -hda "$TEST_IMG" -serial none -monitor stdio >/dev/null 2>&1 <<EOF -savevm test-$i -quit -EOF +silent=yes +for ((n=1;n<=10;n++)); do + echo "savevm $n" + _launch_qemu \ + -drive if=none,id=drive0,node-name=disk0,file="$TEST_IMG",format="$IMGFMT" \ + -device virtio-scsi,id=hba0 -device scsi-hd,drive=drive0 + _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'qmp_capabilities' }" 'return' + _run_qmp_job $QEMU_HANDLE 'save' \ + "{ 'execute': 'snapshot-save', + 'arguments': { 'job-id': 'save', + 'tag': 'test-$n', + 'vmstate': 'disk0', + 'devices': ['disk0'] } }" + _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'quit' }" 'return' + _cleanup_qemu done echo
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 49/88 qemu-iotests/028: migrate away from HMP
In reply to Marc-André LureauReplace HMP drive_backup, info block-jobs, and quit with their QMP equivalents (drive-backup, query-block-jobs, quit). Capture BLOCK_JOB_COMPLETED and JOB_STATUS_CHANGE events during polling to keep the output clean.
--- tests/qemu-iotests/028 | 27 ++++++++++++++++++++------- tests/qemu-iotests/028.out | 17 +++++++++++++---- 2 files changed, 33 insertions(+), 11 deletions(-)
tests/qemu-iotests/028 +20 -7
@@ -49,7 +49,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 qed _supported_proto file fuse _supported_os Linux -_require_hmp # Choose a size that is not necessarily a cluster size multiple for image # formats that use clusters. This will ensure that the base image doesn't end
@@ -109,7 +108,6 @@ echo echo block-backup echo -qemu_comm_method="monitor" _launch_qemu -drive file="${TEST_IMG}",cache=${CACHEMODE},aio=${AIOMODE},id=disk h=$QEMU_HANDLE if [ "${VALGRIND_QEMU}" == "y" ]; then
@@ -119,12 +117,27 @@ else fi TEST_IMG="$TEST_IMG.copy" _make_test_img $image_size -_send_qemu_cmd $h "drive_backup -n disk ${TEST_IMG}.copy" "(qemu)" \ - | _filter_imgfmt -silent=y qemu_cmd_repeat=20 _send_qemu_cmd $h "info block-jobs" "No active jobs" -_send_qemu_cmd $h "info block-jobs" "No active jobs" -_send_qemu_cmd $h 'quit' "" +_send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" 'return' + +capture_events="BLOCK_JOB_COMPLETED JOB_STATUS_CHANGE" \ +_send_qemu_cmd $h \ + "{ 'execute': 'drive-backup', + 'arguments': { 'device': 'disk', + 'target': '${TEST_IMG}.copy', + 'sync': 'full', + 'mode': 'existing' } }" \ + "return" + +capture_events="BLOCK_JOB_COMPLETED JOB_STATUS_CHANGE" \ +silent=y qemu_cmd_repeat=20 _send_qemu_cmd $h \ + '{"execute":"query-block-jobs"}' '"return": \[\]' + +capture_events="BLOCK_JOB_COMPLETED JOB_STATUS_CHANGE" \ +_send_qemu_cmd $h '{"execute":"query-block-jobs"}' '"return": \[\]' + +_send_qemu_cmd $h '{"execute":"quit"}' 'return' +wait=1 _cleanup_qemu # Base image sectors TEST_IMG="${TEST_IMG}.copy" io readv $(( offset )) 512 1024 32
tests/qemu-iotests/028.out +13 -4
@@ -469,10 +469,19 @@ No errors were found on the image. block-backup Formatting 'TEST_DIR/t.IMGFMT.copy', fmt=IMGFMT size=4294968832 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) drive_backup -n disk TEST_DIR/t.IMGFMT.copy -(qemu) info block-jobs -No active jobs +{ 'execute': 'qmp_capabilities' } +{"return": {}} +{ 'execute': 'drive-backup', + 'arguments': { 'device': 'disk', + 'target': 'TEST_DIR/t.IMGFMT.copy', + 'sync': 'full', + 'mode': 'existing' } } +{"return": {}} +{"execute":"query-block-jobs"} +{"return": []} +{"execute":"quit"} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} === IO: pattern 195 read 512/512 bytes at offset 3221194240 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
Re: [PATCH 49/88] qemu-iotests/028: migrate away from HMP
Quoted 10 lines · Marc-André Lureau
Replace HMP
drive_backup, info block-jobs, and quit with their QMP equivalents (drive-backup, query-block-jobs, quit). CaptureBLOCK_JOB_COMPLETEDandJOB_STATUS_CHANGEevents during polling to keep the output clean.Signed-off-by Marc-André Lureau <[email protected]>--- tests/qemu-iotests/028 | 27 ++++++++++++++++++++------- tests/qemu-iotests/028.out | 17 +++++++++++++---- 2 files changed, 33 insertions(+), 11 deletions(-)
PATCH 50/88 qemu-iotests/225: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/225 | 28 ++++++++++++++++++---------- tests/qemu-iotests/225.out | 25 +++++++++++++++---------- 2 files changed, 33 insertions(+), 20 deletions(-)
tests/qemu-iotests/225 +18 -10
@@ -46,7 +46,6 @@ _supported_os Linux _unsupported_imgopts "subformat=monolithicFlat" \ "subformat=twoGbMaxExtentFlat" \ "subformat=twoGbMaxExtentSparse" -_require_hmp TEST_IMG="$TEST_IMG.base" _make_test_img 1M TEST_IMG="$TEST_IMG.not_base" _make_test_img 1M
@@ -83,11 +82,14 @@ echo echo '=== Testing fitting VMDK backing image ===' echo -qemu_comm_method=monitor \ - _launch_qemu -blockdev "$base_opts" -blockdev "$overlay_opts" +_launch_qemu -blockdev "$base_opts" -blockdev "$overlay_opts" +_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'qmp_capabilities' }" "return" # Should not return an error -_send_qemu_cmd $QEMU_HANDLE 'qemu-io overlay "read 0 512"' 'ops' +_send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'overlay', 'command': 'read 0 512' } }" \ + "return" _cleanup_qemu
@@ -96,11 +98,14 @@ echo echo '=== Testing unrelated VMDK backing image ===' echo -qemu_comm_method=monitor \ - _launch_qemu -blockdev "$not_base_opts" -blockdev "$overlay_opts" +_launch_qemu -blockdev "$not_base_opts" -blockdev "$overlay_opts" +_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'qmp_capabilities' }" "return" # Should fail (gracefully) -_send_qemu_cmd $QEMU_HANDLE 'qemu-io overlay "read 0 512"' 'failed' +_send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'overlay', 'command': 'read 0 512' } }" \ + "error" _cleanup_qemu
@@ -118,11 +123,14 @@ echo # this a FIXME because with -blockdev, you cannot specify "partial" # options, so setting file.filename but leaving the rest as specified # by the user does not make sense. -qemu_comm_method=monitor \ - _launch_qemu -blockdev "$not_vmdk_opts" -blockdev "$overlay_opts" +_launch_qemu -blockdev "$not_vmdk_opts" -blockdev "$overlay_opts" +_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'qmp_capabilities' }" "return" # Should fail (gracefully) -_send_qemu_cmd $QEMU_HANDLE 'qemu-io overlay "read 0 512"' 'failed' +_send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'overlay', 'command': 'read 0 512' } }" \ + "error" _cleanup_qemu
tests/qemu-iotests/225.out +15 -10
@@ -5,20 +5,25 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t. === Testing fitting VMDK backing image === -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) qemu-io overlay "read 0 512" -read 512/512 bytes at offset 0 -512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +{ 'execute': 'qmp_capabilities' } +{"return": {}} +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'overlay', 'command': 'read 0 512' } } +{"return": {"human-readable-text": "read 512/512 bytes at offset 0\n512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} === Testing unrelated VMDK backing image === -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) qemu-io overlay "read 0 512" -Error: read failed: Invalid argument +{ 'execute': 'qmp_capabilities' } +{"return": {}} +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'overlay', 'command': 'read 0 512' } } +{"error": {"class": "GenericError", "desc": "read failed: Invalid argument"}} === Testing non-VMDK backing image === -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) qemu-io overlay "read 0 512" -Error: read failed: Invalid argument +{ 'execute': 'qmp_capabilities' } +{"return": {}} +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'overlay', 'command': 'read 0 512' } } +{"error": {"class": "GenericError", "desc": "read failed: Invalid argument"}} *** done
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 51/88 qemu-iotests/300: migrate away from HMP
In reply to Marc-André LureauMigrate away from HMP "info migrate_parameters", and use QMP query-migrate-parameters instead. We no longer check HMP formatting output though, but this is not meant to be a testable interface.
--- tests/qemu-iotests/300 | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-)
tests/qemu-iotests/300 +6 -26
@@ -21,7 +21,6 @@ import os import random -import re from typing import Dict, List, Optional import iotests
@@ -136,8 +135,8 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): Invoke migrate-set-parameters on @vm to set the given @mapping. Check for success if @error is None, or verify the error message if it is not. - On success, verify that "info migrate_parameters" on HMP returns - our mapping. (Just to check its formatting code.) + On success, verify that query-migrate-parameters returns + our mapping. """ result = vm.qmp('migrate-set-parameters', block_bitmap_mapping=mapping)
@@ -145,30 +144,12 @@ class TestDirtyBitmapMigration(iotests.QMPTestCase): if error is None: self.assert_qmp(result, 'return', {}) - result = vm.qmp('human-monitor-command', - command_line='info migrate_parameters') - - m = re.search(r'^block-bitmap-mapping:\r?(\n .*)*\n', - result['return'], flags=re.MULTILINE) - hmp_mapping = m.group(0).replace('\r', '') if m else None - - self.assertEqual(hmp_mapping, self.to_hmp_mapping(mapping)) + result = vm.qmp('query-migrate-parameters') + qmp_mapping = result['return'].get('block-bitmap-mapping') + self.assertEqual(qmp_mapping, mapping) else: self.assert_qmp(result, 'error/desc', error) - @staticmethod - def to_hmp_mapping(mapping: BlockBitmapMapping) -> str: - result = 'block-bitmap-mapping:\n' - - for node in mapping: - result += f" '{node['node-name']}' -> '{node['alias']}'\n" - - assert isinstance(node['bitmaps'], list) - for bitmap in node['bitmaps']: - result += f" '{bitmap['name']}' -> '{bitmap['alias']}'\n" - - return result - class TestAliasMigration(TestDirtyBitmapMigration): src_node_name = 'node0'
@@ -683,5 +664,4 @@ class TestAliasTransformMigration(TestDirtyBitmapMigration): self.verify_dest_error(None) if __name__ == '__main__': - iotests.main(supported_protocols=['file'], - require_hmp=True) + iotests.main(supported_protocols=['file'])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 52/88 qemu-iotests/286: migrate away from HMP
In reply to Marc-André LureauReplaced qemu_comm_method=monitor _launch_qemu -m 512 "$TEST_IMG" with _launch_qemu using -blockdev to set explicit node names (disk0-file and disk0), and HMP savevm with QMP snapshot-save (job-based), waiting for "concluded" status.
--- tests/qemu-iotests/286 | 15 +++++++++++---- tests/qemu-iotests/286.out | 8 +++++--- 2 files changed, 16 insertions(+), 7 deletions(-)
tests/qemu-iotests/286 +11 -4
@@ -40,7 +40,6 @@ _supported_proto file fuse # Internal snapshots are (currently) impossible with refcount_bits=1, # and generally impossible with external data files _unsupported_imgopts 'refcount_bits=1[^0-9]' data_file -_require_hmp _make_test_img 64M
@@ -49,10 +48,18 @@ sn_name=abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz # More memory will give us a larger VM state, i.e. one above 1 MB. # This way, we get a number with a decimal point. -qemu_comm_method=monitor _launch_qemu -m 512 "$TEST_IMG" +_launch_qemu -m 512 \ + -blockdev driver=file,filename="$TEST_IMG",node-name=disk0-file \ + -blockdev driver=$IMGFMT,file=disk0-file,node-name=disk0 -_send_qemu_cmd $QEMU_HANDLE "savevm $sn_name" '(qemu)' -_send_qemu_cmd $QEMU_HANDLE 'quit' '(qemu)' +_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'qmp_capabilities' }" 'return' +silent=yes _run_qmp_job $QEMU_HANDLE 'save0' \ + "{ 'execute': 'snapshot-save', + 'arguments': { 'job-id': 'save0', + 'tag': '$sn_name', + 'vmstate': 'disk0', + 'devices': ['disk0'] } }" +_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'quit' }" 'return' wait=yes _cleanup_qemu # Check that all fields are separated by spaces.
tests/qemu-iotests/286.out +5 -3
@@ -1,8 +1,10 @@ QA output created by 286 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) savevm abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz -(qemu) quit +{ 'execute': 'qmp_capabilities' } +{"return": {}} +{ 'execute': 'quit' } +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} Output structure: (snapshot ID) (snapshot name) (VM state size value) (VM state size unit) (snapshot date) (snapshot time) (VM clock) (icount) *** done
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 53/88 qemu-iotests/142: migrate away from HMP
In reply to Marc-André LureauReplace the HMP monitor (-monitor stdio) with QMP (-qmp stdio) for testing cache mode configuration and inheritance.
The main changes are:
- Use query-block and query-named-block-nodes QMP commands instead of HMP "info block" to retrieve cache settings.
- Introduce _filter_qmp_cache(), a Python helper that parses QMP responses and prints cache modes. Device names are looked up in query-block (backend-level cache) while node names are looked up in query-named-block-nodes (BDS-level cache), preserving the same semantics as HMP "info block <name>".
- Use QMP blockdev-snapshot-sync instead of HMP snapshot_blkdev.
- Use QMP x-qemu-io instead of HMP qemu-io for reopen operations.
The expected output changes only in formatting (QMP banners and JSON responses replacing HMP banners).
--- tests/qemu-iotests/142 | 233 ++++++++++++++++++++++++++------------------- tests/qemu-iotests/142.out | 30 ++++-- 2 files changed, 157 insertions(+), 106 deletions(-)
tests/qemu-iotests/142 +137 -96
@@ -43,25 +43,92 @@ _supported_proto file # We test all cache modes anyway, but O_DIRECT needs to be supported _default_cache_mode none _supported_cache_modes none directsync -_require_hmp do_run_qemu() { - echo Testing: "$@" ( + echo "{ 'execute': 'qmp_capabilities' }" if ! test -t 0; then while read cmd; do - echo $cmd + echo "$cmd" done fi - echo quit - ) | $QEMU -nographic -monitor stdio -nodefaults "$@" - echo + echo "{ 'execute': 'quit' }" + ) | $QEMU -nographic -qmp stdio -nodefaults "$@" 2>&1 } run_qemu() { - do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp + ( + echo Testing: "$@" + do_run_qemu "$@" | _filter_qmp + ) | _filter_testdir | _filter_qemu + echo +} + +# Extract cache info from query-block and query-named-block-nodes QMP +# output. For each name passed as argument, prints its cache mode. +# Device names are looked up in query-block (backend-level cache). +# Node names are looked up in query-named-block-nodes (BDS-level cache). +# Non-JSON lines (startup errors) are passed through. +_filter_qmp_cache() +{ + local nodes=("$@") + python3 -c ' +import sys, json + +nodes = sys.argv[1:] +lines = sys.stdin.read().strip().split("\n") + +cache_map = {} +for line in lines: + line = line.strip() + if not line.startswith("{"): + if line and not line.startswith("Formatting"): + print(line) + continue + try: + resp = json.loads(line) + except json.JSONDecodeError: + continue + if "error" in resp: + print(resp["error"]["desc"]) + continue + ret = resp.get("return") + if not isinstance(ret, list): + continue + for entry in ret: + if not isinstance(entry, dict): + continue + device = entry.get("device") + inserted = entry.get("inserted") if device is not None else entry + if inserted is None: + continue + cache = inserted.get("cache") + if cache is None: + continue + node_name = inserted.get("node-name", "") + if device is not None and device in nodes: + cache_map[device] = cache + elif device is None and node_name in nodes and node_name not in cache_map: + cache_map[node_name] = cache + +for name in nodes: + if name in cache_map: + c = cache_map[name] + mode = "writeback" if c["writeback"] else "writethrough" + if c["direct"]: + mode += ", direct" + if c["no-flush"]: + mode += ", ignore flushes" + print(" Cache mode: %s" % mode) +' "${nodes[@]}" +} + +run_qemu_cache() +{ + do_run_qemu "$@" | _filter_qmp_cache $cache_nodes | \ + _filter_testdir | _filter_qemu } size=128M
@@ -88,42 +155,45 @@ echo files="if=none,file=$TEST_IMG,backing.file.filename=$TEST_IMG.base" ids="node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file" +qmp_query="{ 'execute': 'query-block' } +{ 'execute': 'query-named-block-nodes' }" + check_cache_all() { # cache.direct is supposed to be inherited by both bs->file and # bs->backing printf "cache.direct=on on none0\n" - echo "$hmp_cmds" | run_qemu -drive "$files","$ids",cache.direct=on | grep -e "Cache" -e "[Cc]annot|[Cc]ould not|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$files","$ids",cache.direct=on printf "\ncache.direct=on on file\n" - echo "$hmp_cmds" | run_qemu -drive "$files","$ids",file.cache.direct=on | grep -e "Cache" -e "[Cc]annot|[Cc]ould not|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$files","$ids",file.cache.direct=on printf "\ncache.direct=on on backing\n" - echo "$hmp_cmds" | run_qemu -drive "$files","$ids",backing.cache.direct=on | grep -e "Cache" -e "[Cc]annot|[Cc]ould not|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$files","$ids",backing.cache.direct=on printf "\ncache.direct=on on backing-file\n" - echo "$hmp_cmds" | run_qemu -drive "$files","$ids",backing.file.cache.direct=on | grep -e "Cache" -e "[Cc]annot|[Cc]ould not|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$files","$ids",backing.file.cache.direct=on # cache.writeback is supposed to be inherited by bs->backing; bs->file # always gets cache.writeback=on printf "\n\ncache.writeback=off on none0\n" - echo "$hmp_cmds" | run_qemu -drive "$files","$ids",cache.writeback=off | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$files","$ids",cache.writeback=off printf "\ncache.writeback=off on file\n" - echo "$hmp_cmds" | run_qemu -drive "$files","$ids",file.cache.writeback=off | grep -e "doesn't" -e "does not" + echo "$qmp_cmds" | run_qemu_cache -drive "$files","$ids",file.cache.writeback=off printf "\ncache.writeback=off on backing\n" - echo "$hmp_cmds" | run_qemu -drive "$files","$ids",backing.cache.writeback=off | grep -e "doesn't" -e "does not" + echo "$qmp_cmds" | run_qemu_cache -drive "$files","$ids",backing.cache.writeback=off printf "\ncache.writeback=off on backing-file\n" - echo "$hmp_cmds" | run_qemu -drive "$files","$ids",backing.file.cache.writeback=off | grep -e "doesn't" -e "does not" + echo "$qmp_cmds" | run_qemu_cache -drive "$files","$ids",backing.file.cache.writeback=off # cache.no-flush is supposed to be inherited by both bs->file and bs->backing printf "\n\ncache.no-flush=on on none0\n" - echo "$hmp_cmds" | run_qemu -drive "$files","$ids",cache.no-flush=on | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$files","$ids",cache.no-flush=on printf "\ncache.no-flush=on on file\n" - echo "$hmp_cmds" | run_qemu -drive "$files","$ids",file.cache.no-flush=on | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$files","$ids",file.cache.no-flush=on printf "\ncache.no-flush=on on backing\n" - echo "$hmp_cmds" | run_qemu -drive "$files","$ids",backing.cache.no-flush=on | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$files","$ids",backing.cache.no-flush=on printf "\ncache.no-flush=on on backing-file\n" - echo "$hmp_cmds" | run_qemu -drive "$files","$ids",backing.file.cache.no-flush=on | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$files","$ids",backing.file.cache.no-flush=on } echo
@@ -132,11 +202,8 @@ echo # First check the inherited cache mode after opening the image. -hmp_cmds="info block none0 -info block image -info block file -info block backing -info block backing-file" +qmp_cmds="$qmp_query" +cache_nodes="none0 image file backing backing-file" check_cache_all
@@ -146,12 +213,9 @@ echo # Then trigger a reopen and check that the cache modes are still the same. -hmp_cmds="snapshot_blkdev -n none0 $TEST_IMG.snap $IMGFMT -info block -info block image -info block file -info block backing -info block backing-file" +qmp_cmds="{ 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'none0', 'snapshot-file': '$TEST_IMG.snap', 'format': '$IMGFMT' } } +$qmp_query" +cache_nodes="none0 image file backing backing-file" check_cache_all
@@ -162,12 +226,9 @@ echo # This one actually changes the cache mode with the reopen. For this test, the # new cache mode is specified in the flags, not as an option. -hmp_cmds='qemu-io none0 "reopen -c none" -info block none0 -info block image -info block file -info block backing -info block backing-file' +qmp_cmds="{ 'execute': 'x-qemu-io', 'arguments': { 'device': 'none0', 'command': 'reopen -c none' } } +$qmp_query" +cache_nodes="none0 image file backing backing-file" check_cache_all
@@ -178,12 +239,9 @@ echo # This one actually changes the cache mode with the reopen. For this test, the # new cache mode is specified as an option, not in the flags. -hmp_cmds='qemu-io none0 "reopen -o cache.direct=on" -info block none0 -info block image -info block file -info block backing -info block backing-file' +qmp_cmds="{ 'execute': 'x-qemu-io', 'arguments': { 'device': 'none0', 'command': 'reopen -o cache.direct=on' } } +$qmp_query" +cache_nodes="none0 image file backing backing-file" check_cache_all
@@ -193,13 +251,10 @@ echo # This checks that the original image doesn't inherit from the snapshot -hmp_cmds="snapshot_blkdev -n none0 $TEST_IMG.snap $IMGFMT -qemu-io none0 \"reopen -c none\" -info block none0 -info block image -info block file -info block backing -info block backing-file" +qmp_cmds="{ 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'none0', 'snapshot-file': '$TEST_IMG.snap', 'format': '$IMGFMT' } } +{ 'execute': 'x-qemu-io', 'arguments': { 'device': 'none0', 'command': 'reopen -c none' } } +$qmp_query" +cache_nodes="none0 image file backing backing-file" check_cache_all
@@ -214,13 +269,11 @@ echo # BDS initialised with the json: pseudo-protocol, but still have it inherit # options from its parent node. -hmp_cmds="qemu-io none0 \"reopen -o cache.direct=on,cache.no-flush=on\" -info block none0 -info block image -info block blkdebug -info block file" +qmp_cmds="{ 'execute': 'x-qemu-io', 'arguments': { 'device': 'none0', 'command': 'reopen -o cache.direct=on,cache.no-flush=on' } } +$qmp_query" +cache_nodes="none0 image blkdebug file" -echo "$hmp_cmds" | run_qemu -drive if=none,file="blkdebug::json:{\"filename\":\"$TEST_IMG\",,\"cache\":{\"direct\":false}}",node-name=image,file.node-name=blkdebug,file.image.node-name=file | grep "Cache" +echo "$qmp_cmds" | run_qemu_cache -drive if=none,file="blkdebug::json:{\"filename\":\"$TEST_IMG\",,\"cache\":{\"direct\":false}}",node-name=image,file.node-name=blkdebug,file.image.node-name=file echo echo "=== Check that referenced BDSes don't inherit ==="
@@ -236,35 +289,35 @@ check_cache_all_separate() # Check cache.direct printf "cache.direct=on on blk\n" - echo "$hmp_cmds" | run_qemu -drive "$drv_bkfile" -drive "$drv_bk" -drive "$drv_file" -drive "$drv_img",cache.direct=on | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$drv_bkfile" -drive "$drv_bk" -drive "$drv_file" -drive "$drv_img",cache.direct=on printf "\ncache.direct=on on file\n" - echo "$hmp_cmds" | run_qemu -drive "$drv_bkfile" -drive "$drv_bk" -drive "$drv_file",cache.direct=on -drive "$drv_img" | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$drv_bkfile" -drive "$drv_bk" -drive "$drv_file",cache.direct=on -drive "$drv_img" printf "\ncache.direct=on on backing\n" - echo "$hmp_cmds" | run_qemu -drive "$drv_bkfile" -drive "$drv_bk",cache.direct=on -drive "$drv_file" -drive "$drv_img" | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$drv_bkfile" -drive "$drv_bk",cache.direct=on -drive "$drv_file" -drive "$drv_img" printf "\ncache.direct=on on backing-file\n" - echo "$hmp_cmds" | run_qemu -drive "$drv_bkfile",cache.direct=on -drive "$drv_bk" -drive "$drv_file" -drive "$drv_img" | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$drv_bkfile",cache.direct=on -drive "$drv_bk" -drive "$drv_file" -drive "$drv_img" # Check cache.writeback printf "\n\ncache.writeback=off on blk\n" - echo "$hmp_cmds" | run_qemu -drive "$drv_bkfile" -drive "$drv_bk" -drive "$drv_file" -drive "$drv_img",cache.writeback=off | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$drv_bkfile" -drive "$drv_bk" -drive "$drv_file" -drive "$drv_img",cache.writeback=off printf "\ncache.writeback=off on file\n" - echo "$hmp_cmds" | run_qemu -drive "$drv_bkfile" -drive "$drv_bk" -drive "$drv_file",cache.writeback=off -drive "$drv_img" | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$drv_bkfile" -drive "$drv_bk" -drive "$drv_file",cache.writeback=off -drive "$drv_img" printf "\ncache.writeback=off on backing\n" - echo "$hmp_cmds" | run_qemu -drive "$drv_bkfile" -drive "$drv_bk",cache.writeback=off -drive "$drv_file" -drive "$drv_img" | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$drv_bkfile" -drive "$drv_bk",cache.writeback=off -drive "$drv_file" -drive "$drv_img" printf "\ncache.writeback=off on backing-file\n" - echo "$hmp_cmds" | run_qemu -drive "$drv_bkfile",cache.writeback=off -drive "$drv_bk" -drive "$drv_file" -drive "$drv_img" | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$drv_bkfile",cache.writeback=off -drive "$drv_bk" -drive "$drv_file" -drive "$drv_img" # Check cache.no-flush printf "\n\ncache.no-flush=on on blk\n" - echo "$hmp_cmds" | run_qemu -drive "$drv_bkfile" -drive "$drv_bk" -drive "$drv_file" -drive "$drv_img",cache.no-flush=on | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$drv_bkfile" -drive "$drv_bk" -drive "$drv_file" -drive "$drv_img",cache.no-flush=on printf "\ncache.no-flush=on on file\n" - echo "$hmp_cmds" | run_qemu -drive "$drv_bkfile" -drive "$drv_bk" -drive "$drv_file",cache.no-flush=on -drive "$drv_img" | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$drv_bkfile" -drive "$drv_bk" -drive "$drv_file",cache.no-flush=on -drive "$drv_img" printf "\ncache.no-flush=on on backing\n" - echo "$hmp_cmds" | run_qemu -drive "$drv_bkfile" -drive "$drv_bk",cache.no-flush=on -drive "$drv_file" -drive "$drv_img" | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$drv_bkfile" -drive "$drv_bk",cache.no-flush=on -drive "$drv_file" -drive "$drv_img" printf "\ncache.no-flush=on on backing-file\n" - echo "$hmp_cmds" | run_qemu -drive "$drv_bkfile",cache.no-flush=on -drive "$drv_bk" -drive "$drv_file" -drive "$drv_img" | grep -e "Cache" -e "[Cc]annot\|[Cc]ould not\|[Cc]an't" + echo "$qmp_cmds" | run_qemu_cache -drive "$drv_bkfile",cache.no-flush=on -drive "$drv_bk" -drive "$drv_file" -drive "$drv_img" } echo
@@ -273,10 +326,8 @@ echo # First check the inherited cache mode after opening the image. -hmp_cmds="info block image -info block file -info block backing -info block backing-file" +qmp_cmds="$qmp_query" +cache_nodes="image file backing backing-file" check_cache_all_separate
@@ -286,12 +337,9 @@ echo # Then trigger a reopen and check that the cache modes are still the same. -hmp_cmds="snapshot_blkdev -n blk $TEST_IMG.snap $IMGFMT -info block blk -info block image -info block file -info block backing -info block backing-file" +qmp_cmds="{ 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'blk', 'snapshot-file': '$TEST_IMG.snap', 'format': '$IMGFMT' } } +$qmp_query" +cache_nodes="blk image file backing backing-file" check_cache_all_separate
@@ -302,11 +350,9 @@ echo # This one actually changes the cache mode with the reopen. For this test, the # new cache mode is specified as flags, not as option. -hmp_cmds='qemu-io blk "reopen -c none" -info block image -info block file -info block backing -info block backing-file' +qmp_cmds="{ 'execute': 'x-qemu-io', 'arguments': { 'device': 'blk', 'command': 'reopen -c none' } } +$qmp_query" +cache_nodes="image file backing backing-file" check_cache_all_separate
@@ -322,12 +368,9 @@ echo echo "--- Basic reopen ---" echo -hmp_cmds='qemu-io none0 "reopen -o backing.cache.direct=on" -info block none0 -info block image -info block file -info block backing -info block backing-file' +qmp_cmds="{ 'execute': 'x-qemu-io', 'arguments': { 'device': 'none0', 'command': 'reopen -o backing.cache.direct=on' } } +$qmp_query" +cache_nodes="none0 image file backing backing-file" check_cache_all
@@ -341,15 +384,13 @@ echo # TODO Implement node-name support for 'qemu-io' HMP command for -c # Can use only -o to access child node options for now -hmp_cmds="qemu-io none0 \"reopen -o file.cache.direct=off,file.cache.no-flush=off\" -qemu-io none0 \"reopen -o backing.file.cache.direct=off,backing.file.cache.no-flush=on\" -qemu-io none0 \"reopen -c none\" -info block image -info block file -info block backing -info block backing-file" +qmp_cmds="{ 'execute': 'x-qemu-io', 'arguments': { 'device': 'none0', 'command': 'reopen -o file.cache.direct=off,file.cache.no-flush=off' } } +{ 'execute': 'x-qemu-io', 'arguments': { 'device': 'none0', 'command': 'reopen -o backing.file.cache.direct=off,backing.file.cache.no-flush=on' } } +{ 'execute': 'x-qemu-io', 'arguments': { 'device': 'none0', 'command': 'reopen -c none' } } +$qmp_query" +cache_nodes="image file backing backing-file" -echo "$hmp_cmds" | run_qemu -drive "$files","$ids" | grep "Cache" +echo "$qmp_cmds" | run_qemu_cache -drive "$files","$ids" echo echo "--- Alignment after changing O_DIRECT ---"
tests/qemu-iotests/142.out +20 -10
@@ -6,24 +6,34 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 backing_file=TEST_DIR/ === Simple test for all cache modes === Testing: -drive file=TEST_DIR/t.qcow2,cache=none -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) quit +QMP_VERSION +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} Testing: -drive file=TEST_DIR/t.qcow2,cache=directsync -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) quit +QMP_VERSION +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} Testing: -drive file=TEST_DIR/t.qcow2,cache=writeback -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) quit +QMP_VERSION +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} Testing: -drive file=TEST_DIR/t.qcow2,cache=writethrough -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) quit +QMP_VERSION +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} Testing: -drive file=TEST_DIR/t.qcow2,cache=unsafe -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) quit +QMP_VERSION +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} Testing: -drive file=TEST_DIR/t.qcow2,cache=invalid_value QEMU_PROG: -drive file=TEST_DIR/t.qcow2,cache=invalid_value: invalid cache option
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 54/88 qemu-iotests/146: migrate away from HMP
In reply to Marc-André LureauHMP is actually unused.
--- tests/qemu-iotests/146 | 5 ----- 1 file changed, 5 deletions(-)
tests/qemu-iotests/146 +0 -5
@@ -42,11 +42,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt vpc _supported_proto file _supported_os Linux -_require_hmp - - -qemu_comm_method="monitor" -silent= echo echo === Testing VPC Autodetect ===
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 55/88 qemu-iotests/117: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/117 | 5 ++--- tests/qemu-iotests/117.out | 8 +++----- 2 files changed, 5 insertions(+), 8 deletions(-)
tests/qemu-iotests/117 +2 -3
@@ -41,7 +41,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file fuse -_require_hmp _make_test_img 64k
@@ -66,8 +65,8 @@ _send_qemu_cmd $QEMU_HANDLE \ 'return' _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': 'qemu-io format \"write -P 42 0 64k\"' } }" \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'format', 'command': 'write -P 42 0 64k' } }" \ 'return' _send_qemu_cmd $QEMU_HANDLE \
tests/qemu-iotests/117.out +3 -5
@@ -12,11 +12,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65536 'driver': 'IMGFMT', 'file': 'protocol' } } {"return": {}} -{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': 'qemu-io format "write -P 42 0 64k"' } } -wrote 65536/65536 bytes at offset 0 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -{"return": ""} +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'format', 'command': 'write -P 42 0 64k' } } +{"return": {"human-readable-text": "wrote 65536/65536 bytes at offset 0\n64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} { 'execute': 'quit' } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}}
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 56/88 qemu-iotests/119: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/119 | 5 ++--- tests/qemu-iotests/119.out | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-)
tests/qemu-iotests/119 +2 -3
@@ -41,13 +41,12 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt raw _supported_proto nbd _supported_os Linux -_require_hmp _make_test_img 64M # This should not crash echo "{'execute': 'qmp_capabilities'} - {'execute': 'human-monitor-command', - 'arguments': {'command-line': 'qemu-io drv \"read -P 0 0 64k\"'}} + {'execute': 'x-qemu-io', + 'arguments': {'device': 'drv', 'command': 'read -P 0 0 64k'}} {'execute': 'quit'}" \ | $QEMU -nographic -drive id=drv,if=none,file="$TEST_IMG",driver=nbd \ -qmp stdio -nodefaults \
tests/qemu-iotests/119.out +1 -3
@@ -2,9 +2,7 @@ QA output created by 119 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 QMP_VERSION {"return": {}} -read 65536/65536 bytes at offset 0 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -{"return": ""} +{"return": {"human-readable-text": "read 65536/65536 bytes at offset 0\n64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}}
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 57/88 qemu-iotests/060: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/060 | 9 ++++----- tests/qemu-iotests/060.out | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-)
tests/qemu-iotests/060 +4 -5
@@ -56,7 +56,6 @@ _unsupported_imgopts 'compat=0.10' data_file \ # The repair process will create a large file - so check for availability first _require_large_file 64G -_require_hmp rt_offset=65536 # 0x10000 (XXX: just an assumption) rb_offset=131072 # 0x20000 (XXX: just an assumption)
@@ -450,8 +449,8 @@ echo _make_test_img 64M poke_file "$TEST_IMG" "$rt_offset" "\x00\x00\x00\x00\x00\x00\x00\x00" echo "{'execute': 'qmp_capabilities'} - {'execute': 'human-monitor-command', - 'arguments': {'command-line': 'qemu-io drive \"write 0 512\"'}} + {'execute': 'x-qemu-io', + 'arguments': {'device': 'drive', 'command': 'write 0 512'}} {'execute': 'quit'}" \ | $QEMU -qmp stdio -nographic -nodefaults \ -drive if=none,node-name=drive,file="$TEST_IMG",driver=qcow2 \
@@ -469,8 +468,8 @@ poke_file "$TEST_IMG" "$l1_offset" "\x00\x00\x00\x00\x2a\x2a\x2a\x2a" # Inactive images are effectively read-only images, so this should be a # non-fatal corruption (which does not modify the image) echo "{'execute': 'qmp_capabilities'} - {'execute': 'human-monitor-command', - 'arguments': {'command-line': 'qemu-io drive \"read 0 512\"'}} + {'execute': 'x-qemu-io', + 'arguments': {'device': 'drive', 'command': 'read 0 512'}} {'execute': 'quit'}" \ | $QEMU -qmp stdio -nographic -nodefaults \ -blockdev "{'node-name': 'drive',
tests/qemu-iotests/060.out +1 -1
@@ -419,7 +419,7 @@ qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps QMP_VERSION {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_IMAGE_CORRUPTED", "data": {"device": "none0", "msg": "Preventing invalid write on metadata (overlaps with refcount table)", "offset": 65536, "node-name": "drive", "fatal": true, "size": 65536}} -{"return": "Error: write failed: Input/output error\r\n"} +{"error": {"class": "GenericError", "desc": "write failed: Input/output error"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}}
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 58/88 qemu-iotests/071: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/071 | 31 ++++++++++++++++++------------- tests/qemu-iotests/071.out | 12 ++++-------- 2 files changed, 22 insertions(+), 21 deletions(-)
tests/qemu-iotests/071 +18 -13
@@ -43,7 +43,6 @@ _require_drivers blkdebug blkverify # blkdebug can only inject errors on bs->file, not on the data_file, # so this test does not work with external data files _unsupported_imgopts data_file -_require_hmp do_run_qemu() {
@@ -140,9 +139,10 @@ run_qemu <<EOF } } } -{ "execute": "human-monitor-command", +{ "execute": "x-qemu-io", "arguments": { - "command-line": 'qemu-io drive0-debug "read 0 512"' + "device": "drive0-debug", + "command": "read 0 512" } } { "execute": "quit" }
@@ -175,9 +175,10 @@ run_qemu <<EOF } } } -{ "execute": "human-monitor-command", +{ "execute": "x-qemu-io", "arguments": { - "command-line": 'qemu-io drive0-verify "read 0 512"' + "device": "drive0-verify", + "command": "read 0 512" } } { "execute": "quit" }
@@ -210,9 +211,10 @@ run_qemu <<EOF "raw": "drive0" } } -{ "execute": "human-monitor-command", +{ "execute": "x-qemu-io", "arguments": { - "command-line": 'qemu-io drive0-verify "read 0 512"' + "device": "drive0-verify", + "command": "read 0 512" } } { "execute": "quit" }
@@ -249,19 +251,22 @@ run_qemu <<EOF } } } -{ "execute": "human-monitor-command", +{ "execute": "x-qemu-io", "arguments": { - "command-line": 'qemu-io drive0-debug "read 0 512"' + "device": "drive0-debug", + "command": "read 0 512" } } -{ "execute": "human-monitor-command", +{ "execute": "x-qemu-io", "arguments": { - "command-line": 'qemu-io drive0-debug "write 0 512"' + "device": "drive0-debug", + "command": "write 0 512" } } -{ "execute": "human-monitor-command", +{ "execute": "x-qemu-io", "arguments": { - "command-line": 'qemu-io drive0-debug "read 0 512"' + "device": "drive0-debug", + "command": "read 0 512" } } { "execute": "quit" }
tests/qemu-iotests/071.out +4 -8
@@ -43,7 +43,7 @@ QMP_VERSION {"return": {}} {"return": {}} {"return": {}} -{"return": "Error: read failed: Input/output error\r\n"} +{"error": {"class": "GenericError", "desc": "read failed: Input/output error"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}}
@@ -75,13 +75,9 @@ QMP_VERSION {"return": {}} {"return": {}} {"return": {}} -read 512/512 bytes at offset 0 -512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -{"return": ""} -wrote 512/512 bytes at offset 0 -512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -{"return": ""} -{"return": "Error: read failed: Input/output error\r\n"} +{"return": {"human-readable-text": "read 512/512 bytes at offset 0\n512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"return": {"human-readable-text": "wrote 512/512 bytes at offset 0\n512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"error": {"class": "GenericError", "desc": "read failed: Input/output error"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} QEMU_PROG: Failed to flush the L2 table cache: Input/output error QEMU_PROG: Failed to flush the refcount block cache: Input/output error
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 59/88 qemu-iotests/081: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/081 | 11 ++++++----- tests/qemu-iotests/081.out | 8 ++------ 2 files changed, 8 insertions(+), 11 deletions(-)
tests/qemu-iotests/081 +6 -5
@@ -44,7 +44,6 @@ _supported_proto file _supported_os Linux _require_drivers quorum _require_devices virtio-scsi -_require_hmp do_run_qemu() {
@@ -138,9 +137,10 @@ run_qemu <<EOF ] } } -{ "execute": "human-monitor-command", +{ "execute": "x-qemu-io", "arguments": { - "command-line": 'qemu-io drive0-quorum "read -P 0x32 0 $size"' + "device": "drive0-quorum", + "command": "read -P 0x32 0 $size" } } { "execute": "quit" }
@@ -200,9 +200,10 @@ run_qemu \ <<EOF { "execute": "qmp_capabilities" } { - "execute": "human-monitor-command", + "execute": "x-qemu-io", "arguments": { - "command-line": 'qemu-io -d quorum-drive "read -P 0x32 0 $size"' + "qdev": "quorum-drive", + "command": "read -P 0x32 0 $size" } } { "execute": "quit" }
tests/qemu-iotests/081.out +2 -6
@@ -32,9 +32,7 @@ QMP_VERSION {"return": {}} {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "QUORUM_REPORT_BAD", "data": {"node-name": "drive2", "sectors-count": 20480, "sector-num": 0, "type": "read"}} -read 10485760/10485760 bytes at offset 0 -10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -{"return": ""} +{"return": {"human-readable-text": "read 10485760/10485760 bytes at offset 0\n10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}}
@@ -64,9 +62,7 @@ Testing: -blockdev file,node-name=file1,filename=TEST_DIR/1.IMGFMT -blockdev fil QMP_VERSION {"return": {}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "QUORUM_REPORT_BAD", "data": {"node-name": "file2", "sectors-count": 20480, "sector-num": 0, "type": "read"}} -read 10485760/10485760 bytes at offset 0 -10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -{"return": ""} +{"return": {"human-readable-text": "read 10485760/10485760 bytes at offset 0\n10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}}
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 60/88 qemu-iotests/102: migrate away from HMP
In reply to Marc-André LureauNo need to substitute qemu-io command.
--- tests/qemu-iotests/102 | 21 ++++++++++++++------- tests/qemu-iotests/102.out | 12 ++++++++---- 2 files changed, 22 insertions(+), 11 deletions(-)
tests/qemu-iotests/102 +14 -7
@@ -41,7 +41,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file fuse -_require_hmp IMG_SIZE=64K
@@ -67,18 +66,26 @@ echo _make_test_img $IMG_SIZE $QEMU_IO -c 'write 0 64k' "$TEST_IMG" | _filter_qemu_io -qemu_comm_method=monitor _launch_qemu -drive if=none,file="$TEST_IMG",id=drv0 +_launch_qemu -drive if=none,file="$TEST_IMG",id=drv0 -# Wait for a prompt to appear (so we know qemu has opened the image) -_send_qemu_cmd $QEMU_HANDLE '' '(qemu)' +_send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' $QEMU_IMG resize --shrink --image-opts \ "driver=raw,file.driver=file,file.filename=$TEST_IMG,file.locking=off" \ $((5 * 64 * 1024)) -_send_qemu_cmd $QEMU_HANDLE 'qemu-io drv0 map' 'allocated' \ - | sed -e 's/^(qemu).*qemu-io drv0 map...$/(qemu) qemu-io drv0 map/' -_send_qemu_cmd $QEMU_HANDLE 'quit' '' +_send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'drv0', 'command': 'map' } }" \ + 'return' + +_send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'quit' }" \ + 'return' + +wait=1 _cleanup_qemu # success, all done echo '*** done'
tests/qemu-iotests/102.out +8 -4
@@ -15,9 +15,13 @@ Offset Length File Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=65536 wrote 65536/65536 bytes at offset 0 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) +{ 'execute': 'qmp_capabilities' } +{"return": {}} Image resized. -(qemu) qemu-io drv0 map -64 KiB (0x10000) bytes allocated at offset 0 bytes (0x0) +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'drv0', 'command': 'map' } } +{"return": {"human-readable-text": "64 KiB (0x10000) bytes allocated at offset 0 bytes (0x0)\n"}} +{ 'execute': 'quit' } +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} *** done
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 61/88 qemu-iotests/091: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/091 | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-)
tests/qemu-iotests/091 +35 -10
@@ -48,7 +48,6 @@ _supported_fmt qcow2 _supported_proto file fuse _supported_os Linux _supported_cache_modes writethrough none writeback -_require_hmp _default_cache_mode none writeback size=1G
@@ -61,7 +60,6 @@ echo echo === Starting QEMU VM1 === echo -qemu_comm_method="monitor" _launch_qemu -drive file="${TEST_IMG}",cache=${CACHEMODE},aio=${AIOMODE},id=disk h1=$QEMU_HANDLE
@@ -77,26 +75,53 @@ echo === VM 1: Migrate from VM1 to VM2 === echo silent=yes -_send_qemu_cmd $h1 'qemu-io disk "write -P 0x22 0 4M"' "(qemu)" +_send_qemu_cmd $h1 \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' +_send_qemu_cmd $h2 \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' + +_send_qemu_cmd $h1 \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', 'command': 'write -P 0x22 0 4M' } }" \ + 'return' echo "vm1: qemu-io disk write complete" -_send_qemu_cmd $h1 "migrate \"exec: cat > '${MIG_FIFO}'\"" "(qemu)" +_send_qemu_cmd $h1 \ + "{ 'execute': 'migrate', + 'arguments': { 'uri': 'exec:cat > ${MIG_FIFO}' } }" \ + 'return' echo "vm1: live migration started" -qemu_cmd_repeat=20 _send_qemu_cmd $h1 "info migrate" "completed" +qemu_cmd_repeat=20 _send_qemu_cmd $h1 \ + "{ 'execute': 'query-migrate' }" \ + '"status": "completed"' echo "vm1: live migration completed" echo echo === VM 2: Post-migration, write to disk, verify running === echo -_send_qemu_cmd $h2 'qemu-io disk "write 4M 1M"' "(qemu)" +_send_qemu_cmd $h2 \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', 'command': 'write 4M 1M' } }" \ + 'return' echo "vm2: qemu-io disk write complete" -qemu_cmd_repeat=20 _send_qemu_cmd $h2 "info status" "running" +qemu_cmd_repeat=20 _send_qemu_cmd $h2 \ + "{ 'execute': 'query-status' }" \ + '"status": "running"' echo "vm2: qemu process running successfully" echo "vm2: flush io, and quit" -_send_qemu_cmd $h2 'qemu-io disk flush' "(qemu)" -_send_qemu_cmd $h2 'quit' "" -_send_qemu_cmd $h1 'quit' "" +_send_qemu_cmd $h2 \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', 'command': 'flush' } }" \ + 'return' +_send_qemu_cmd $h2 \ + "{ 'execute': 'quit' }" \ + 'return' +_send_qemu_cmd $h1 \ + "{ 'execute': 'quit' }" \ + 'return' wait=yes _cleanup_qemu >/dev/null
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 62/88 qemu-iotests/120: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/120 | 5 ++--- tests/qemu-iotests/120.out | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-)
tests/qemu-iotests/120 +2 -3
@@ -42,13 +42,12 @@ _supported_fmt generic _supported_proto file fuse _unsupported_fmt luks _require_drivers raw -_require_hmp _make_test_img 64M echo "{'execute': 'qmp_capabilities'} - {'execute': 'human-monitor-command', - 'arguments': {'command-line': 'qemu-io drv \"write -P 42 0 64k\"'}} + {'execute': 'x-qemu-io', + 'arguments': {'device': 'drv', 'command': 'write -P 42 0 64k'}} {'execute': 'quit'}" \ | $QEMU -qmp stdio -nographic -nodefaults \ -drive id=drv,if=none,file="$TEST_IMG",driver=raw,file.driver=$IMGFMT \
tests/qemu-iotests/120.out +1 -3
@@ -2,9 +2,7 @@ QA output created by 120 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 QMP_VERSION {"return": {}} -wrote 65536/65536 bytes at offset 0 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -{"return": ""} +{"return": {"human-readable-text": "wrote 65536/65536 bytes at offset 0\n64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} {"return": {}} read 65536/65536 bytes at offset 0
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 63/88 qemu-iotests/161: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/161 | 19 +++++++++---------- tests/qemu-iotests/161.out | 24 ++++++++++++------------ 2 files changed, 21 insertions(+), 22 deletions(-)
tests/qemu-iotests/161 +9 -10
@@ -45,7 +45,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 qed _supported_proto file fuse _supported_os Linux -_require_hmp IMG_SIZE=1M
@@ -65,9 +64,9 @@ _send_qemu_cmd $QEMU_HANDLE \ 'return' _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': - 'qemu-io none0 \"reopen -o backing.detect-zeroes=on\"' } }" \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'none0', + 'command': 'reopen -o backing.detect-zeroes=on' } }" \ "return" _cleanup_qemu
@@ -93,9 +92,9 @@ _send_qemu_cmd $QEMU_HANDLE \ sleep 0.5 _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': - 'qemu-io none0 \"reopen -o backing.detect-zeroes=on\"' } }" \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'none0', + 'command': 'reopen -o backing.detect-zeroes=on' } }" \ "return" _cleanup_qemu
@@ -126,9 +125,9 @@ _send_qemu_cmd $QEMU_HANDLE \ sleep 0.5 _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': - 'qemu-io none0 \"reopen -o backing.detect-zeroes=on\"' } }" \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'none0', + 'command': 'reopen -o backing.detect-zeroes=on' } }" \ "return" _cleanup_qemu
tests/qemu-iotests/161.out +12 -12
@@ -7,10 +7,10 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t. { 'execute': 'qmp_capabilities' } {"return": {}} -{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': - 'qemu-io none0 "reopen -o backing.detect-zeroes=on"' } } -{"return": ""} +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'none0', + 'command': 'reopen -o backing.detect-zeroes=on' } } +{"return": {"human-readable-text": ""}} *** Stream and then change an option on the backing file
@@ -21,15 +21,15 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t. {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "none0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "none0"}} {"return": {}} -{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': - 'qemu-io none0 "reopen -o backing.detect-zeroes=on"' } } +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'none0', + 'command': 'reopen -o backing.detect-zeroes=on' } } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "none0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "none0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "none0", "len": 1048576, "offset": 1048576, "speed": 0, "type": "stream"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "none0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "none0"}} -{"return": ""} +{"return": {"human-readable-text": ""}} *** Commit and then change an option on the backing file
@@ -43,13 +43,13 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t. {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "created", "id": "none0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "none0"}} {"return": {}} -{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': - 'qemu-io none0 "reopen -o backing.detect-zeroes=on"' } } +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'none0', + 'command': 'reopen -o backing.detect-zeroes=on' } } {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "none0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "none0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "none0", "len": 1048576, "offset": 1048576, "speed": 0, "type": "commit"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "none0"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "none0"}} -{"return": ""} +{"return": {"human-readable-text": ""}} *** done
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 64/88 qemu-iotests/249: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/249 | 19 +++++++++---------- tests/qemu-iotests/249.out | 18 +++++++++--------- 2 files changed, 18 insertions(+), 19 deletions(-)
tests/qemu-iotests/249 +9 -10
@@ -45,7 +45,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 qed _supported_proto file fuse _supported_os Linux -_require_hmp IMG_SIZE=1M
@@ -68,9 +67,9 @@ echo echo '=== Send a write command to a drive opened in read-only mode (1)' echo _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': {'command-line': 'qemu-io none0 \"aio_write 0 2k\"'}}" \ - 'return' + "{ 'execute': 'x-qemu-io', + 'arguments': {'device': 'none0', 'command': 'aio_write 0 2k'}}" \ + 'error' echo echo '=== Run block-commit on base using an invalid filter node name'
@@ -85,9 +84,9 @@ echo echo '=== Send a write command to a drive opened in read-only mode (2)' echo _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': {'command-line': 'qemu-io none0 \"aio_write 0 2k\"'}}" \ - 'return' + "{ 'execute': 'x-qemu-io', + 'arguments': {'device': 'none0', 'command': 'aio_write 0 2k'}}" \ + 'error' echo echo '=== Run block-commit on base using the default filter node name'
@@ -105,9 +104,9 @@ echo echo '=== Send a write command to a drive opened in read-only mode (3)' echo _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': {'command-line': 'qemu-io none0 \"aio_write 0 2k\"'}}" \ - 'return' + "{ 'execute': 'x-qemu-io', + 'arguments': {'device': 'none0', 'command': 'aio_write 0 2k'}}" \ + 'error' _cleanup_qemu
tests/qemu-iotests/249.out +9 -9
@@ -7,9 +7,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t. === Send a write command to a drive opened in read-only mode (1) -{ 'execute': 'human-monitor-command', - 'arguments': {'command-line': 'qemu-io none0 "aio_write 0 2k"'}} -{"return": "Error: Block node is read-onlyrn"} +{ 'execute': 'x-qemu-io', + 'arguments': {'device': 'none0', 'command': 'aio_write 0 2k'}} +{"error": {"class": "GenericError", "desc": "Block node is read-only"}} === Run block-commit on base using an invalid filter node name
@@ -22,9 +22,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t. === Send a write command to a drive opened in read-only mode (2) -{ 'execute': 'human-monitor-command', - 'arguments': {'command-line': 'qemu-io none0 "aio_write 0 2k"'}} -{"return": "Error: Block node is read-onlyrn"} +{ 'execute': 'x-qemu-io', + 'arguments': {'device': 'none0', 'command': 'aio_write 0 2k'}} +{"error": {"class": "GenericError", "desc": "Block node is read-only"}} === Run block-commit on base using the default filter node name
@@ -41,7 +41,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 backing_file=TEST_DIR/t. === Send a write command to a drive opened in read-only mode (3) -{ 'execute': 'human-monitor-command', - 'arguments': {'command-line': 'qemu-io none0 "aio_write 0 2k"'}} -{"return": "Error: Block node is read-onlyrn"} +{ 'execute': 'x-qemu-io', + 'arguments': {'device': 'none0', 'command': 'aio_write 0 2k'}} +{"error": {"class": "GenericError", "desc": "Block node is read-only"}} *** done
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 65/88 qemu-iotests/156: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/156 | 37 ++++++++++++++-------------- tests/qemu-iotests/156.out | 60 +++++++++++++++++++--------------------------- 2 files changed, 42 insertions(+), 55 deletions(-)
tests/qemu-iotests/156 +18 -19
@@ -53,7 +53,6 @@ _supported_fmt qcow2 qed _supported_proto file # Copying files around with cp does not work with external data files _unsupported_imgopts data_file -_require_hmp # Create source disk TEST_IMG="$TEST_IMG.backing" _make_test_img 1M
@@ -80,9 +79,9 @@ _send_qemu_cmd $QEMU_HANDLE \ # Write something to the snapshot _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': - 'qemu-io source \"write -P 3 128k 128k\"' } }" \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'source', + 'command': 'write -P 3 128k 128k' } }" \ 'return' # Create target image
@@ -105,9 +104,9 @@ _send_qemu_cmd $QEMU_HANDLE \ # Write some more _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': - 'qemu-io source \"write -P 4 192k 64k\"' } }" \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'source', + 'command': 'write -P 4 192k 64k' } }" \ 'return' # Copy source backing chain to the target before completing the job
@@ -134,27 +133,27 @@ echo # Check online disk contents _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': - 'qemu-io source \"read -P 1 0k 64k\"' } }" \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'source', + 'command': 'read -P 1 0k 64k' } }" \ 'return' _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': - 'qemu-io source \"read -P 2 64k 64k\"' } }" \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'source', + 'command': 'read -P 2 64k 64k' } }" \ 'return' _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': - 'qemu-io source \"read -P 3 128k 64k\"' } }" \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'source', + 'command': 'read -P 3 128k 64k' } }" \ 'return' _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': - 'qemu-io source \"read -P 4 192k 64k\"' } }" \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'source', + 'command': 'read -P 4 192k 64k' } }" \ 'return' echo
tests/qemu-iotests/156.out +24 -36
78 lines not on this page · raw message
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 66/88 qemu-iotests/write-zeroes-unmap: migrate away from HMP
In reply to Marc-André LureauIntroduce qmp_qemu_io() to help with sending just one x-qemu-io command.
--- tests/qemu-iotests/tests/write-zeroes-unmap | 42 +++++++------ tests/qemu-iotests/tests/write-zeroes-unmap.out | 80 ++++++++++++------------- 2 files changed, 64 insertions(+), 58 deletions(-)
tests/qemu-iotests/tests/write-zeroes-unmap +24 -18
@@ -33,27 +33,33 @@ _supported_fmt raw _supported_proto file _supported_os Linux _require_disk_usage -_require_hmp create_test_image() { _make_test_img -f $IMGFMT 1m } filter_command() { - _filter_testdir | _filter_qemu_io | _filter_qemu | _filter_hmp + _filter_qmp | _filter_testdir | _filter_qemu_io | _filter_qemu } print_disk_usage() { du -sh $TEST_IMG | _filter_testdir } +qmp_qemu_io() { + printf '%s\n' \ + '{"execute":"qmp_capabilities"}' \ + "{\"execute\":\"x-qemu-io\",\"arguments\":{\"device\":\"none0\",\"command\":\"$1\"}}" \ + '{"execute":"quit"}' +} + echo echo "=== defaults - write zeros ===" echo create_test_image -echo -e 'qemu-io none0 "write -z 0 1m"\nquit' \ - | $QEMU -monitor stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT \ +qmp_qemu_io "write -z 0 1m" \ + | $QEMU -qmp stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT \ | filter_command print_disk_usage
@@ -62,8 +68,8 @@ echo "=== defaults - write zeros unmap ===" echo create_test_image -echo -e 'qemu-io none0 "write -zu 0 1m"\nquit' \ - | $QEMU -monitor stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT \ +qmp_qemu_io "write -zu 0 1m" \ + | $QEMU -qmp stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT \ | filter_command print_disk_usage
@@ -73,8 +79,8 @@ echo "=== defaults - write actual zeros ===" echo create_test_image -echo -e 'qemu-io none0 "write -P 0 0 1m"\nquit' \ - | $QEMU -monitor stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT \ +qmp_qemu_io "write -P 0 0 1m" \ + | $QEMU -qmp stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT \ | filter_command print_disk_usage
@@ -83,8 +89,8 @@ echo "=== discard=off - write zeroes unmap ===" echo create_test_image -echo -e 'qemu-io none0 "write -zu 0 1m"\nquit' \ - | $QEMU -monitor stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT,discard=off \ +qmp_qemu_io "write -zu 0 1m" \ + | $QEMU -qmp stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT,discard=off \ | filter_command print_disk_usage
@@ -93,8 +99,8 @@ echo "=== detect-zeroes=on - write actual zeros ===" echo create_test_image -echo -e 'qemu-io none0 "write -P 0 0 1m"\nquit' \ - | $QEMU -monitor stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT,detect-zeroes=on \ +qmp_qemu_io "write -P 0 0 1m" \ + | $QEMU -qmp stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT,detect-zeroes=on \ | filter_command print_disk_usage
@@ -103,8 +109,8 @@ echo "=== detect-zeroes=on,discard=on - write actual zeros ===" echo create_test_image -echo -e 'qemu-io none0 "write -P 0 0 1m"\nquit' \ - | $QEMU -monitor stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT,detect-zeroes=on,discard=on \ +qmp_qemu_io "write -P 0 0 1m" \ + | $QEMU -qmp stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT,detect-zeroes=on,discard=on \ | filter_command print_disk_usage
@@ -113,8 +119,8 @@ echo "=== discard=on - write zeroes ===" echo create_test_image -echo -e 'qemu-io none0 "write -z 0 1m"\nquit' \ - | $QEMU -monitor stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT,discard=on \ +qmp_qemu_io "write -z 0 1m" \ + | $QEMU -qmp stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT,discard=on \ | filter_command print_disk_usage
@@ -123,7 +129,7 @@ echo "=== discard=on - write zeroes unmap ===" echo create_test_image -echo -e 'qemu-io none0 "write -zu 0 1m"\nquit' \ - | $QEMU -monitor stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT,discard=on \ +qmp_qemu_io "write -zu 0 1m" \ + | $QEMU -qmp stdio -drive if=none,file=$TEST_IMG,format=$IMGFMT,discard=on \ | filter_command print_disk_usage
tests/qemu-iotests/tests/write-zeroes-unmap.out +40 -40
119 lines not on this page · raw message
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 67/88 qemu-iotests/luks-detached-header: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/tests/luks-detached-header | 49 +++++++-------------------- 1 file changed, 13 insertions(+), 36 deletions(-)
tests/qemu-iotests/tests/luks-detached-header +13 -36
@@ -266,52 +266,29 @@ class TestDetachedLUKSHeader(QMPTestCase): # (Pattern verification will be checked by tearDown()) # Normal LUKS disk - result = self.vm.qmp_log( - "human-monitor-command", - command_line='qemu-io luks-1-format "write -P 40 0 64k"', - ) - self.assert_qmp(result, "return", "") + self.vm.qmp_qemu_io("luks-1-format", "write -P 40 0 64k", + use_log=True) - result = self.vm.qmp_log( - "human-monitor-command", - command_line='qemu-io luks-1-format "read -P 40 0 64k"', - ) - self.assert_qmp(result, "return", "") + self.vm.qmp_qemu_io("luks-1-format", "read -P 40 0 64k", + use_log=True) # Detached LUKS header with raw payload - cmd = 'qemu-io luks-2-payload-raw-format "write -P 41 0 64k"' - result = self.vm.qmp( - "human-monitor-command", - command_line=cmd - ) - self.assert_qmp(result, "return", "") + self.vm.qmp_qemu_io("luks-2-payload-raw-format", + "write -P 41 0 64k") - cmd = 'qemu-io luks-2-payload-raw-format "read -P 41 0 64k"' - result = self.vm.qmp( - "human-monitor-command", - command_line=cmd - ) - self.assert_qmp(result, "return", "") + self.vm.qmp_qemu_io("luks-2-payload-raw-format", + "read -P 41 0 64k") # Detached LUKS header with qcow2 payload - cmd = 'qemu-io luks-3-payload-qcow2-format "write -P 42 0 64k"' - result = self.vm.qmp( - "human-monitor-command", - command_line=cmd - ) - self.assert_qmp(result, "return", "") + self.vm.qmp_qemu_io("luks-3-payload-qcow2-format", + "write -P 42 0 64k") - cmd = 'qemu-io luks-3-payload-qcow2-format "read -P 42 0 64k"' - result = self.vm.qmp( - "human-monitor-command", - command_line=cmd - ) - self.assert_qmp(result, "return", "") + self.vm.qmp_qemu_io("luks-3-payload-qcow2-format", + "read -P 42 0 64k") self.vm.shutdown() if __name__ == "__main__": # Test image creation and I/O - iotests.main(supported_fmts=["luks"], supported_protocols=["file"], - require_hmp=True) + iotests.main(supported_fmts=["luks"], supported_protocols=["file"])
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
Re: [PATCH 67/88] qemu-iotests/luks-detached-header: migrate away from HMP
Thks, Yong
Quoted 80 lines · Marc-André Lureau
Signed-off-by Marc-André Lureau <[email protected]>--- tests/qemu-iotests/tests/luks-detached-header | 49 +++++++-------------------- 1 file changed, 13 insertions(+), 36 deletions(-)tests/qemu-iotests/tests/luks-detached-header +13
-37@@ -266,52 +266,29 @@ class TestDetachedLUKSHeader(QMPTestCase): # (Pattern verification will be checked by tearDown()) # Normal LUKS disk - result = self.vm.qmp_log( - "human-monitor-command", - command_line='qemu-io luks-1-format "write -P 40 0 64k"', - ) - self.assert_qmp(result, "return", "") + self.vm.qmp_qemu_io("luks-1-format", "write -P 40 0 64k", + use_log=True) - result = self.vm.qmp_log( - "human-monitor-command", - command_line='qemu-io luks-1-format "read -P 40 0 64k"', - ) - self.assert_qmp(result, "return", "") + self.vm.qmp_qemu_io("luks-1-format", "read -P 40 0 64k", + use_log=True) # Detached LUKS header with raw payload - cmd = 'qemu-io luks-2-payload-raw-format "write -P 41 0 64k"' - result = self.vm.qmp( - "human-monitor-command", - command_line=cmd - ) - self.assert_qmp(result, "return", "") + self.vm.qmp_qemu_io("luks-2-payload-raw-format", + "write -P 41 0 64k") - cmd = 'qemu-io luks-2-payload-raw-format "read -P 41 0 64k"' - result = self.vm.qmp( - "human-monitor-command", - command_line=cmd - ) - self.assert_qmp(result, "return", "") + self.vm.qmp_qemu_io("luks-2-payload-raw-format", + "read -P 41 0 64k") # Detached LUKS header with qcow2 payload - cmd = 'qemu-io luks-3-payload-qcow2-format "write -P 42 0 64k"' - result = self.vm.qmp( - "human-monitor-command", - command_line=cmd - ) - self.assert_qmp(result, "return", "") + self.vm.qmp_qemu_io("luks-3-payload-qcow2-format", + "write -P 42 0 64k") - cmd = 'qemu-io luks-3-payload-qcow2-format "read -P 42 0 64k"' - result = self.vm.qmp( - "human-monitor-command", - command_line=cmd - ) - self.assert_qmp(result, "return", "") + self.vm.qmp_qemu_io("luks-3-payload-qcow2-format", + "read -P 42 0 64k") self.vm.shutdown() if __name__ == "__main__": # Test image creation and I/O - iotests.main(supported_fmts=["luks"], supported_protocols=["file"], - require_hmp=True) + iotests.main(supported_fmts=["luks"], supported_protocols=["file"]) --2.56.0.rc0.29.g47ce80527c56
PATCH 68/88 qemu-iotests/qcow2-internal-snapshots: migrate away from HMP
In reply to Marc-André LureauReplace the HMP-based test infrastructure with QMP using common.qemu.
The old _qemu() function piped HMP commands (savevm, loadvm, delvm, qemu-io) through a monitor stdio pipe. Replace it with interactive QMP control via _launch_qemu / _send_qemu_cmd, using the job-based QMP commands snapshot-save, snapshot-load, and snapshot-delete.
These snapshot commands use the JOB_MANUAL_DISMISS flag, so jobs remain in the "concluded" state until explicitly dismissed. The test handles this through two helpers:
- _do_snapshot_cmd(): captures noisy QMP events (JOB_STATUS_CHANGE, STOP, RESUME) during the snapshot operation, silently waits for the job to reach "concluded", then dismisses it with job-dismiss.
- _do_snapshot_error(): same flow, but before dismissing, queries the concluded job with query-jobs to retrieve the error message. This preserves the error verification that HMP provided natively through its text output.
I/O operations use x-qemu-io via _do_qemu_io(). CLI error cases (e.g. conflicting -loadvm with -incoming defer or -preconfig) invoke QEMU directly with stderr redirected, since those errors are emitted before QMP is available.
--- tests/qemu-iotests/tests/qcow2-internal-snapshots | 226 +++++++++++++++------ .../tests/qcow2-internal-snapshots.out | 175 ++++++++++------ 2 files changed, 284 insertions(+), 117 deletions(-)
tests/qemu-iotests/tests/qcow2-internal-snapshots +169 -57
@@ -29,13 +29,16 @@ status=1 # failure is the default! _cleanup() { + _cleanup_qemu _cleanup_test_img } trap "_cleanup; exit \$status" 0 1 2 3 15 # get standard environment, filters and checks -. ../common.rc -. ../common.filter +cd .. +. ./common.rc +. ./common.filter +. ./common.qemu # This tests qcow2-specific low-level functionality _supported_fmt qcow2
@@ -43,20 +46,78 @@ _supported_proto file # Internal snapshots are (currently) impossible with refcount_bits=1, # and generally impossible with external data files _unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file -_require_hmp IMG_SIZE=64M -_qemu() +QEMU_ARGS="-no-shutdown -nodefaults \ + -blockdev file,filename=$TEST_IMG,node-name=disk0-file \ + -blockdev $IMGFMT,file=disk0-file,node-name=disk0 \ + -object iothread,id=iothread0 \ + -device virtio-scsi,iothread=iothread0 \ + -device scsi-hd,drive=disk0,share-rw=on" + +_do_qemu_io() { - $QEMU -no-shutdown -nographic -monitor stdio -serial none \ - -blockdev file,filename="$TEST_IMG",node-name=disk0-file \ - -blockdev "$IMGFMT",file=disk0-file,node-name=disk0 \ - -object iothread,id=iothread0 \ - -device virtio-scsi,iothread=iothread0 \ - -device scsi-hd,drive=disk0,share-rw=on \ - "$@" 2>&1 |\ - _filter_qemu | _filter_hmp | _filter_qemu_io + _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk0', + 'command': '$1' } }" \ + 'return' +} + +_do_snapshot_cmd() +{ + local cmd="$1" job_id="$2" + capture_events="JOB_STATUS_CHANGE STOP RESUME" \ + _send_qemu_cmd $QEMU_HANDLE "$cmd" 'return' + silent=yes _send_qemu_cmd $QEMU_HANDLE '' '"concluded"' + silent=yes capture_events="JOB_STATUS_CHANGE" \ + _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'job-dismiss', + 'arguments': { 'id': '$job_id' } }" \ + 'return' +} + +_do_snapshot_save() +{ + _do_snapshot_cmd \ + "{ 'execute': 'snapshot-save', + 'arguments': { 'job-id': '$2', 'tag': '$1', + 'vmstate': 'disk0', + 'devices': [\"disk0\"] } }" "$2" +} + +_do_snapshot_load() +{ + _do_snapshot_cmd \ + "{ 'execute': 'snapshot-load', + 'arguments': { 'job-id': '$2', 'tag': '$1', + 'vmstate': 'disk0', + 'devices': [\"disk0\"] } }" "$2" +} + +_do_snapshot_delete() +{ + _do_snapshot_cmd \ + "{ 'execute': 'snapshot-delete', + 'arguments': { 'job-id': '$2', 'tag': '$1', + 'devices': [\"disk0\"] } }" "$2" +} + +_do_snapshot_error() +{ + local cmd="$1" job_id="$2" + capture_events="JOB_STATUS_CHANGE STOP RESUME" \ + _send_qemu_cmd $QEMU_HANDLE "$cmd" 'return' + silent=yes _send_qemu_cmd $QEMU_HANDLE '' '"concluded"' + _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'query-jobs' }" \ + 'return' + silent=yes capture_events="JOB_STATUS_CHANGE" \ + _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'job-dismiss', + 'arguments': { 'id': '$job_id' } }" \ + 'return' } _make_test_img $IMG_SIZE
@@ -65,14 +126,16 @@ echo echo "=== Write some data, take a snapshot and overwrite part of it ===" echo -{ - echo 'qemu-io disk0 "write -P0x11 0 1M"' - # Give qemu some time to boot before saving the VM state - sleep 0.5 - echo "savevm snap0" - echo 'qemu-io disk0 "write -P0x22 0 512k"' - echo "quit" -} | _qemu +_launch_qemu $QEMU_ARGS +_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'qmp_capabilities' }" 'return' + +_do_qemu_io "write -P0x11 0 1M" +_do_snapshot_save snap0 save0 +_do_qemu_io "write -P0x22 0 512k" + +capture_events="JOB_STATUS_CHANGE SHUTDOWN" \ +_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'quit' }" 'return' +wait=1 _cleanup_qemu echo $QEMU_IMG snapshot -l "$TEST_IMG" | _filter_date | _filter_vmstate_size
@@ -82,26 +145,29 @@ echo echo "=== Verify that loading the snapshot reverts to the old content ===" echo -{ - # -loadvm reverted the write from the previous QEMU instance - echo 'qemu-io disk0 "read -P0x11 0 1M"' +# -loadvm reverts the write from the previous QEMU instance +_launch_qemu $QEMU_ARGS -loadvm snap0 +_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'qmp_capabilities' }" 'return' - # Verify that it works without restarting QEMU, too - echo 'qemu-io disk0 "write -P0x33 512k 512k"' - echo "loadvm snap0" - echo 'qemu-io disk0 "read -P0x11 0 1M"' +_do_qemu_io "read -P0x11 0 1M" - # Verify COW by writing a partial cluster - echo 'qemu-io disk0 "write -P0x33 63k 2k"' - echo 'qemu-io disk0 "read -P0x11 0 63k"' - echo 'qemu-io disk0 "read -P0x33 63k 2k"' - echo 'qemu-io disk0 "read -P0x11 65k 63k"' +# Verify that it works without restarting QEMU, too +_do_qemu_io "write -P0x33 512k 512k" +_do_snapshot_load snap0 load0 +_do_qemu_io "read -P0x11 0 1M" - # Take a second snapshot - echo "savevm snap1" +# Verify COW by writing a partial cluster +_do_qemu_io "write -P0x33 63k 2k" +_do_qemu_io "read -P0x11 0 63k" +_do_qemu_io "read -P0x33 63k 2k" +_do_qemu_io "read -P0x11 65k 63k" - echo "quit" -} | _qemu -loadvm snap0 +# Take a second snapshot +_do_snapshot_save snap1 save1 + +capture_events="JOB_STATUS_CHANGE SHUTDOWN" \ +_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'quit' }" 'return' +wait=1 _cleanup_qemu echo $QEMU_IMG snapshot -l "$TEST_IMG" | _filter_date | _filter_vmstate_size
@@ -123,15 +189,19 @@ $QEMU_IO \ echo echo "=== Deleting snapshots ===" echo -{ - # The active layer stays unaffected by deleting the snapshot - echo "delvm snap1" - echo 'qemu-io disk0 "read -P0x11 0 63k"' - echo 'qemu-io disk0 "read -P0x33 63k 2k"' - echo 'qemu-io disk0 "read -P0x11 65k 63k"' - echo "quit" -} | _qemu +_launch_qemu $QEMU_ARGS +_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'qmp_capabilities' }" 'return' + +# The active layer stays unaffected by deleting the snapshot +_do_snapshot_delete snap1 del0 +_do_qemu_io "read -P0x11 0 63k" +_do_qemu_io "read -P0x33 63k 2k" +_do_qemu_io "read -P0x11 65k 63k" + +capture_events="JOB_STATUS_CHANGE SHUTDOWN" \ +_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'quit' }" 'return' +wait=1 _cleanup_qemu echo
@@ -143,27 +213,69 @@ echo "=== Error cases ===" echo # snap1 should not exist any more -_qemu -loadvm snap1 +$QEMU -no-shutdown -nographic -serial none -nodefaults \ + -blockdev file,filename="$TEST_IMG",node-name=disk0-file \ + -blockdev "$IMGFMT",file=disk0-file,node-name=disk0 \ + -object iothread,id=iothread0 \ + -device virtio-scsi,iothread=iothread0 \ + -device scsi-hd,drive=disk0,share-rw=on \ + -loadvm snap1 2>&1 | _filter_qemu echo -{ - echo "loadvm snap1" - echo "quit" -} | _qemu +_launch_qemu $QEMU_ARGS +_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'qmp_capabilities' }" 'return' +_do_snapshot_error \ + "{ 'execute': 'snapshot-load', + 'arguments': { 'job-id': 'load1', 'tag': 'snap1', + 'vmstate': 'disk0', + 'devices': [\"disk0\"] } }" load1 +capture_events="JOB_STATUS_CHANGE SHUTDOWN" \ +_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'quit' }" 'return' +wait=1 _cleanup_qemu # Snapshot operations and inactive images are incompatible echo -_qemu -loadvm snap0 -incoming defer -{ - echo "loadvm snap0" - echo "delvm snap0" - echo "savevm snap1" - echo "quit" -} | _qemu -incoming defer +$QEMU -no-shutdown -nographic -serial none -nodefaults \ + -blockdev file,filename="$TEST_IMG",node-name=disk0-file \ + -blockdev "$IMGFMT",file=disk0-file,node-name=disk0 \ + -object iothread,id=iothread0 \ + -device virtio-scsi,iothread=iothread0 \ + -device scsi-hd,drive=disk0,share-rw=on \ + -loadvm snap0 -incoming defer 2>&1 | _filter_qemu + +_launch_qemu $QEMU_ARGS -incoming defer +_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'qmp_capabilities' }" 'return' + +_do_snapshot_error \ + "{ 'execute': 'snapshot-load', + 'arguments': { 'job-id': 'load2', 'tag': 'snap0', + 'vmstate': 'disk0', + 'devices': [\"disk0\"] } }" load2 + +_do_snapshot_error \ + "{ 'execute': 'snapshot-delete', + 'arguments': { 'job-id': 'del2', 'tag': 'snap0', + 'devices': [\"disk0\"] } }" del2 + +_do_snapshot_error \ + "{ 'execute': 'snapshot-save', + 'arguments': { 'job-id': 'save2', 'tag': 'snap1', + 'vmstate': 'disk0', + 'devices': [\"disk0\"] } }" save2 + +capture_events="JOB_STATUS_CHANGE SHUTDOWN" \ +_send_qemu_cmd $QEMU_HANDLE "{ 'execute': 'quit' }" 'return' +wait=1 _cleanup_qemu # -loadvm and -preconfig are incompatible echo -_qemu -loadvm snap0 -preconfig +$QEMU -no-shutdown -nographic -serial none -nodefaults \ + -blockdev file,filename="$TEST_IMG",node-name=disk0-file \ + -blockdev "$IMGFMT",file=disk0-file,node-name=disk0 \ + -object iothread,id=iothread0 \ + -device virtio-scsi,iothread=iothread0 \ + -device scsi-hd,drive=disk0,share-rw=on \ + -loadvm snap0 -preconfig 2>&1 | _filter_qemu # success, all done echo "*** done"
tests/qemu-iotests/tests/qcow2-internal-snapshots.out +115 -60
202 lines not on this page · raw message
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 69/88 qemu-iotests/185: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/185 | 15 ++++++--------- tests/qemu-iotests/185.out | 10 ++++------ 2 files changed, 10 insertions(+), 15 deletions(-)
tests/qemu-iotests/185 +6 -9
@@ -50,7 +50,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file _supported_os Linux -_require_hmp _flaky_test https://gitlab.com/qemu-project/qemu/-/issues/3270 size=$((64 * 1048576))
@@ -80,9 +79,9 @@ _send_qemu_cmd $h \ "return" _send_qemu_cmd $h \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': - 'qemu-io disk \"write 0 4M\"' } }" \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', + 'command': 'write 0 4M' } }" \ "return" _send_qemu_cmd $h \
@@ -307,15 +306,13 @@ wait_for_job_and_quit() { echo '--- Writing data to the virtio-blk device ---' for ofs in $(seq 0 $step $((size - step))); do - qemu_io_cmd="qemu-io -d vblk/virtio-backend " - qemu_io_cmd+="\\\"aio_write $ofs $cluster_size\\\"" - # Do not include these requests in the reference output # (it's just too much) silent=yes _send_qemu_cmd $h \ - "{\"execute\": \"human-monitor-command\", + "{\"execute\": \"x-qemu-io\", \"arguments\": { - \"command-line\": \"$qemu_io_cmd\" + \"qdev\": \"vblk/virtio-backend\", + \"command\": \"aio_write $ofs $cluster_size\" }}" \ 'return' done
tests/qemu-iotests/185.out +4 -6
@@ -15,12 +15,10 @@ Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=67108864 'mode': 'absolute-paths' } } Formatting 'TEST_DIR/t.qcow2.mid', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=67108864 backing_file=TEST_DIR/t.qcow2.base backing_fmt=qcow2 lazy_refcounts=off refcount_bits=16 {"return": {}} -{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': - 'qemu-io disk "write 0 4M"' } } -wrote 4194304/4194304 bytes at offset 0 -4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -{"return": ""} +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', + 'command': 'write 0 4M' } } +{"return": {"human-readable-text": "wrote 4194304/4194304 bytes at offset 0\n4 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} { 'execute': 'blockdev-snapshot-sync', 'arguments': { 'device': 'disk', 'snapshot-file': 'TEST_DIR/t.IMGFMT',
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 70/88 qemu-iotests/246: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/246 | 11 +++++------ tests/qemu-iotests/246.out | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-)
tests/qemu-iotests/246 +5 -6
@@ -24,8 +24,7 @@ import iotests from iotests import log iotests.script_initialize(supported_fmts=['qcow2'], - unsupported_imgopts=['compat'], - require_hmp=True) + unsupported_imgopts=['compat']) size = 64 * 1024 * 1024 * 1024 gran_small = 32 * 1024 gran_large = 128 * 1024
@@ -69,8 +68,8 @@ with iotests.FilePath('img') as img_path, \ log('--- Adding new bitmap, growing image, and adding 2nd new bitmap ---') vm.qmp_log("block-dirty-bitmap-add", node="drive0", name="New", persistent=True) - vm.qmp_log("human-monitor-command", - command_line="block_resize drive0 70G") + vm.qmp_log("block_resize", device="drive0", + size=70 * 1024 * 1024 * 1024) vm.qmp_log("block-dirty-bitmap-add", node="drive0", name="Newtwo", persistent=True) log(query_bitmaps(vm), indent=2)
@@ -90,8 +89,8 @@ with iotests.FilePath('img') as img_path, \ name="New") log('--- Truncating image ---\n') - vm.qmp_log("human-monitor-command", - command_line="block_resize drive0 50G") + vm.qmp_log("block_resize", device="drive0", + size=50 * 1024 * 1024 * 1024) log('--- Adding "NewC" bitmap, removing "NewTwo" bitmap ---') vm.qmp_log("block-dirty-bitmap-add", node="drive0",
tests/qemu-iotests/246.out +4 -4
@@ -88,8 +88,8 @@ --- Adding new bitmap, growing image, and adding 2nd new bitmap --- {"execute": "block-dirty-bitmap-add", "arguments": {"name": "New", "node": "drive0", "persistent": true}} {"return": {}} -{"execute": "human-monitor-command", "arguments": {"command-line": "block_resize drive0 70G"}} -{"return": ""} +{"execute": "block_resize", "arguments": {"device": "drive0", "size": 75161927680}} +{"return": {}} {"execute": "block-dirty-bitmap-add", "arguments": {"name": "Newtwo", "node": "drive0", "persistent": true}} {"return": {}} {
@@ -195,8 +195,8 @@ {"return": {}} --- Truncating image --- -{"execute": "human-monitor-command", "arguments": {"command-line": "block_resize drive0 50G"}} -{"return": ""} +{"execute": "block_resize", "arguments": {"device": "drive0", "size": 53687091200}} +{"return": {}} --- Adding "NewC" bitmap, removing "NewTwo" bitmap --- {"execute": "block-dirty-bitmap-add", "arguments": {"name": "NewC", "node": "drive0", "persistent": true}} {"return": {}}
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 71/88 qemu-iotests/274: migrate away from HMP
In reply to Marc-André LureauDrop the quite redundant HMP code path.
--- tests/qemu-iotests/274 | 14 +------------- tests/qemu-iotests/274.out | 26 -------------------------- 2 files changed, 1 insertion(+), 39 deletions(-)
tests/qemu-iotests/274 +1 -13
@@ -24,8 +24,7 @@ import iotests iotests.script_initialize(supported_fmts=['qcow2'], supported_platforms=['linux'], - unsupported_imgopts=['refcount_bits', 'compat'], - require_hmp=True) + unsupported_imgopts=['refcount_bits', 'compat']) size_short = 1 * 1024 * 1024 size_long = 2 * 1024 * 1024
@@ -93,17 +92,6 @@ with iotests.FilePath('base') as base, \ iotests.qemu_io_log('-c', 'read -P 1 0 %d' % size_short, mid) iotests.qemu_io_log('-c', 'read -P 0 %d %d' % (size_short, size_diff), mid) - iotests.log('=== Testing HMP commit (top -> mid) ===') - - create_chain() - with create_vm() as vm: - vm.launch() - vm.qmp_log('human-monitor-command', command_line='commit drive0') - - iotests.img_info_log(mid) - iotests.qemu_io_log('-c', 'read -P 1 0 %d' % size_short, mid) - iotests.qemu_io_log('-c', 'read -P 0 %d %d' % (size_short, size_diff), mid) - iotests.log('=== Testing QMP active commit (top -> mid) ===') create_chain()
tests/qemu-iotests/274.out +0 -26
@@ -59,32 +59,6 @@ read 1048576/1048576 bytes at offset 0 read 1048576/1048576 bytes at offset 1048576 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -=== Testing HMP commit (top -> mid) === -wrote 2097152/2097152 bytes at offset 0 -2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) - -{"execute": "human-monitor-command", "arguments": {"command-line": "commit drive0"}} -{"return": ""} -image: TEST_IMG -file format: IMGFMT -virtual size: 2 MiB (2097152 bytes) -cluster_size: 65536 -backing file: TEST_DIR/PID-base -backing file format: IMGFMT -Format specific information: - compat: 1.1 - compression type: COMPRESSION_TYPE - lazy refcounts: false - refcount bits: 16 - corrupt: false - extended l2: false - -read 1048576/1048576 bytes at offset 0 -1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) - -read 1048576/1048576 bytes at offset 1048576 -1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) - === Testing QMP active commit (top -> mid) === wrote 2097152/2097152 bytes at offset 0 2 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 72/88 qemu-iotests/145: migrate away from HMP
In reply to Marc-André Lureau--- tests/qemu-iotests/145 | 8 ++++---- tests/qemu-iotests/145.out | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-)
tests/qemu-iotests/145 +4 -4
@@ -40,7 +40,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt generic _supported_proto generic -_require_hmp _make_test_img 1M
@@ -57,9 +56,10 @@ else SYSEMU_EXTRA_ARGS="" fi -echo quit | $QEMU -nographic $SYSEMU_EXTRA_ARGS -drive $SYSEMU_DRIVE_ARG \ - -incoming 'exec:true' -snapshot -serial none -monitor stdio \ - | _filter_qemu | _filter_hmp +printf '%s\n' '{"execute":"qmp_capabilities"}' '{"execute":"quit"}' \ + | $QEMU -nographic $SYSEMU_EXTRA_ARGS -drive $SYSEMU_DRIVE_ARG \ + -incoming 'exec:true' -snapshot -serial none -qmp stdio \ + | _filter_qmp | _filter_qemu # success, all done echo "*** done"
tests/qemu-iotests/145.out +4 -2
@@ -1,5 +1,7 @@ QA output created by 145 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1048576 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) quit +QMP_VERSION +{"return": {}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} *** done
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 73/88 qemu-iotests/068: migrate away from HMP
In reply to Marc-André LureauReplace HMP savevm/loadvm with QMP snapshot-save/snapshot-load job-based API. Use _run_qmp_job() helper to factor the common send/wait/dismiss pattern.
The sleep before sending commands is no longer needed: the QMP qmp_capabilities handshake is synchronous, so QEMU is guaranteed to be ready.
--- tests/qemu-iotests/068 | 56 ++++++++++++++++++++++++++++++++++------------ tests/qemu-iotests/068.out | 26 ++++++++++----------- 2 files changed, 54 insertions(+), 28 deletions(-)
tests/qemu-iotests/068 +42 -14
@@ -29,6 +29,7 @@ status=1 # failure is the default! _cleanup() { + _cleanup_qemu _cleanup_test_img } trap "_cleanup; exit \$status" 0 1 2 3 15
@@ -36,6 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 # get standard environment, filters and checks . ./common.rc . ./common.filter +. ./common.qemu # This tests qcow2-specific low-level functionality _supported_fmt qcow2
@@ -43,7 +45,6 @@ _supported_proto generic # Internal snapshots are (currently) impossible with refcount_bits=1, # and generally impossible with external data files _unsupported_imgopts 'compat=0.10' 'refcount_bits=1[^0-9]' data_file -_require_hmp IMG_SIZE=128K
@@ -56,16 +57,6 @@ case "$QEMU_DEFAULT_MACHINE" in ;; esac -_qemu() -{ - $QEMU $platform_parm -nographic -monitor stdio -serial none \ - -drive if=none,id=drive0,file="$TEST_IMG",format="$IMGFMT" \ - -device virtio-scsi,id=hba0 \ - -device scsi-hd,drive=drive0 \ - "$@" |\ - _filter_qemu | _filter_hmp -} - for extra_args in \ "" \ "-object iothread,id=iothread0 -set device.hba0.iothread=iothread0"; do
@@ -75,10 +66,47 @@ for extra_args in \ _make_test_img $IMG_SIZE - # Give qemu some time to boot before saving the VM state - { sleep 1; printf "savevm 0\nquit\n"; } | _qemu $extra_args + # Save VM state + _launch_qemu $platform_parm \ + -drive if=none,id=drive0,node-name=disk0,file="$TEST_IMG",format="$IMGFMT" \ + -device virtio-scsi,id=hba0 \ + -device scsi-hd,drive=drive0 \ + $extra_args + silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' + silent=yes _run_qmp_job $QEMU_HANDLE 'save0' \ + "{ 'execute': 'snapshot-save', + 'arguments': { 'job-id': 'save0', + 'tag': '0', + 'vmstate': 'disk0', + 'devices': ['disk0'] } }" + _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'quit' }" \ + 'return' + wait=1 _cleanup_qemu + # Now try to continue from that VM state (this should just work) - { sleep 1; printf "loadvm 0\nloadvm 0\nquit\n"; } | _qemu $extra_args -S + _launch_qemu $platform_parm \ + -drive if=none,id=drive0,node-name=disk0,file="$TEST_IMG",format="$IMGFMT" \ + -device virtio-scsi,id=hba0 \ + -device scsi-hd,drive=drive0 \ + -S $extra_args + silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' + for i in 1 2; do + silent=yes _run_qmp_job $QEMU_HANDLE "load$i" \ + "{ 'execute': 'snapshot-load', + 'arguments': { 'job-id': 'load$i', + 'tag': '0', + 'vmstate': 'disk0', + 'devices': ['disk0'] } }" + done + _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'quit' }" \ + 'return' + wait=1 _cleanup_qemu done # success, all done
tests/qemu-iotests/068.out +12 -14
@@ -3,22 +3,20 @@ QA output created by 068 === Saving and reloading a VM state to/from a qcow2 image () === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=131072 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) savevm 0 -(qemu) quit -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) loadvm 0 -(qemu) loadvm 0 -(qemu) quit +{ 'execute': 'quit' } +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} +{ 'execute': 'quit' } +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} === Saving and reloading a VM state to/from a qcow2 image (-object iothread,id=iothread0 -set device.hba0.iothread=iothread0) === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=131072 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) savevm 0 -(qemu) quit -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) loadvm 0 -(qemu) loadvm 0 -(qemu) quit +{ 'execute': 'quit' } +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} +{ 'execute': 'quit' } +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} *** done
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 74/88 qemu-iotests/130: migrate away from HMP
In reply to Marc-André LureauReplace HMP commit with QMP block-commit job-based API, using _run_qmp_job() helper for the complete/dismiss sequence. Silence all QMP output since the test validates backing file path preservation via _img_info, not the commit protocol itself.
--- tests/qemu-iotests/130 | 53 +++++++++++++++++++++++++++++++++++++--------- tests/qemu-iotests/130.out | 8 +------ 2 files changed, 44 insertions(+), 17 deletions(-)
tests/qemu-iotests/130 +43 -10
@@ -46,9 +46,6 @@ _supported_proto file _supported_os Linux # We are going to use lazy-refcounts _unsupported_imgopts 'compat=0.10' -_require_hmp - -qemu_comm_method="monitor" TEST_IMG="$TEST_IMG.orig" _make_test_img 64M
@@ -57,24 +54,60 @@ _make_test_img 64M _img_info | _filter_img_info echo -echo "=== HMP commit ===" +echo "=== commit ===" echo # bdrv_make_empty() involves a header update for qcow2 # Test that a backing file isn't written _launch_qemu -drive id=testdisk,file="$TEST_IMG",backing.file.filename="$TEST_IMG.base" -_send_qemu_cmd $QEMU_HANDLE "commit testdisk" "(qemu)" -_send_qemu_cmd $QEMU_HANDLE '' '(qemu)' -_cleanup_qemu +silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' +silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'block-commit', + 'arguments': { 'device': 'testdisk', + 'job-id': 'job0', + 'auto-dismiss': false } }" \ + 'BLOCK_JOB_READY' +silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'block-job-complete', + 'arguments': { 'device': 'job0' } }" \ + 'return' +silent=yes _send_qemu_cmd $QEMU_HANDLE '' '"concluded"' +silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'job-dismiss', + 'arguments': { 'id': 'job0' } }" 'return' +silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'quit' }" \ + 'return' +wait=1 _cleanup_qemu _img_info | _filter_img_info # Make sure that if there was a backing file that was just overridden on the # command line, that backing file is retained, with the right format _make_test_img -F raw -b "$TEST_IMG.orig" 64M _launch_qemu -drive id=testdisk,file="$TEST_IMG",backing.file.filename="$TEST_IMG.base",backing.driver=$IMGFMT -_send_qemu_cmd $QEMU_HANDLE "commit testdisk" "(qemu)" -_send_qemu_cmd $QEMU_HANDLE '' '(qemu)' -_cleanup_qemu +silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' +silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'block-commit', + 'arguments': { 'device': 'testdisk', + 'job-id': 'job0', + 'auto-dismiss': false } }" \ + 'BLOCK_JOB_READY' +silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'block-job-complete', + 'arguments': { 'device': 'job0' } }" \ + 'return' +silent=yes _send_qemu_cmd $QEMU_HANDLE '' '"concluded"' +silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'job-dismiss', + 'arguments': { 'id': 'job0' } }" 'return' +silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'quit' }" \ + 'return' +wait=1 _cleanup_qemu _img_info | _filter_img_info echo
tests/qemu-iotests/130.out +1 -7
@@ -6,18 +6,12 @@ image: TEST_DIR/t.IMGFMT file format: IMGFMT virtual size: 64 MiB (67108864 bytes) -=== HMP commit === +=== commit === -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) commit testdisk -(qemu) image: TEST_DIR/t.IMGFMT file format: IMGFMT virtual size: 64 MiB (67108864 bytes) Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 backing_file=TEST_DIR/t.IMGFMT.orig backing_fmt=raw -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) commit testdisk -(qemu) image: TEST_DIR/t.IMGFMT file format: IMGFMT virtual size: 64 MiB (67108864 bytes)
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 75/88 qemu-iotests/153: migrate away from HMP
In reply to Marc-André LureauReplace HMP drive_add/drive_del with QMP blockdev-add/blockdev-del. Convert pipe-based monitor to QMP.
--- tests/qemu-iotests/153 | 37 +++++++++++++++++++++---------------- tests/qemu-iotests/153.out | 44 ++++++++++++++++++++++++++------------------ 2 files changed, 47 insertions(+), 34 deletions(-)
tests/qemu-iotests/153 +21 -16
@@ -59,7 +59,6 @@ _check_ofd || _notrun "OFD lock not available" _supported_fmt qcow2 _supported_proto file -_require_hmp _run_cmd() {
@@ -70,13 +69,14 @@ _run_cmd() _do_run_qemu() { ( + echo '{"execute":"qmp_capabilities"}' if ! test -t 0; then while read cmd; do - echo $cmd + echo "$cmd" done fi - echo quit - ) | $QEMU -nographic -monitor stdio -serial none "$@" 1>/dev/null + echo '{"execute":"quit"}' + ) | $QEMU -nographic -qmp stdio -serial none "$@" 1>/dev/null } _run_qemu_with_images()
@@ -106,8 +106,8 @@ for opts1 in "" "read-only=on" "read-only=on,force-share=on"; do for opts2 in "" "read-only=on" "read-only=on,force-share=on"; do echo echo "== Launching another QEMU, opts: '$opts2' ==" - echo "quit" | \ - $QEMU -nographic -monitor stdio \ + printf '%s\n' '{"execute":"qmp_capabilities"}' '{"execute":"quit"}' | \ + $QEMU -nographic -qmp stdio \ -drive file="${TEST_IMG}",if=none,$opts2 2>&1 1>/dev/null | \ _filter_testdir | _filter_qemu done
@@ -213,8 +213,10 @@ _send_qemu_cmd $QEMU_HANDLE \ echo "Adding drive" _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': 'drive_add 0 if=none,id=d0,file=${TEST_IMG}' } }" \ + "{ 'execute': 'blockdev-add', + 'arguments': { 'driver': '$IMGFMT', 'node-name': 'd0', + 'file': { 'driver': 'file', + 'filename': '${TEST_IMG}' } } }" \ 'return' _run_cmd $QEMU_IO "${TEST_IMG}" -c 'write 0 512'
@@ -224,8 +226,8 @@ _run_cmd $QEMU_IMG create -f $IMGFMT -b "${TEST_IMG}" -F $IMGFMT "${TEST_IMG}.ov echo "== Closing an image should unlock it ==" _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': 'drive_del d0' } }" \ + "{ 'execute': 'blockdev-del', + 'arguments': { 'node-name': 'd0' } }" \ 'return' _run_cmd $QEMU_IO "${TEST_IMG}" -c 'write 0 512'
@@ -233,24 +235,27 @@ _run_cmd $QEMU_IO "${TEST_IMG}" -c 'write 0 512' echo "Adding two and closing one" for d in d0 d1; do _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': 'drive_add 0 if=none,id=$d,file=${TEST_IMG},readonly=on' } }" \ + "{ 'execute': 'blockdev-add', + 'arguments': { 'driver': '$IMGFMT', 'node-name': '$d', + 'read-only': true, + 'file': { 'driver': 'file', + 'filename': '${TEST_IMG}' } } }" \ 'return' done _run_cmd $QEMU_IMG info "${TEST_IMG}" _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': 'drive_del d0' } }" \ + "{ 'execute': 'blockdev-del', + 'arguments': { 'node-name': 'd0' } }" \ 'return' _run_cmd $QEMU_IO "${TEST_IMG}" -c 'write 0 512' echo "Closing the other" _send_qemu_cmd $QEMU_HANDLE \ - "{ 'execute': 'human-monitor-command', - 'arguments': { 'command-line': 'drive_del d1' } }" \ + "{ 'execute': 'blockdev-del', + 'arguments': { 'node-name': 'd1' } }" \ 'return' _run_cmd $QEMU_IO "${TEST_IMG}" -c 'write 0 512'
tests/qemu-iotests/153.out +26 -18
66 lines not on this page · raw message
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 76/88 qemu-iotests/157: migrate away from HMP
In reply to Marc-André LureauReplace HMP "info block" with QMP "query-block". The expected output changes from HMP "Cache mode: writeback/writethrough" to QMP "writeback": true/false.
--- tests/qemu-iotests/157 | 10 +++++----- tests/qemu-iotests/157.out | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-)
tests/qemu-iotests/157 +5 -5
@@ -41,18 +41,18 @@ _supported_fmt generic _supported_proto file _require_devices virtio-blk -_require_hmp do_run_qemu() { ( + printf '%s\n' '{"execute":"qmp_capabilities"}' if ! test -t 0; then while read cmd; do echo $cmd done fi - echo quit - ) | $QEMU -nodefaults -nographic -monitor stdio -serial none "$@" + printf '%s\n' '{"execute":"quit"}' + ) | $QEMU -nodefaults -nographic -qmp stdio -serial none "$@" echo }
@@ -89,10 +89,10 @@ echo for cache in "writeback" "writethrough"; do for wce in "" ",write-cache=auto" ",write-cache=on" ",write-cache=off"; do echo "Testing: cache='$cache' wce='$wce'" - echo "info block" \ + echo '{"execute":"query-block"}' \ | run_qemu $SYSEMU_EXTRA_ARGS -drive "$SYSEMU_DRIVE_ARG,cache=$cache" \ -device "virtio-blk,drive=none0$wce" \ - | grep -e "Testing" -e "Cache mode" + | grep -o '"writeback": *[a-z]*' done done
tests/qemu-iotests/157.out +8 -8
@@ -4,19 +4,19 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 === Setting WCE with qdev and with manually created BB === Testing: cache='writeback' wce='' - Cache mode: writeback +"writeback": true Testing: cache='writeback' wce=',write-cache=auto' - Cache mode: writeback +"writeback": true Testing: cache='writeback' wce=',write-cache=on' - Cache mode: writeback +"writeback": true Testing: cache='writeback' wce=',write-cache=off' - Cache mode: writethrough +"writeback": false Testing: cache='writethrough' wce='' - Cache mode: writethrough +"writeback": false Testing: cache='writethrough' wce=',write-cache=auto' - Cache mode: writethrough +"writeback": false Testing: cache='writethrough' wce=',write-cache=on' - Cache mode: writeback +"writeback": true Testing: cache='writethrough' wce=',write-cache=off' - Cache mode: writethrough +"writeback": false *** done
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 77/88 qemu-iotests/181: migrate away from HMP
In reply to Marc-André LureauReplace HMP migration and savevm/loadvm commands with QMP equivalents.
--- tests/qemu-iotests/181 | 86 ++++++++++++++++++++++++++++++++-------------- tests/qemu-iotests/181.out | 36 +++++++++---------- 2 files changed, 78 insertions(+), 44 deletions(-)
tests/qemu-iotests/181 +60 -26
@@ -47,7 +47,6 @@ _supported_fmt generic _unsupported_fmt qcow vdi vhdx vmdk vpc vvfat parallels _supported_proto generic _supported_os Linux -_require_hmp _flaky_test https://gitlab.com/qemu-project/qemu/-/work_items/3515
@@ -58,8 +57,6 @@ echo echo === Starting VMs === echo -qemu_comm_method="monitor" - if [ "$IMGOPTSSYNTAX" = "true" ]; then _launch_qemu \ -drive "${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,id=disk
@@ -80,15 +77,27 @@ else fi dest=$QEMU_HANDLE +silent=yes +_send_qemu_cmd $src \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' +_send_qemu_cmd $dest \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' + echo echo === Write something on the source === echo silent= -_send_qemu_cmd $src 'qemu-io disk "write -P 0x55 0 64k"' "(qemu)" -_send_qemu_cmd $src "" "ops/sec" -_send_qemu_cmd $src 'qemu-io disk "read -P 0x55 0 64k"' "(qemu)" -_send_qemu_cmd $src "" "ops/sec" +_send_qemu_cmd $src \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', 'command': 'write -P 0x55 0 64k' } }" \ + 'return' +_send_qemu_cmd $src \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', 'command': 'read -P 0x55 0 64k' } }" \ + 'return' echo echo === Do postcopy migration to destination ===
@@ -98,28 +107,45 @@ echo # switch to postcopy # Enable postcopy-ram capability both on source and destination silent=yes -_send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on' "(qemu)" - qemu_error_no_exit=yes success_or_failure=yes \ - _send_qemu_cmd $dest '' "(qemu)" "Postcopy is not supported" + _send_qemu_cmd $dest \ + "{ 'execute': 'migrate-set-capabilities', + 'arguments': { 'capabilities': [ + { 'capability': 'postcopy-ram', 'state': true } ] } }" \ + 'return' 'error' if [ ${QEMU_STATUS[$dest]} -lt 0 ]; then - _send_qemu_cmd $dest '' "(qemu)" - - _send_qemu_cmd $src 'quit' "" - _send_qemu_cmd $dest 'quit' "" + _send_qemu_cmd $src \ + "{ 'execute': 'quit' }" \ + 'return' + _send_qemu_cmd $dest \ + "{ 'execute': 'quit' }" \ + 'return' wait=1 _cleanup_qemu _notrun 'Postcopy is not supported' fi -_send_qemu_cmd $src 'migrate_set_parameter max-bandwidth 4k' "(qemu)" -_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)" -_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)" -_send_qemu_cmd $src 'migrate_start_postcopy' "(qemu)" +_send_qemu_cmd $src \ + "{ 'execute': 'migrate-set-parameters', + 'arguments': { 'max-bandwidth': 4096 } }" \ + 'return' +_send_qemu_cmd $src \ + "{ 'execute': 'migrate-set-capabilities', + 'arguments': { 'capabilities': [ + { 'capability': 'postcopy-ram', 'state': true } ] } }" \ + 'return' +_send_qemu_cmd $src \ + "{ 'execute': 'migrate', + 'arguments': { 'uri': 'unix:${MIG_SOCKET}' } }" \ + 'return' +_send_qemu_cmd $src \ + "{ 'execute': 'migrate-start-postcopy' }" \ + 'return' QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \ - _send_qemu_cmd $src "info migrate" "completed\|failed" -silent=yes _send_qemu_cmd $src "" "(qemu)" + _send_qemu_cmd $src \ + "{ 'execute': 'query-migrate' }" \ + '"status": "completed"\|"status": "failed"' echo echo === Do some I/O on the destination ===
@@ -129,17 +155,25 @@ echo # of the node name, which would create a new BlockBackend and not test whether # the guest has the necessary permissions to access the image now silent= -_send_qemu_cmd $dest 'qemu-io disk "read -P 0x55 0 64k"' "(qemu)" -_send_qemu_cmd $dest "" "ops/sec" -_send_qemu_cmd $dest 'qemu-io disk "write -P 0x66 1M 64k"' "(qemu)" -_send_qemu_cmd $dest "" "ops/sec" +_send_qemu_cmd $dest \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', 'command': 'read -P 0x55 0 64k' } }" \ + 'return' +_send_qemu_cmd $dest \ + "{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', 'command': 'write -P 0x66 1M 64k' } }" \ + 'return' echo echo === Shut down and check image === echo -_send_qemu_cmd $src 'quit' "" -_send_qemu_cmd $dest 'quit' "" +_send_qemu_cmd $src \ + "{ 'execute': 'quit' }" \ + 'return' +_send_qemu_cmd $dest \ + "{ 'execute': 'quit' }" \ + 'return' wait=1 _cleanup_qemu _check_test_img
tests/qemu-iotests/181.out +18 -18
@@ -6,32 +6,32 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 === Write something on the source === -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) qemu-io disk "write -P 0x55 0 64k" -wrote 65536/65536 bytes at offset 0 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -(qemu) -(qemu) qemu-io disk "read -P 0x55 0 64k" -read 65536/65536 bytes at offset 0 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', 'command': 'write -P 0x55 0 64k' } } +{"return": {"human-readable-text": "wrote 65536/65536 bytes at offset 0n64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)n"}} +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', 'command': 'read -P 0x55 0 64k' } } +{"return": {"human-readable-text": "read 65536/65536 bytes at offset 0n64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)n"}} === Do postcopy migration to destination === === Do some I/O on the destination === -(qemu) qemu-io disk "read -P 0x55 0 64k" -read 65536/65536 bytes at offset 0 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) -(qemu) -(qemu) qemu-io disk "write -P 0x66 1M 64k" -wrote 65536/65536 bytes at offset 1048576 -64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', 'command': 'read -P 0x55 0 64k' } } +{"return": {"human-readable-text": "read 65536/65536 bytes at offset 0n64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)n"}} +{ 'execute': 'x-qemu-io', + 'arguments': { 'device': 'disk', 'command': 'write -P 0x66 1M 64k' } } +{"return": {"human-readable-text": "wrote 65536/65536 bytes at offset 1048576n64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)n"}} === Shut down and check image === -(qemu) quit -(qemu) -(qemu) quit +{ 'execute': 'quit' } +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} +{ 'execute': 'quit' } +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} No errors were found on the image. *** done
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 78/88 qemu-iotests/182: migrate away from HMP
In reply to Marc-André LureauReplace -monitor stdio with -qmp stdio for the second QEMU instance that tests file locking.
--- tests/qemu-iotests/182 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tests/qemu-iotests/182 +3 -2
@@ -55,10 +55,11 @@ _launch_qemu -drive file=$TEST_IMG,if=none,id=drive0,file.locking=on \ echo echo "Starting a second QEMU using the same image should fail" -echo 'quit' | $QEMU -nographic -monitor stdio \ +echo '{"execute":"qmp_capabilities"} +{"execute":"quit"}' | $QEMU -nographic -qmp stdio \ -drive file=$TEST_IMG,if=none,id=drive0,file.locking=on \ -device virtio-blk,drive=drive0 2>&1 | _filter_testdir 2>&1 | - _filter_qemu | + _filter_qemu | grep -v '^{' | sed -e '/falling back to POSIX file/d' \ -e '/locks can be lost unexpectedly/d'
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 79/88 qemu-iotests/186: migrate away from HMP
In reply to Marc-André LureauReplace pipe-based HMP info block with QMP query-block.
--- tests/qemu-iotests/186 | 12 +- tests/qemu-iotests/186.out | 590 +++++++++++++++++++-------------------------- 2 files changed, 256 insertions(+), 346 deletions(-)
tests/qemu-iotests/186 +6 -6
@@ -41,7 +41,6 @@ _supported_fmt qcow2 _supported_proto file fuse _require_drivers null-co _require_devices virtio-scsi-pci -_require_hmp if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then _notrun "Requires a PC machine"
@@ -52,20 +51,21 @@ do_run_qemu() echo Testing: "$@" ( + echo '{ "execute": "qmp_capabilities" }' if ! test -t 0; then while read cmd; do - echo $cmd + echo "$cmd" done fi - echo quit - ) | $QEMU -S -display none -device virtio-scsi-pci -monitor stdio "$@" 2>&1 + echo '{ "execute": "quit" }' + ) | $QEMU -S -display none -device virtio-scsi-pci -qmp stdio "$@" 2>&1 echo } check_info_block() { - echo "info block" | - do_run_qemu "$@" | _filter_win32 | _filter_hmp | _filter_qemu | + echo '{ "execute": "query-block" }' | + do_run_qemu "$@" | _filter_win32 | _filter_qmp | _filter_qemu | _filter_generated_node_ids | _filter_qom_path }
tests/qemu-iotests/186.out +245 -336
703 lines not on this page · raw message
-pflash0 (NODE_NAME): json:{"read-zeroes": "on", "driver": "null-co", "size": "1M"} (null-co)
- Attached to: /machine/system.flash0 - Cache mode: writeback
-(qemu) quit
+QMP_VERSION
+{"return": {}}
+{"return": [{"device": "pflash0", "locked": false, "removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 512, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 1048576, "filename": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\", \"size\": \"1M\"}", "format": "null-co", "actual-size": 0}, "iops_wr": 0, "ro": false, "children": [], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "null-co", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "json:{\"read-zeroes\": \"on\", \"driver\": \"null-co\", \"size\": \"1M\"}"}, "qdev": "/machine/system.flash0", "type": "unknown"}]} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
+{"return": {}}
*** done
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 80/88 qemu-iotests/192: migrate away from HMP
In reply to Marc-André LureauReplace HMP nbd_server_start/nbd_server_add with QMP nbd-server-start/nbd-server-add.
--- tests/qemu-iotests/192 | 25 ++++++++++++++++++++----- tests/qemu-iotests/192.out | 17 +++++++++++++---- 2 files changed, 33 insertions(+), 9 deletions(-)
tests/qemu-iotests/192 +20 -5
@@ -43,7 +43,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt generic _supported_proto file -_require_hmp if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then _notrun "Requires a PC machine"
@@ -59,7 +58,6 @@ else DRIVE_ARG=if=ide,id=drive0,format=$IMGFMT,file=$TEST_IMG fi -qemu_comm_method="monitor" _launch_qemu -drive $DRIVE_ARG -incoming defer h=$QEMU_HANDLE if [ "${VALGRIND_QEMU}" == "y" ]; then
@@ -68,9 +66,26 @@ else QEMU_COMM_TIMEOUT=1 fi -_send_qemu_cmd $h "nbd_server_start unix:$SOCK_DIR/nbd" "(qemu)" -_send_qemu_cmd $h "nbd_server_add -w drive0" "(qemu)" -_send_qemu_cmd $h "q" "(qemu)" +_send_qemu_cmd $h \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' + +_send_qemu_cmd $h \ + "{ 'execute': 'nbd-server-start', + 'arguments': { 'addr': { 'type': 'unix', + 'data': { 'path': '$SOCK_DIR/nbd' } } } }" \ + 'return' + +_send_qemu_cmd $h \ + "{ 'execute': 'nbd-server-add', + 'arguments': { 'device': 'drive0', 'writable': true } }" \ + 'return' + +_send_qemu_cmd $h \ + "{ 'execute': 'quit' }" \ + 'return' + +wait=1 _cleanup_qemu # success, all done echo "*** done"
tests/qemu-iotests/192.out +13 -4
@@ -1,7 +1,16 @@ QA output created by 192 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) nbd_server_start unix:SOCK_DIR/nbd -(qemu) nbd_server_add -w drive0 -(qemu) q +{ 'execute': 'qmp_capabilities' } +{"return": {}} +{ 'execute': 'nbd-server-start', + 'arguments': { 'addr': { 'type': 'unix', + 'data': { 'path': 'SOCK_DIR/nbd' } } } } +{"return": {}} +{ 'execute': 'nbd-server-add', + 'arguments': { 'device': 'drive0', 'writable': true } } +{"return": {}} +{ 'execute': 'quit' } +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_EXPORT_DELETED", "data": {"id": "drive0"}} +{"return": {}} *** done
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 81/88 qemu-iotests/201: migrate away from HMP
In reply to Marc-André LureauReplace HMP migration and savevm/loadvm commands with QMP equivalents.
--- tests/qemu-iotests/201 | 75 +++++++++++++++++++++++++++++----------------- tests/qemu-iotests/201.out | 10 ++++--- 2 files changed, 53 insertions(+), 32 deletions(-)
tests/qemu-iotests/201 +47 -28
@@ -47,7 +47,6 @@ _supported_os Linux # Internal snapshots are (currently) impossible with refcount_bits=1, # and generally impossible with external data files _unsupported_imgopts 'refcount_bits=1[^0-9]' data_file -_require_hmp size=64M _make_test_img $size
@@ -56,76 +55,96 @@ echo echo === Starting VMs === echo -qemu_comm_method="monitor" - if [ "$IMGOPTSSYNTAX" = "true" ]; then _launch_qemu \ - -drive "${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,id=disk + -drive "${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,id=disk,node-name=disk0 else _launch_qemu \ - -drive file="${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,driver=$IMGFMT,id=disk + -drive file="${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,driver=$IMGFMT,id=disk,node-name=disk0 fi src=$QEMU_HANDLE +silent=yes _send_qemu_cmd $src "{ 'execute': 'qmp_capabilities' }" 'return' if [ "$IMGOPTSSYNTAX" = "true" ]; then _launch_qemu \ - -drive "${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,id=disk \ + -drive "${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,id=disk,node-name=disk0 \ -incoming "unix:${MIG_SOCKET}" else _launch_qemu \ - -drive file="${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,driver=$IMGFMT,id=disk \ + -drive file="${TEST_IMG}",cache=${CACHEMODE},aio=$AIOMODE,driver=$IMGFMT,id=disk,node-name=disk0 \ -incoming "unix:${MIG_SOCKET}" fi dest=$QEMU_HANDLE +silent=yes _send_qemu_cmd $dest "{ 'execute': 'qmp_capabilities' }" 'return' echo echo === Set \'migrate_set_capability postcopy-ram on\' and migrate === echo -silent=yes -_send_qemu_cmd $dest 'migrate_set_capability postcopy-ram on' "(qemu)" - -qemu_error_no_exit=yes success_or_failure=yes \ - _send_qemu_cmd $dest '' "(qemu)" "Postcopy is not supported" +silent=yes qemu_error_no_exit=yes success_or_failure=yes \ + _send_qemu_cmd $dest \ + "{ 'execute': 'migrate-set-capabilities', + 'arguments': { 'capabilities': [ + { 'capability': 'postcopy-ram', 'state': true } + ] } }" \ + 'return' "Postcopy is not supported" if [ ${QEMU_STATUS[$dest]} -lt 0 ]; then - _send_qemu_cmd $dest '' "(qemu)" - - _send_qemu_cmd $src 'quit' "" - _send_qemu_cmd $dest 'quit' "" + _send_qemu_cmd $src "{ 'execute': 'quit' }" 'return' + _send_qemu_cmd $dest "{ 'execute': 'quit' }" 'return' wait=1 _cleanup_qemu - _notrun 'Postcopy is not supported' fi -_send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)" -_send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)" +silent=yes _send_qemu_cmd $src \ + "{ 'execute': 'migrate-set-capabilities', + 'arguments': { 'capabilities': [ + { 'capability': 'postcopy-ram', 'state': true } + ] } }" \ + 'return' + +silent=yes _send_qemu_cmd $src \ + "{ 'execute': 'migrate', + 'arguments': { 'uri': 'unix:${MIG_SOCKET}' } }" \ + 'return' QEMU_COMM_TIMEOUT=1 qemu_cmd_repeat=10 silent=yes \ - _send_qemu_cmd $src "info migrate" "completed\|failed" -silent=yes _send_qemu_cmd $src "" "(qemu)" + _send_qemu_cmd $src \ + "{ 'execute': 'query-migrate' }" \ + '"completed"\|"failed"' echo echo === Check if migration was successful === echo QEMU_COMM_TIMEOUT=1 silent=yes \ - _send_qemu_cmd $src "info migrate" "completed" -silent=yes _send_qemu_cmd $src "" "(qemu)" + _send_qemu_cmd $src \ + "{ 'execute': 'query-migrate' }" \ + '"completed"' echo echo === On destination, execute savevm and loadvm === echo -silent= -_send_qemu_cmd $dest 'savevm state1' "(qemu)" -_send_qemu_cmd $dest 'loadvm state1' "(qemu)" +silent=yes _run_qmp_job $dest 'save0' \ + "{ 'execute': 'snapshot-save', + 'arguments': { 'job-id': 'save0', + 'tag': 'state1', + 'vmstate': 'disk0', + 'devices': ['disk0'] } }" + +silent=yes _run_qmp_job $dest 'load0' \ + "{ 'execute': 'snapshot-load', + 'arguments': { 'job-id': 'load0', + 'tag': 'state1', + 'vmstate': 'disk0', + 'devices': ['disk0'] } }" echo echo === Shut down and check image === echo -_send_qemu_cmd $src 'quit' "" -_send_qemu_cmd $dest 'quit' "" +_send_qemu_cmd $src "{ 'execute': 'quit' }" 'return' +_send_qemu_cmd $dest "{ 'execute': 'quit' }" 'return' wait=1 _cleanup_qemu _check_test_img
tests/qemu-iotests/201.out +6 -4
@@ -12,12 +12,14 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 === On destination, execute savevm and loadvm === -(qemu) savevm state1 -(qemu) loadvm state1 === Shut down and check image === -(qemu) quit -(qemu) quit +{ 'execute': 'quit' } +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} +{ 'execute': 'quit' } +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} +{"return": {}} No errors were found on the image. *** done
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 82/88 qemu-iotests/232: migrate away from HMP
In reply to Marc-André LureauReplace pipe-based HMP info block -n with QMP query-named-block-nodes.
--- tests/qemu-iotests/232 | 32 +++---- tests/qemu-iotests/232.out | 216 ++++++++++++++++++++++++++++++++++++++------- 2 files changed, 196 insertions(+), 52 deletions(-)
tests/qemu-iotests/232 +10 -22
@@ -43,31 +43,19 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt generic _supported_proto file _supported_os Linux -_require_hmp - -do_run_qemu() -{ - echo Testing: "$@" - ( - if ! test -t 0; then - while read cmd; do - echo $cmd - done - fi - echo quit - ) | $QEMU -nographic -monitor stdio -nodefaults "$@" - echo -} - -run_qemu() -{ - do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp | - _filter_generated_node_ids | _filter_imgfmt -} run_qemu_info_block() { - echo "info block -n" | run_qemu "$@" | grep -e "(file" -e "QEMU_PROG" + ( + printf '%s\n' '{"execute":"qmp_capabilities"}' \ + '{"execute":"query-named-block-nodes"}' \ + '{"execute":"quit"}' + ) | $QEMU -nographic -qmp stdio -nodefaults "$@" 2>&1 | + _filter_testdir | _filter_qemu | _filter_qmp | + _filter_generated_node_ids | _filter_imgfmt | + _filter_actual_image_size | + gsed -e 's/\("virtual-size":\s*\)[0-9]\+/\1VSIZE/g' + echo } size=128M
tests/qemu-iotests/232.out +186 -30
243 lines not on this page · raw message
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 83/88 qemu-iotests/267: migrate away from HMP
In reply to Marc-André LureauReplace pipe-based HMP savevm/loadvm, nbd_server_start/add, and info snapshots with QMP equivalents.
--- tests/qemu-iotests/267 | 139 +++++++++----- tests/qemu-iotests/267.out | 447 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 435 insertions(+), 151 deletions(-)
tests/qemu-iotests/267 +93 -46
@@ -29,6 +29,7 @@ status=1 # failure is the default! _cleanup() { + _cleanup_qemu _cleanup_test_img rm -f "$SOCK_DIR/nbd" }
@@ -37,6 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 # get standard environment, filters and checks . ./common.rc . ./common.filter +. ./common.qemu _supported_fmt qcow2 _supported_proto file
@@ -48,38 +50,53 @@ _require_drivers copy-on-read _unsupported_imgopts 'refcount_bits=1[^0-9]' data_file _require_devices virtio-blk -_require_hmp - -do_run_qemu() -{ - echo Testing: "$@" - ( - if ! test -t 0; then - while read cmd; do - echo $cmd - done - fi - echo quit - ) | $QEMU -nographic -monitor stdio -nodefaults "$@" - echo -} - -run_qemu() -{ - do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp | - _filter_generated_node_ids | _filter_imgfmt | _filter_vmstate_size -} size=128M +# snapshot-save/snapshot-load are job-based QMP commands; wait for +# "concluded" (auto-dismiss to "null" only fires on the next command). run_test() { + local snapshot_node="$1" + shift + if [ -n "$BACKING_FILE" ]; then _make_test_img -b "$BACKING_FILE" -F $IMGFMT $size else _make_test_img $size fi - printf "savevm snap0\ninfo snapshots\nloadvm snap0\n" | run_qemu "$@" | _filter_date + + echo Testing: "$@" | _filter_testdir | _filter_imgfmt + _launch_qemu -nodefaults "$@" + _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' + + # snapshot-save + _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'snapshot-save', + 'arguments': { 'job-id': 'save0', 'tag': 'snap0', + 'vmstate': '$snapshot_node', + 'devices': [\"$snapshot_node\"] } }" \ + 'return' + silent=yes _send_qemu_cmd $QEMU_HANDLE '' '"concluded"' + + # snapshot-load + _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'snapshot-load', + 'arguments': { 'job-id': 'load0', 'tag': 'snap0', + 'vmstate': '$snapshot_node', + 'devices': [\"$snapshot_node\"] } }" \ + 'return' + silent=yes _send_qemu_cmd $QEMU_HANDLE '' '"concluded"' + + _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'quit' }" \ + 'return' + wait=1 _cleanup_qemu + + $QEMU_IMG snapshot -l "$TEST_IMG" | _filter_date | _filter_vmstate_size + echo }
@@ -87,31 +104,31 @@ echo echo "=== No block devices at all ===" echo -run_test +run_test nonexistent echo echo "=== -drive if=none ===" echo -run_test -drive driver=file,file="$TEST_IMG",if=none -run_test -drive driver=$IMGFMT,file="$TEST_IMG",if=none -run_test -drive driver=$IMGFMT,file="$TEST_IMG",if=none -device virtio-blk,drive=none0 +run_test drv0 -drive driver=file,file="$TEST_IMG",if=none,node-name=drv0 +run_test drv0 -drive driver=$IMGFMT,file="$TEST_IMG",if=none,node-name=drv0 +run_test drv0 -drive driver=$IMGFMT,file="$TEST_IMG",if=none,node-name=drv0 -device virtio-blk,drive=none0 echo echo "=== -drive if=virtio ===" echo -run_test -drive driver=file,file="$TEST_IMG",if=virtio -run_test -drive driver=$IMGFMT,file="$TEST_IMG",if=virtio +run_test drv0 -drive driver=file,file="$TEST_IMG",if=virtio,node-name=drv0 +run_test drv0 -drive driver=$IMGFMT,file="$TEST_IMG",if=virtio,node-name=drv0 echo echo "=== Simple -blockdev ===" echo -run_test -blockdev driver=file,filename="$TEST_IMG",node-name=file -run_test -blockdev driver=file,filename="$TEST_IMG",node-name=file \ +run_test file -blockdev driver=file,filename="$TEST_IMG",node-name=file +run_test fmt -blockdev driver=file,filename="$TEST_IMG",node-name=file \ -blockdev driver=$IMGFMT,file=file,node-name=fmt -run_test -blockdev driver=file,filename="$TEST_IMG",node-name=file \ +run_test fmt -blockdev driver=file,filename="$TEST_IMG",node-name=file \ -blockdev driver=raw,file=file,node-name=raw \ -blockdev driver=$IMGFMT,file=raw,node-name=fmt
@@ -119,7 +136,7 @@ echo echo "=== -blockdev with a filter on top ===" echo -run_test -blockdev driver=file,filename="$TEST_IMG",node-name=file \ +run_test fmt -blockdev driver=file,filename="$TEST_IMG",node-name=file \ -blockdev driver=$IMGFMT,file=file,node-name=fmt \ -blockdev driver=copy-on-read,file=fmt,node-name=filter
@@ -130,12 +147,12 @@ echo TEST_IMG="$TEST_IMG.base" _make_test_img $size BACKING_FILE="$TEST_IMG.base" \ -run_test -blockdev driver=file,filename="$TEST_IMG.base",node-name=backing-file \ +run_test fmt -blockdev driver=file,filename="$TEST_IMG.base",node-name=backing-file \ -blockdev driver=file,filename="$TEST_IMG",node-name=file \ -blockdev driver=$IMGFMT,file=file,backing=backing-file,node-name=fmt BACKING_FILE="$TEST_IMG.base" \ -run_test -blockdev driver=file,filename="$TEST_IMG.base",node-name=backing-file \ +run_test fmt -blockdev driver=file,filename="$TEST_IMG.base",node-name=backing-file \ -blockdev driver=$IMGFMT,file=backing-file,node-name=backing-fmt \ -blockdev driver=file,filename="$TEST_IMG",node-name=file \ -blockdev driver=$IMGFMT,file=file,backing=backing-fmt,node-name=fmt
@@ -152,18 +169,48 @@ echo "=== -blockdev with NBD server on the backing file ===" echo _make_test_img -b "$TEST_IMG.base" -F $IMGFMT $size -cat <<EOF | -nbd_server_start unix:$SOCK_DIR/nbd -nbd_server_add -w backing-fmt -savevm snap0 -info snapshots -loadvm snap0 -EOF -run_qemu -blockdev driver=file,filename="$TEST_IMG.base",node-name=backing-file \ - -blockdev driver=$IMGFMT,file=backing-file,node-name=backing-fmt \ - -blockdev driver=file,filename="$TEST_IMG",node-name=file \ - -blockdev driver=$IMGFMT,file=file,backing=backing-fmt,node-name=fmt | - _filter_date + +_launch_qemu -nodefaults \ + -blockdev driver=file,filename="$TEST_IMG.base",node-name=backing-file \ + -blockdev driver=$IMGFMT,file=backing-file,node-name=backing-fmt \ + -blockdev driver=file,filename="$TEST_IMG",node-name=file \ + -blockdev driver=$IMGFMT,file=file,backing=backing-fmt,node-name=fmt + +_send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' + +_send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'nbd-server-start', + 'arguments': { 'addr': { 'type': 'unix', + 'data': { 'path': '$SOCK_DIR/nbd' } } } }" \ + 'return' + +_send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'nbd-server-add', + 'arguments': { 'device': 'backing-fmt', 'writable': true } }" \ + 'return' + +_send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'snapshot-save', + 'arguments': { 'job-id': 'save0', 'tag': 'snap0', + 'vmstate': 'fmt', + 'devices': [\"fmt\", \"backing-fmt\"] } }" \ + 'return' +silent=yes _send_qemu_cmd $QEMU_HANDLE '' '"concluded"' + +_send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'snapshot-load', + 'arguments': { 'job-id': 'load0', 'tag': 'snap0', + 'vmstate': 'fmt', + 'devices': [\"fmt\", \"backing-fmt\"] } }" \ + 'return' +silent=yes _send_qemu_cmd $QEMU_HANDLE '' '"concluded"' + +_send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'quit' }" \ + 'return' +wait=1 _cleanup_qemu # This time, a snapshot should be created on both files echo Internal snapshots on overlay:
tests/qemu-iotests/267.out +342 -105
510 lines not on this page · raw message
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 84/88 qemu-iotests/051: migrate away from HMP
In reply to Marc-André LureauReplace pipe-based HMP monitor with QMP. Convert info block, qemu-io, and commit commands to their QMP equivalents. Use existing filter helpers (_filter_qmp, _filter_qmp_empty_return, _filter_actual_image_size) instead of custom Python filters.
--- tests/qemu-iotests/051 | 75 ++++++---- tests/qemu-iotests/051.out | 241 ++++++++++++-------------------- tests/qemu-iotests/051.pc.out | 311 ++++++++++++++++-------------------------- 3 files changed, 258 insertions(+), 369 deletions(-)
tests/qemu-iotests/051 +51 -24
@@ -29,6 +29,7 @@ status=1 # failure is the default! _cleanup() { + _cleanup_qemu _cleanup_test_img } trap "_cleanup; exit \$status" 0 1 2 3 15
@@ -36,6 +37,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 # get standard environment, filters and checks . ./common.rc . ./common.filter +. ./common.qemu _supported_fmt qcow2 _supported_proto file
@@ -45,7 +47,6 @@ _supported_proto file _unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)' data_file \ compression_type _require_drivers nbd -_require_hmp if [ "$QEMU_DEFAULT_MACHINE" = "pc" ]; then _require_devices lsi53c895a
@@ -55,20 +56,22 @@ do_run_qemu() { echo Testing: "$@" ( + echo '{"execute":"qmp_capabilities"}' if ! test -t 0; then while read cmd; do - echo $cmd + echo "$cmd" done fi - echo quit - ) | $QEMU -nographic -monitor stdio -serial none "$@" + echo '{"execute":"quit"}' + ) | $QEMU -nographic -qmp stdio -serial none "$@" echo } run_qemu() { - do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | - _filter_generated_node_ids | _filter_hmp + do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu \ + | _filter_generated_node_ids | _filter_qmp | _filter_qmp_empty_return \ + | _filter_actual_image_size } size=128M
@@ -131,8 +134,8 @@ echo echo === Overriding backing file === echo -echo "info block" | run_qemu -drive file="$TEST_IMG",driver=qcow2,backing.file.filename="$TEST_IMG.orig",if=none,id=$device_id -nodefaults\ - | _filter_generated_node_ids +echo "{ 'execute': 'query-block' }" | \ + run_qemu -drive file="$TEST_IMG",driver=qcow2,backing.file.filename="$TEST_IMG.orig",if=none,id=$device_id -nodefaults # Drivers that don't support backing files run_qemu -drive file="$TEST_IMG",driver=raw,backing.file.filename="$TEST_IMG.orig"
@@ -257,7 +260,7 @@ run_qemu -drive driver=null-co,cache=invalid_value # Test 142 checks the direct=on cases for cache in writeback writethrough unsafe invalid_value; do - printf "info block %s\n" '' file backing backing-file | \ + printf '%s\n' "{ 'execute': 'query-block' }" "{ 'execute': 'query-named-block-nodes' }" | \ run_qemu -drive file="$TEST_IMG",cache=$cache,backing.file.filename="$TEST_IMG.base",backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=$device_id -nodefaults done
@@ -343,31 +346,56 @@ echo $QEMU_IO -c "write -P 0x11 0 4k" "$TEST_IMG" | _filter_qemu_io +qmp_write_22="{ 'execute': 'x-qemu-io', 'arguments': { 'device': '$device_id', 'command': 'write -P 0x22 0 4k' } }" -echo "qemu-io $device_id \"write -P 0x22 0 4k\"" | run_qemu -drive file="$TEST_IMG",if=none,id=$device_id -snapshot | _filter_qemu_io -echo "qemu-io $device_id \"write -P 0x22 0 4k\"" | run_qemu -drive file="$TEST_IMG",snapshot=on,if=none,id=$device_id | _filter_qemu_io -echo "qemu-io $device_id \"write -P 0x22 0 4k\"" | run_qemu -drive file.filename="$TEST_IMG",driver=qcow2,snapshot=on,if=none,id=$device_id\ +echo "$qmp_write_22" | run_qemu -drive file="$TEST_IMG",if=none,id=$device_id -snapshot | _filter_qemu_io +echo "$qmp_write_22" | run_qemu -drive file="$TEST_IMG",snapshot=on,if=none,id=$device_id | _filter_qemu_io +echo "$qmp_write_22" | run_qemu -drive file.filename="$TEST_IMG",driver=qcow2,snapshot=on,if=none,id=$device_id\ | _filter_qemu_io -echo "qemu-io $device_id \"write -P 0x22 0 4k\"" | run_qemu -drive file.filename="$TEST_IMG",driver=qcow2,if=none,id=$device_id -snapshot\ +echo "$qmp_write_22" | run_qemu -drive file.filename="$TEST_IMG",driver=qcow2,if=none,id=$device_id -snapshot\ | _filter_qemu_io -echo "qemu-io $device_id \"write -P 0x22 0 4k\"" | run_qemu -drive file="file:$TEST_IMG",if=none,id=$device_id -snapshot | _filter_qemu_io -echo "qemu-io $device_id \"write -P 0x22 0 4k\"" | run_qemu -drive file="file:$TEST_IMG",snapshot=on,if=none,id=$device_id | _filter_qemu_io +echo "$qmp_write_22" | run_qemu -drive file="file:$TEST_IMG",if=none,id=$device_id -snapshot | _filter_qemu_io +echo "$qmp_write_22" | run_qemu -drive file="file:$TEST_IMG",snapshot=on,if=none,id=$device_id | _filter_qemu_io # Opening a read-only file r/w with snapshot=on chmod u-w "$TEST_IMG" -echo "qemu-io $device_id \"write -P 0x22 0 4k\"" | run_qemu -drive file="$TEST_IMG",if=none,id=$device_id -snapshot | _filter_qemu_io -echo "qemu-io $device_id \"write -P 0x22 0 4k\"" | run_qemu -drive file="$TEST_IMG",snapshot=on,if=none,id=$device_id | _filter_qemu_io +echo "$qmp_write_22" | run_qemu -drive file="$TEST_IMG",if=none,id=$device_id -snapshot | _filter_qemu_io +echo "$qmp_write_22" | run_qemu -drive file="$TEST_IMG",snapshot=on,if=none,id=$device_id | _filter_qemu_io chmod u+w "$TEST_IMG" $QEMU_IO -c "read -P 0x11 0 4k" "$TEST_IMG" | _filter_qemu_io -echo "qemu-io $device_id \"write -P 0x22 0 4k\"" | run_qemu -drive file="$TEST_IMG",snapshot=off,if=none,id=$device_id | _filter_qemu_io +echo "$qmp_write_22" | run_qemu -drive file="$TEST_IMG",snapshot=off,if=none,id=$device_id | _filter_qemu_io $QEMU_IO -c "read -P 0x22 0 4k" "$TEST_IMG" | _filter_qemu_io -printf %b "qemu-io $device_id \"write -P 0x33 0 4k\"\ncommit $device_id\n" | - run_qemu -drive file="$TEST_IMG",snapshot=on,if=none,id=$device_id | - _filter_qemu_io +echo "Testing: -drive file=$TEST_IMG,snapshot=on,if=none,id=$device_id" | + _filter_testdir +_launch_qemu -drive file="$TEST_IMG",snapshot=on,if=none,id=$device_id +silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'qmp_capabilities' }" \ + 'return' +_send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'x-qemu-io', 'arguments': { 'device': '$device_id', 'command': 'write -P 0x33 0 4k' } }" \ + 'return' +qmp_commit="{ 'execute': 'block-commit', 'arguments': { 'device': '$device_id', 'job-id': 'job0' } }" +echo "$qmp_commit" +silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "$qmp_commit" \ + 'return' +silent=yes _timed_wait_for $QEMU_HANDLE '"ready"' +qmp_complete="{ 'execute': 'block-job-complete', 'arguments': { 'device': 'job0' } }" +echo "$qmp_complete" +silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "$qmp_complete" \ + 'return' +silent=yes _timed_wait_for $QEMU_HANDLE '"null"' +echo "block job completed" +silent=yes _send_qemu_cmd $QEMU_HANDLE \ + "{ 'execute': 'quit' }" \ + 'return' +wait=1 _cleanup_qemu +echo $QEMU_IO -c "read -P 0x33 0 4k" "$TEST_IMG" | _filter_qemu_io
@@ -380,10 +408,9 @@ TMPDIR=/nonexistent run_qemu -drive driver=null-co,snapshot=on | sed -e "s#'[^']*/vl\.[A-Za-z0-9]\{6\}'#SNAPSHOT_PATH#g" # Using snapshot=on together with read-only=on -echo "info block" | +echo "{ 'execute': 'query-block' }" | run_qemu -drive file="$TEST_IMG",snapshot=on,read-only=on,if=none,id=$device_id | - _filter_qemu_io | - sed -e 's#"[^"]*/vl\.[A-Za-z0-9]\{6\}"#SNAPSHOT_PATH#g' + sed -e 's|/[^"[:space:]]*/vl\.[A-Za-z0-9]\{6\}|SNAPSHOT_PATH|g' # success, all done
tests/qemu-iotests/051.out +8 -12
@@ -50,15 +50,15 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=qcow2,format=qcow2: Cannot specif === Node names === Testing: -drive file=TEST_DIR/t.qcow2,node-name=x123456789012345678901234567890 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) quit +QMP_VERSION +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} Testing: -drive file=TEST_DIR/t.qcow2,node-name=x1234567890123456789012345678901 QEMU_PROG: -drive file=TEST_DIR/t.qcow2,node-name=x1234567890123456789012345678901: Node name too long Testing: -drive file=TEST_DIR/t.qcow2,node-name=All-Types.of_all0wed_chars -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) quit +QMP_VERSION +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} Testing: -drive file=TEST_DIR/t.qcow2,node-name=123foo QEMU_PROG: -drive file=TEST_DIR/t.qcow2,node-name=123foo: Invalid node-name: '123foo'
@@ -73,20 +73,16 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,node-name=foo#12: Invalid node-name: 'fo === Device without drive === Testing: -device virtio-scsi -device scsi-hd -QEMU X.Y.Z monitor - type 'help' for more information +QMP_VERSION QEMU_PROG: -device scsi-hd: drive property not set === Overriding backing file === Testing: -drive file=TEST_DIR/t.qcow2,driver=qcow2,backing.file.filename=TEST_DIR/t.qcow2.orig,if=none,id=drive0 -nodefaults -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -drive0 (NODE_NAME): json:{"backing": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2.orig"}}, "driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2"}} (qcow2) - Removable device: not locked, tray closed - Cache mode: writeback - Backing file: TEST_DIR/t.qcow2.orig (chain depth: 1) -(qemu) quit +QMP_VERSION +{"return": [{"device": "drive0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.orig", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "backing-filename-format": "qcow2", "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DI R/t.qcow2.orig\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "full-backing-filename": "TEST_DIR/t.qcow2.base", "backing-filename": "TEST_DIR/t.qcow2.base", "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "backing"}, {"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backing_file": "TEST_DIR/t.qcow2.orig", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.orig\"}} , \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}"}, "type": "unknown"}]} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,driver=raw,backing.file.filename=TEST_DIR/t.qcow2.orig
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=raw,backing.file.filename=TEST_DIR/t.qcow2.orig: Driver doesn't support backing files
@@ -102,12 +98,12 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.backing.driver=qcow2,file.backing.f
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=off
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=: Parameter 'lazy-refcounts' expects 'on' or 'off'
@@ -126,14 +122,14 @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on: Lazy refcounts require a qcow2 image with at least qemu 1.1 compatibility level
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=off
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
=== No medium ===
Testing: -drive if=virtio
-QEMU X.Y.Z monitor - type 'help' for more information +QMP_VERSION
QEMU_PROG: -drive if=virtio: Device needs media, but drive is empty
@@ -143,94 +139,52 @@ QEMU_PROG: -drive if=virtio: Device needs media, but drive is empty
=== Read-only ===
Testing: -drive file=TEST_DIR/t.qcow2,if=virtio,readonly=on
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
=== Cache modes ===
Testing: -drive driver=null-co,read-zeroes=on,cache=none
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive driver=null-co,cache=invalid_value
QEMU_PROG: -drive driver=null-co,cache=invalid_value: invalid cache option
Testing: -drive file=TEST_DIR/t.qcow2,cache=writeback,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) info block
-drive0 (NODE_NAME): json:{"backing": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2.base"}}, "driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2"}} (qcow2)
- Removable device: not locked, tray closed - Cache mode: writeback - Backing file: TEST_DIR/t.qcow2.base (chain depth: 1)
-(qemu) info block file
-
-file: TEST_DIR/t.qcow2 (file)
- Cache mode: writeback
-(qemu) info block backing
-backing: TEST_DIR/t.qcow2.base (qcow2, read-only)
- Cache mode: writeback, ignore flushes
-(qemu) info block backing-file
-
-backing-file: TEST_DIR/t.qcow2.base (file, read-only)
- Cache mode: writeback, ignore flushes
-(qemu) quit
+QMP_VERSION
+{"return": [{"device": "drive0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qc
ow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "0.10", "compression-type": "zlib", "refcount-bits": 16}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "backing", "child": "backing"}, {"node-name": "file", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backing_file": "TEST_DIR/t.qcow2.base", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}"}, "type": "unknown"}]}
+{"return": [{"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": true, "children": [{"node-name": "backing-file", "child": "file"}], "node-name": "backing", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.base"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"request-a
lignment": 1, "min-mem-alignment": 1, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 197120, "filename": "TEST_DIR/t.qcow2.base", "format": "file", "actual-size": SIZE, "format-specific": {"type": "file", "data": {}}, "dirty-flag": false}, "iops_wr": 0, "ro": true, "children": [], "node-name": "backing-file", "backing_file_depth": 0, "drv": "file", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.base"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compr ession-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "0.10", "compression-type": "zlib", "refcount-bits": 16}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "backing", "child": "backing"}, {"node-name": "file", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backi ng_file": "TEST_DIR/t.qcow2.base", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 1, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 197120, "filename": "TEST_DIR/t.qcow2", "format": "file", "actual-size": SIZE, "format-specific": {"type": "file", "data": {}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [], "node-name": "file", "backing_file_depth": 0, "drv": "file", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}]}
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,cache=writethrough,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) info block
-drive0 (NODE_NAME): json:{"backing": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2.base"}}, "driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2"}} (qcow2)
- Removable device: not locked, tray closed - Cache mode: writethrough - Backing file: TEST_DIR/t.qcow2.base (chain depth: 1)
-(qemu) info block file
-
-file: TEST_DIR/t.qcow2 (file)
- Cache mode: writeback
-(qemu) info block backing
-backing: TEST_DIR/t.qcow2.base (qcow2, read-only)
- Cache mode: writeback, ignore flushes
-(qemu) info block backing-file
-
-backing-file: TEST_DIR/t.qcow2.base (file, read-only)
- Cache mode: writeback, ignore flushes
-(qemu) quit
+QMP_VERSION
+{"return": [{"device": "drive0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qc
ow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "0.10", "compression-type": "zlib", "refcount-bits": 16}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "backing", "child": "backing"}, {"node-name": "file", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backing_file": "TEST_DIR/t.qcow2.base", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": false}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}"}, "type": "unknown"}]}
+{"return": [{"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": true, "children": [{"node-name": "backing-file", "child": "file"}], "node-name": "backing", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.base"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"request-a
lignment": 1, "min-mem-alignment": 1, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 197120, "filename": "TEST_DIR/t.qcow2.base", "format": "file", "actual-size": SIZE, "format-specific": {"type": "file", "data": {}}, "dirty-flag": false}, "iops_wr": 0, "ro": true, "children": [], "node-name": "backing-file", "backing_file_depth": 0, "drv": "file", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.base"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compr ession-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "0.10", "compression-type": "zlib", "refcount-bits": 16}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "backing", "child": "backing"}, {"node-name": "file", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backi ng_file": "TEST_DIR/t.qcow2.base", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 1, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 197120, "filename": "TEST_DIR/t.qcow2", "format": "file", "actual-size": SIZE, "format-specific": {"type": "file", "data": {}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [], "node-name": "file", "backing_file_depth": 0, "drv": "file", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}]}
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,cache=unsafe,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) info block
-drive0 (NODE_NAME): json:{"backing": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2.base"}}, "driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2"}} (qcow2)
- Removable device: not locked, tray closed - Cache mode: writeback, ignore flushes - Backing file: TEST_DIR/t.qcow2.base (chain depth: 1)
-(qemu) info block file
-
-file: TEST_DIR/t.qcow2 (file)
- Cache mode: writeback, ignore flushes
-(qemu) info block backing
-backing: TEST_DIR/t.qcow2.base (qcow2, read-only)
- Cache mode: writeback, ignore flushes
-(qemu) info block backing-file
-
-backing-file: TEST_DIR/t.qcow2.base (file, read-only)
- Cache mode: writeback, ignore flushes
-(qemu) quit
+QMP_VERSION
+{"return": [{"device": "drive0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qc
ow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "0.10", "compression-type": "zlib", "refcount-bits": 16}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "backing", "child": "backing"}, {"node-name": "file", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backing_file": "TEST_DIR/t.qcow2.base", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}"}, "type": "unknown"}]}
+{"return": [{"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": true, "children": [{"node-name": "backing-file", "child": "file"}], "node-name": "backing", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.base"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"request-a
lignment": 1, "min-mem-alignment": 1, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 197120, "filename": "TEST_DIR/t.qcow2.base", "format": "file", "actual-size": SIZE, "format-specific": {"type": "file", "data": {}}, "dirty-flag": false}, "iops_wr": 0, "ro": true, "children": [], "node-name": "backing-file", "backing_file_depth": 0, "drv": "file", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.base"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compr ession-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "0.10", "compression-type": "zlib", "refcount-bits": 16}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "backing", "child": "backing"}, {"node-name": "file", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backi ng_file": "TEST_DIR/t.qcow2.base", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 1, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 197120, "filename": "TEST_DIR/t.qcow2", "format": "file", "actual-size": SIZE, "format-specific": {"type": "file", "data": {}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [], "node-name": "file", "backing_file_depth": 0, "drv": "file", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}]}
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,cache=invalid_value,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,cache=invalid_value,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0: invalid cache option
@@ -239,8 +193,8 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,cache=invalid_value,backing.file.filenam
=== Specifying the protocol layer ===
Testing: -drive file=TEST_DIR/t.qcow2,file.driver=file
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
=== Leaving out required options ===
@@ -336,16 +290,16 @@ Testing: -drive file=TEST_DIR/t.qcow2,throttling.bps-total=-5
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,throttling.bps-total=-5: bps/iops/max values must be within [0, 1000000000000000]
Testing: -drive file=TEST_DIR/t.qcow2,bps=0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,bps=1
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,bps=1000000000000000
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,bps=1000000000000001
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,bps=1000000000000001: bps/iops/max values must be within [0, 1000000000000000]
@@ -366,12 +320,12 @@ Testing: -drive file.filename=foo:bar
QEMU_PROG: -drive file.filename=foo:bar: Could not open 'foo:bar': No such file or directory
Testing: -hda file:TEST_DIR/t.qcow2
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=file:TEST_DIR/t.qcow2
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file.filename=file:TEST_DIR/t.qcow2
QEMU_PROG: -drive file.filename=file:TEST_DIR/t.qcow2: Could not open 'file:TEST_DIR/t.qcow2': No such file or directory
@@ -382,79 +336,60 @@ QEMU_PROG: -drive file.filename=file:TEST_DIR/t.qcow2: Could not open 'file:TEST
wrote 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=drive0 -snapshot
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file.filename=TEST_DIR/t.qcow2,driver=qcow2,snapshot=on,if=none,id=drive0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file.filename=TEST_DIR/t.qcow2,driver=qcow2,if=none,id=drive0 -snapshot
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=file:TEST_DIR/t.qcow2,if=none,id=drive0 -snapshot
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=file:TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=drive0 -snapshot
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
read 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=off,if=none,id=drive0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
read 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x33 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) commit drive0
-(qemu) quit
+{ 'execute': 'x-qemu-io', 'arguments': { 'device': 'drive0', 'command': 'write -P 0x33 0 4k' } }
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{ 'execute': 'block-commit', 'arguments': { 'device': 'drive0', 'job-id': 'job0' } }
+{ 'execute': 'block-job-complete', 'arguments': { 'device': 'job0' } }
+block job completed
read 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
@@ -462,12 +397,8 @@ Testing: -drive driver=null-co,snapshot=on
QEMU_PROG: -drive driver=null-co,snapshot=on: Could not open temporary file SNAPSHOT_PATH: No such file or directory
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=on,read-only=on,if=none,id=drive0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) info block
-drive0 (NODE_NAME): json:{"backing": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2"}}, "driver": "qcow2", "file": {"driver": "file", "filename": SNAPSHOT_PATH}} (qcow2, read-only)
- Removable device: not locked, tray closed - Cache mode: writeback, ignore flushes - Backing file: TEST_DIR/t.qcow2 (chain depth: 1)
-(qemu) quit
+QMP_VERSION
+{"return": [{"device": "drive0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "0.10", "compression-type": "zlib", "refcount-bits": 16}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"SNAPSHOT_PATH\"}}"
, "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": true, "children": [{"node-name": "NODE_NAME", "child": "backing"}, {"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backing_file": "TEST_DIR/t.qcow2", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"SNAPSHOT_PATH\"}}"}, "type": "unknown"}]}
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
*** done
tests/qemu-iotests/051.pc.out +8 -12
@@ -50,15 +50,15 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=qcow2,format=qcow2: Cannot specif === Node names === Testing: -drive file=TEST_DIR/t.qcow2,node-name=x123456789012345678901234567890 -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) quit +QMP_VERSION +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} Testing: -drive file=TEST_DIR/t.qcow2,node-name=x1234567890123456789012345678901 QEMU_PROG: -drive file=TEST_DIR/t.qcow2,node-name=x1234567890123456789012345678901: Node name too long Testing: -drive file=TEST_DIR/t.qcow2,node-name=All-Types.of_all0wed_chars -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) quit +QMP_VERSION +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}} Testing: -drive file=TEST_DIR/t.qcow2,node-name=123foo QEMU_PROG: -drive file=TEST_DIR/t.qcow2,node-name=123foo: Invalid node-name: '123foo'
@@ -73,20 +73,16 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,node-name=foo#12: Invalid node-name: 'fo === Device without drive === Testing: -device virtio-scsi -device scsi-hd -QEMU X.Y.Z monitor - type 'help' for more information +QMP_VERSION QEMU_PROG: -device scsi-hd: drive property not set === Overriding backing file === Testing: -drive file=TEST_DIR/t.qcow2,driver=qcow2,backing.file.filename=TEST_DIR/t.qcow2.orig,if=none,id=drive0 -nodefaults -QEMU X.Y.Z monitor - type 'help' for more information -(qemu) info block -drive0 (NODE_NAME): json:{"backing": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2.orig"}}, "driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2"}} (qcow2) - Removable device: not locked, tray closed - Cache mode: writeback - Backing file: TEST_DIR/t.qcow2.orig (chain depth: 1) -(qemu) quit +QMP_VERSION +{"return": [{"device": "drive0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.orig", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "backing-filename-format": "qcow2", "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DI R/t.qcow2.orig\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "full-backing-filename": "TEST_DIR/t.qcow2.base", "backing-filename": "TEST_DIR/t.qcow2.base", "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "backing"}, {"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backing_file": "TEST_DIR/t.qcow2.orig", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.orig\"}} , \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}"}, "type": "unknown"}]} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,driver=raw,backing.file.filename=TEST_DIR/t.qcow2.orig
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,driver=raw,backing.file.filename=TEST_DIR/t.qcow2.orig: Driver doesn't support backing files
@@ -102,12 +98,12 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,file.backing.driver=qcow2,file.backing.f
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=off
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=: Parameter 'lazy-refcounts' expects 'on' or 'off'
@@ -126,191 +122,149 @@ Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=on: Lazy refcounts require a qcow2 image with at least qemu 1.1 compatibility level
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,lazy-refcounts=off
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
=== No medium ===
Testing: -drive if=floppy
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive if=ide,media=cdrom
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive if=ide
-QEMU X.Y.Z monitor - type 'help' for more information +QMP_VERSION
QEMU_PROG: Device needs media, but drive is empty
Testing: -drive if=virtio
-QEMU X.Y.Z monitor - type 'help' for more information +QMP_VERSION
QEMU_PROG: -drive if=virtio: Device needs media, but drive is empty
Testing: -drive if=none,id=disk -device ide-cd,drive=disk
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive if=none,id=disk -device lsi53c895a -device scsi-cd,drive=disk
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive if=none,id=disk -device ide-hd,drive=disk
-QEMU X.Y.Z monitor - type 'help' for more information +QMP_VERSION
QEMU_PROG: -device ide-hd,drive=disk: Device needs media, but drive is empty
Testing: -drive if=none,id=disk -device lsi53c895a -device scsi-hd,drive=disk
-QEMU X.Y.Z monitor - type 'help' for more information +QMP_VERSION
QEMU_PROG: -device scsi-hd,drive=disk: Device needs media, but drive is empty
=== Attach to node in non-default iothread ===
Testing: -drive file=TEST_DIR/t.qcow2,if=none,node-name=disk -object iothread,id=thread0 -device virtio-scsi,iothread=thread0,id=virtio-scsi0 -device scsi-hd,bus=virtio-scsi0.0,drive=disk,share-rw=on -device ide-hd,drive=disk,share-rw=on
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) QEMU_PROG: -device ide-hd,drive=disk,share-rw=on: Cannot change iothread of active block backend
+QMP_VERSION
+QEMU_PROG: -device ide-hd,drive=disk,share-rw=on: Cannot change iothread of active block backend
Testing: -drive file=TEST_DIR/t.qcow2,if=none,node-name=disk -object iothread,id=thread0 -device virtio-scsi,iothread=thread0,id=virtio-scsi0 -device scsi-hd,bus=virtio-scsi0.0,drive=disk,share-rw=on -device virtio-blk-pci,drive=disk,share-rw=on
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) QEMU_PROG: -device virtio-blk-pci,drive=disk,share-rw=on: Cannot change iothread of active block backend
+QMP_VERSION
+QEMU_PROG: -device virtio-blk-pci,drive=disk,share-rw=on: Cannot change iothread of active block backend
Testing: -drive file=TEST_DIR/t.qcow2,if=none,node-name=disk -object iothread,id=thread0 -device virtio-scsi,iothread=thread0,id=virtio-scsi0 -device scsi-hd,bus=virtio-scsi0.0,drive=disk,share-rw=on -device lsi53c895a,id=lsi0 -device scsi-hd,bus=lsi0.0,drive=disk,share-rw=on
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) QEMU_PROG: -device scsi-hd,bus=lsi0.0,drive=disk,share-rw=on: HBA does not support iothreads
+QMP_VERSION
+QEMU_PROG: -device scsi-hd,bus=lsi0.0,drive=disk,share-rw=on: HBA does not support iothreads
Testing: -drive file=TEST_DIR/t.qcow2,if=none,node-name=disk -object iothread,id=thread0 -device virtio-scsi,iothread=thread0,id=virtio-scsi0 -device scsi-hd,bus=virtio-scsi0.0,drive=disk,share-rw=on -device virtio-scsi,id=virtio-scsi1 -device scsi-hd,bus=virtio-scsi1.0,drive=disk,share-rw=on
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,if=none,node-name=disk -object iothread,id=thread0 -device virtio-scsi,iothread=thread0,id=virtio-scsi0 -device scsi-hd,bus=virtio-scsi0.0,drive=disk,share-rw=on -device virtio-blk-pci,drive=disk,iothread=thread0,share-rw=on
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) QEMU_PROG: -device virtio-blk-pci,drive=disk,iothread=thread0,share-rw=on: Cannot change iothread of active block backend
+QMP_VERSION
+QEMU_PROG: -device virtio-blk-pci,drive=disk,iothread=thread0,share-rw=on: Cannot change iothread of active block backend
Testing: -drive file=TEST_DIR/t.qcow2,if=none,node-name=disk -object iothread,id=thread0 -device virtio-scsi,iothread=thread0,id=virtio-scsi0 -device scsi-hd,bus=virtio-scsi0.0,drive=disk,share-rw=on -device virtio-scsi,id=virtio-scsi1,iothread=thread0 -device scsi-hd,bus=virtio-scsi1.0,drive=disk,share-rw=on
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
=== Read-only ===
Testing: -drive file=TEST_DIR/t.qcow2,if=floppy,readonly=on
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,if=ide,media=cdrom,readonly=on
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,if=ide,readonly=on
-QEMU X.Y.Z monitor - type 'help' for more information +QMP_VERSION
QEMU_PROG: Block node is read-only
Testing: -drive file=TEST_DIR/t.qcow2,if=virtio,readonly=on
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device ide-cd,drive=disk
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-cd,drive=disk
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device ide-hd,drive=disk
-QEMU X.Y.Z monitor - type 'help' for more information
+QMP_VERSION
QEMU_PROG: -device ide-hd,drive=disk: Block node is read-only
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=disk,readonly=on -device lsi53c895a -device scsi-hd,drive=disk
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
=== Cache modes ===
Testing: -drive driver=null-co,read-zeroes=on,cache=none
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive driver=null-co,read-zeroes=on,cache=directsync
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive driver=null-co,read-zeroes=on,cache=writeback
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive driver=null-co,read-zeroes=on,cache=writethrough
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive driver=null-co,read-zeroes=on,cache=unsafe
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive driver=null-co,cache=invalid_value
QEMU_PROG: -drive driver=null-co,cache=invalid_value: invalid cache option
Testing: -drive file=TEST_DIR/t.qcow2,cache=writeback,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) info block
-drive0 (NODE_NAME): json:{"backing": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2.base"}}, "driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2"}} (qcow2)
- Removable device: not locked, tray closed - Cache mode: writeback - Backing file: TEST_DIR/t.qcow2.base (chain depth: 1)
-(qemu) info block file
-
-file: TEST_DIR/t.qcow2 (file)
- Cache mode: writeback
-(qemu) info block backing
-backing: TEST_DIR/t.qcow2.base (qcow2, read-only)
- Cache mode: writeback, ignore flushes
-(qemu) info block backing-file
-
-backing-file: TEST_DIR/t.qcow2.base (file, read-only)
- Cache mode: writeback, ignore flushes
-(qemu) quit
+QMP_VERSION
+{"return": [{"device": "drive0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qc
ow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "0.10", "compression-type": "zlib", "refcount-bits": 16}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "backing", "child": "backing"}, {"node-name": "file", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backing_file": "TEST_DIR/t.qcow2.base", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}"}, "type": "unknown"}]}
+{"return": [{"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": true, "children": [{"node-name": "backing-file", "child": "file"}], "node-name": "backing", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.base"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"request-a
lignment": 1, "min-mem-alignment": 1, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 197120, "filename": "TEST_DIR/t.qcow2.base", "format": "file", "actual-size": SIZE, "format-specific": {"type": "file", "data": {}}, "dirty-flag": false}, "iops_wr": 0, "ro": true, "children": [], "node-name": "backing-file", "backing_file_depth": 0, "drv": "file", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.base"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compr ession-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "0.10", "compression-type": "zlib", "refcount-bits": 16}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "backing", "child": "backing"}, {"node-name": "file", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backi ng_file": "TEST_DIR/t.qcow2.base", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 1, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 197120, "filename": "TEST_DIR/t.qcow2", "format": "file", "actual-size": SIZE, "format-specific": {"type": "file", "data": {}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [], "node-name": "file", "backing_file_depth": 0, "drv": "file", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}]}
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,cache=writethrough,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) info block
-drive0 (NODE_NAME): json:{"backing": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2.base"}}, "driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2"}} (qcow2)
- Removable device: not locked, tray closed - Cache mode: writethrough - Backing file: TEST_DIR/t.qcow2.base (chain depth: 1)
-(qemu) info block file
-
-file: TEST_DIR/t.qcow2 (file)
- Cache mode: writeback
-(qemu) info block backing
-backing: TEST_DIR/t.qcow2.base (qcow2, read-only)
- Cache mode: writeback, ignore flushes
-(qemu) info block backing-file
-
-backing-file: TEST_DIR/t.qcow2.base (file, read-only)
- Cache mode: writeback, ignore flushes
-(qemu) quit
+QMP_VERSION
+{"return": [{"device": "drive0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qc
ow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "0.10", "compression-type": "zlib", "refcount-bits": 16}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "backing", "child": "backing"}, {"node-name": "file", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backing_file": "TEST_DIR/t.qcow2.base", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": false}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}"}, "type": "unknown"}]}
+{"return": [{"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": true, "children": [{"node-name": "backing-file", "child": "file"}], "node-name": "backing", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.base"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"request-a
lignment": 1, "min-mem-alignment": 1, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 197120, "filename": "TEST_DIR/t.qcow2.base", "format": "file", "actual-size": SIZE, "format-specific": {"type": "file", "data": {}}, "dirty-flag": false}, "iops_wr": 0, "ro": true, "children": [], "node-name": "backing-file", "backing_file_depth": 0, "drv": "file", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.base"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compr ession-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "0.10", "compression-type": "zlib", "refcount-bits": 16}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "backing", "child": "backing"}, {"node-name": "file", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backi ng_file": "TEST_DIR/t.qcow2.base", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 1, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 197120, "filename": "TEST_DIR/t.qcow2", "format": "file", "actual-size": SIZE, "format-specific": {"type": "file", "data": {}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [], "node-name": "file", "backing_file_depth": 0, "drv": "file", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}]}
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,cache=unsafe,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) info block
-drive0 (NODE_NAME): json:{"backing": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2.base"}}, "driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2"}} (qcow2)
- Removable device: not locked, tray closed - Cache mode: writeback, ignore flushes - Backing file: TEST_DIR/t.qcow2.base (chain depth: 1)
-(qemu) info block file
-
-file: TEST_DIR/t.qcow2 (file)
- Cache mode: writeback, ignore flushes
-(qemu) info block backing
-backing: TEST_DIR/t.qcow2.base (qcow2, read-only)
- Cache mode: writeback, ignore flushes
-(qemu) info block backing-file
-
-backing-file: TEST_DIR/t.qcow2.base (file, read-only)
- Cache mode: writeback, ignore flushes
-(qemu) quit
+QMP_VERSION
+{"return": [{"device": "drive0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qc
ow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "0.10", "compression-type": "zlib", "refcount-bits": 16}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "backing", "child": "backing"}, {"node-name": "file", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backing_file": "TEST_DIR/t.qcow2.base", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}"}, "type": "unknown"}]}
+{"return": [{"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": true, "children": [{"node-name": "backing-file", "child": "file"}], "node-name": "backing", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.base"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"request-a
lignment": 1, "min-mem-alignment": 1, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 197120, "filename": "TEST_DIR/t.qcow2.base", "format": "file", "actual-size": SIZE, "format-specific": {"type": "file", "data": {}}, "dirty-flag": false}, "iops_wr": 0, "ro": true, "children": [], "node-name": "backing-file", "backing_file_depth": 0, "drv": "file", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.base"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2.base", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compr ession-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "0.10", "compression-type": "zlib", "refcount-bits": 16}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "backing", "child": "backing"}, {"node-name": "file", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backi ng_file": "TEST_DIR/t.qcow2.base", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2.base\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}"}, {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"request-alignment": 1, "min-mem-alignment": 1, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 197120, "filename": "TEST_DIR/t.qcow2", "format": "file", "actual-size": SIZE, "format-specific": {"type": "file", "data": {}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [], "node-name": "file", "backing_file_depth": 0, "drv": "file", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}]}
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,cache=invalid_value,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0 -nodefaults
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,cache=invalid_value,backing.file.filename=TEST_DIR/t.qcow2.base,backing.cache.no-flush=on,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file,if=none,id=drive0: invalid cache option
@@ -319,8 +273,8 @@ QEMU_PROG: -drive file=TEST_DIR/t.qcow2,cache=invalid_value,backing.file.filenam
=== Specifying the protocol layer ===
Testing: -drive file=TEST_DIR/t.qcow2,file.driver=file
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
=== Leaving out required options ===
@@ -416,16 +370,16 @@ Testing: -drive file=TEST_DIR/t.qcow2,throttling.bps-total=-5
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,throttling.bps-total=-5: bps/iops/max values must be within [0, 1000000000000000]
Testing: -drive file=TEST_DIR/t.qcow2,bps=0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,bps=1
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,bps=1000000000000000
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,bps=1000000000000001
QEMU_PROG: -drive file=TEST_DIR/t.qcow2,bps=1000000000000001: bps/iops/max values must be within [0, 1000000000000000]
@@ -446,12 +400,12 @@ Testing: -drive file.filename=foo:bar
QEMU_PROG: -drive file.filename=foo:bar: Could not open 'foo:bar': No such file or directory
Testing: -hda file:TEST_DIR/t.qcow2
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=file:TEST_DIR/t.qcow2
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) quit
+QMP_VERSION
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file.filename=file:TEST_DIR/t.qcow2
QEMU_PROG: -drive file.filename=file:TEST_DIR/t.qcow2: Could not open 'file:TEST_DIR/t.qcow2': No such file or directory
@@ -462,79 +416,60 @@ QEMU_PROG: -drive file.filename=file:TEST_DIR/t.qcow2: Could not open 'file:TEST
wrote 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=drive0 -snapshot
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file.filename=TEST_DIR/t.qcow2,driver=qcow2,snapshot=on,if=none,id=drive0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file.filename=TEST_DIR/t.qcow2,driver=qcow2,if=none,id=drive0 -snapshot
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=file:TEST_DIR/t.qcow2,if=none,id=drive0 -snapshot
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=file:TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,if=none,id=drive0 -snapshot
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
read 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=off,if=none,id=drive0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x22 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) quit
+QMP_VERSION
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
read 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=on,if=none,id=drive0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) qemu-io drive0 "write -P 0x33 0 4k"
-wrote 4096/4096 bytes at offset 0
-4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
-(qemu) commit drive0
-(qemu) quit
+{ 'execute': 'x-qemu-io', 'arguments': { 'device': 'drive0', 'command': 'write -P 0x33 0 4k' } }
+{"return": {"human-readable-text": "wrote 4096/4096 bytes at offset 0\n4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)\n"}} +{ 'execute': 'block-commit', 'arguments': { 'device': 'drive0', 'job-id': 'job0' } }
+{ 'execute': 'block-job-complete', 'arguments': { 'device': 'job0' } }
+block job completed
read 4096/4096 bytes at offset 0
4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
@@ -542,12 +477,8 @@ Testing: -drive driver=null-co,snapshot=on
QEMU_PROG: -drive driver=null-co,snapshot=on: Could not open temporary file SNAPSHOT_PATH: No such file or directory
Testing: -drive file=TEST_DIR/t.qcow2,snapshot=on,read-only=on,if=none,id=drive0
-QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) info block
-drive0 (NODE_NAME): json:{"backing": {"driver": "qcow2", "file": {"driver": "file", "filename": "TEST_DIR/t.qcow2"}}, "driver": "qcow2", "file": {"driver": "file", "filename": SNAPSHOT_PATH}} (qcow2, read-only)
- Removable device: not locked, tray closed - Cache mode: writeback, ignore flushes - Backing file: TEST_DIR/t.qcow2 (chain depth: 1)
-(qemu) quit
+QMP_VERSION
+{"return": [{"device": "drive0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"backing-image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "0.10", "compression-type": "zlib", "refcount-bits": 16}}, "dirty-flag": false}, "limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 134217728, "filename": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"SNAPSHOT_PATH\"}}"
, "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": true, "children": [{"node-name": "NODE_NAME", "child": "backing"}, {"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 1, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "backing_file": "TEST_DIR/t.qcow2", "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": true, "direct": false, "writeback": true}, "file": "json:{\"backing\": {\"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"TEST_DIR/t.qcow2\"}}, \"driver\": \"qcow2\", \"file\": {\"driver\": \"file\", \"filename\": \"SNAPSHOT_PATH\"}}"}, "type": "unknown"}]}
+{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
*** done
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 85/88 qdev: add x-query-qtree QMP command
In reply to Marc-André LureauAdd x-query-qtree QMP command returning HumanReadableText with the device tree. Supports an optional "brief" parameter to omit device properties, matching the -b flag of "info qtree".
Refactor the BusClass print_dev callback and qbus_print/qdev_print functions to write to a GString buffer instead of requiring a Monitor, so the QMP command can collect the output directly without needing monitor internals.
Rewire hmp_info_qtree to use the new QMP command.
Eventually, qom-list and properties retrieval should be enhanced to do tree traversal and make this pretty-printing method obsolete and return structured data instead.
--- hw/char/virtio-serial-bus.c | 23 ++++++++-------------- hw/core/sysbus.c | 17 +++++------------ hw/misc/auxbus.c | 22 ++++++++------------- hw/pci/pci-hmp-cmds.c | 38 ------------------------------------- hw/pci/pci-internal.h | 2 +- hw/pci/pci.c | 40 +++++++++++++++++++++++++++++++++++++-- hw/usb/bus.c | 23 ++++++++-------------- hw/xen/xen-bus.c | 12 +++--------- include/hw/core/qdev.h | 4 +--- qapi/qdev.json | 31 ++++++++++++++++++++++++++++++ rust/bindings/hwcore-sys/lib.rs | 2 +- system/qdev-monitor.c | 42 +++++++++++++++++++++++++++-------------- 12 files changed, 132 insertions(+), 124 deletions(-)
hw/char/virtio-serial-bus.c +8 -15
@@ -24,8 +24,6 @@#include "qemu/main-loop.h" #include "qemu/module.h" #include "migration/qemu-file-types.h" -#include "monitor/monitor.h" -#include "monitor/hmp.h" #include "qemu/error-report.h" #include "qemu/queue.h" #include "hw/core/qdev-properties.h"
@@ -818,9 +816,7 @@ static int virtio_serial_load_device(VirtIODevice *vdev, QEMUFile *f,return 0 ; } -#ifdef CONFIG_HMP -static void virtser_bus_dev_print (MonitorHMP *hmp,DeviceState *qdev,int indent); -#endif +static void virtser_bus_dev_print (GString *buf,DeviceState *qdev,int indent);static const Property virtser_props[] = {DEFINE_PROP_UINT32 ("nr" , VirtIOSerialPort, id,VIRTIO_CONSOLE_BAD_ID ),
@@ -829,10 +825,8 @@ static const Property virtser_props[] = {static void virtser_bus_class_init (ObjectClass *klass,const void *data) { -#ifdef CONFIG_HMP BusClass *k =BUS_CLASS (klass); k->print_dev = virtser_bus_dev_print; -#endif }static const TypeInfo virtser_bus_info = {
@@ -842,18 +836,17 @@ static const TypeInfo virtser_bus_info = { .class_init = virtser_bus_class_init, }; -#ifdef CONFIG_HMP -static void virtser_bus_dev_print (MonitorHMP *hmp,DeviceState *qdev,int indent) +static void virtser_bus_dev_print (GString *buf,DeviceState *qdev,int indent) {VirtIOSerialPort *port =VIRTIO_SERIAL_PORT (qdev); -monitor_hmp_printf (hmp,"%*sport %d, guest %s, host %s, throttle %s\n" , - indent,"" , port->id, - port->guest_connected ?"on" :"off" , - port->host_connected ?"on" :"off" , - port->throttled ?"on" :"off" ); +g_string_append_printf (buf, +"%*sport %d, guest %s, host %s, throttle %s\n" , + indent,"" , port->id, + port->guest_connected ?"on" :"off" , + port->host_connected ?"on" :"off" , + port->throttled ?"on" :"off" ); } -#endif /* This function is only used if a port id is not provided by the user */ static uint32_t find_free_port_id (VirtIOSerial *vser)
hw/core/sysbus.c +5 -12
@@ -20,13 +20,9 @@#include "qemu/osdep.h" #include "qapi/error.h" #include "hw/core/sysbus.h" -#include "monitor/monitor.h" -#include "monitor/hmp.h" #include "system/address-spaces.h" -#ifdef CONFIG_HMP -static void sysbus_dev_print (MonitorHMP *hmp,DeviceState *dev,int indent); -#endif +static void sysbus_dev_print (GString *buf,DeviceState *dev,int indent);static char *sysbus_get_fw_dev_path (DeviceState *dev); typedef struct SysBusFind {
@@ -78,9 +74,7 @@ static void system_bus_class_init(ObjectClass *klass, const void *data) {BusClass *k =BUS_CLASS (klass); -#ifdef CONFIG_HMP k->print_dev = sysbus_dev_print; -#endif k->get_fw_dev_path = sysbus_get_fw_dev_path; }
@@ -253,8 +247,7 @@ bool sysbus_realize_and_unref(SysBusDevice *dev, Error **errp)return qdev_realize_and_unref (DEVICE (dev),sysbus_get_default (), errp); } -#ifdef CONFIG_HMP -static void sysbus_dev_print (MonitorHMP *hmp,DeviceState *dev,int indent) +static void sysbus_dev_print (GString *buf,DeviceState *dev,int indent) {SysBusDevice *s =SYS_BUS_DEVICE (dev);hwaddr size;
@@ -262,11 +255,11 @@ static void sysbus_dev_print(MonitorHMP *hmp, DeviceState *dev, int indent)for (i =0 ; i < s->num_mmio; i++) { size =memory_region_size (s->mmio[i].memory); -monitor_hmp_printf (hmp,"%*smmio " HWADDR_FMT_plx"/" HWADDR_FMT_plx"\n" , - indent,"" , s->mmio[i].addr, size); +g_string_append_printf (buf,"%*smmio " + HWADDR_FMT_plx"/" HWADDR_FMT_plx"\n" , + indent,"" , s->mmio[i].addr, size); } } -#endif static char *sysbus_get_fw_dev_path (DeviceState *dev) {
hw/misc/auxbus.c +8 -14
@@ -32,8 +32,6 @@#include "qemu/module.h" #include "hw/misc/auxbus.h" #include "hw/i2c/i2c.h" -#include "monitor/monitor.h" -#include "monitor/hmp.h" #include "qapi/error.h" #ifndef DEBUG_AUX
@@ -47,22 +45,18 @@ }while (0 ) -#ifdef CONFIG_HMP -static void aux_slave_dev_print (MonitorHMP *hmp,DeviceState *dev,int indent); -#endif +static void aux_slave_dev_print(GString *buf, DeviceState *dev, int indent);static inline I2CBus *aux_bridge_get_i2c_bus (AUXTOI2CState *bridge);/* aux-bus implementation (internal not public) */ static void aux_bus_class_init (ObjectClass *klass,const void *data) { -#ifdef CONFIG_HMP BusClass *k =BUS_CLASS (klass);/* AUXSlave has an MMIO so we need to change the way we print information * in monitor. */ k->print_dev = aux_slave_dev_print; -#endif }AUXBus *aux_bus_init (DeviceState *parent,const char *name)
@@ -287,13 +281,12 @@ static const TypeInfo aux_to_i2c_type_info = { };/* aux-slave implementation */ -#ifdef CONFIG_HMP static bool aux_bus_is_bridge (AUXBus *bus,DeviceState *dev) {return (dev ==DEVICE (bus->bridge)); } -static void aux_slave_dev_print (MonitorHMP *hmp,DeviceState *dev,int indent) +static void aux_slave_dev_print (GString *buf,DeviceState *dev,int indent) {AUXBus *bus =AUX_BUS (qdev_get_parent_bus (dev));AUXSlave *s;
@@ -305,12 +298,13 @@ static void aux_slave_dev_print(MonitorHMP *hmp, DeviceState *dev, int indent) s =AUX_SLAVE (dev); -monitor_hmp_printf (hmp,"%*smemory " HWADDR_FMT_plx"/" HWADDR_FMT_plx"\n" , - indent,"" , -object_property_get_uint (OBJECT (s->mmio),"addr" ,NULL ), - memory_region_size(s->mmio)); +g_string_append_printf (buf, +"%*smemory " HWADDR_FMT_plx"/" HWADDR_FMT_plx"\n" , + indent,"" , +object_property_get_uint (OBJECT (s->mmio), +"addr" ,NULL ), +memory_region_size (s->mmio)); } -#endif void aux_init_mmio (AUXSlave *aux_slave,MemoryRegion *mmio) {
hw/pci/pci-hmp-cmds.c +0 -38
@@ -135,44 +135,6 @@ void hmp_info_pci(MonitorHMP *hmp, const QDict *qdict)qapi_free_PciInfoList (info_list); } -#ifdef CONFIG_HMP -void pcibus_dev_print (MonitorHMP *hmp,DeviceState *dev,int indent) -{ -PCIDevice *d = (PCIDevice *)dev; -int class =pci_get_word (d->config +PCI_CLASS_DEVICE ); -const pci_class_desc *desc =get_class_desc (class); -char ctxt[64 ]; -PCIIORegion *r; -int i; - -if (desc->desc) { -snprintf (ctxt,sizeof (ctxt),"%s" , desc->desc); - }else { -snprintf (ctxt,sizeof (ctxt),"Class %04x" , class); - } - -monitor_hmp_printf (hmp,"%*sclass %s, addr %02x:%02x.%x, " -"pci id %04x:%04x (sub %04x:%04x)\n" , - indent,"" , ctxt,pci_dev_bus_num (d), -PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), -pci_get_word (d->config +PCI_VENDOR_ID ), -pci_get_word (d->config +PCI_DEVICE_ID ), -pci_get_word (d->config +PCI_SUBSYSTEM_VENDOR_ID ), -pci_get_word (d->config +PCI_SUBSYSTEM_ID )); -for (i =0 ; i <PCI_NUM_REGIONS ; i++) { - r = &d->io_regions[i]; -if (!r->size) { -continue ; - } -monitor_hmp_printf (hmp,"%*sbar %d: %s at 0x%" FMT_PCIBUS -" [0x%" FMT_PCIBUS "]\n" , - indent,"" , - i, r->type &PCI_BASE_ADDRESS_SPACE_IO ?"i/o" :"mem" , - r->addr, r->addr + r->size -1 ); - } -} -#endif -void hmp_pcie_aer_inject_error (MonitorHMP *hmp,const QDict *qdict) {Error *err =NULL ;
hw/pci/pci-internal.h +1 -1
@@ -16,7 +16,7 @@ extern PCIHostStateList pci_host_bridges;const pci_class_desc *get_class_desc (int class);PCIBus *pci_find_bus_nr (PCIBus *bus,int bus_num); -void pcibus_dev_print (MonitorHMP *mon,DeviceState *dev,int indent); +void pcibus_dev_print (GString *buf,DeviceState *dev,int indent);int pcie_aer_parse_error_string (const char *error_name,uint32_t *status,bool *correctable);
hw/pci/pci.c +38 -2
@@ -293,9 +293,7 @@ static void pci_bus_class_init(ObjectClass *klass, const void *data)ResettableClass *rc =RESETTABLE_CLASS (klass);FWCfgDataGeneratorClass *fwgc =FW_CFG_DATA_GENERATOR_CLASS (klass); -#ifdef CONFIG_HMP k->print_dev = pcibus_dev_print; -#endif k->get_dev_path = pcibus_get_dev_path; k->get_fw_dev_path = pcibus_get_fw_dev_path; k->realize = pci_bus_realize;
@@ -2094,6 +2092,44 @@ const pci_class_desc *get_class_desc(int class)return desc; } +void pcibus_dev_print (GString *buf,DeviceState *dev,int indent) +{ +PCIDevice *d = (PCIDevice *)dev; +int class =pci_get_word (d->config +PCI_CLASS_DEVICE ); +const pci_class_desc *desc =get_class_desc (class); +char ctxt[64 ]; +PCIIORegion *r; +int i; + +if (desc->desc) { +snprintf (ctxt,sizeof (ctxt),"%s" , desc->desc); + }else { +snprintf (ctxt,sizeof (ctxt),"Class %04x" , class); + } + +g_string_append_printf (buf,"%*sclass %s, addr %02x:%02x.%x, " +"pci id %04x:%04x (sub %04x:%04x)\n" , + indent,"" , ctxt,pci_dev_bus_num (d), +PCI_SLOT (d->devfn),PCI_FUNC (d->devfn), +pci_get_word (d->config +PCI_VENDOR_ID ), +pci_get_word (d->config +PCI_DEVICE_ID ), +pci_get_word (d->config +PCI_SUBSYSTEM_VENDOR_ID ), +pci_get_word (d->config +PCI_SUBSYSTEM_ID )); +for (i =0 ; i <PCI_NUM_REGIONS ; i++) { + r = &d->io_regions[i]; +if (!r->size) { +continue ; + } +g_string_append_printf (buf,"%*sbar %d: %s at 0x%" FMT_PCIBUS +" [0x%" FMT_PCIBUS "]\n" , + indent,"" , + i, + r->type &PCI_BASE_ADDRESS_SPACE_IO + ?"i/o" :"mem" , + r->addr, r->addr + r->size -1 ); + } +} +void pci_init_nic_devices (PCIBus *bus,const char *default_model) { qemu_create_nic_bus_devices(&bus->qbus, TYPE_PCI_DEVICE, default_model,
hw/usb/bus.c +8 -15
@@ -8,14 +8,10 @@#include "qemu/module.h" #include "system/system.h" #include "migration/vmstate.h" -#include "monitor/monitor.h" -#include "monitor/hmp.h" #include "trace.h" #include "qemu/cutils.h" -#ifdef CONFIG_HMP -static void usb_bus_dev_print (MonitorHMP *hmp,DeviceState *qdev,int indent); -#endif +static void usb_bus_dev_print (GString *buf,DeviceState *qdev,int indent);static char *usb_get_dev_path (DeviceState *dev);static char *usb_get_fw_dev_path (DeviceState *qdev);
@@ -34,9 +30,7 @@ static void usb_bus_class_init(ObjectClass *klass, const void *data)BusClass *k =BUS_CLASS (klass);HotplugHandlerClass *hc =HOTPLUG_HANDLER_CLASS (klass); -#ifdef CONFIG_HMP k->print_dev = usb_bus_dev_print; -#endif k->get_dev_path = usb_get_dev_path; k->get_fw_dev_path = usb_get_fw_dev_path; hc->unplug = qdev_simple_device_unplug_cb;
@@ -548,19 +542,18 @@ static const char *usb_speed(unsigned int speed)return txt[speed]; } -#ifdef CONFIG_HMP -static void usb_bus_dev_print (MonitorHMP *hmp,DeviceState *qdev,int indent) +static void usb_bus_dev_print (GString *buf,DeviceState *qdev,int indent) {USBDevice *dev =USB_DEVICE (qdev);USBBus *bus =usb_bus_from_device (dev); -monitor_hmp_printf (hmp,"%*saddr %d.%d, port %s, speed %s, name %s%s\n" , - indent,"" , bus->busnr, dev->addr, - dev->port ? dev->port->path :"-" , -usb_speed (dev->speed), dev->product_desc, - dev->attached ?", attached" :"" ); +g_string_append_printf (buf, +"%*saddr %d.%d, port %s, speed %s, name %s%s\n" , + indent,"" , bus->busnr, dev->addr, + dev->port ? dev->port->path :"-" , +usb_speed (dev->speed), dev->product_desc, + dev->attached ?", attached" :"" ); } -#endif static char *usb_get_dev_path (DeviceState *qdev) {
hw/xen/xen-bus.c +3 -9
@@ -16,8 +16,6 @@#include "hw/xen/xen-legacy-backend.h" /* xen_be_init() */ #include "hw/xen/xen-bus.h" #include "hw/xen/xen-bus-helper.h" -#include "monitor/monitor.h" -#include "monitor/hmp.h" #include "qapi/error.h" #include "qobject/qdict.h" #include "system/system.h"
@@ -101,15 +99,13 @@ abort:qemu_xen_xs_transaction_end (xenbus->xsh, tid, true); } -#ifdef CONFIG_HMP -static void xen_bus_print_dev (MonitorHMP *hmp,DeviceState *dev,int indent) +static void xen_bus_print_dev (GString *buf,DeviceState *dev,int indent) {XenDevice *xendev =XEN_DEVICE (dev); -monitor_hmp_printf (hmp,"%*sname = '%s' frontend_id = %u\n" , - indent,"" , xendev->name, xendev->frontend_id); +g_string_append_printf (buf,"%*sname = '%s' frontend_id = %u\n" , + indent,"" , xendev->name, xendev->frontend_id); } -#endif static char *xen_bus_get_dev_path (DeviceState *dev) {
@@ -388,9 +384,7 @@ static void xen_bus_class_init(ObjectClass *class, const void *data)BusClass *bus_class =BUS_CLASS (class);HotplugHandlerClass *hotplug_class =HOTPLUG_HANDLER_CLASS (class); -#ifdef CONFIG_HMP bus_class->print_dev = xen_bus_print_dev; -#endif bus_class->get_dev_path = xen_bus_get_dev_path; bus_class->realize = xen_bus_realize; bus_class->unrealize = xen_bus_unrealize;
include/hw/core/qdev.h +1 -3
@@ -323,10 +323,8 @@ DECLARE_OBJ_CHECKERS(BusState, BusClass,struct BusClass {ObjectClass parent_class; -#ifdef CONFIG_HMP /* FIXME first arg should be BusState */ -void (*print_dev)(MonitorHMP *mon,DeviceState *dev,int indent); -#endif +void (*print_dev)(GString *buf,DeviceState *dev,int indent);/* * Return a newly allocated string containing the path of the * device on this bus.
qapi/qdev.json +31 -0
@@ -165,6 +165,37 @@ { 'event': 'DEVICE_UNPLUG_GUEST_ERROR', 'data': { '*device': 'str', 'path': 'str' } } +## +# @x-query-qtree: +# +# Query device tree +# +# @brief: if true, omit device properties. (default: false) +# +# Features: +# +# @unstable: This command is meant for debugging. +# +# Returns: device tree +# +# Since: 11.2 +# +# .. qmp-example:: +# +# -> { "execute": "x-query-qtree" } +# <- { "return": { "human-readable-text": "..." } } +# +# .. qmp-example:: +# +# -> { "execute": "x-query-qtree", +# "arguments": { "brief": true } } +# <- { "return": { "human-readable-text": "..." } } +## +{ 'command': 'x-query-qtree', + 'data': { '*brief': 'bool' }, + 'returns': 'HumanReadableText', + 'features': [ 'unstable' ] } + ## # @device-sync-config: #
rust/bindings/hwcore-sys/lib.rs +1 -1
@@ -21,7 +21,7 @@use chardev_sys::Chardev ;use common::Zeroable ; -use glib_sys::GSList ; +use glib_sys::{GSList ,GString };use migration_sys::VMStateDescription ;use qom_sys::{InterfaceClass ,Object ,ObjectClass ,ObjectProperty ,ObjectPropertyAccessor ,
system/qdev-monitor.c +28 -14
96 lines not on this page · raw message
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56
PATCH 86/88 qemu-iotests/172: migrate away from HMP
In reply to Marc-André LureauReplace HMP with QMP, using x-query-qtree for the device tree and query-block for block device info.
The query-block output now includes all block devices, including those without media inserted (e.g. ide1-cd0, empty floppy drives).
--- tests/qemu-iotests/172 | 76 +++++++++-- tests/qemu-iotests/172.out | 305 ++++----------------------------------------- 2 files changed, 89 insertions(+), 292 deletions(-)
tests/qemu-iotests/172 +63 -13
@@ -42,7 +42,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file _supported_os Linux -_require_hmp if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then _notrun "Requires a PC machine"
@@ -51,16 +50,70 @@ fi do_run_qemu() { ( + echo '{"execute":"qmp_capabilities"}' if ! test -t 0; then while read cmd; do - echo $cmd + echo "$cmd" done fi - echo quit - ) | $QEMU -accel qtest -nographic -monitor stdio -serial none -vga none -nic none "$@" + echo '{"execute":"quit"}' + ) | $QEMU -accel qtest -nographic -qmp stdio -serial none -vga none -nic none "$@" echo } +_filter_qmp_responses() +{ + $PYTHON -c ' +import sys, json, re +for line in sys.stdin: + try: + j = json.loads(line) + except Exception: + continue + if "error" in j: + print(json.dumps(j["error"])) + continue + r = j.get("return") + if r is None: + continue + if isinstance(r, dict) and "human-readable-text" in r: + p = False + for l in r["human-readable-text"].split("\n"): + if "dev: isa-fdc" in l: + p = True + elif p and l.startswith(" dev:"): + p = False + if p: + print(l) + elif isinstance(r, list): + if r: + s = json.dumps(r) + s = re.sub(r"device\[\d+\]", "device[N]", s) + print(s) +' +} + +_filter_block_cache() +{ + $PYTHON -c ' +import sys, json +for line in sys.stdin: + try: + r = json.loads(line).get("return") + except Exception: + continue + if not isinstance(r, list): + continue + for entry in r: + if entry.get("device") == "none0" and "inserted" in entry: + cache = entry["inserted"]["cache"] + if cache["writeback"]: + print(" Cache mode: writeback") + else: + print(" Cache mode: writethrough") +' +} + check_floppy_qtree() { echo
@@ -68,21 +121,18 @@ check_floppy_qtree() # QEMU_OPTIONS contains -nodefaults, we don't want that here because the # defaults are part of what should be checked here. - # - # Apply the sed filter to stdout only, but keep the stderr output and - # filter the qemu program name in it. - printf "info qtree\ninfo block\n" | + printf '{"execute":"x-query-qtree"}\n{"execute":"query-block"}\n' | (QEMU_OPTIONS="" do_run_qemu "$@" | - _filter_testdir |_filter_generated_node_ids | _filter_hmp | - sed -ne '/^ dev: isa-fdc/,/^ dev:/{x;p};/^[a-z][^ ]* (NODE_NAME):* /,/^(qemu)$/{p}') 2>&1 | - _filter_win32 | _filter_qemu | _filter_qom_path + _filter_testdir | _filter_generated_node_ids | + _filter_qmp_responses | _filter_actual_image_size) 2>&1 | + _filter_win32 | _filter_qemu } check_cache_mode() { - echo "info block none0" | + printf '{"execute":"query-block"}\n' | QEMU_OPTIONS="" do_run_qemu -drive if=none,file="$TEST_IMG" "$@" | - _filter_win32 | _filter_qemu | grep "Cache mode" + _filter_block_cache }
tests/qemu-iotests/172.out +2 -13
@@ -7,7 +7,6 @@ Formatting 'TEST_DIR/t.IMGFMT.3', fmt=IMGFMT size=737280 === Default === Testing: - dev: isa-fdc, id "" iobase = 1008 (0x3f0) irq = 6 (0x6)
@@ -32,12 +31,12 @@ Testing: account-failed = "auto" stats-intervals = <null> drive-type = "288" +[{"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "type": "unknown"}] === Using -fda/-fdb options === Testing: -fda TEST_DIR/t.qcow2 - dev: isa-fdc, id "" iobase = 1008 (0x3f0) irq = 6 (0x6)
@@ -62,19 +61,9 @@ Testing: -fda TEST_DIR/t.qcow2 account-failed = "auto" stats-intervals = <null> drive-type = "144" -floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2) - Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback - -ide1-cd0: [not inserted] - Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed -(qemu) quit - +[{"device": "floppy0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/unattached/device[N]" , "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}] Testing: -fdb TEST_DIR/t.qcow2 - dev: isa-fdc, id "" iobase = 1008 (0x3f0)
irq = 6 (0x6)
@@ -114,23 +103,9 @@ Testing: -fdb TEST_DIR/t.qcow2
account-failed = "auto" stats-intervals = <null> drive-type = "288"
-floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-
-floppy0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "floppy1", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/unattached/device[N]"
, "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "type": "unknown"}]
Testing: -fda TEST_DIR/t.qcow2 -fdb TEST_DIR/t.qcow2.2
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -170,24 +145,9 @@ Testing: -fda TEST_DIR/t.qcow2 -fdb TEST_DIR/t.qcow2.2
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
-floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback - -floppy1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) - Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "floppy0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/unattached/device[N]"
, "type": "unknown"}, {"device": "floppy1", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2.2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.2"}, "qdev": "/mach ine/unattached/device[N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
Testing: -fdb
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -227,12 +187,12 @@ Testing: -fdb
account-failed = "auto"
stats-intervals = <null>
drive-type = "288"
+[{"device": "floppy1", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "type": "unknown"}]
=== Using -drive options ===
Testing: -drive if=floppy,file=TEST_DIR/t.qcow2
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -257,19 +217,9 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
-floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "floppy0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/unattached/device[N]"
, "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
Testing: -drive if=floppy,file=TEST_DIR/t.qcow2,index=1
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -309,23 +259,9 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2,index=1
account-failed = "auto"
stats-intervals = <null>
drive-type = "288"
-floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-
-floppy0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "floppy1", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/unattached/device[N]"
, "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "type": "unknown"}]
Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=floppy,file=TEST_DIR/t.qcow2.2,index=1
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -365,27 +301,12 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=floppy,file=TEST_DIR/t
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
-floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback - -floppy1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) - Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "floppy0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/unattached/device[N]"
, "type": "unknown"}, {"device": "floppy1", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2.2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.2"}, "qdev": "/mach ine/unattached/device[N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
=== Using -drive if=none and -device ===
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -410,19 +331,9 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
-none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "none0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/peripheral-anon/device[
N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,unit=1
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -447,19 +358,9 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,unit=1
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
-none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "none0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/peripheral-anon/device[
N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0 -device floppy,drive=none1,unit=1
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -499,21 +400,7 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qco
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
-none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback - -none1 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "none0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/peripheral-anon/device[
N]", "type": "unknown"}, {"device": "none1", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2.2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.2"}, "qdev": "/mac hine/peripheral-anon/device[N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
=== Mixing -fdX and -global ===
@@ -525,7 +412,6 @@ QEMU_PROG: -global floppy.drive=... conflicts with drive=floppy0
=== Mixing -fdX and -device ===
Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -565,24 +451,9 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
-floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback - -none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "floppy0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/unattached/device[N]"
, "type": "unknown"}, {"device": "none0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2.2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.2"}, "qdev": "/machin e/peripheral-anon/device[N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0,unit=1
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -622,24 +493,9 @@ Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
-floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback - -none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "floppy0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/unattached/device[N]"
, "type": "unknown"}, {"device": "none0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2.2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.2"}, "qdev": "/machin e/peripheral-anon/device[N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -679,24 +535,9 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
-floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback - -none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "floppy1", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/unattached/device[N]"
, "type": "unknown"}, {"device": "none0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2.2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.2"}, "qdev": "/machin e/peripheral-anon/device[N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0,unit=0
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -736,21 +577,7 @@ Testing: -fdb TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device fl
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
-floppy1 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback - -none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "floppy1", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/unattached/device[N]"
, "type": "unknown"}, {"device": "none0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2.2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.2"}, "qdev": "/machin e/peripheral-anon/device[N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
Testing: -fda TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0,unit=0
QEMU_PROG: -device floppy,drive=none0,unit=0: Floppy unit 0 is in use
@@ -762,7 +589,6 @@ QEMU_PROG: -device floppy,drive=none0,unit=1: Floppy unit 1 is in use
=== Mixing -drive and -device ===
Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -802,24 +628,9 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.q
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
-floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback - -none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "floppy0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/unattached/device[N]"
, "type": "unknown"}, {"device": "none0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2.2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.2"}, "qdev": "/machin e/peripheral-anon/device[N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0,unit=1
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -859,21 +670,7 @@ Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.q
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
-floppy0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/unattached/device[N] - Removable device: not locked, tray closed - Cache mode: writeback - -none0 (NODE_NAME): TEST_DIR/t.qcow2.2 (qcow2) - Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "floppy0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/unattached/device[N]"
, "type": "unknown"}, {"device": "none0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2.2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2.2"}, "qdev": "/machin e/peripheral-anon/device[N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
Testing: -drive if=floppy,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -device floppy,drive=none0,unit=0
QEMU_PROG: -device floppy,drive=none0,unit=0: Floppy unit 0 is in use
@@ -882,7 +679,6 @@ QEMU_PROG: -device floppy,drive=none0,unit=0: Floppy unit 0 is in use
=== Mixing -global and -device ===
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -global floppy.drive=none0 -device floppy,unit=0
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -907,16 +703,7 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -global floppy.drive=none0 -device
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
-none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "none0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/peripheral-anon/device[
N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -drive if=none,file=TEST_DIR/t.qcow2.2 -global floppy.drive=none0 -device floppy,drive=none1,unit=0
QEMU_PROG: -device floppy,drive=none1,unit=0: -global floppy.drive=... conflicts with drive=none1
@@ -949,7 +736,6 @@ QEMU_PROG: -device floppy,drive=none1: Can't create floppy unit 2, bus supports
=== Creating an empty drive with anonymous BB ===
Testing: -device floppy
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -974,9 +760,9 @@ Testing: -device floppy
account-failed = "auto"
stats-intervals = <null>
drive-type = "288"
+[{"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}, {"device": "", "locked": false, "removable": true, "qdev": "/machine/peripheral-anon/device[N]", "type": "unknown"}]
Testing: -device floppy,drive-type=120
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -1001,9 +787,9 @@ Testing: -device floppy,drive-type=120
account-failed = "auto"
stats-intervals = <null>
drive-type = "120"
+[{"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}, {"device": "", "locked": false, "removable": true, "qdev": "/machine/peripheral-anon/device[N]", "type": "unknown"}]
Testing: -device floppy,drive-type=144
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -1028,9 +814,9 @@ Testing: -device floppy,drive-type=144
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
+[{"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}, {"device": "", "locked": false, "removable": true, "qdev": "/machine/peripheral-anon/device[N]", "type": "unknown"}]
Testing: -device floppy,drive-type=288
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -1055,12 +841,12 @@ Testing: -device floppy,drive-type=288
account-failed = "auto"
stats-intervals = <null>
drive-type = "288"
+[{"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}, {"device": "", "locked": false, "removable": true, "qdev": "/machine/peripheral-anon/device[N]", "type": "unknown"}]
=== Try passing different drive size with image ===
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,drive-type=120
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -1085,19 +871,9 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,drive-t
account-failed = "auto"
stats-intervals = <null>
drive-type = "120"
-none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "none0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/peripheral-anon/device[
N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,drive-type=288
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -1122,22 +898,12 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,drive-t
account-failed = "auto"
stats-intervals = <null>
drive-type = "288"
-none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "none0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/peripheral-anon/device[
N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
=== Try passing different block sizes ===
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,logical_block_size=512
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -1162,19 +928,9 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,logical
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
-none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "none0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/peripheral-anon/device[
N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,physical_block_size=512
-
dev: isa-fdc, id ""
iobase = 1008 (0x3f0)
irq = 6 (0x6)@@ -1199,16 +955,7 @@ Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,physica
account-failed = "auto"
stats-intervals = <null>
drive-type = "144"
-none0 (NODE_NAME): TEST_DIR/t.qcow2 (qcow2)
- Attached to: /machine/peripheral-anon/device[N] - Removable device: not locked, tray closed - Cache mode: writeback
-
-ide1-cd0: [not inserted]
- Attached to: /machine/unattached/device[N]
- Removable device: not locked, tray closed
-(qemu) quit
-
+[{"device": "none0", "locked": false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "active": true, "image": {"limits": {"write-zeroes-alignment": 65536, "request-alignment": 1, "min-mem-alignment": 1, "discard-alignment": 65536, "opt-mem-alignment": 4096, "max-iov": 1024}, "virtual-size": 737280, "filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat": "1.1", "compression-type": "zlib", "lazy-refcounts": false, "refcount-bits": 16, "corrupt": false, "extended-l2": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false, "children": [{"node-name": "NODE_NAME", "child": "file"}], "node-name": "NODE_NAME", "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "write_threshold": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "cache": {"no-flush": false, "direct": false, "writeback": true}, "file": "TEST_DIR/t.qcow2"}, "qdev": "/machine/peripheral-anon/device[
N]", "type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true, "qdev": "/machine/unattached/device[N]", "tray_open": false, "type": "unknown"}]
Testing: -drive if=none,file=TEST_DIR/t.qcow2 -device floppy,drive=none0,logical_block_size=4096
QEMU_PROG: -device floppy,drive=none0,logical_block_size=4096: logical_block_size > physical_block_size not supported
Signature · 1 line
2.56.0.rc0.29.g47ce80527c56