Skip to contentSkip to conversation

Block patches

GIT PULL In review Kevin Wolf 4 participants 18 messages Aug 6, 2012 – Aug 9, 2012 Block layer

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

The following changes since commit 26b9b5fe17cc1b6be2e8bf8b9d16094f420bb8ad:

virtio: fix vhost handling (2012-08-06 14:01:44 -0500)

are available in the git repository at:
http://repo.or.cz/r/qemu/kevin.git for-anthony

Dong Xu Wang (1):
qemu-img: use QemuOpts instead of QEMUOptionParameter in resize function

Kevin Wolf (1):
qemu-iotests: Be more flexible with image creation options

Markus Armbruster (1):
ide scsi: Mess with geometry only for hard disk devices

Paolo Bonzini (1):
qapi: generalize documentation of streaming commands

Stefan Hajnoczi (8):
qemu-iotests: add qed.py image manipulation utility
docs: add dirty bit to qcow2 specification
qcow2: introduce dirty bit
docs: add lazy refcounts bit to qcow2 specification
qemu-iotests: ignore qemu-img create lazy_refcounts output
qcow2: implement lazy refcounts
qemu-io: add "abort" command to simulate program crash
qemu-iotests: add 039 qcow2 lazy refcounts test

 block/qcow2-cluster.c        |    5 +-
 block/qcow2.c                |  123 +++++++++++++++++++++--
 block/qcow2.h                |   21 ++++
 block_int.h                  |   26 +++--
 docs/specs/qcow2.txt         |   14 ++-
 hmp-commands.hx              |    2 +-
 hw/ide/qdev.c                |    3 +-
 hw/scsi-disk.c               |    3 +-
 qapi-schema.json             |   17 ++--
 qemu-img.c                   |   28 +++--
 qemu-io.c                    |   12 ++
 tests/qemu-iotests/031.out   |   20 ++--
 tests/qemu-iotests/036.out   |    4 +-
 tests/qemu-iotests/039       |  136 ++++++++++++++++++++++++
 tests/qemu-iotests/039.out   |   53 ++++++++++
 tests/qemu-iotests/common.rc |    7 +-
 tests/qemu-iotests/group     |    1 +
 tests/qemu-iotests/qed.py    |  235 ++++++++++++++++++++++++++++++++++++++++++
 18 files changed, 650 insertions(+), 60 deletions(-)
 create mode 100755 tests/qemu-iotests/039
 create mode 100644 tests/qemu-iotests/039.out
 create mode 100755 tests/qemu-iotests/qed.py
author
#1 lore raw

PATCH 1/12 ide scsi: Mess with geometry only for hard disk devices

From: Markus Armbruster <[email protected]>

Legacy -drive cyls=... are now ignored completely when the drive doesn't back a hard disk device. Before, they were first checked against a hard disk's limits, then ignored.

---
 hw/ide/qdev.c  |    3 ++-
 hw/scsi-disk.c |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
hw/ide/qdev.c +2 -1
index 22e58df..5ea9b8f 100644
@@ -149,7 +149,8 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
     }
 
     blkconf_serial(&dev->conf, &dev->serial);
-    if (blkconf_geometry(&dev->conf, &dev->chs_trans, 65536, 16, 255) < 0) {
+    if (kind != IDE_CD
+        && blkconf_geometry(&dev->conf, &dev->chs_trans, 65536, 16, 255) < 0) {
         return -1;
     }
 
hw/scsi-disk.c +2 -1
index a9c7279..c8d5edd 100644
@@ -1958,7 +1958,8 @@ static int scsi_initfn(SCSIDevice *dev)
     }
 
     blkconf_serial(&s->qdev.conf, &s->serial);
-    if (blkconf_geometry(&dev->conf, NULL, 65535, 255, 255) < 0) {
+    if (dev->type == TYPE_DISK
+        && blkconf_geometry(&dev->conf, NULL, 65535, 255, 255) < 0) {
         return -1;
     }
 
Signature · 1 line
1.7.6.5
author
#2 lore raw

PATCH 2/12 qapi: generalize documentation of streaming commands

In reply to Kevin Wolf

From: Paolo Bonzini <[email protected]>

Talk about background operations in general, rather than specifically about streaming.

---
 hmp-commands.hx  |    2 +-
 qapi-schema.json |   17 ++++++++---------
 2 files changed, 9 insertions(+), 10 deletions(-)
hmp-commands.hx +1 -1
index eea8b32..9bbc7f7 100644
@@ -101,7 +101,7 @@ ETEXI
         .name       = "block_job_cancel",
         .args_type  = "device:B",
         .params     = "device",
-        .help       = "stop an active block streaming operation",
+        .help       = "stop an active background block operation",
         .mhandler.cmd = hmp_block_job_cancel,
     },
 
qapi-schema.json +8 -9
index cddf63a..bd9c450 100644
@@ -1660,7 +1660,7 @@
 # Returns: Nothing on success
 #          If the job type does not support throttling, NotSupported
 #          If the speed value is invalid, InvalidParameter
-#          If streaming is not active on this device, DeviceNotActive
+#          If no background operation is active on this device, DeviceNotActive
 #
 # Since: 1.1
 ##
@@ -1670,9 +1670,9 @@
 ##
 # @block-job-cancel:
 #
-# Stop an active block streaming operation.
+# Stop an active background block operation.
 #
-# This command returns immediately after marking the active block streaming
+# This command returns immediately after marking the active background block
 # operation for cancellation.  It is an error to call this command if no
 # operation is in progress.
 #
@@ -1680,16 +1680,15 @@
 # BLOCK_JOB_CANCELLED event.  Before that happens the job is still visible when
 # enumerated using query-block-jobs.
 #
-# The image file retains its backing file unless the streaming operation happens
-# to complete just as it is being cancelled.
-#
-# A new block streaming operation can be started at a later time to finish
-# copying all data from the backing file.
+# For streaming, the image file retains its backing file unless the streaming
+# operation happens to complete just as it is being cancelled.  A new streaming
+# operation can be started at a later time to finish copying all data from the
+# backing file.
 #
 # @device: the device name
 #
 # Returns: Nothing on success
-#          If streaming is not active on this device, DeviceNotActive
+#          If no background operation is active on this device, DeviceNotActive
 #          If cancellation already in progress, DeviceInUse
 #
 # Since: 1.1
Signature · 1 line
1.7.6.5
author
#3 lore raw

PATCH 3/12 qemu-iotests: add qed.py image manipulation utility

In reply to Kevin Wolf

From: Stefan Hajnoczi <[email protected]>

The qed.py utility can inspect and manipulate QED image files. It can be used for testing to see the state of image metadata and also to inject corruptions into the image file. It also has a scrubbing feature to copy just the metadata out of an image file, allowing users to share broken image files without revealing data in bug reports.

