vmdk: fix cluster size check for flat extents
PATCH v2 1/1 vmdk: fix cluster size check for flat extents
We use the extent size as cluster size for flat extents (where no L1/L2 table is allocated so it's safe) reuse sector calculating code with sparse extents.
Don't pass in the cluster size for adding flat extent, just set it to sectors later, then the cluster size checking will not fail.
The cluster_sectors is changed to int64_t to allow big flat extent.
Without this, flat extent opening is broken:
# qemu-img create -f vmdk -o subformat=monolithicFlat /tmp/a.vmdk 100G
Formatting '/tmp/a.vmdk', fmt=vmdk size=107374182400 compat6=off subformat='monolithicFlat' zeroed_grain=off
# qemu-img info /tmp/a.vmdk
image: /tmp/a.vmdk
file format: raw
virtual size: 0 (0 bytes)
disk size: 4.0K--- block/vmdk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
block/vmdk.c +3 -3
@@ -105,7 +105,7 @@ typedef struct VmdkExtent {uint32_t l2_cache_offsets[L2_CACHE_SIZE ];uint32_t l2_cache_counts[L2_CACHE_SIZE ]; -unsigned int cluster_sectors; +int64_t cluster_sectors; } VmdkExtent; typedef struct BDRVVmdkState {
@@ -424,7 +424,7 @@ static int vmdk_add_extent(BlockDriverState *bs, extent->l1_size = l1_size; extent->l1_entry_sectors = l2_size * cluster_sectors; extent->l2_size = l2_size; - extent->cluster_sectors = cluster_sectors; + extent->cluster_sectors = flat ? sectors : cluster_sectors;if (s->num_extents >1 ) { extent->end_sector = (*(extent -1 )).end_sector + extent->sectors;
@@ -741,7 +741,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,VmdkExtent *extent; ret =vmdk_add_extent (bs, extent_file, true, sectors, -0 ,0 ,0 ,0 , sectors, &extent); +0 ,0 ,0 ,0 ,0 , &extent);if (ret <0 ) {return ret; }
Signature · 1 line
1.8.3.1
Quoted 19 lines · Fam Zheng
We use the extent size as cluster size for flat extents (where no L1/L2 table is allocated so it's safe) reuse sector calculating code with sparse extents.
Don't pass in the cluster size for adding flat extent, just set it to sectors later, then the cluster size checking will not fail.
The
cluster_sectorsis changed toint64_tto allow big flat extent.Without this, flat extent opening is broken:
# qemu-img create -f vmdk -o subformat=monolithicFlat /tmp/a.vmdk 100G Formatting '/tmp/a.vmdk', fmt=vmdk size=107374182400 compat6=off subformat='monolithicFlat' zeroed_grain=off # qemu-img info /tmp/a.vmdk image: /tmp/a.vmdk file format: raw virtual size: 0 (0 bytes) disk size: 4.0K
Quoted 2 lines
Signed-off-by Fam Zheng <[email protected]>---
When adding a test case, iotests case 059 seems broken now, it will perhaps take some time to check and I'll post a fix together with test case for this later.
Fam
cover Fix and add test into 059.
In reply to Fam ZhengThe first fixes 059 to follow latest error message change in block layer.
The second adds a test for monolithiFlat vmdk.
Fam Zheng (2):
qemu-iotests: fix test case 059
qemu-iotests: add monolithicFlat creation test to 059
tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/2 qemu-iotests: fix test case 059
Since commit "block: Error parameter for open functions", error output is more verbose. Update test case output file to follow the change.
--- tests/qemu-iotests/059.out | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tests/qemu-iotests/059.out +6 -6
@@ -1,20 +1,20 @@ QA output created by 059 === Testing invalid granularity === -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 invalid granularity, image may be corrupt -qemu-io: can't open device TEST_DIR/t.vmdk +qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' === Testing too big L2 table size === -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 L2 table size too big -qemu-io: can't open device TEST_DIR/t.vmdk +qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' === Testing too big L1 table size === -Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 L1 size too big -qemu-io: can't open device TEST_DIR/t.vmdk +qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' *** done
Signature · 1 line
1.8.3.1
PATCH 2/2 qemu-iotests: add monolithicFlat creation test to 059
--- tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 7 +++++++ 2 files changed, 12 insertions(+)
tests/qemu-iotests/059 +5 -0
@@ -66,6 +66,11 @@ poke_file "$TEST_IMG" "$capacity_offset" "\xff\xff\xff\xff" poke_file "$TEST_IMG" "$grain_table_size_offset" "\x01\x00\x00\x00" { $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir +echo "=== Testing monolithicFlat creation and opening ===" +echo +IMGOPTS="subformat=monolithicFlat" _make_test_img 64M +$QEMU_IMG info $TEST_IMG + # success, all done echo "*** done" rm -f $seq.full
tests/qemu-iotests/059.out +7 -0
@@ -17,4 +17,11 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 L1 size too big qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' +=== Testing monolithicFlat creation and opening === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 +image: /home/fam/qemu/tests/qemu-iotests/scratch/t.vmdk +file format: vmdk +virtual size: 64M (67108864 bytes) +disk size: 4.0K *** done
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 1/2] qemu-iotests: fix test case 059
In reply to Fam ZhengQuoted 2 lines · Fam Zheng
Since commit "block: Error parameter for open functions", error output is more verbose. Update test case output file to follow the change.
This doesn't explain the "Formatting ..." trailing space change.
If this has changed, please split the change into a separate patch, with an explanation of when the space was introduced, and fix the other test case output files:
$ git grep '^Formatting' | grep '[^ ]$' 017.out:Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=6442450944 018.out:Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=6442450944 048.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 059.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 059.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 059.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 063.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4194304 063.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2097152
Re: [Qemu-devel] [PATCH 1/2] qemu-iotests: fix test case 059
Quoted 10 lines · Stefan Hajnoczi
Quoted 2 lines · Fam Zheng
Since commit "block: Error parameter for open functions", error output is more verbose. Update test case output file to follow the change.
This doesn't explain the "Formatting ..." trailing space change.
If this has changed, please split the change into a separate patch, with an explanation of when the space was introduced, and fix the other test case output files:
Quoted 9 lines
$ git grep '^Formatting' | grep '[^ ]$' 017.out:Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=6442450944 018.out:Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=6442450944 048.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 059.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 059.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 059.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 063.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4194304 063.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2097152
Not sure how it's introduced, it is actually ignored when comparing because we have "-w" for diff command. I'll drop the spaces here and send another revision, I'd like focus this series for fixing vmdk and leave the space clean up for another series (if necessary).
Fam
Re: [Qemu-devel] [PATCH 1/2] qemu-iotests: fix test case 059
Quoted 21 lines · Fam Zheng
Quoted 10 lines · Stefan Hajnoczi
Quoted 2 lines · Fam Zheng
Since commit "block: Error parameter for open functions", error output is more verbose. Update test case output file to follow the change.
This doesn't explain the "Formatting ..." trailing space change.
If this has changed, please split the change into a separate patch, with an explanation of when the space was introduced, and fix the other test case output files:
Quoted 9 lines
$ git grep '^Formatting' | grep '[^ ]$' 017.out:Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=6442450944 018.out:Formatting 'TEST_DIR/t.IMGFMT.base', fmt=IMGFMT size=6442450944 048.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824 059.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 059.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 059.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 063.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4194304 063.out:Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2097152
Quoted 4 lines
Not sure how it's introduced, it is actually ignored when comparing because we have "-w" for diff command. I'll drop the spaces here and send another revision, I'd like focus this series for fixing vmdk and leave the space clean up for another series (if necessary).
Good idea. Given the diff -w option I don't see a need to change the whitespace.
Stefan
v2 cover Fix and add test into 059.
In reply to Fam ZhengThe first fixes 059 to follow latest error message change in block layer.
The second adds a test for monolithiFlat vmdk.
v2: Drop space changes
Fam Zheng (2):
qemu-iotests: fix test case 059
qemu-iotests: add monolithicFlat creation test to 059
tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v2 1/2 qemu-iotests: fix test case 059
Since commit "block: Error parameter for open functions", error output is more verbose. Update test case output file to follow the change.
--- tests/qemu-iotests/059.out | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tests/qemu-iotests/059.out +3 -3
@@ -3,18 +3,18 @@ QA output created by 059 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 invalid granularity, image may be corrupt -qemu-io: can't open device TEST_DIR/t.vmdk +qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' === Testing too big L2 table size === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 L2 table size too big -qemu-io: can't open device TEST_DIR/t.vmdk +qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' === Testing too big L1 table size === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 L1 size too big -qemu-io: can't open device TEST_DIR/t.vmdk +qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' *** done
Signature · 1 line
1.8.3.1
PATCH v2 2/2 qemu-iotests: add monolithicFlat creation test to 059
In reply to Fam Zheng--- tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 7 +++++++ 2 files changed, 12 insertions(+)
tests/qemu-iotests/059 +5 -0
@@ -66,6 +66,11 @@ poke_file "$TEST_IMG" "$capacity_offset" "\xff\xff\xff\xff" poke_file "$TEST_IMG" "$grain_table_size_offset" "\x01\x00\x00\x00" { $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir +echo "=== Testing monolithicFlat creation and opening ===" +echo +IMGOPTS="subformat=monolithicFlat" _make_test_img 64M +$QEMU_IMG info $TEST_IMG + # success, all done echo "*** done" rm -f $seq.full
tests/qemu-iotests/059.out +7 -0
@@ -17,4 +17,11 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 L1 size too big qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' +=== Testing monolithicFlat creation and opening === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 +image: /home/fam/qemu/tests/qemu-iotests/scratch/t.vmdk +file format: vmdk +virtual size: 64M (67108864 bytes) +disk size: 4.0K *** done
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH v2 2/2] qemu-iotests: add monolithicFlat creation test to 059
Am 25.09.2013 um 03:14 hat Fam Zheng geschrieben:
Quoted 27 lines
Signed-off-by Fam Zheng <[email protected]>--- tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 7 +++++++ 2 files changed, 12 insertions(+)tests/qemu-iotests/059 +5
-0@@ -66,6 +66,11 @@ poke_file "$TEST_IMG" "$capacity_offset" "\xff\xff\xff\xff" poke_file "$TEST_IMG" "$grain_table_size_offset" "\x01\x00\x00\x00" { $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir +echo "=== Testing monolithicFlat creation and opening ===" +echo +IMGOPTS="subformat=monolithicFlat" _make_test_img 64M +$QEMU_IMG info $TEST_IMG + # success, all done echo "*** done" rm -f $seq.fulltests/qemu-iotests/059.out +0
-0
tests/qemu-iotests/059.out Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 · line 23
Quoted 7 lines
tests/qemu-iotests/059.out +4
-0@@ -17,4 +17,11 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 L1 size too big qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' +=== Testing monolithicFlat creation and opening === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 +image: /home/fam/qemu/tests/qemu-iotests/scratch/t.vmdk
You want to _filter_testdir the output. :-)
tests/qemu-iotests/059.out Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 · line 27
Quoted 4 lines
tests/qemu-iotests/059.out +3
-0+file format: vmdk +virtual size: 64M (67108864 bytes) +disk size: 4.0K *** done
Kevin
Re: [Qemu-devel] [PATCH v2 2/2] qemu-iotests: add monolithicFlat creation test to 059
Quoted 29 lines · Kevin Wolf
Am 25.09.2013 um 03:14 hat Fam Zheng geschrieben:
Quoted 28 lines
Signed-off-by Fam Zheng <[email protected]>--- tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 7 +++++++ 2 files changed, 12 insertions(+)tests/qemu-iotests/059 +5
-0@@ -66,6 +66,11 @@ poke_file "$TEST_IMG" "$capacity_offset" "\xff\xff\xff\xff" poke_file "$TEST_IMG" "$grain_table_size_offset" "\x01\x00\x00\x00" { $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir +echo "=== Testing monolithicFlat creation and opening ===" +echo +IMGOPTS="subformat=monolithicFlat" _make_test_img 64M +$QEMU_IMG info $TEST_IMG + # success, all done echo "*** done" rm -f $seq.fulltests/qemu-iotests/059.out +0
-0@@ -17,4 +17,11 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 L1 size too big
Quoted 9 lines
tests/qemu-iotests/059.out Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 · line 23
Quoted 6 lines
tests/qemu-iotests/059.out +4
-0qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' +=== Testing monolithicFlat creation and opening === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 +image: /home/fam/qemu/tests/qemu-iotests/scratch/t.vmdkYou want to
_filter_testdirthe output. :-)
Oops! Otherwise only _fam_ can pass the test!
Fam
v3 cover Fix and add test into 059.
In reply to Fam ZhengThe first fixes 059 to follow latest error message change in block layer.
The second adds a test for monolithiFlat vmdk.
v3: filter test dir in script and output file.
v2: Drop space changes
Fam Zheng (2):
qemu-iotests: fix test case 059
qemu-iotests: add monolithicFlat creation test to 059
tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v3 1/2 qemu-iotests: fix test case 059
Since commit "block: Error parameter for open functions", error output is more verbose. Update test case output file to follow the change.
--- tests/qemu-iotests/059.out | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tests/qemu-iotests/059.out +3 -3
@@ -3,18 +3,18 @@ QA output created by 059 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 invalid granularity, image may be corrupt -qemu-io: can't open device TEST_DIR/t.vmdk +qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' === Testing too big L2 table size === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 L2 table size too big -qemu-io: can't open device TEST_DIR/t.vmdk +qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' === Testing too big L1 table size === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 L1 size too big -qemu-io: can't open device TEST_DIR/t.vmdk +qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' *** done
Signature · 1 line
1.8.3.1
PATCH v3 2/2 qemu-iotests: add monolithicFlat creation test to 059
In reply to Fam Zheng--- tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 7 +++++++ 2 files changed, 12 insertions(+)
tests/qemu-iotests/059 +5 -0
@@ -66,6 +66,11 @@ poke_file "$TEST_IMG" "$capacity_offset" "\xff\xff\xff\xff" poke_file "$TEST_IMG" "$grain_table_size_offset" "\x01\x00\x00\x00" { $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir +echo "=== Testing monolithicFlat creation and opening ===" +echo +IMGOPTS="subformat=monolithicFlat" _make_test_img 64M +$QEMU_IMG info $TEST_IMG | _filter_testdir + # success, all done echo "*** done" rm -f $seq.full
tests/qemu-iotests/059.out +7 -0
@@ -17,4 +17,11 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 L1 size too big qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' +=== Testing monolithicFlat creation and opening === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 +image: TEST_DIR/t.vmdk +file format: vmdk +virtual size: 64M (67108864 bytes) +disk size: 4.0K *** done
Signature · 1 line
1.8.3.1
v4 cover Fix and add test into 059.
In reply to Fam ZhengThe first fixes 059 to follow latest error message change in block layer.
The second adds a test for monolithiFlat vmdk.
v4: Bigger image size to catch the cluster size checking issue.
v3: filter test dir in script and output file.
v2: Drop space changes
Fam Zheng (2):
qemu-iotests: fix test case 059
qemu-iotests: add monolithicFlat creation test to 059
tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.3.1
PATCH v4 1/2 qemu-iotests: fix test case 059
Since commit "block: Error parameter for open functions", error output is more verbose. Update test case output file to follow the change.
--- tests/qemu-iotests/059.out | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tests/qemu-iotests/059.out +3 -3
@@ -3,18 +3,18 @@ QA output created by 059 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 invalid granularity, image may be corrupt -qemu-io: can't open device TEST_DIR/t.vmdk +qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' === Testing too big L2 table size === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 L2 table size too big -qemu-io: can't open device TEST_DIR/t.vmdk +qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' === Testing too big L1 table size === Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 L1 size too big -qemu-io: can't open device TEST_DIR/t.vmdk +qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' *** done
Signature · 1 line
1.8.3.1
PATCH v4 2/2 qemu-iotests: add monolithicFlat creation test to 059
In reply to Fam Zheng--- tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 7 +++++++ 2 files changed, 12 insertions(+)
tests/qemu-iotests/059 +5 -0
@@ -66,6 +66,11 @@ poke_file "$TEST_IMG" "$capacity_offset" "\xff\xff\xff\xff" poke_file "$TEST_IMG" "$grain_table_size_offset" "\x01\x00\x00\x00" { $QEMU_IO -c "read 0 512" $TEST_IMG; } 2>&1 | _filter_qemu_io | _filter_testdir +echo "=== Testing monolithicFlat creation and opening ===" +echo +IMGOPTS="subformat=monolithicFlat" _make_test_img 2G +$QEMU_IMG info $TEST_IMG | _filter_testdir + # success, all done echo "*** done" rm -f $seq.full
tests/qemu-iotests/059.out +7 -0
@@ -17,4 +17,11 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864 L1 size too big qemu-io: can't open device TEST_DIR/t.vmdk: Could not open 'TEST_DIR/t.vmdk': Wrong medium type no file open, try 'help open' +=== Testing monolithicFlat creation and opening === + +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2147483648 +image: TEST_DIR/t.vmdk +file format: vmdk +virtual size: 2.0G (2147483648 bytes) +disk size: 4.0K *** done
Signature · 1 line
1.8.3.1
Kevin Wolf
AppliedRe: [Qemu-devel] [PATCH v4 0/2] Fix and add test into 059.
In reply to Fam ZhengAm 25.09.2013 um 11:45 hat Fam Zheng geschrieben:
Quoted 9 lines
The first fixes 059 to follow latest error message change in block layer.
The second adds a test for monolithiFlat vmdk.
v4: Bigger image size to catch the cluster size checking issue.
v3: filter test dir in script and output file.
v2: Drop space changes
Quoted 7 lines
Fam Zheng (2):
qemu-iotests: fix test case 059
qemu-iotests: add monolithicFlat creation test to 059tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
Thanks applied the vmdk patch and this series to the block branch.
Kevin
v2 cover Fix and add test into 059.
In reply to Fam ZhengThe first fixes 059 to follow latest error message change in block layer.
The second adds a test for monolithiFlat vmdk.
Fam Zheng (2):
qemu-iotests: fix test case 059
qemu-iotests: add monolithicFlat creation test to 059
tests/qemu-iotests/059 | 5 +++++ tests/qemu-iotests/059.out | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-)
Signature · 1 line
1.8.3.1
Quoted 6 lines · Fam Zheng
We use the extent size as cluster size for flat extents (where no L1/L2 table is allocated so it's safe) reuse sector calculating code with sparse extents.
Don't pass in the cluster size for adding flat extent, just set it to sectors later, then the cluster size checking will not fail.
This is a little hacky, the next person that modifies vmdk may not be aware of this trick. I would avoid using ->cluster_sectors at all with flat extents. But I didn't investigate how feasible that approach is...
Quoted 59 lines · Fam Zheng
We use the extent size as cluster size for flat extents (where no L1/L2 table is allocated so it's safe) reuse sector calculating code with sparse extents.
Don't pass in the cluster size for adding flat extent, just set it to sectors later, then the cluster size checking will not fail.
The
cluster_sectorsis changed toint64_tto allow big flat extent.Without this, flat extent opening is broken:
# qemu-img create -f vmdk -o subformat=monolithicFlat /tmp/a.vmdk 100G Formatting '/tmp/a.vmdk', fmt=vmdk size=107374182400 compat6=off subformat='monolithicFlat' zeroed_grain=off # qemu-img info /tmp/a.vmdk image: /tmp/a.vmdk file format: raw virtual size: 0 (0 bytes) disk size: 4.0KSigned-off-by Fam Zheng <[email protected]>--- block/vmdk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)block/vmdk.c +3
-3@@ -105,7 +105,7 @@ typedef struct VmdkExtent {uint32_t l2_cache_offsets[L2_CACHE_SIZE ];uint32_t l2_cache_counts[L2_CACHE_SIZE ]; -unsigned int cluster_sectors; +int64_t cluster_sectors; } VmdkExtent; typedef struct BDRVVmdkState {@@ -424,7 +424,7 @@ static int vmdk_add_extent(BlockDriverState *bs, extent->l1_size = l1_size; extent->l1_entry_sectors = l2_size * cluster_sectors; extent->l2_size = l2_size; - extent->cluster_sectors = cluster_sectors; + extent->cluster_sectors = flat ? sectors : cluster_sectors;if (s->num_extents >1 ) { extent->end_sector = (*(extent -1 )).end_sector + extent->sectors;@@ -741,7 +741,7 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs,VmdkExtent *extent; ret =vmdk_add_extent (bs, extent_file, true, sectors, -0 ,0 ,0 ,0 , sectors, &extent); +0 ,0 ,0 ,0 ,0 , &extent);if (ret <0 ) {return ret; }Signature · 1 line
1.8.3.1
CC'ing qemu-stable as this applies to 1.6 as well.
Fam