VirtIOBlockDataPlane *s = vblk->dataplane;
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vblk)));
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
+ AioContext *old_context;
unsigned i;
unsigned nvqs = s->conf->num_queues;
Error *local_err = NULL;
vblk->dataplane_started = true;
trace_virtio_blk_data_plane_start(s);
+ old_context = blk_get_aio_context(s->conf->conf.blk);
+ aio_context_acquire(old_context);
r = blk_set_aio_context(s->conf->conf.blk, s->ctx, &local_err);
+ aio_context_release(old_context);
if (r < 0) {
error_report_err(local_err);
goto fail_guest_notifiers;
{
ERRP_GUARD();
XenDevice *xendev = dataplane->xendev;
+ AioContext *old_context;
unsigned int ring_size;
unsigned int i;
goto stop;
}
- aio_context_acquire(dataplane->ctx);
+ old_context = blk_get_aio_context(dataplane->blk);
+ aio_context_acquire(old_context);
/* If other users keep the BlockBackend in the iothread, that's ok */
blk_set_aio_context(dataplane->blk, dataplane->ctx, NULL);
+ aio_context_release(old_context);
+
/* Only reason for failure is a NULL channel */
+ aio_context_acquire(dataplane->ctx);
xen_device_set_event_channel_context(xendev, dataplane->event_channel,
dataplane->ctx, &error_abort);
aio_context_release(dataplane->ctx);
VirtIODevice *vdev = VIRTIO_DEVICE(hotplug_dev);
VirtIOSCSI *s = VIRTIO_SCSI(vdev);
SCSIDevice *sd = SCSI_DEVICE(dev);
+ AioContext *old_context;
int ret;
if (s->ctx && !s->dataplane_fenced) {
if (blk_op_is_blocked(sd->conf.blk, BLOCK_OP_TYPE_DATAPLANE, errp)) {
return;
}
- virtio_scsi_acquire(s);
+ old_context = blk_get_aio_context(sd->conf.blk);
+ aio_context_acquire(old_context);
ret = blk_set_aio_context(sd->conf.blk, s->ctx, errp);
- virtio_scsi_release(s);
+ aio_context_release(old_context);
if (ret < 0) {
return;
}
CoMutex send_lock;
Coroutine *send_coroutine;
+ bool read_yielding;
+ bool quiescing;
+
QTAILQ_ENTRY(NBDClient) next;
int nb_requests;
bool closing;
return 0;
}
-static int nbd_receive_request(QIOChannel *ioc, NBDRequest *request,
+/* nbd_read_eof
+ * Tries to read @size bytes from @ioc. This is a local implementation of
+ * qio_channel_readv_all_eof. We have it here because we need it to be
+ * interruptible and to know when the coroutine is yielding.
+ * Returns 1 on success
+ * 0 on eof, when no data was read (errp is not set)
+ * negative errno on failure (errp is set)
+ */
+static inline int coroutine_fn
+nbd_read_eof(NBDClient *client, void *buffer, size_t size, Error **errp)
+{
+ bool partial = false;
+
+ assert(size);
+ while (size > 0) {
+ struct iovec iov = { .iov_base = buffer, .iov_len = size };
+ ssize_t len;
+
+ len = qio_channel_readv(client->ioc, &iov, 1, errp);
+ if (len == QIO_CHANNEL_ERR_BLOCK) {
+ client->read_yielding = true;
+ qio_channel_yield(client->ioc, G_IO_IN);
+ client->read_yielding = false;
+ if (client->quiescing) {
+ return -EAGAIN;
+ }
+ continue;
+ } else if (len < 0) {
+ return -EIO;
+ } else if (len == 0) {
+ if (partial) {
+ error_setg(errp,
+ "Unexpected end-of-file before all bytes were read");
+ return -EIO;
+ } else {
+ return 0;
+ }
+ }
+
+ partial = true;
+ size -= len;
+ buffer = (uint8_t *) buffer + len;
+ }
+ return 1;
+}
+
+static int nbd_receive_request(NBDClient *client, NBDRequest *request,
Error **errp)
{
uint8_t buf[NBD_REQUEST_SIZE];
uint32_t magic;
int ret;
- ret = nbd_read(ioc, buf, sizeof(buf), "request", errp);
+ ret = nbd_read_eof(client, buf, sizeof(buf), errp);
if (ret < 0) {
return ret;
}
QTAILQ_FOREACH(client, &exp->clients, next) {
qio_channel_attach_aio_context(client->ioc, ctx);
+
+ assert(client->recv_coroutine == NULL);
+ assert(client->send_coroutine == NULL);
+
+ if (client->quiescing) {
+ client->quiescing = false;
+ nbd_client_receive_next_request(client);
+ }
+ }
+}
+
+static void nbd_aio_detach_bh(void *opaque)
+{
+ NBDExport *exp = opaque;
+ NBDClient *client;
+
+ QTAILQ_FOREACH(client, &exp->clients, next) {
+ qio_channel_detach_aio_context(client->ioc);
+ client->quiescing = true;
+
if (client->recv_coroutine) {
- aio_co_schedule(ctx, client->recv_coroutine);
+ if (client->read_yielding) {
+ qemu_aio_coroutine_enter(exp->common.ctx,
+ client->recv_coroutine);
+ } else {
+ AIO_WAIT_WHILE(exp->common.ctx, client->recv_coroutine != NULL);
+ }
}
+
if (client->send_coroutine) {
- aio_co_schedule(ctx, client->send_coroutine);
+ AIO_WAIT_WHILE(exp->common.ctx, client->send_coroutine != NULL);
}
}
}
static void blk_aio_detach(void *opaque)
{
NBDExport *exp = opaque;
- NBDClient *client;
trace_nbd_blk_aio_detach(exp->name, exp->common.ctx);
- QTAILQ_FOREACH(client, &exp->clients, next) {
- qio_channel_detach_aio_context(client->ioc);
- }
+ aio_wait_bh_oneshot(exp->common.ctx, nbd_aio_detach_bh, exp);
exp->common.ctx = NULL;
}
/* nbd_co_receive_request
* Collect a client request. Return 0 if request looks valid, -EIO to drop
- * connection right away, and any other negative value to report an error to
- * the client (although the caller may still need to disconnect after reporting
- * the error).
+ * connection right away, -EAGAIN to indicate we were interrupted and the
+ * channel should be quiesced, and any other negative value to report an error
+ * to the client (although the caller may still need to disconnect after
+ * reporting the error).
*/
static int nbd_co_receive_request(NBDRequestData *req, NBDRequest *request,
Error **errp)
{
NBDClient *client = req->client;
int valid_flags;
+ int ret;
g_assert(qemu_in_coroutine());
assert(client->recv_coroutine == qemu_coroutine_self());
- if (nbd_receive_request(client->ioc, request, errp) < 0) {
- return -EIO;
+ ret = nbd_receive_request(client, request, errp);
+ if (ret < 0) {
+ return ret;
}
trace_nbd_co_receive_request_decode_type(request->handle, request->type,
return;
}
+ if (client->quiescing) {
+ /*
+ * We're switching between AIO contexts. Don't attempt to receive a new
+ * request and kick the main context which may be waiting for us.
+ */
+ nbd_client_put(client);
+ client->recv_coroutine = NULL;
+ aio_wait_kick();
+ return;
+ }
+
req = nbd_request_get(client);
ret = nbd_co_receive_request(req, &request, &local_err);
client->recv_coroutine = NULL;
goto done;
}
+ if (ret == -EAGAIN) {
+ assert(client->quiescing);
+ goto done;
+ }
+
nbd_client_receive_next_request(client);
if (ret == -EIO) {
goto disconnect;
static void nbd_client_receive_next_request(NBDClient *client)
{
- if (!client->recv_coroutine && client->nb_requests < MAX_NBD_REQUESTS) {
+ if (!client->recv_coroutine && client->nb_requests < MAX_NBD_REQUESTS &&
+ !client->quiescing) {
nbd_client_get(client);
client->recv_coroutine = qemu_coroutine_create(nbd_trip, client);
aio_co_schedule(client->exp->common.ctx, client->recv_coroutine);
sioc = qio_channel_socket_new();
if (qio_channel_socket_connect_sync(sioc, saddr, &err) < 0) {
error_report_err(err);
- return EXIT_FAILURE;
+ goto out;
}
rc = nbd_receive_export_list(QIO_CHANNEL(sioc), tls, hostname, &list,
&err);
char *device = arg;
NBDExportInfo info = { .request_sizes = false, .name = g_strdup("") };
QIOChannelSocket *sioc;
- int fd;
- int ret;
+ int fd = -1;
+ int ret = EXIT_FAILURE;
pthread_t show_parts_thread;
Error *local_error = NULL;
goto out;
}
- ret = nbd_receive_negotiate(NULL, QIO_CHANNEL(sioc),
- NULL, NULL, NULL, &info, &local_error);
- if (ret < 0) {
+ if (nbd_receive_negotiate(NULL, QIO_CHANNEL(sioc),
+ NULL, NULL, NULL, &info, &local_error) < 0) {
if (local_error) {
error_report_err(local_error);
}
- goto out_socket;
+ goto out;
}
fd = open(device, O_RDWR);
if (fd < 0) {
/* Linux-only, we can use %m in printf. */
error_report("Failed to open %s: %m", device);
- goto out_socket;
+ goto out;
}
- ret = nbd_init(fd, sioc, &info, &local_error);
- if (ret < 0) {
+ if (nbd_init(fd, sioc, &info, &local_error) < 0) {
error_report_err(local_error);
- goto out_fd;
+ goto out;
}
/* update partition table */
dup2(STDOUT_FILENO, STDERR_FILENO);
}
- ret = nbd_client(fd);
- if (ret) {
- goto out_fd;
+ if (nbd_client(fd) < 0) {
+ goto out;
}
- close(fd);
- object_unref(OBJECT(sioc));
- g_free(info.name);
- kill(getpid(), SIGTERM);
- return (void *) EXIT_SUCCESS;
-out_fd:
- close(fd);
-out_socket:
+ ret = EXIT_SUCCESS;
+
+ out:
+ if (fd >= 0) {
+ close(fd);
+ }
object_unref(OBJECT(sioc));
-out:
g_free(info.name);
kill(getpid(), SIGTERM);
- return (void *) EXIT_FAILURE;
+ return (void *) (intptr_t) ret;
}
#endif /* HAVE_NBD_DEVICE */
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test simple read/write using plain bdrv_pread/bdrv_pwrite
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test simple read/write using plain bdrv_pread/bdrv_pwrite
#
#!/usr/bin/env bash
+# group: rw auto
#
# Test simple read/write using bdrv_aio_readv/bdrv_aio_writev
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Make sure we can't read and write outside of the image size.
#
#!/usr/bin/env bash
+# group: img auto quick
#
# Make sure qemu-img can create 5TB images
#
#!/usr/bin/env bash
+# group: snapshot auto
#
# Check for one possible case of qcow2 refcount corruption.
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test simple asynchronous read/write operations.
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Nolan I qcow2 corruption - incorrectly reports free clusters
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Nolan II qcow2 corruption - wrong used cluster
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test for AIO allocation on the same cluster
#
#!/usr/bin/env bash
+# group: auto quick
#
# Make sure we can open read-only images
#
#!/usr/bin/env bash
+# group: rw auto
#
# qcow2 pattern test, empty and compressed image - 4k cluster patterns
#
#!/usr/bin/env bash
+# group: rw
#
# qcow2 pattern test, complex patterns including compression and snapshots
# Using patterns for 4k cluster size.
#!/usr/bin/env bash
+# group: rw snapshot
#
# Combined test to grow the refcount table and test snapshots.
#
#!/usr/bin/env bash
+# group: rw backing auto quick
#
# Simple backing file reads
#
#!/usr/bin/env bash
+# group: rw backing auto quick
#
# Merge backing file into test image when converting the image
#
#!/usr/bin/env bash
+# group: rw backing auto quick
#
# When using a backing file for the output image in qemu-img convert,
# the backing file clusters must not copied. The data must still be
#!/usr/bin/env bash
+# group: rw backing auto quick
#
# Commit changes to backing file
#
#!/usr/bin/env bash
+# group: io auto quick
#
# Test handling of invalid patterns arguments to qemu-io
#
#!/usr/bin/env bash
+# group: rw snapshot auto
#
# Test bdrv_load/save_vmstate using the usual patterns
#
#!/usr/bin/env bash
+# group: rw
#
# qcow2 pattern test with various cluster sizes
#
#!/usr/bin/env bash
+# group: rw backing auto quick
#
# Rebasing COW images
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Resizing images
#
#!/usr/bin/env bash
+# group: rw blkdbg
#
# qcow2 error path testing
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test that sub-cluster allocating writes zero the rest of the cluster
#
#!/usr/bin/env bash
+# group: rw backing quick
#
# Test that backing files can be smaller than the image
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# qcow2 internal snapshots/VM state tests
#
#!/usr/bin/env python3
+# group: rw auto backing
#
# Tests for image streaming.
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test that all qcow2 header extensions survive a header rewrite
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test that AIO requests are drained before an image is closed. This used
# to segfault because the request coroutine kept running even after the
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test aligned and misaligned write zeroes operations.
#
#!/usr/bin/env bash
+# group: rw auto backing quick
#
# Test bdrv_pwrite_zeroes with backing files (see also 154)
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Let a few AIO requests run in parallel and have them access different L2
# tables so that the cache has a chance to get used up.
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test qcow2 feature bits
#
#!/usr/bin/env bash
+# group: rw auto backing quick
#
# Test COW from backing files
#
#!/usr/bin/env bash
+# group: rw auto backing quick
#
# Test COW from backing files with AIO
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test qcow2 lazy refcounts
#
#!/usr/bin/env python3
+# group: rw auto
#
# Tests for image block commit.
#
#!/usr/bin/env python3
+# group: rw auto backing
#
# Tests for image mirroring.
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test qemu-img operation on zero size images
#
#!/usr/bin/env bash
+# group: rw auto backing
#
# Test that qemu-img info --backing-chain detects infinite loops
#
#!/usr/bin/env python3
+# group: rw
#
# Tests growing a large refcount table.
#
#!/usr/bin/env python3
+# group: rw quick
#
# Tests for fdsets and getfd.
#
#!/usr/bin/env bash
+# group: rw auto aio quick
#
# Test concurrent cluster allocations
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Regression test for commit b7ab0fea (which was a corruption fix,
# despite the commit message claiming otherwise)
#!/usr/bin/env bash
+# group: img auto quick
##
## qemu-img compare test
##
#!/usr/bin/env bash
+# group: rw auto
#
# Check qemu-img option parsing
#
#!/usr/bin/env bash
+# group: rw auto backing quick
#
# Test qemu-img rebase with zero clusters
#
#!/usr/bin/env bash
+# group: rw
#
# Test command line configuration of block devices and driver-specific options
#
#!/usr/bin/env bash
+# group: rw auto backing quick
#
# Test bdrv_pread/bdrv_pwrite using BDRV_O_SNAPSHOT
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test qemu-img convert when image length is not a multiple of cluster size
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test huge qcow2 images
#
#!/usr/bin/env python3
+# group: rw
#
# Tests for drive-backup and blockdev-backup
#
#!/usr/bin/env python3
+# group: rw backing
#
# Tests for drive-backup
#
#!/usr/bin/env python3
+# group: rw
#
# Tests for internal snapshot.
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test export internal snapshot by qemu-nbd, convert it by qemu-img.
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test case for vmdk
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test case for image corruption (overlapping data structures) in qcow2
#
#!/usr/bin/env bash
+# group: rw auto
#
# Test case for image option amendment in qcow2.
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test case for snapshotting images with unallocated zero clusters in
# qcow2
#!/usr/bin/env bash
+# group: rw auto quick
#
# test of qemu-img convert -n - convert without creation
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test VHDX read/write from a sample image created with Hyper-V
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test for additional information emitted by qemu-img info on qcow2
# images
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test case for preallocated zero clusters in qcow2
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test case for loading a saved VM state from a qcow2 image
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test case for deleting a backing file
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test VHDX log replay from an image with a journal that needs to be
# replayed
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test case for the QMP blkdebug and blkverify interfaces
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test case for nested image formats
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test count_contiguous_clusters in qcow2
#
#!/usr/bin/env bash
+# group: rw auto quick
##
## qemu-img compare test (qcow2 only ones)
##
#!/usr/bin/env bash
+# group: rw quick
#
# cloop format input validation tests
#
#!/usr/bin/env bash
+# group: io
#
# parallels format input validation tests
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test concurrent pread/pwrite
#
#!/usr/bin/env bash
+# group: rw quick
#
# bochs format input validation tests
#
#!/usr/bin/env bash
+# group: rw auto
#
# Test qcow2 preallocation with different cluster_sizes
#
#!/usr/bin/env bash
+# group: rw auto
#
# qcow2 format input validation tests
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test Quorum block driver
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test qemu-img command line parsing
#
#!/usr/bin/env bash
+# group: rw
#
# Test NBD client unexpected disconnect
#
#!/usr/bin/env bash
+# group: img quick
#
# Test case for VDI header corruption; image too large, and too many blocks.
# Also simple test for creating dynamic and static VDI images.
#!/usr/bin/env bash
+# group: rw
#
# Live snapshot tests
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test qemu-img progress output
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test unsupported blockdev-add cases
#
#!/usr/bin/env bash
+# group: rw quick
#
# vpc (VHD) format input validation tests
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test case for support of JSON filenames
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test for discarding compressed clusters on qcow2 images
#
#!/usr/bin/env bash
+# group: rw migration quick
#
# Live migration test
#
#!/usr/bin/env bash
+# group: rw quick
#
# qcow1 format input validation tests
#
#!/usr/bin/env python3
+# group: throttle
#
# Tests for IO throttling
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test case for drive-mirror to NBD
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test for commit of larger active layer
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test that snapshots move the throttling configuration to the active
# layer
#!/usr/bin/env bash
+# group: rw auto backing
#
# Commit changes into backing chains and empty the top image if the
# backing image is not explicitly specified
#!/usr/bin/env bash
+# group: rw auto backing quick
#
# Test qcow2's bdrv_make_empty for images without internal snapshots
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test valid filenames for blkdebug and blkverify representatively for
# other protocols (such as NBD) when queried
#!/usr/bin/env bash
+# group: rw quick
#
# Test short file I/O
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test case for qemu-io -c map and qemu-img map
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test case for qcow2 metadata cache size specification
#
#!/usr/bin/env bash
+# group: rw auto
#
# Test image creation with aligned and unaligned sizes
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Create, read, write big image
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test preallocated resize of raw images
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Tests updates of the qcow2 L1 table
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test case for repairing qcow2 images which cannot be repaired using
# the on-disk refcount structures
#!/usr/bin/env bash
+# group: rw
#
# Test writing image headers of other formats into raw images
#
#!/usr/bin/env bash
+# group: rw auto backing quick
#
# Test case for relative backing file names in complex BDS trees
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test case for non-existing backing file when creating a qcow2 image
# and not specifying the size
#!/usr/bin/env bash
+# group: rw
#
# Test cases for different refcount_bits values
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test case for accessing creation options on image formats and
# protocols not supporting image creation
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test invalid backing file format in qcow2 images
#
#!/usr/bin/env bash
+# group: rw
#
# Test case for non-self-referential qcow2 refcount blocks
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test error code paths for invalid QED images
#
#!/usr/bin/env bash
+# group: rw auto
#
# Test case for shared BDS between backend trees
#
#!/usr/bin/env python3
+# group: rw
#
# Test case for the QMP 'change' command and all other associated
# commands
#!/usr/bin/env bash
+# group: rw quick
#
# NBD test case for overriding BDRV_O_PROTOCOL by explicitly specifying
# a driver
#!/usr/bin/env bash
+# group: rw auto quick
#
# Non-NBD test cases for overriding BDRV_O_PROTOCOL by explicitly
# specifying a driver
#!/usr/bin/env bash
+# group: rw
#
# Test cases for qcow2 refcount table growth
#
#!/usr/bin/env bash
+# group: rw
#
# Test some qemu-img convert cases
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test case for qemu-img convert to NBD
#
#!/usr/bin/env python3
+# group: rw backing
#
# Tests for incremental drive-backup
#
#!/usr/bin/env bash
+# group: rw
#
# Test preallocated growth of qcow2 images
#
#!/usr/bin/env bash
+# group: rw auto backing
#
# Tests handling of colons in filenames (which may be confused with protocol
# prefixes)
#!/usr/bin/env bash
+# group: rw auto backing quick
#
# Test case for mirroring with dataplane
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test that opening O_DIRECT succeeds when image file I/O produces EIO
#
#!/usr/bin/env python3
+# group: rw quick
#
# Tests that "bdrv_drain_all" doesn't drain block jobs
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test that temporary backing file overrides (on the command line or in
# blockdev-add) don't replace the original path stored in the image during
#!/usr/bin/env bash
+# group: rw quick
#
# parallels format validation tests (created by QEMU)
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test mirror with unmap
#
#!/usr/bin/env bash
+# group: auto quick
#
# Test for reopen
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test encrypted read/write using plain bdrv_pread/bdrv_pwrite
#
#!/usr/bin/env bash
+# group: rw
#
# Test VPC open of image with large Max Table Entries value.
#
#!/usr/bin/env python3
+# group: rw
#
# Tests for block device statistics
#
#!/usr/bin/env bash
+# group: rw auto
#
# Test qcow2 reopen
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# General test case for qcow2's image check
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test cases for the QMP 'blockdev-del' command
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test case for ejecting a BlockBackend with an NBD server attached to it
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test case for ejecting BDSs with block jobs still running on them
#
#!/usr/bin/env bash
+# group: auto quick
#
# Test case for connecting to a non-existing NBD export name
#
#!/usr/bin/env bash
+# group: rw quick
# Check live snapshot, followed by active commit, and another snapshot.
#
# This test is to catch the error case of BZ #1300209:
#!/usr/bin/env bash
+# group: quick
#
# Test the combination of -incoming and snapshot=on
#
#!/usr/bin/env bash
+# group: quick
#
# Test VHD image format creator detection and override
#
#!/usr/bin/env python3
+# group: img
#
# Test case for NBD's blockdev-add interface
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test the rate limit of QMP events
#
#!/usr/bin/env python3
+# group: rw sudo
#
# Copyright (C) 2016 Red Hat, Inc.
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test that qemu-img convert -S 0 fully allocates the target image
#
#!/usr/bin/env python3
+# group: rw
#
# Tests for active mirroring
#
#!/usr/bin/env python3
+# group: rw quick
#
# Tests for drive-mirror with source size unaligned to granularity
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test image locking
#
#!/usr/bin/env bash
+# group: rw auto backing quick
#
# qcow2 specific bdrv_pwrite_zeroes tests with backing files (complements 034)
#
#!/usr/bin/env python3
+# group: rw
#
# Test whether the backing BDSs are correct after completion of a
# mirror block job; in "existing" modes (drive-mirror with
#!/usr/bin/env bash
+# group: rw auto quick
#
# Tests oVirt-like storage migration:
# - Create snapshot
#!/usr/bin/env bash
+# group: quick
#
# Test command line configuration of block devices with qdev
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test encrypted read/write using backing files
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# qemu-img dd test with different block sizes
#
#!/usr/bin/env bash
+# group: rw quick
#
# qemu-img dd test for the skip option
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test reopening a backing image after block-stream and block-commit
#
#!/usr/bin/env bash
+# group: quick
#
# Test case for specifying runtime options of the wrong type to some
# block drivers
#!/usr/bin/env python3
+# group: rw
#
# Tests for shrinking images
#
#!/usr/bin/env python3
+# group: rw quick
#
# Tests for persistent dirty bitmaps.
#
#!/usr/bin/env python3
+# group: rw migration
#
# Tests for dirty bitmaps migration.
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# qemu-img dd test
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test 'offset' and 'size' options of the raw driver. Make sure we can't
# (or can) read and write outside of the image size.
#!/usr/bin/env bash
+# group: auto
#
# Test floppy configuration
#
#!/usr/bin/env bash
+# group: rw
#
# Test QAPI commands looking up protocol based images with relative
# filename backing strings
#!/usr/bin/env bash
+# group: auto
#
# Test that qemu-io fail with non-zero exit code
#
#!/usr/bin/env bash
+# group: quick
#
# Test creating raw image preallocation mode
#
== resize empty image with block_resize ==
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=0
size=1048576, min allocation
- *** done
+*** done
#!/usr/bin/env bash
+# group: rw auto backing
#
# Commit changes into backing chains and empty the top image if the
# backing image is not explicitly specified.
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test corner cases with unusual block geometries
#
#!/usr/bin/env bash
+# group: img
#
# qemu-img measure sub-command tests
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test case for write zeroes with unmap
#
#!/usr/bin/env bash
+# group: rw auto migration quick
#
# Test postcopy live migration with shared storage
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test image locking for POSIX locks
#
#!/usr/bin/env bash
+# group: rw migration quick
#
# Test old-style block migration (migrate -b)
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test I/O throttle block filter driver interface
#
#!/usr/bin/env bash
+# group: rw
#
# Test exiting qemu while jobs are still running
#
#!/usr/bin/env bash
+# group: rw auto
#
# Test 'info block' with all kinds of configurations
#
#!/usr/bin/env bash
+# group: rw auto
#
# Test switching between read-only and read-write
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test encrypted read/write using plain bdrv_pread/bdrv_pwrite
#
#!/usr/bin/env bash
+# group: rw
#
# Test encrypted read/write using backing files
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# qemu-img measure sub-command tests on huge qcow2 files
#
#!/usr/bin/env bash
+# group: rw auto
#
# Test commit block job where top has two parents
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test NBD export with -incoming (non-shared storage migration use case from
# libvirt)
#!/usr/bin/env python3
+# group: rw migration quick
#
# Copyright (C) 2017 Red Hat, Inc.
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test change-backing-file command
#
#!/usr/bin/env python3
+# group: rw quick migration
#
# Test clearing unknown autoclear_features flag by qcow2 after
# migration. This test mimics migration to older qemu.
#!/usr/bin/env bash
+# group: rw quick
#
# Test case for copy-on-read into qcow2
#
#!/usr/bin/env bash
+# group: rw
#
# Test commit of encrypted qcow2 files
#
#!/usr/bin/env python3
+# group: rw migration
#
# Tests for dirty bitmaps postcopy migration.
#
#!/usr/bin/env bash
+# group: rw
#
# Block job co-routine race condition test.
#
#!/usr/bin/env bash
+# group: rw migration quick
#
# Test savevm and loadvm after live migration with postcopy flag
#
#!/usr/bin/env python3
+# group: rw quick
#
# Copyright (C) 2017 Red Hat, Inc.
#
#!/usr/bin/env python3
+# group: rw auto migration quick
#
# Copyright (C) 2017 Red Hat, Inc.
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test corner cases with unusual block geometries
#
#!/usr/bin/env python3
+# group: rw quick
#
# Tests for qmp command nbd-server-remove.
#
#!/usr/bin/env python3
+# group: rw
#
# Test qcow2 and file image creation
#
#!/usr/bin/env python3
+# group: rw
#
# Test ssh image creation
#
#!/usr/bin/env python3
+# group: rw quick
#
# Copyright (C) 2018 Red Hat, Inc.
#
#!/usr/bin/env python3
+# group: rw quick
#
# Tests for NBD BLOCK_STATUS extension
#
#!/usr/bin/env python3
+# group: rw
#
# Test luks and file image creation
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test VDI and file image creation
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test parallels and file image creation
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test vhdx and file image creation
#
#!/usr/bin/env bash
+# group: rw auto
#
# Test qcow2 image compression
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test case for copy-on-read into qcow2, using the COR filter driver
#
#!/usr/bin/env python3
+# group: rw quick
#
# Copy-on-read tests using a COR filter node
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# I/O errors when working with internal qcow2 snapshots, and repairing
# the result
#!/usr/bin/env python3
+# group: rw quick
#
# This test covers what happens when a mirror block job is cancelled
# in various phases of its existence.
#!/usr/bin/env python3
+# group: rw
#
# Copyright (C) 2018 Red Hat, Inc.
#
#!/usr/bin/env bash
+# group: rw auto
#
# max limits on compression in huge qcow2 files
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test qemu-img vs. unaligned images
# (See also 253, which is the O_DIRECT version)
#!/usr/bin/env python3
+# group: rw quick
#
# This test covers the basic fleecing workflow, which provides a
# point-in-time snapshot of a node that can be queried over NBD.
#!/usr/bin/env bash
+# group: rw quick
#
# Test reading dirty bitmap over NBD
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test json:{} filenames with qemu-internal BDSs
# (the one of commit, to be precise)
#!/usr/bin/env bash
+# group: rw quick
#
# Test vmdk backing file correlation
#
#!/usr/bin/env bash
+# group: auto quick
#
# This test covers expected filetypes for the file, host_cdrom and
# host_device drivers.
#!/usr/bin/env bash
+# group: quick
#
# Test query-blockstats with different ways to create a BB
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test for when a backing file is considered overridden (thus, a
# json:{} filename is generated for the overlay) and when it is not
#!/usr/bin/env bash
+# group: auto quick
#
# Test for force canceling a running blockjob that is paused in
# an error state.
#!/usr/bin/env bash
+# group: quick
#
# Test legacy and modern option parsing for rbd/ceph. This will not
# actually connect to a ceph server, but rather looks for the appropriate
#!/usr/bin/env bash
+# group: quick
#
# Test for auto-read-only
#
#!/usr/bin/env bash
+# group: quick
#
# Test NBD TLS certificate / authorization integration
#
#!/usr/bin/env python3
+# group: quick migration
#
# Copyright (C) 2018 Red Hat, Inc.
#
#!/usr/bin/env python3
+# group: quick
#
# Simple mirror test
#
#!/usr/bin/env python3
+# group: quick
#
# Test bitmap merges.
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test vmdk and file image creation
#
#!/usr/bin/env python3
+# group: quick
#
# Regression test for throttle group member unregister segfault with iothread
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test case for dmg
#
#!/usr/bin/env python3
+# group: quick
# Test hot plugging and unplugging with iothreads
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test qemu-nbd vs. unaligned images
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test for qcow2 bitmap printed information
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test qcow2 preallocation
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test qcow2 with external data files
#
#!/usr/bin/env python3
+# group: rw
#
# Test cases for the QMP 'x-blockdev-reopen' command
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test persistent bitmap resizing.
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test for auto-read-only with commit block job
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test resume mirror after auto pause on ENOSPC
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test that a backing image is put back in read-only mode after
# block-commit (both when it fails and when it succeeds).
#!/usr/bin/env bash
+# group: rw quick
#
# Test big discard in qcow2 shrink
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test qemu-img convert --salvage
#
#!/usr/bin/env bash
+# group: rw auto backing quick
#
# Tests for rebasing COW images that require zero cluster support
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test qemu-img vs. unaligned images; O_DIRECT version
# (Originates from 221)
#!/usr/bin/env python3
+# group: rw backing quick
#
# Test external snapshot with bitmap copying and moving.
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test commit job graph modifications while requests are active
#
#!/usr/bin/env python3
+# group: rw auto quick
#
# Test incremental/backup across iothread contexts
#
#!/usr/bin/env python3
+# group: rw
#
# Test bitmap-sync backups (incremental, differential, and partials)
#
#!/usr/bin/env python3
+# group: rw quick
#
# Very specific tests for adjacent commit/stream block jobs
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test generic image creation fallback (by using NBD)
#
#!/usr/bin/env python3
+# group: rw quick
#
# Tests for temporary external snapshot when we have bitmaps.
#
#!/usr/bin/env bash
+# group: rw
#
# Test case for qcow2's handling of extra data in snapshot table entries
# (and more generally, how certain cases of broken snapshot tables are
#!/usr/bin/env python3
+# group: rw quick migration
#
# Copyright (C) 2019 Red Hat, Inc.
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test encrypted write that crosses cluster boundary of two unallocated clusters
# Based on 188
#!/usr/bin/env python3
+# group: rw
#
# Test nbd reconnect
#
import time
import iotests
-from iotests import qemu_img_create, qemu_io_silent_check, file_path, \
- qemu_nbd_popen, log
+from iotests import qemu_img_create, file_path, qemu_nbd_popen, log
iotests.script_initialize(
supported_fmts=['qcow2'],
disk_a, disk_b, nbd_sock = file_path('disk_a', 'disk_b', 'nbd-sock')
nbd_uri = 'nbd+unix:///?socket=' + nbd_sock
size = 5 * 1024 * 1024
-wait_limit = 3
+wait_limit = 3.0
wait_step = 0.2
qemu_img_create('-f', iotests.imgfmt, disk_a, str(size))
'file': {'driver': 'nbd',
'server': {'type': 'unix', 'path': nbd_sock},
'reconnect-delay': 10}})
- vm.qmp_log('blockdev-backup', device='drive0', sync='full', target='backup0',
- speed=(1 * 1024 * 1024))
+ vm.qmp_log('blockdev-backup', device='drive0', sync='full',
+ target='backup0', speed=(1 * 1024 * 1024))
# Wait for some progress
- t = 0
+ t = 0.0
while t < wait_limit:
jobs = vm.qmp('query-block-jobs')['return']
if jobs and jobs[0]['offset'] > 0:
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test reverse-ordered qcow2 writes on a sub-cluster level
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test VPC and file image creation
#
#!/usr/bin/env bash
+# group: rw auto quick snapshot
#
# Test which nodes are involved in internal snapshots
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test write request with required alignment larger than the cluster size
#
#!/usr/bin/env bash
+# group: rw backing quick
#
# Test large write to a qcow2 image
#
#!/usr/bin/env bash
+# group: rw auto
#
# Test qcow2 images with extended L2 entries
#
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
+qcow2: Marking image as corrupt: Invalid cluster entry found (L2 offset: 0x40000, L2 index: 0x1); further corruption events will be suppressed
write failed: Input/output error
### Corrupted L2 entries - write test (unallocated) ###
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
+qcow2: Marking image as corrupt: Invalid cluster entry found (L2 offset: 0x40000, L2 index: 0); further corruption events will be suppressed
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
+qcow2: Marking image as corrupt: Invalid cluster entry found (L2 offset: 0x40000, L2 index: 0x1); further corruption events will be suppressed
write failed: Input/output error
### Compressed cluster with subcluster bitmap != 0 - write test ###
read 524288/524288 bytes at offset 524288
512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Offset Length Mapped to File
-0 0x80000 0 TEST_DIR/t.qcow2.base
+0 0x80000 0 TEST_DIR/t.qcow2.base
# backing file and preallocation=falloc
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=524288 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=raw preallocation=falloc
Image resized.
read 524288/524288 bytes at offset 524288
512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Offset Length Mapped to File
-0 0x80000 0 TEST_DIR/t.qcow2.base
+0 0x80000 0 TEST_DIR/t.qcow2.base
# backing file and preallocation=full
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=524288 backing_file=TEST_DIR/t.IMGFMT.base backing_fmt=raw preallocation=full
Image resized.
read 524288/524288 bytes at offset 524288
512 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
Offset Length Mapped to File
-0 0x80000 0 TEST_DIR/t.qcow2.base
+0 0x80000 0 TEST_DIR/t.qcow2.base
### Image resizing with preallocation and backing files ###
#!/usr/bin/env bash
+# group: rw
#
# Test compressed write to a qcow2 image at an offset above 4 GB
#
#!/usr/bin/env bash
+# group: backing quick
#
# Test multiple blockdev-snapshot calls with 'backing': null
#
#!/usr/bin/env python3
+# group: rw backing
#
# Copyright (C) 2019 Red Hat, Inc.
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test NBD client reconnection
#
def start_server_NBD(event):
make_conf_file(event)
- srv = subprocess.Popen(['nbd-fault-injector.py', '--classic-negotiation',
+ srv = subprocess.Popen(['./nbd-fault-injector.py', '--classic-negotiation',
nbd_sock, conf_file], stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, universal_newlines=True)
line = srv.stdout.readline()
#!/usr/bin/env bash
+# group: rw backing quick
#
# Test qemu-img --backing-chain --image-opts
#
#!/usr/bin/env python3
+# group: rw migration quick
#
# Copyright (C) 2019 Red Hat, Inc.
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test cases for blockdev + IOThread interactions
#
#!/usr/bin/env bash
+# group: rw img quick
#
# Test qemu-img file cleanup for LUKS when using a non-UTF8 secret
#
#!/usr/bin/env python3
+# group: auto quick
#
# Test for backup-top filter permission activation failure
#
#!/usr/bin/env bash
+# group: rw
#
# Test ref count checks on encrypted images
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test qemu-img snapshot -l
#
#!/usr/bin/env bash
+# group: auto quick
#
# Test case for an image using zstd compression
#
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
incompatible_features [3]
-=== Testing zlib with incompatible bit set ===
+=== Testing zlib with incompatible bit set ===
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
incompatible_features [3]
-=== Testing zstd with incompatible bit unset ===
+=== Testing zstd with incompatible bit unset ===
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
incompatible_features []
-=== Testing compression type values ===
+=== Testing compression type values ===
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
- 0
+0
Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
- 1
+1
=== Testing simple reading and writing with zstd ===
#!/usr/bin/env bash
+# group: quick
#
# qemu-img measure tests for LUKS images
#
#!/usr/bin/env bash
+# group: rw quick
#
# qcow2 v3-exclusive error path testing
# (026 tests paths common to v2 and v3)
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test how 'qemu-io -c discard' behaves on v2 and v3 qcow2 images
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test qemu-img bitmap handling
#
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test resizing a qcow2 image with a backing file
#
#!/usr/bin/env bash
+# group: rw
#
# Test encryption key management with luks
# Based on 134
+#!/usr/bin/env bash
+# group: rw quick
#
# Copyright (C) 2019 Red Hat, Inc.
#
#!/usr/bin/env python3
+# group: rw
#
# Test case QMP's encrypted key management
#
#!/usr/bin/env python3
+# group: rw
#
# Test case for encryption key management versus image sharing
#
#!/usr/bin/env bash
+# group: meta
#
# Copyright (C) 2020 Red Hat, Inc.
#
#!/usr/bin/env python3
+# group: auto quick
#
# Test shutdown when bitmap is exported through NBD server
#
#!/usr/bin/env python3
+# group: migration
#
# Copyright (C) 2020 Red Hat, Inc.
#
#!/usr/bin/env bash
+# group: backing quick
#
# Test qcow backing file warnings
#
#!/usr/bin/env python3
+# group: quick
#
# Tests converting qcow2 compressed to NBD
#
#!/usr/bin/env python3
+# group: rw quick
#
# Test for dumping of qcow2 image metadata
#
add_bitmap(1, 0, 6, False)
add_bitmap(2, 6, 8, True)
-dump = ['qcow2.py', disk, 'dump-header']
+dump = ['./qcow2.py', disk, 'dump-header']
subprocess.run(dump)
# Dump the metadata in JSON format
dump.append('-j')
#!/usr/bin/env python3
+# group: rw quick
#
# Tests dirty-bitmap backup with unaligned bitmap granularity
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test the handling of errors in write requests with multiple allocations
#
#!/usr/bin/env python3
+# group: rw quick export
#
# Copyright (C) 2020 Red Hat, Inc.
#
#!/usr/bin/env bash
+# group: rw
#
# Test FUSE exports (in ways that are not captured by the generic
# tests)
#!/usr/bin/env bash
+# group: rw auto quick
#
# Test qemu-nbd -A
#
#!/usr/bin/env bash
+# group: rw quick
#
# Test drive-mirror with quorum
#
universal_newlines=True)
output = subp.communicate()[0]
if subp.returncode < 0:
- sys.stderr.write('%s received signal %i: %s\n'
- % (tool, -subp.returncode,
- ' '.join(qemu_img_args + list(args))))
+ cmd = ' '.join(args)
+ sys.stderr.write(f'{tool} received signal {-subp.returncode}: {cmd}\n')
return (output, subp.returncode)
def qemu_img_pipe_and_status(*args: str) -> Tuple[str, int]:
def qemu_io(*args):
'''Run qemu-io and return the stdout data'''
args = qemu_io_args + list(args)
- subp = subprocess.Popen(args, stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT,
- universal_newlines=True)
- output = subp.communicate()[0]
- if subp.returncode < 0:
- sys.stderr.write('qemu-io received signal %i: %s\n'
- % (-subp.returncode, ' '.join(args)))
- return output
+ return qemu_tool_pipe_and_status('qemu-io', args)[0]
def qemu_io_log(*args):
result = qemu_io(*args)