This has lived in my local repo for a long time but could be useful to others.

---
 tests/qemu-iotests/qed.py |  235 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 235 insertions(+), 0 deletions(-)
 create mode 100755 tests/qemu-iotests/qed.py
tests/qemu-iotests/qed.py new file +235 -0
new file mode 100755
index 0000000..52ff845
@@ -0,0 +1,235 @@
+#!/usr/bin/env python
+#
+# Tool to manipulate QED image files
+#
+# Copyright (C) 2010 IBM, Corp.
+#
+# Authors:
+#  Stefan Hajnoczi <[email protected]>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+
+import sys
+import struct
+import random
+import optparse
+
+# This can be used as a module
+__all__ = ['QED_F_NEED_CHECK', 'QED']
+
+QED_F_NEED_CHECK = 0x02
+
+header_fmt = '<IIIIQQQQQII'
+header_size = struct.calcsize(header_fmt)
+field_names = ['magic', 'cluster_size', 'table_size',
+               'header_size', 'features', 'compat_features',
+               'autoclear_features', 'l1_table_offset', 'image_size',
+               'backing_filename_offset', 'backing_filename_size']
+table_elem_fmt = '<Q'
+table_elem_size = struct.calcsize(table_elem_fmt)
+
+def err(msg):
+    sys.stderr.write(msg + '\n')
+    sys.exit(1)
+
+def unpack_header(s):
+    fields = struct.unpack(header_fmt, s)
+    return dict((field_names[idx], val) for idx, val in enumerate(fields))
+
+def pack_header(header):
+    fields = tuple(header[x] for x in field_names)
+    return struct.pack(header_fmt, *fields)
+
+def unpack_table_elem(s):
+    return struct.unpack(table_elem_fmt, s)[0]
+
+def pack_table_elem(elem):
+    return struct.pack(table_elem_fmt, elem)
+
+class QED(object):
+    def __init__(self, f):
+        self.f = f
+
+        self.f.seek(0, 2)
+        self.filesize = f.tell()
+
+        self.load_header()
+        self.load_l1_table()
+
+    def raw_pread(self, offset, size):
+        self.f.seek(offset)
+        return self.f.read(size)
+
+    def raw_pwrite(self, offset, data):
+        self.f.seek(offset)
+        return self.f.write(data)
+
+    def load_header(self):
+        self.header = unpack_header(self.raw_pread(0, header_size))
+
+    def store_header(self):
+        self.raw_pwrite(0, pack_header(self.header))
+
+    def read_table(self, offset):
+        size = self.header['table_size'] * self.header['cluster_size']
+        s = self.raw_pread(offset, size)
+        table = [unpack_table_elem(s[i:i + table_elem_size]) for i in xrange(0, size, table_elem_size)]
+        return table
+
+    def load_l1_table(self):
+        self.l1_table = self.read_table(self.header['l1_table_offset'])
+        self.table_nelems = self.header['table_size'] * self.header['cluster_size'] / table_elem_size
+
+    def write_table(self, offset, table):
+        s = ''.join(pack_table_elem(x) for x in table)
+        self.raw_pwrite(offset, s)
+
+def random_table_item(table):
+    vals = [(index, offset) for index, offset in enumerate(table) if offset != 0]
+    if not vals:
+        err('cannot pick random item because table is empty')
+    return random.choice(vals)
+
+def corrupt_table_duplicate(table):
+    '''Corrupt a table by introducing a duplicate offset'''
+    victim_idx, victim_val = random_table_item(table)
+    unique_vals = set(table)
+    if len(unique_vals) == 1:
+        err('no duplication corruption possible in table')
+    dup_val = random.choice(list(unique_vals.difference([victim_val])))
+    table[victim_idx] = dup_val
+
+def corrupt_table_invalidate(qed, table):
+    '''Corrupt a table by introducing an invalid offset'''
+    index, _ = random_table_item(table)
+    table[index] = qed.filesize + random.randint(0, 100 * 1024 * 1024 * 1024 * 1024)
+
+def cmd_show(qed, *args):
+    '''show [header|l1|l2 <offset>]- Show header or l1/l2 tables'''
+    if not args or args[0] == 'header':
+        print qed.header
+    elif args[0] == 'l1':
+        print qed.l1_table
+    elif len(args) == 2 and args[0] == 'l2':
+        offset = int(args[1])
+        print qed.read_table(offset)
+    else:
+        err('unrecognized sub-command')
+
+def cmd_duplicate(qed, table_level):
+    '''duplicate l1|l2 - Duplicate a random table element'''
+    if table_level == 'l1':
+        offset = qed.header['l1_table_offset']
+        table = qed.l1_table
+    elif table_level == 'l2':
+        _, offset = random_table_item(qed.l1_table)
+        table = qed.read_table(offset)
+    else:
+        err('unrecognized sub-command')
+    corrupt_table_duplicate(table)
+    qed.write_table(offset, table)
+
+def cmd_invalidate(qed, table_level):
+    '''invalidate l1|l2 - Plant an invalid table element at random'''
+    if table_level == 'l1':
+        offset = qed.header['l1_table_offset']
+        table = qed.l1_table
+    elif table_level == 'l2':
+        _, offset = random_table_item(qed.l1_table)
+        table = qed.read_table(offset)
+    else:
+        err('unrecognized sub-command')
+    corrupt_table_invalidate(qed, table)
+    qed.write_table(offset, table)
+
+def cmd_need_check(qed, *args):
+    '''need-check [on|off] - Test, set, or clear the QED_F_NEED_CHECK header bit'''
+    if not args:
+        print bool(qed.header['features'] & QED_F_NEED_CHECK)
+        return
+
+    if args[0] == 'on':
+        qed.header['features'] |= QED_F_NEED_CHECK
+    elif args[0] == 'off':
+        qed.header['features'] &= ~QED_F_NEED_CHECK
+    else:
+        err('unrecognized sub-command')
+    qed.store_header()
+
+def cmd_zero_cluster(qed, pos, *args):
+    '''zero-cluster <pos> [<n>] - Zero data clusters'''
+    pos, n = int(pos), 1
+    if args:
+        if len(args) != 1:
+            err('expected one argument')
+        n = int(args[0])
+
+    for i in xrange(n):
+        l1_index = pos / qed.header['cluster_size'] / len(qed.l1_table)
+        if qed.l1_table[l1_index] == 0:
+            err('no l2 table allocated')
+
+        l2_offset = qed.l1_table[l1_index]
+        l2_table = qed.read_table(l2_offset)
+
+        l2_index = (pos / qed.header['cluster_size']) % len(qed.l1_table)
+        l2_table[l2_index] = 1 # zero the data cluster
+        qed.write_table(l2_offset, l2_table)
+        pos += qed.header['cluster_size']
+
+def cmd_copy_metadata(qed, outfile):
+    '''copy-metadata <outfile> - Copy metadata only (for scrubbing corrupted images)'''
+    out = open(outfile, 'wb')
+
+    # Match file size
+    out.seek(qed.filesize - 1)
+    out.write('\0')
+
+    # Copy header clusters
+    out.seek(0)
+    header_size_bytes = qed.header['header_size'] * qed.header['cluster_size']
+    out.write(qed.raw_pread(0, header_size_bytes))
+
+    # Copy L1 table
+    out.seek(qed.header['l1_table_offset'])
+    s = ''.join(pack_table_elem(x) for x in qed.l1_table)
+    out.write(s)
+
+    # Copy L2 tables
+    for l2_offset in qed.l1_table:
+        if l2_offset == 0:
+            continue
+        l2_table = qed.read_table(l2_offset)
+        out.seek(l2_offset)
+        s = ''.join(pack_table_elem(x) for x in l2_table)
+        out.write(s)
+
+    out.close()
+
+def usage():
+    print 'Usage: %s <file> <cmd> [<arg>, ...]' % sys.argv[0]
+    print
+    print 'Supported commands:'
+    for cmd in sorted(x for x in globals() if x.startswith('cmd_')):
+        print globals()[cmd].__doc__
+    sys.exit(1)
+
+def main():
+    if len(sys.argv) < 3:
+        usage()
+    filename, cmd = sys.argv[1:3]
+
+    cmd = 'cmd_' + cmd.replace('-', '_')
+    if cmd not in globals():
+        usage()
+
+    qed = QED(open(filename, 'r+b'))
+    try:
+        globals()[cmd](qed, *sys.argv[3:])
+    except TypeError, e:
+        sys.stderr.write(globals()[cmd].__doc__ + '\n')
+        sys.exit(1)
+
+if __name__ == '__main__':
+    main()
Signature · 1 line
1.7.6.5
author
#4 lore raw

