[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 16/23] qapi: Add corrupt field to ImageInfoSpecificQC
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 16/23] qapi: Add corrupt field to ImageInfoSpecificQCow2 |
Date: |
Sat, 4 Oct 2014 21:24:42 +0100 |
From: Max Reitz <address@hidden>
Just like lazy-refcounts, this field will be present iff the qcow2
compat level is 1.1 (or probably any future revision).
As expected, this breaks some tests due to the new field present in
qemu-img info output; so fix their output accordingly.
Suggested-by: Eric Blake <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/qcow2.c | 3 +++
qapi/block-core.json | 6 +++++-
tests/qemu-iotests/065 | 12 ++++++------
tests/qemu-iotests/067.out | 10 +++++-----
tests/qemu-iotests/082.out | 7 +++++++
tests/qemu-iotests/089.out | 2 ++
6 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/block/qcow2.c b/block/qcow2.c
index 778fc1e..fb28493 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2282,6 +2282,9 @@ static ImageInfoSpecific
*qcow2_get_specific_info(BlockDriverState *bs)
.lazy_refcounts = s->compatible_features &
QCOW2_COMPAT_LAZY_REFCOUNTS,
.has_lazy_refcounts = true,
+ .corrupt = s->incompatible_features &
+ QCOW2_INCOMPAT_CORRUPT,
+ .has_corrupt = true,
};
}
diff --git a/qapi/block-core.json b/qapi/block-core.json
index fa2d1b7..8f7089e 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -38,12 +38,16 @@
#
# @lazy-refcounts: #optional on or off; only valid for compat >= 1.1
#
+# @corrupt: #optional true if the image has been marked corrupt; only valid for
+# compat >= 1.1 (since 2.2)
+#
# Since: 1.7
##
{ 'type': 'ImageInfoSpecificQCow2',
'data': {
'compat': 'str',
- '*lazy-refcounts': 'bool'
+ '*lazy-refcounts': 'bool',
+ '*corrupt': 'bool'
} }
##
diff --git a/tests/qemu-iotests/065 b/tests/qemu-iotests/065
index e89b61d..8d3a9c9 100755
--- a/tests/qemu-iotests/065
+++ b/tests/qemu-iotests/065
@@ -94,28 +94,28 @@ class TestQCow2(TestQemuImgInfo):
class TestQCow3NotLazy(TestQemuImgInfo):
'''Testing a qcow2 version 3 image with lazy refcounts disabled'''
img_options = 'compat=1.1,lazy_refcounts=off'
- json_compare = { 'compat': '1.1', 'lazy-refcounts': False }
- human_compare = [ 'compat: 1.1', 'lazy refcounts: false' ]
+ json_compare = { 'compat': '1.1', 'lazy-refcounts': False, 'corrupt':
False }
+ human_compare = [ 'compat: 1.1', 'lazy refcounts: false', 'corrupt: false'
]
class TestQCow3Lazy(TestQemuImgInfo):
'''Testing a qcow2 version 3 image with lazy refcounts enabled'''
img_options = 'compat=1.1,lazy_refcounts=on'
- json_compare = { 'compat': '1.1', 'lazy-refcounts': True }
- human_compare = [ 'compat: 1.1', 'lazy refcounts: true' ]
+ json_compare = { 'compat': '1.1', 'lazy-refcounts': True, 'corrupt': False
}
+ human_compare = [ 'compat: 1.1', 'lazy refcounts: true', 'corrupt: false' ]
class TestQCow3NotLazyQMP(TestQMP):
'''Testing a qcow2 version 3 image with lazy refcounts disabled, opening
with lazy refcounts enabled'''
img_options = 'compat=1.1,lazy_refcounts=off'
qemu_options = 'lazy-refcounts=on'
- compare = { 'compat': '1.1', 'lazy-refcounts': False }
+ compare = { 'compat': '1.1', 'lazy-refcounts': False, 'corrupt': False }
class TestQCow3LazyQMP(TestQMP):
'''Testing a qcow2 version 3 image with lazy refcounts enabled, opening
with lazy refcounts disabled'''
img_options = 'compat=1.1,lazy_refcounts=on'
qemu_options = 'lazy-refcounts=off'
- compare = { 'compat': '1.1', 'lazy-refcounts': True }
+ compare = { 'compat': '1.1', 'lazy-refcounts': True, 'corrupt': False }
TestImageInfoSpecific = None
TestQemuImgInfo = None
diff --git a/tests/qemu-iotests/067.out b/tests/qemu-iotests/067.out
index 7e090b9..0f72dcf 100644
--- a/tests/qemu-iotests/067.out
+++ b/tests/qemu-iotests/067.out
@@ -6,7 +6,7 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk -device
virtio-blk-pci,drive=disk,id=virtio0
QMP_VERSION
{"return": {}}
-{"return": [{"io-status": "ok", "device": "disk", "locked": false,
"removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image":
{"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size":
65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type":
"qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag":
false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2",
"iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file":
"TEST_DIR/t.qcow2", "encryption_key_missing": false}, "type": "unknown"},
{"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true,
"tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false,
"removable": true, "tray_open": false, "type": "unknown"}, {"device": "sd0",
"locked": false, "removable": true, "tray_open": false, "type": "unknown"}]}
+{"return": [{"io-status": "ok", "device": "disk", "locked": false,
"removable": false, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image":
{"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size":
65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type":
"qcow2", "data": {"compat": "1.1", "lazy-refcounts": false, "corrupt": false}},
"dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0,
"drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd":
0, "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false}, "type":
"unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false,
"removable": true, "tray_open": false, "type": "unknown"}, {"device":
"floppy0", "locked": false, "removable": true, "tray_open": false, "type":
"unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open":
false, "type": "unknown"}]}
{"return": {}}
{"return": {}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event":
"DEVICE_DELETED", "data": {"path":
"/machine/peripheral/virtio0/virtio-backend"}}
@@ -24,7 +24,7 @@ QMP_VERSION
Testing: -drive file=TEST_DIR/t.qcow2,format=qcow2,if=none,id=disk
QMP_VERSION
{"return": {}}
-{"return": [{"device": "disk", "locked": false, "removable": true, "inserted":
{"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 134217728,
"filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2",
"actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat":
"1.1", "lazy-refcounts": false}}, "dirty-flag": false}, "iops_wr": 0, "ro":
false, "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0,
"encrypted": false, "bps": 0, "bps_rd": 0, "file": "TEST_DIR/t.qcow2",
"encryption_key_missing": false}, "tray_open": false, "type": "unknown"},
{"io-status": "ok", "device": "ide1-cd0", "locked": false, "removable": true,
"tray_open": false, "type": "unknown"}, {"device": "floppy0", "locked": false,
"removable": true, "tray_open": false, "type": "unknown"}, {"device": "sd0",
"locked": false, "removable": true, "tray_open": false, "type": "unknown"}]}
+{"return": [{"device": "disk", "locked": false, "removable": true, "inserted":
{"iops_rd": 0, "detect_zeroes": "off", "image": {"virtual-size": 134217728,
"filename": "TEST_DIR/t.qcow2", "cluster-size": 65536, "format": "qcow2",
"actual-size": SIZE, "format-specific": {"type": "qcow2", "data": {"compat":
"1.1", "lazy-refcounts": false, "corrupt": false}}, "dirty-flag": false},
"iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2", "iops": 0,
"bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file":
"TEST_DIR/t.qcow2", "encryption_key_missing": false}, "tray_open": false,
"type": "unknown"}, {"io-status": "ok", "device": "ide1-cd0", "locked": false,
"removable": true, "tray_open": false, "type": "unknown"}, {"device":
"floppy0", "locked": false, "removable": true, "tray_open": false, "type":
"unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open":
false, "type": "unknown"}]}
{"return": {}}
{"return": {}}
{"return": {}}
@@ -44,7 +44,7 @@ Testing:
QMP_VERSION
{"return": {}}
{"return": "OK\r\n"}
-{"return": [{"io-status": "ok", "device": "ide1-cd0", "locked": false,
"removable": true, "tray_open": false, "type": "unknown"}, {"device":
"floppy0", "locked": false, "removable": true, "tray_open": false, "type":
"unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open":
false, "type": "unknown"}, {"device": "disk", "locked": false, "removable":
true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image":
{"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size":
65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type":
"qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag":
false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2",
"iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file":
"TEST_DIR/t.qcow2", "encryption_key_missing": false}, "tray_open": false,
"type": "unknown"}]}
+{"return": [{"io-status": "ok", "device": "ide1-cd0", "locked": false,
"removable": true, "tray_open": false, "type": "unknown"}, {"device":
"floppy0", "locked": false, "removable": true, "tray_open": false, "type":
"unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open":
false, "type": "unknown"}, {"device": "disk", "locked": false, "removable":
true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image":
{"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size":
65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type":
"qcow2", "data": {"compat": "1.1", "lazy-refcounts": false, "corrupt": false}},
"dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0,
"drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd":
0, "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false}, "tray_open":
false, "type": "unknown"}]}
{"return": {}}
{"return": {}}
{"return": {}}
@@ -64,14 +64,14 @@ Testing:
QMP_VERSION
{"return": {}}
{"return": {}}
-{"return": [{"io-status": "ok", "device": "ide1-cd0", "locked": false,
"removable": true, "tray_open": false, "type": "unknown"}, {"device":
"floppy0", "locked": false, "removable": true, "tray_open": false, "type":
"unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open":
false, "type": "unknown"}, {"device": "disk", "locked": false, "removable":
true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image":
{"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size":
65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type":
"qcow2", "data": {"compat": "1.1", "lazy-refcounts": false}}, "dirty-flag":
false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0, "drv": "qcow2",
"iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd": 0, "file":
"TEST_DIR/t.qcow2", "encryption_key_missing": false}, "tray_open": false,
"type": "unknown"}]}
+{"return": [{"io-status": "ok", "device": "ide1-cd0", "locked": false,
"removable": true, "tray_open": false, "type": "unknown"}, {"device":
"floppy0", "locked": false, "removable": true, "tray_open": false, "type":
"unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open":
false, "type": "unknown"}, {"device": "disk", "locked": false, "removable":
true, "inserted": {"iops_rd": 0, "detect_zeroes": "off", "image":
{"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2", "cluster-size":
65536, "format": "qcow2", "actual-size": SIZE, "format-specific": {"type":
"qcow2", "data": {"compat": "1.1", "lazy-refcounts": false, "corrupt": false}},
"dirty-flag": false}, "iops_wr": 0, "ro": false, "backing_file_depth": 0,
"drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted": false, "bps": 0, "bps_rd":
0, "file": "TEST_DIR/t.qcow2", "encryption_key_missing": false}, "tray_open":
false, "type": "unknown"}]}
{"return": {}}
{"return": {}}
{"return": {}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event":
"DEVICE_DELETED", "data": {"path":
"/machine/peripheral/virtio0/virtio-backend"}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event":
"DEVICE_DELETED", "data": {"device": "virtio0", "path":
"/machine/peripheral/virtio0"}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event":
"RESET"}
-{"return": [{"io-status": "ok", "device": "ide1-cd0", "locked": false,
"removable": true, "tray_open": false, "type": "unknown"}, {"device":
"floppy0", "locked": false, "removable": true, "tray_open": false, "type":
"unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open":
false, "type": "unknown"}, {"io-status": "ok", "device": "disk", "locked":
false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off",
"image": {"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2",
"cluster-size": 65536, "format": "qcow2", "actual-size": SIZE,
"format-specific": {"type": "qcow2", "data": {"compat": "1.1",
"lazy-refcounts": false}}, "dirty-flag": false}, "iops_wr": 0, "ro": false,
"backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr": 0, "encrypted":
false, "bps": 0, "bps_rd": 0, "file": "TEST_DIR/t.qcow2",
"encryption_key_missing": false}, "tray_open": false, "type": "unknown"}]}
+{"return": [{"io-status": "ok", "device": "ide1-cd0", "locked": false,
"removable": true, "tray_open": false, "type": "unknown"}, {"device":
"floppy0", "locked": false, "removable": true, "tray_open": false, "type":
"unknown"}, {"device": "sd0", "locked": false, "removable": true, "tray_open":
false, "type": "unknown"}, {"io-status": "ok", "device": "disk", "locked":
false, "removable": true, "inserted": {"iops_rd": 0, "detect_zeroes": "off",
"image": {"virtual-size": 134217728, "filename": "TEST_DIR/t.qcow2",
"cluster-size": 65536, "format": "qcow2", "actual-size": SIZE,
"format-specific": {"type": "qcow2", "data": {"compat": "1.1",
"lazy-refcounts": false, "corrupt": false}}, "dirty-flag": false}, "iops_wr":
0, "ro": false, "backing_file_depth": 0, "drv": "qcow2", "iops": 0, "bps_wr":
0, "encrypted": false, "bps": 0, "bps_rd": 0, "file": "TEST_DIR/t.qcow2",
"encryption_key_missing": false}, "tray_open": false, "type": "unknown"}]}
{"return": {}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event":
"SHUTDOWN"}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event":
"DEVICE_TRAY_MOVED", "data": {"device": "ide1-cd0", "tray-open": true}}
diff --git a/tests/qemu-iotests/082.out b/tests/qemu-iotests/082.out
index 249c5e4..0a3ab5a 100644
--- a/tests/qemu-iotests/082.out
+++ b/tests/qemu-iotests/082.out
@@ -21,6 +21,7 @@ cluster_size: 4096
Format specific information:
compat: 1.1
lazy refcounts: true
+ corrupt: false
Testing: create -f qcow2 -o cluster_size=4k -o lazy_refcounts=on -o
cluster_size=8k TEST_DIR/t.qcow2 128M
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 encryption=off
cluster_size=8192 lazy_refcounts=on
@@ -34,6 +35,7 @@ cluster_size: 8192
Format specific information:
compat: 1.1
lazy refcounts: true
+ corrupt: false
Testing: create -f qcow2 -o cluster_size=4k,cluster_size=8k TEST_DIR/t.qcow2
128M
Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=134217728 encryption=off
cluster_size=8192 lazy_refcounts=off
@@ -197,6 +199,7 @@ cluster_size: 4096
Format specific information:
compat: 1.1
lazy refcounts: true
+ corrupt: false
Testing: convert -O qcow2 -o cluster_size=4k -o lazy_refcounts=on -o
cluster_size=8k TEST_DIR/t.qcow2 TEST_DIR/t.qcow2.base
@@ -209,6 +212,7 @@ cluster_size: 8192
Format specific information:
compat: 1.1
lazy refcounts: true
+ corrupt: false
Testing: convert -O qcow2 -o cluster_size=4k,cluster_size=8k TEST_DIR/t.qcow2
TEST_DIR/t.qcow2.base
image: TEST_DIR/t.IMGFMT.base
@@ -357,6 +361,7 @@ cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: true
+ corrupt: false
Testing: amend -f qcow2 -o size=130M -o lazy_refcounts=off TEST_DIR/t.qcow2
@@ -369,6 +374,7 @@ cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
+ corrupt: false
Testing: amend -f qcow2 -o size=8M -o lazy_refcounts=on -o size=132M
TEST_DIR/t.qcow2
@@ -381,6 +387,7 @@ cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: true
+ corrupt: false
Testing: amend -f qcow2 -o size=4M,size=148M TEST_DIR/t.qcow2
image: TEST_DIR/t.IMGFMT
diff --git a/tests/qemu-iotests/089.out b/tests/qemu-iotests/089.out
index 4ca2f88..b2b0390 100644
--- a/tests/qemu-iotests/089.out
+++ b/tests/qemu-iotests/089.out
@@ -41,10 +41,12 @@ vm state offset: 512 MiB
Format specific information:
compat: 1.1
lazy refcounts: false
+ corrupt: false
format name: IMGFMT
cluster size: 64 KiB
vm state offset: 512 MiB
Format specific information:
compat: 1.1
lazy refcounts: false
+ corrupt: false
*** done
--
1.9.3
- [Qemu-devel] [PULL 07/23] qemu-iotests: Fix supported cache modes for 052, (continued)
- [Qemu-devel] [PULL 07/23] qemu-iotests: Fix supported cache modes for 052, Stefan Hajnoczi, 2014/10/04
- [Qemu-devel] [PULL 08/23] blockdev: Orphaned drive search, Stefan Hajnoczi, 2014/10/04
- [Qemu-devel] [PULL 09/23] blockdev: Allow overriding if_max_dev property, Stefan Hajnoczi, 2014/10/04
- [Qemu-devel] [PULL 11/23] ide: Update ide_drive_get to be HBA agnostic, Stefan Hajnoczi, 2014/10/04
- [Qemu-devel] [PULL 12/23] qtest/bios-tables: Correct Q35 command line, Stefan Hajnoczi, 2014/10/04
- [Qemu-devel] [PULL 10/23] pc/vl: Add units-per-default-bus property, Stefan Hajnoczi, 2014/10/04
- [Qemu-devel] [PULL 13/23] q35/ahci: Pick up -cdrom and -hda options, Stefan Hajnoczi, 2014/10/04
- [Qemu-devel] [PULL 14/23] util: Emancipate id_wellformed() from QemuOpts, Stefan Hajnoczi, 2014/10/04
- [Qemu-devel] [PULL 15/23] iotests: Use _img_info, Stefan Hajnoczi, 2014/10/04
- [Qemu-devel] [PULL 17/23] iotests: qemu-img info output for corrupt image, Stefan Hajnoczi, 2014/10/04
- [Qemu-devel] [PULL 16/23] qapi: Add corrupt field to ImageInfoSpecificQCow2,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 18/23] drive_del-test: Merge of qdev-monitor-test, blockdev-test, Stefan Hajnoczi, 2014/10/04
- [Qemu-devel] [PULL 19/23] blockdev-test: Use single rather than double quotes in QMP, Stefan Hajnoczi, 2014/10/04
- [Qemu-devel] [PULL 20/23] blockdev-test: Clean up bogus drive_add argument, Stefan Hajnoczi, 2014/10/04
- [Qemu-devel] [PULL 21/23] blockdev-test: Simplify by using g_assert_cmpstr(), Stefan Hajnoczi, 2014/10/04
- [Qemu-devel] [PULL 22/23] blockdev-test: Factor out some common code into helpers, Stefan Hajnoczi, 2014/10/04
- [Qemu-devel] [PULL 23/23] blockdev-test: Test device_del after drive_del, Stefan Hajnoczi, 2014/10/04
- Re: [Qemu-devel] [PULL 00/23] Block patches, Peter Maydell, 2014/10/06