PATCH 4/12 docs: add dirty bit to qcow2 specification

In reply to Kevin Wolf

From: Stefan Hajnoczi <[email protected]>

The dirty bit will make it possible to perform lazy refcount updates, where the image file is not kept consistent all the time. Upon opening a dirty image file, it is necessary to perform a consistency check and repair any incorrect refcounts.

Therefore the dirty bit must be an incompatible feature bit. We don't want old programs accessing a file with stale refcounts.

---
 docs/specs/qcow2.txt |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
docs/specs/qcow2.txt +6 -1
index 87bf785..339cdc1 100644
@@ -75,7 +75,12 @@ in the description of a field.
                     Bitmask of incompatible features. An implementation must
                     fail to open an image if an unknown bit is set.
 
-                    Bits 0-63:  Reserved (set to 0)
+                    Bit 0:      Dirty bit.  If this bit is set then refcounts
+                                may be inconsistent, make sure to scan L1/L2
+                                tables to repair refcounts before accessing the
+                                image.
+
+                    Bits 1-63:  Reserved (set to 0)
 
          80 -  87:  compatible_features
                     Bitmask of compatible features. An implementation can
Signature · 1 line
1.7.6.5
author
#5 lore raw

PATCH 5/12 qcow2: introduce dirty bit

In reply to Kevin Wolf

From: Stefan Hajnoczi <[email protected]>

This patch adds an incompatible feature bit to mark images that have not been closed cleanly. When a dirty image file is opened a consistency check and repair is performed.

Update qemu-iotests 031 and 036 since the extension header size changes when we add feature bit table entries.

---
 block/qcow2.c              |   50 +++++++++++++++++++++++++++++++++++++++++--
 block/qcow2.h              |    8 +++++++
 tests/qemu-iotests/031.out |   20 ++++++++--------
 tests/qemu-iotests/036.out |    4 +-
 4 files changed, 67 insertions(+), 15 deletions(-)
block/qcow2.c +47 -3
index 870148d..7fe1567 100644
@@ -214,6 +214,27 @@ static void report_unsupported_feature(BlockDriverState *bs,
     }
 }
 
+/*
+ * Clears the dirty bit and flushes before if necessary.  Only call this
+ * function when there are no pending requests, it does not guard against
+ * concurrent requests dirtying the image.
+ */
+static int qcow2_mark_clean(BlockDriverState *bs)
+{
+    BDRVQcowState *s = bs->opaque;
+
+    if (s->incompatible_features & QCOW2_INCOMPAT_DIRTY) {
+        int ret = bdrv_flush(bs);
+        if (ret < 0) {
+            return ret;
+        }
+
+        s->incompatible_features &= ~QCOW2_INCOMPAT_DIRTY;
+        return qcow2_update_header(bs);
+    }
+    return 0;
+}
+
 static int qcow2_open(BlockDriverState *bs, int flags)
 {
     BDRVQcowState *s = bs->opaque;
@@ -287,12 +308,13 @@ static int qcow2_open(BlockDriverState *bs, int flags)
     s->compatible_features      = header.compatible_features;
     s->autoclear_features       = header.autoclear_features;
 
-    if (s->incompatible_features != 0) {
+    if (s->incompatible_features & ~QCOW2_INCOMPAT_MASK) {
         void *feature_table = NULL;
         qcow2_read_extensions(bs, header.header_length, ext_end,
                               &feature_table);
         report_unsupported_feature(bs, feature_table,
-                                   s->incompatible_features);
+                                   s->incompatible_features &
+                                   ~QCOW2_INCOMPAT_MASK);
         ret = -ENOTSUP;
         goto fail;
     }
@@ -412,6 +434,22 @@ static int qcow2_open(BlockDriverState *bs, int flags)
     /* Initialise locks */
     qemu_co_mutex_init(&s->lock);
 
+    /* Repair image if dirty */
+    if ((s->incompatible_features & QCOW2_INCOMPAT_DIRTY) &&
+        !bs->read_only) {
+        BdrvCheckResult result = {0};
+
+        ret = qcow2_check_refcounts(bs, &result, BDRV_FIX_ERRORS);
+        if (ret < 0) {
+            goto fail;
+        }
+
+        ret = qcow2_mark_clean(bs);
+        if (ret < 0) {
+            goto fail;
+        }
+    }
+
 #ifdef DEBUG_ALLOC
     {
         BdrvCheckResult result = {0};
@@ -785,6 +823,8 @@ static void qcow2_close(BlockDriverState *bs)
     qcow2_cache_flush(bs, s->l2_table_cache);
     qcow2_cache_flush(bs, s->refcount_block_cache);
 
+    qcow2_mark_clean(bs);
+
     qcow2_cache_destroy(bs, s->l2_table_cache);
     qcow2_cache_destroy(bs, s->refcount_block_cache);
 
@@ -949,7 +989,11 @@ int qcow2_update_header(BlockDriverState *bs)
 
     /* Feature table */
     Qcow2Feature features[] = {
-        /* no feature defined yet */
+        {
+            .type = QCOW2_FEAT_TYPE_INCOMPATIBLE,
+            .bit  = QCOW2_INCOMPAT_DIRTY_BITNR,
+            .name = "dirty bit",
+        },
     };
 
     ret = header_ext_add(buf, QCOW2_EXT_MAGIC_FEATURE_TABLE,
block/qcow2.h +8 -0
index 455b6d7..b5fefc0 100644
@@ -110,6 +110,14 @@ enum {
     QCOW2_FEAT_TYPE_AUTOCLEAR       = 2,
 };
 
+/* Incompatible feature bits */
+enum {
+    QCOW2_INCOMPAT_DIRTY_BITNR   = 0,
+    QCOW2_INCOMPAT_DIRTY         = 1 << QCOW2_INCOMPAT_DIRTY_BITNR,
+
+    QCOW2_INCOMPAT_MASK          = QCOW2_INCOMPAT_DIRTY,
+};
+
 typedef struct Qcow2Feature {
     uint8_t type;
     uint8_t bit;
tests/qemu-iotests/031.out +10 -10
index d3cab30..297b458 100644
@@ -54,8 +54,8 @@ header_length             72
 
 Header extension:
 magic                     0x6803f857
-length                    0
-data                      ''
+length                    48
+data                      <binary>
 
 Header extension:
 magic                     0x12345678
@@ -68,7 +68,7 @@ No errors were found on the image.
 
 magic                     0x514649fb
 version                   2
-backing_file_offset       0x98
+backing_file_offset       0xc8
 backing_file_size         0x17
 cluster_bits              16
 size                      67108864
@@ -92,8 +92,8 @@ data                      'host_device'
 
 Header extension:
 magic                     0x6803f857
-length                    0
-data                      ''
+length                    48
+data                      <binary>
 
 Header extension:
 magic                     0x12345678
@@ -155,8 +155,8 @@ header_length             104
 
 Header extension:
 magic                     0x6803f857
-length                    0
-data                      ''
+length                    48
+data                      <binary>
 
 Header extension:
 magic                     0x12345678
@@ -169,7 +169,7 @@ No errors were found on the image.
 
 magic                     0x514649fb
 version                   3
-backing_file_offset       0xb8
+backing_file_offset       0xe8
 backing_file_size         0x17
 cluster_bits              16
 size                      67108864
@@ -193,8 +193,8 @@ data                      'host_device'
 
 Header extension:
 magic                     0x6803f857
-length                    0
-data                      ''
+length                    48
+data                      <binary>
 
 Header extension:
 magic                     0x12345678
tests/qemu-iotests/036.out +2 -2
index 6953e37..ca0fda1 100644
@@ -46,7 +46,7 @@ header_length             104
 
 Header extension:
 magic                     0x6803f857
-length                    0
-data                      ''
+length                    48
+data                      <binary>
 
 *** done
Signature · 1 line
1.7.6.5
author
#6 lore raw

PATCH 6/12 docs: add lazy refcounts bit to qcow2 specification

In reply to Kevin Wolf

From: Stefan Hajnoczi <[email protected]>

The lazy refcounts bit indicates that this image can take advantage of the dirty bit and that refcount updates can be postponed.

---
 docs/specs/qcow2.txt |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
docs/specs/qcow2.txt +6 -1
index 339cdc1..36a559d 100644
@@ -86,7 +86,12 @@ in the description of a field.
                     Bitmask of compatible features. An implementation can
                     safely ignore any unknown bits that are set.
 
-                    Bits 0-63:  Reserved (set to 0)
+                    Bit 0:      Lazy refcounts bit.  If this bit is set then
+                                lazy refcount updates can be used.  This means
+                                marking the image file dirty and postponing
+                                refcount metadata updates.
+
+                    Bits 1-63:  Reserved (set to 0)
 
          88 -  95:  autoclear_features
                     Bitmask of auto-clear features. An implementation may only
Signature · 1 line
1.7.6.5
author
#7 lore raw

PATCH 7/12 qemu-iotests: ignore qemu-img create lazy_refcounts output

In reply to Kevin Wolf

From: Stefan Hajnoczi <[email protected]>

Hide the default lazy_refcounts=off output from qemu-img like we do with other image creation options. This ensures that existing golden outputs continue to pass despite the new option that has been added.

Note that this patch applies before the one that actually introduces the lazy_refcounts=on|off option. This ensures git-bisect(1) continues to work.

---
 tests/qemu-iotests/common.rc |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
tests/qemu-iotests/common.rc +2 -1
index 5e3a524..cc4e39b 100644
@@ -113,7 +113,8 @@ _make_test_img()
 	sed -e "s# table_size=0##g" | \
 	sed -e "s# compat='[^']*'##g" | \
 	sed -e "s# compat6=off##g" | \
-	sed -e "s# static=off##g"
+	sed -e "s# static=off##g" | \
+	sed -e "s# lazy_refcounts=off##g"
 }
 
 _cleanup_test_img()
Signature · 1 line
1.7.6.5
author
#9 lore raw

PATCH 9/12 qemu-io: add "abort" command to simulate program crash

In reply to Kevin Wolf

From: Stefan Hajnoczi <[email protected]>

Avoiding data loss and corruption is the top requirement for image file formats. The qemu-io "abort" command makes it possible to simulate program crashes and does not give the image format a chance to cleanly shut down. This command is useful for data integrity test cases.

---
 qemu-io.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
qemu-io.c +12 -0
index 8f3b94b..d0f4fb7 100644
@@ -1652,6 +1652,17 @@ static const cmdinfo_t map_cmd = {
        .oneline        = "prints the allocated areas of a file",
 };
 
+static int abort_f(int argc, char **argv)
+{
+    abort();
+}
+
+static const cmdinfo_t abort_cmd = {
+       .name           = "abort",
+       .cfunc          = abort_f,
+       .flags          = CMD_NOFILE_OK,
+       .oneline        = "simulate a program crash using abort(3)",
+};
 
 static int close_f(int argc, char **argv)
 {
@@ -1905,6 +1916,7 @@ int main(int argc, char **argv)
     add_command(&discard_cmd);
     add_command(&alloc_cmd);
     add_command(&map_cmd);
+    add_command(&abort_cmd);
 
     add_args_command(init_args_command);
     add_check_command(init_check_command);
Signature · 1 line
1.7.6.5
author
#8 lore raw

PATCH 8/12 qcow2: implement lazy refcounts

In reply to Kevin Wolf

From: Stefan Hajnoczi <[email protected]>

Lazy refcounts is a performance optimization for qcow2 that postpones refcount metadata updates and instead marks the image dirty. In the case of crash or power failure the image will be left in a dirty state and repaired next time it is opened.

Reducing metadata I/O is important for cache=writethrough and cache=directsync because these modes guarantee that data is on disk after each write (hence we cannot take advantage of caching updates in RAM). Refcount metadata is not needed for guest->file block address translation and therefore does not need to be on-disk at the time of write completion - this is the motivation behind the lazy refcount optimization.

The lazy refcount optimization must be enabled at image creation time:

qemu-img create -f qcow2 -o compat=1.1,lazy_refcounts=on a.qcow2 10G qemu-system-x86_64 -drive if=virtio,file=a.qcow2,cache=writethrough

Update qemu-iotests 031 and 036 since the extension header size changes when we add feature bit table entries.

---
 block/qcow2-cluster.c      |    5 ++-
 block/qcow2.c              |   73 +++++++++++++++++++++++++++++++++++++++++--
 block/qcow2.h              |   13 ++++++++
 block_int.h                |   26 ++++++++-------
 tests/qemu-iotests/031.out |   12 +++---
 tests/qemu-iotests/036.out |    2 +-
 6 files changed, 107 insertions(+), 24 deletions(-)
block/qcow2-cluster.c +4 -1
index d7e0e19..e179211 100644
@@ -662,7 +662,10 @@ int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m)
         qcow2_cache_depends_on_flush(s->l2_table_cache);
     }
 
-    qcow2_cache_set_dependency(bs, s->l2_table_cache, s->refcount_block_cache);
+    if (qcow2_need_accurate_refcounts(s)) {
+        qcow2_cache_set_dependency(bs, s->l2_table_cache,
+                                   s->refcount_block_cache);
+    }
     ret = get_cluster_table(bs, m->offset, &l2_table, &l2_index);
     if (ret < 0) {
         goto err;
block/qcow2.c +69 -4

121 lines not on this page · raw message

block/qcow2.h +13 -0
index b5fefc0..b4eb654 100644
@@ -118,6 +118,14 @@ enum {
     QCOW2_INCOMPAT_MASK          = QCOW2_INCOMPAT_DIRTY,
 };
 
+/* Compatible feature bits */
+enum {
+    QCOW2_COMPAT_LAZY_REFCOUNTS_BITNR = 0,
+    QCOW2_COMPAT_LAZY_REFCOUNTS       = 1 << QCOW2_COMPAT_LAZY_REFCOUNTS_BITNR,
+
+    QCOW2_COMPAT_FEAT_MASK            = QCOW2_COMPAT_LAZY_REFCOUNTS,
+};
+
 typedef struct Qcow2Feature {
     uint8_t type;
     uint8_t bit;
@@ -245,6 +253,11 @@ static inline int qcow2_get_cluster_type(uint64_t l2_entry)
     }
 }
 
+/* Check whether refcounts are eager or lazy */
+static inline bool qcow2_need_accurate_refcounts(BDRVQcowState *s)
+{
+    return !(s->incompatible_features & QCOW2_INCOMPAT_DIRTY);
+}
 
 // FIXME Need qcow2_ prefix to global functions
 
block_int.h +14 -12
index d72317f..6c1d9ca 100644
@@ -31,8 +31,9 @@
 #include "qemu-timer.h"
 #include "qapi-types.h"
 
-#define BLOCK_FLAG_ENCRYPT	1
-#define BLOCK_FLAG_COMPAT6	4
+#define BLOCK_FLAG_ENCRYPT          1
+#define BLOCK_FLAG_COMPAT6          4
+#define BLOCK_FLAG_LAZY_REFCOUNTS   8
 
 #define BLOCK_IO_LIMIT_READ     0
 #define BLOCK_IO_LIMIT_WRITE    1
@@ -41,16 +42,17 @@
 #define BLOCK_IO_SLICE_TIME     100000000
 #define NANOSECONDS_PER_SECOND  1000000000.0
 
-#define BLOCK_OPT_SIZE          "size"
-#define BLOCK_OPT_ENCRYPT       "encryption"
-#define BLOCK_OPT_COMPAT6       "compat6"
-#define BLOCK_OPT_BACKING_FILE  "backing_file"
-#define BLOCK_OPT_BACKING_FMT   "backing_fmt"
-#define BLOCK_OPT_CLUSTER_SIZE  "cluster_size"
-#define BLOCK_OPT_TABLE_SIZE    "table_size"
-#define BLOCK_OPT_PREALLOC      "preallocation"
-#define BLOCK_OPT_SUBFMT        "subformat"
-#define BLOCK_OPT_COMPAT_LEVEL  "compat"
+#define BLOCK_OPT_SIZE              "size"
+#define BLOCK_OPT_ENCRYPT           "encryption"
+#define BLOCK_OPT_COMPAT6           "compat6"
+#define BLOCK_OPT_BACKING_FILE      "backing_file"
+#define BLOCK_OPT_BACKING_FMT       "backing_fmt"
+#define BLOCK_OPT_CLUSTER_SIZE      "cluster_size"
+#define BLOCK_OPT_TABLE_SIZE        "table_size"
+#define BLOCK_OPT_PREALLOC          "preallocation"
+#define BLOCK_OPT_SUBFMT            "subformat"
+#define BLOCK_OPT_COMPAT_LEVEL      "compat"
+#define BLOCK_OPT_LAZY_REFCOUNTS    "lazy_refcounts"
 
 typedef struct BdrvTrackedRequest BdrvTrackedRequest;
 
tests/qemu-iotests/031.out +6 -6
index 297b458..796c993 100644
@@ -54,7 +54,7 @@ header_length             72
 
 Header extension:
 magic                     0x6803f857
-length                    48
+length                    96
 data                      <binary>
 
 Header extension:
@@ -68,7 +68,7 @@ No errors were found on the image.
 
 magic                     0x514649fb
 version                   2
-backing_file_offset       0xc8
+backing_file_offset       0xf8
 backing_file_size         0x17
 cluster_bits              16
 size                      67108864
@@ -92,7 +92,7 @@ data                      'host_device'
 
 Header extension:
 magic                     0x6803f857
-length                    48
+length                    96
 data                      <binary>
 
 Header extension:
@@ -155,7 +155,7 @@ header_length             104
 
 Header extension:
 magic                     0x6803f857
-length                    48
+length                    96
 data                      <binary>
 
 Header extension:
@@ -169,7 +169,7 @@ No errors were found on the image.
 
 magic                     0x514649fb
 version                   3
-backing_file_offset       0xe8
+backing_file_offset       0x118
 backing_file_size         0x17
 cluster_bits              16
 size                      67108864
@@ -193,7 +193,7 @@ data                      'host_device'
 
 Header extension:
 magic                     0x6803f857
-length                    48
+length                    96
 data                      <binary>
 
 Header extension:
tests/qemu-iotests/036.out +1 -1
index ca0fda1..063ca22 100644
@@ -46,7 +46,7 @@ header_length             104
 
 Header extension:
 magic                     0x6803f857
-length                    48
+length                    96
 data                      <binary>
 
 *** done
Signature · 1 line
1.7.6.5
author
#11 lore raw

PATCH 11/12 qemu-iotests: Be more flexible with image creation options

In reply to Kevin Wolf

qemu-iotests already filters out image creation options that may be present or not in order to get the same output in both cases. However, often it only considers the default value of the option. Cover all valid values instead so that ./check -o name=value can be used successfull for all of them.

---
 tests/qemu-iotests/039.out   |    6 +++---
 tests/qemu-iotests/common.rc |    8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)
tests/qemu-iotests/039.out +3 -3
index 8ad570d..155a05e 100644
@@ -1,14 +1,14 @@
 QA output created by 039
 
 == Checking that image is clean on shutdown ==
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 lazy_refcounts=on 
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 incompatible_features     0x0
 No errors were found on the image.
 
 == Creating a dirty image file ==
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 lazy_refcounts=on 
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 incompatible_features     0x1
@@ -34,7 +34,7 @@ read 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
 == Opening a dirty image read/write should repair it ==
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 lazy_refcounts=on 
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 incompatible_features     0x1
tests/qemu-iotests/common.rc +4 -4
index cc4e39b..7782808 100644
@@ -110,11 +110,11 @@ _make_test_img()
     	sed -e "s#$IMGFMT#IMGFMT#g" | \
 	sed -e "s# encryption=off##g" | \
 	sed -e "s# cluster_size=[0-9]\\+##g" | \
-	sed -e "s# table_size=0##g" | \
+	sed -e "s# table_size=[0-9]\\+##g" | \
 	sed -e "s# compat='[^']*'##g" | \
-	sed -e "s# compat6=off##g" | \
-	sed -e "s# static=off##g" | \
-	sed -e "s# lazy_refcounts=off##g"
+	sed -e "s# compat6=\\(on\\|off\\)##g" | \
+	sed -e "s# static=\\(on\\|off\\)##g" | \
+	sed -e "s# lazy_refcounts=\\(on\\|off\\)##g"
 }
 
 _cleanup_test_img()
Signature · 1 line
1.7.6.5
author
#10 lore raw

PATCH 10/12 qemu-iotests: add 039 qcow2 lazy refcounts test

In reply to Kevin Wolf

From: Stefan Hajnoczi <[email protected]>

This tests establishes the basic post-conditions of the qcow2 lazy refcounts features:

1. If the image was closed normally, it is marked clean.

2. If an allocating write was performed and the image was not closed normally, then it is marked dirty.

a. Written data can be read back successfully.
b. The image file can be repaired and will be marked clean again. c. The image file is automatically repaired when opened read/write.

---
 tests/qemu-iotests/039     |  136 ++++++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/039.out |   53 +++++++++++++++++
 tests/qemu-iotests/group   |    1 +
 3 files changed, 190 insertions(+), 0 deletions(-)
 create mode 100755 tests/qemu-iotests/039
 create mode 100644 tests/qemu-iotests/039.out
tests/qemu-iotests/039 new file +136 -0
new file mode 100755
index 0000000..a749fcf
@@ -0,0 +1,136 @@
+#!/bin/bash
+#
+# Test qcow2 lazy refcounts
+#
+# Copyright (C) 2012 Red Hat, Inc.
+# Copyright IBM, Corp. 2010
+#
+# Based on test 038.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+# creator
[email protected]
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+
+_cleanup()
+{
+	_cleanup_test_img
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+
+_supported_fmt qcow2
+_supported_proto generic
+_supported_os Linux
+
+size=128M
+
+echo
+echo "== Checking that image is clean on shutdown =="
+
+IMGOPTS="compat=1.1,lazy_refcounts=on"
+_make_test_img $size
+
+$QEMU_IO -c "write -P 0x5a 0 512" $TEST_IMG | _filter_qemu_io
+
+# The dirty bit must not be set
+./qcow2.py $TEST_IMG dump-header | grep incompatible_features
+_check_test_img
+
+echo
+echo "== Creating a dirty image file =="
+
+IMGOPTS="compat=1.1,lazy_refcounts=on"
+_make_test_img $size
+
+old_ulimit=$(ulimit -c)
+ulimit -c 0 # do not produce a core dump on abort(3)
+$QEMU_IO -c "write -P 0x5a 0 512" -c "abort" $TEST_IMG | _filter_qemu_io
+ulimit -c "$old_ulimit"
+
+# The dirty bit must be set
+./qcow2.py $TEST_IMG dump-header | grep incompatible_features
+_check_test_img
+
+echo
+echo "== Read-only access must still work =="
+
+$QEMU_IO -r -c "read -P 0x5a 0 512" $TEST_IMG | _filter_qemu_io
+
+# The dirty bit must be set
+./qcow2.py $TEST_IMG dump-header | grep incompatible_features
+
+echo
+echo "== Repairing the image file must succeed =="
+
+$QEMU_IMG check -r all $TEST_IMG
+
+# The dirty bit must not be set
+./qcow2.py $TEST_IMG dump-header | grep incompatible_features
+
+echo
+echo "== Data should still be accessible after repair =="
+
+$QEMU_IO -c "read -P 0x5a 0 512" $TEST_IMG | _filter_qemu_io
+
+echo
+echo "== Opening a dirty image read/write should repair it =="
+
+IMGOPTS="compat=1.1,lazy_refcounts=on"
+_make_test_img $size
+
+old_ulimit=$(ulimit -c)
+ulimit -c 0 # do not produce a core dump on abort(3)
+$QEMU_IO -c "write -P 0x5a 0 512" -c "abort" $TEST_IMG | _filter_qemu_io
+ulimit -c "$old_ulimit"
+
+# The dirty bit must be set
+./qcow2.py $TEST_IMG dump-header | grep incompatible_features
+
+$QEMU_IO -c "write 0 512" $TEST_IMG | _filter_qemu_io
+
+# The dirty bit must not be set
+./qcow2.py $TEST_IMG dump-header | grep incompatible_features
+
+echo
+echo "== Creating an image file with lazy_refcounts=off =="
+
+IMGOPTS="compat=1.1,lazy_refcounts=off"
+_make_test_img $size
+
+old_ulimit=$(ulimit -c)
+ulimit -c 0 # do not produce a core dump on abort(3)
+$QEMU_IO -c "write -P 0x5a 0 512" -c "abort" $TEST_IMG | _filter_qemu_io
+ulimit -c "$old_ulimit"
+
+# The dirty bit must not be set since lazy_refcounts=off
+./qcow2.py $TEST_IMG dump-header | grep incompatible_features
+_check_test_img
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
+
tests/qemu-iotests/039.out new file +53 -0

53 lines not on this page · raw message

tests/qemu-iotests/group +1 -0
index 7a2c92b..ebb5ca4 100644
@@ -45,3 +45,4 @@
 036 rw auto quick
 037 rw auto backing
 038 rw auto backing
+039 rw auto
Signature · 1 line
1.7.6.5
author
#15 lore raw

PATCH 12/12 qemu-img: use QemuOpts instead of QEMUOptionParameter in resize function

In reply to Kevin Wolf

From: Dong Xu Wang <[email protected]>

---
 qemu-img.c |   28 +++++++++++++++++-----------
 1 files changed, 17 insertions(+), 11 deletions(-)
qemu-img.c +17 -11
index b866f80..94a31ad 100644
@@ -1567,14 +1567,19 @@ static int img_resize(int argc, char **argv)
     const char *filename, *fmt, *size;
     int64_t n, total_size;
     BlockDriverState *bs = NULL;
-    QEMUOptionParameter *param;
-    QEMUOptionParameter resize_options[] = {
-        {
-            .name = BLOCK_OPT_SIZE,
-            .type = OPT_SIZE,
-            .help = "Virtual disk size"
+    QemuOpts *param;
+    static QemuOptsList resize_options = {
+        .name = "resize_options",
+        .head = QTAILQ_HEAD_INITIALIZER(resize_options.head),
+        .desc = {
+            {
+                .name = BLOCK_OPT_SIZE,
+                .type = QEMU_OPT_SIZE,
+                .help = "Virtual disk size"
+            }, {
+                /* end of list */
+            }
         },
-        { NULL }
     };
 
     /* Remove size from argv manually so that negative numbers are not treated
@@ -1624,14 +1629,15 @@ static int img_resize(int argc, char **argv)
     }
 
     /* Parse size */
-    param = parse_option_parameters("", resize_options, NULL);
-    if (set_option_parameter(param, BLOCK_OPT_SIZE, size)) {
+    param = qemu_opts_create(&resize_options, NULL, 0, NULL);
+    if (qemu_opt_set(param, BLOCK_OPT_SIZE, size)) {
         /* Error message already printed when size parsing fails */
         ret = -1;
+        qemu_opts_del(param);
         goto out;
     }
-    n = get_option_parameter(param, BLOCK_OPT_SIZE)->value.n;
-    free_option_parameters(param);
+    n = qemu_opt_get_size(param, BLOCK_OPT_SIZE, 0);
+    qemu_opts_del(param);
 
     bs = bdrv_new_open(filename, fmt, BDRV_O_FLAGS | BDRV_O_RDWR);
     if (!bs) {
Signature · 1 line
1.7.6.5
#12 lore raw

Re: [Qemu-devel] [PATCH 11/12] qemu-iotests: Be more flexible with image creation options

In reply to Kevin Wolf
Quoted 9 lines · Kevin Wolf

qemu-iotests already filters out image creation options that may be present or not in order to get the same output in both cases. However, often it only considers the default value of the option. Cover all valid values instead so that ./check -o name=value can be used successfull for all of them.

+++ b/tests/qemu-iotests/common.rc

tests/qemu-iotests/common.rc _make_test_img() · line 113

Quoted 5 lines
tests/qemu-iotests/common.rc +1 -1
@@ -110,11 +110,11 @@ _make_test_img()
     	sed -e "s#$IMGFMT#IMGFMT#g" | \
 	sed -e "s# encryption=off##g" | \
 	sed -e "s# cluster_size=[0-9]\\+##g" | \
-	sed -e "s# table_size=0##g" | \
+	sed -e "s# table_size=[0-9]\\+##g" | \

Technically, use of \+ in a sed expression is undefined by POSIX.

tests/qemu-iotests/common.rc _make_test_img() · line 115

Quoted 5 lines
tests/qemu-iotests/common.rc +1 -3
 	sed -e "s# compat='[^']*'##g" | \
-	sed -e "s# compat6=off##g" | \
-	sed -e "s# static=off##g" | \
-	sed -e "s# lazy_refcounts=off##g"
+	sed -e "s# compat6=\\(on\\|off\\)##g" | \

Likewise for use of \(, \|, and \).

If you were worried about strict POSIX compliance, you could rewrite these to use similar expressions that are limited to portable sed:

sed -e "s# table_size=[0-9][0-9]*##g"
sed -e "s# compat6=o[nf]*##g"

(and if the difference of wiping unlikely things like compat6=onfnfn really matters to one of our tests, then we've got some UI to improve.)
But since this is the testsuite, which will run primarily on systems
with GNU sed where all four extensions are commonly present for selecting features of ERE on top of the POSIX-mandated BRE syntax used by sed, and where encountering a non-GNU sed that doesn't have the same extensions will probably result in a noisy testsuite failure rather than silent disk corruption, I'm okay overlooking this non-portable aspect for now. (Not to mention that you're not the first offender, seeing that cluster_size earlier in the context also used \+.)

Signature · 2 lines
Eric Blake   [email protected]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#13 lore raw

Re: [Qemu-devel] [PATCH 11/12] qemu-iotests: Be more flexible with image creation options

Quoted 8 lines · Eric Blake
Quoted 6 lines · Kevin Wolf

qemu-iotests already filters out image creation options that may be present or not in order to get the same output in both cases. However, often it only considers the default value of the option. Cover all valid values instead so that ./check -o name=value can be used successfull for all of them.

Quoted 9 lines

tests/qemu-iotests/common.rc _make_test_img() · line 113

Quoted 7 lines

+++ b/tests/qemu-iotests/common.rc

tests/qemu-iotests/common.rc +1 -1
@@ -110,11 +110,11 @@ _make_test_img()
     	sed -e "s#$IMGFMT#IMGFMT#g" | \
 	sed -e "s# encryption=off##g" | \
 	sed -e "s# cluster_size=[0-9]\\+##g" | \
-	sed -e "s# table_size=0##g" | \
+	sed -e "s# table_size=[0-9]\\+##g" | \

Technically, use of \+ in a sed expression is undefined by POSIX.

Oh, one other thing. This wastes a lot of processes by making a huge pipeline. Why not just do it with one sed process instead?

sed -e "s# encryption=off##g" \
    -e "s# cluster_size=..." \
    -e ...
Signature · 2 lines
Eric Blake   [email protected]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#16 lore raw
In reply to Kevin Wolf

Il 06/08/2012 22:44, Kevin Wolf ha scritto:

Quoted 3 lines

The following changes since commit 26b9b5fe17cc1b6be2e8bf8b9d16094f420bb8ad:

virtio: fix vhost handling (2012-08-06 14:01:44 -0500)

I see the virtio caching patches are not included, should I resubmit them together with the change of the default from writethrough to writeback?

Paolo

Quoted 49 lines

are available in the git repository at:
http://repo.or.cz/r/qemu/kevin.git for-anthony

Dong Xu Wang (1):
qemu-img: use QemuOpts instead of QEMUOptionParameter in resize function

Kevin Wolf (1):
qemu-iotests: Be more flexible with image creation options

Markus Armbruster (1):
ide scsi: Mess with geometry only for hard disk devices

Paolo Bonzini (1):
qapi: generalize documentation of streaming commands

Stefan Hajnoczi (8):
qemu-iotests: add qed.py image manipulation utility
docs: add dirty bit to qcow2 specification
qcow2: introduce dirty bit
docs: add lazy refcounts bit to qcow2 specification
qemu-iotests: ignore qemu-img create lazy_refcounts output
qcow2: implement lazy refcounts
qemu-io: add "abort" command to simulate program crash
qemu-iotests: add 039 qcow2 lazy refcounts test

 block/qcow2-cluster.c        |    5 +-
 block/qcow2.c                |  123 +++++++++++++++++++++--
 block/qcow2.h                |   21 ++++
 block_int.h                  |   26 +++--
 docs/specs/qcow2.txt         |   14 ++-
 hmp-commands.hx              |    2 +-
 hw/ide/qdev.c                |    3 +-
 hw/scsi-disk.c               |    3 +-
 qapi-schema.json             |   17 ++--
 qemu-img.c                   |   28 +++--
 qemu-io.c                    |   12 ++
 tests/qemu-iotests/031.out   |   20 ++--
 tests/qemu-iotests/036.out   |    4 +-
 tests/qemu-iotests/039       |  136 ++++++++++++++++++++++++
 tests/qemu-iotests/039.out   |   53 ++++++++++
 tests/qemu-iotests/common.rc |    7 +-
 tests/qemu-iotests/group     |    1 +
 tests/qemu-iotests/qed.py    |  235 ++++++++++++++++++++++++++++++++++++++++++
 18 files changed, 650 insertions(+), 60 deletions(-)
 create mode 100755 tests/qemu-iotests/039
 create mode 100644 tests/qemu-iotests/039.out
 create mode 100755 tests/qemu-iotests/qed.py
#17 lore raw
In reply to Kevin Wolf
Quoted 6 lines · Kevin Wolf

The following changes since commit 26b9b5fe17cc1b6be2e8bf8b9d16094f420bb8ad:

virtio: fix vhost handling (2012-08-06 14:01:44 -0500)

are available in the git repository at:
http://repo.or.cz/r/qemu/kevin.git for-anthony

Pulled. Thanks.

Regards,

Anthony Liguori

Quoted 45 lines

Dong Xu Wang (1):
qemu-img: use QemuOpts instead of QEMUOptionParameter in resize function

Kevin Wolf (1):
qemu-iotests: Be more flexible with image creation options

Markus Armbruster (1):
ide scsi: Mess with geometry only for hard disk devices

Paolo Bonzini (1):
qapi: generalize documentation of streaming commands

Stefan Hajnoczi (8):
qemu-iotests: add qed.py image manipulation utility
docs: add dirty bit to qcow2 specification
qcow2: introduce dirty bit
docs: add lazy refcounts bit to qcow2 specification
qemu-iotests: ignore qemu-img create lazy_refcounts output
qcow2: implement lazy refcounts
qemu-io: add "abort" command to simulate program crash
qemu-iotests: add 039 qcow2 lazy refcounts test

 block/qcow2-cluster.c        |    5 +-
 block/qcow2.c                |  123 +++++++++++++++++++++--
 block/qcow2.h                |   21 ++++
 block_int.h                  |   26 +++--
 docs/specs/qcow2.txt         |   14 ++-
 hmp-commands.hx              |    2 +-
 hw/ide/qdev.c                |    3 +-
 hw/scsi-disk.c               |    3 +-
 qapi-schema.json             |   17 ++--
 qemu-img.c                   |   28 +++--
 qemu-io.c                    |   12 ++
 tests/qemu-iotests/031.out   |   20 ++--
 tests/qemu-iotests/036.out   |    4 +-
 tests/qemu-iotests/039       |  136 ++++++++++++++++++++++++
 tests/qemu-iotests/039.out   |   53 ++++++++++
 tests/qemu-iotests/common.rc |    7 +-
 tests/qemu-iotests/group     |    1 +
 tests/qemu-iotests/qed.py    |  235 ++++++++++++++++++++++++++++++++++++++++++
 18 files changed, 650 insertions(+), 60 deletions(-)
 create mode 100755 tests/qemu-iotests/039
 create mode 100644 tests/qemu-iotests/039.out
 create mode 100755 tests/qemu-iotests/qed.py
author
#14 lore raw

Re: [Qemu-devel] [PATCH 11/12] qemu-iotests: Be more flexible with image creation options

In reply to Eric Blake

Am 06.08.2012 23:57, schrieb Eric Blake:

Quoted 19 lines · Eric Blake
Quoted 8 lines · Kevin Wolf
Quoted 6 lines

qemu-iotests already filters out image creation options that may be present or not in order to get the same output in both cases. However, often it only considers the default value of the option. Cover all valid values instead so that ./check -o name=value can be used successfull for all of them.

Quoted 9 lines

tests/qemu-iotests/common.rc _make_test_img() · line 113

Quoted 7 lines

+++ b/tests/qemu-iotests/common.rc

tests/qemu-iotests/common.rc +1 -1
@@ -110,11 +110,11 @@ _make_test_img()
     	sed -e "s#$IMGFMT#IMGFMT#g" | \
 	sed -e "s# encryption=off##g" | \
 	sed -e "s# cluster_size=[0-9]\\+##g" | \
-	sed -e "s# table_size=0##g" | \
+	sed -e "s# table_size=[0-9]\\+##g" | \

Technically, use of \+ in a sed expression is undefined by POSIX.

Quoted 6 lines

Oh, one other thing. This wastes a lot of processes by making a huge pipeline. Why not just do it with one sed process instead?

sed -e "s# encryption=off##g" \
    -e "s# cluster_size=..." \
    -e ...

Makes sense, I'll send a patch.

Kevin