From: Max Reitz <mreitz@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: qemu-devel@nongnu.org, Kevin Wolf <kwolf@redhat.com>,
Jeff Cody <jcody@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Eric Blake <eblake@redhat.com>, John Snow <jsnow@redhat.com>,
qemu-block@nongnu.org, berrange@redhat.com, pbonzini@redhat.com,
den@openvz.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v5 24/27] iotests: Disable image locking in 085
Date: Fri, 3 Jun 2016 16:41:25 +0200 [thread overview]
Message-ID: <46961ea9-7269-720f-ff04-aab7265d329e@redhat.com> (raw)
In-Reply-To: <20160603071854.GM29298@ad.usersys.redhat.com>
[-- Attachment #1: Type: text/plain, Size: 4515 bytes --]
On 03.06.2016 09:18, Fam Zheng wrote:
> On Wed, 05/25 15:52, Max Reitz wrote:
>> On 17.05.2016 09:35, Fam Zheng wrote:
>>> The cases is about live snapshot features. Disable image locking because
>>> otherwise a few tests are going to fail because we reuse the same images
>>> at blockdev-add.
>>>
>>> Signed-off-by: Fam Zheng <famz@redhat.com>
>>> ---
>>> tests/qemu-iotests/085 | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tests/qemu-iotests/085 b/tests/qemu-iotests/085
>>> index aa77eca..48f6684 100755
>>> --- a/tests/qemu-iotests/085
>>> +++ b/tests/qemu-iotests/085
>>> @@ -102,6 +102,7 @@ function add_snapshot_image()
>>> cmd="{ 'execute': 'blockdev-add', 'arguments':
>>> { 'options':
>>> { 'driver': 'qcow2', 'node-name': 'snap_${1}', ${extra_params}
>>> + 'lock-mode': 'off',
>>> 'file':
>>> { 'driver': 'file', 'filename': '${snapshot_file}',
>>> 'node-name': 'file_${1}' } } } }"
>>> @@ -130,7 +131,7 @@ echo === Running QEMU ===
>>> echo
>>>
>>> qemu_comm_method="qmp"
>>> -_launch_qemu -drive file="${TEST_IMG}.1",if=virtio -drive file="${TEST_IMG}.2",if=virtio
>>> +_launch_qemu -drive file="${TEST_IMG}.1",if=virtio,lock-mode=off -drive file="${TEST_IMG}.2",if=virtio,lock-mode=off
>>> h=$QEMU_HANDLE
>>>
>>> echo
>>>
>>
>> So as far as I understand it, add_snapshot_image() is supposed to add
>> images from the backing chain to the running VM. The top image is never
>> used by add_snapshot_image(), thus the lock-mode=off in the QEMU command
>> line seems superfluous.
>
> But down the backing chain is 10-snapshot-v0.qcow2, created in
> create_single_snapshot (or create_group_snapshot?). Without lock-mode=off in
> the command line, the shared lock cannot work.
My reasoning was wrong, but still it works for me if the lock-mode is
omitted everywhere but the blockdev-add operation specifies
"'read-only': true".
OK, so let's try again.
<what_the_read_only_does_and_where_to_put_it>
<explanation_what_happens>
The files specified on the command line will later be snapshotted; the
snapshot operation will reopen them read-only, therefore, they will have
a shared lock then.
Only after those snapshots have occurred will we blockdev-add new files.
If we do not force them to be opened read-only, the "Invalid command -
snapshot node has a backing image" test will fail. This is because of
the following (I believe):
This test is the only one that adds a new snapshot image with its
backing chain (of which some images have already been opened by qemu).
Of course, the whole backing chain is opened read-only, therefore this
is only an issue if some image of that chain has been opened read/write
by qemu before.
Now, blockdev-snapshot-sync will keep the flags of the old BDS for the
new snapshot BDS. Therefore, if we made the original drive read-only,
all snapshots created with that command would remain read-only and no
locking issue would occur.
However, we are sometimes using blockdev-snapshot, and that command of
course will not change the flags the existing overlay node has been
created with. If we are therefore not making these nodes read-only, the
images opened for virtio0 and virtio1 will not be read-only at the time
of the "Invalid command - snapshot node has a backing image" test.
</explanation_what_happens>
If we specify "'read-only': true" in the blockdev-add command, they will
be read-only, on the other hand. Then, the locking will not interfere.
For the sake of clarity, I would then however propose specifying
read-only on the command line, too, so it is clear that we are trying to
keep the drives read-only the entire time.
</what_the_read_only_does_and_where_to_put_it>
But this is a bit complicated, and rather complicated to understand,
too. The issue we really have is that that one test tries to open a
snapshot with its backing chain while parts of the backing chain are
still opened by qemu. Therefore, alternatively, we can just switch off
locking in that single case. This can be accomplished by replacing
extra_params=""
by
extra_params="'lock-mode': 'off', "
in add_snapshot_image (second line in that function's body). That works
for me.
Also, I guess I made us waste too much time on this already... If this
doesn't work for you, I'm fine with the original patch as it was.
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-06-03 14:41 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-17 7:35 [Qemu-devel] [PATCH v5 00/27] block: Lock images when opening Fam Zheng
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 01/27] block: Add flag bits for image locking Fam Zheng
2016-05-24 12:14 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 02/27] qapi: Add lock-mode in blockdev-add options Fam Zheng
2016-05-24 12:15 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 03/27] blockdev: Add and parse "lock-mode" option for image locking Fam Zheng
2016-05-24 12:17 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 04/27] block: Introduce image file locking Fam Zheng
2016-05-24 16:01 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 05/27] block: Add bdrv_image_locked Fam Zheng
2016-05-24 16:04 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 06/27] block: Make bdrv_reopen_{commit, abort} private functions Fam Zheng
2016-05-24 16:09 ` Max Reitz
2016-05-27 7:42 ` Fam Zheng
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 07/27] block: Handle image locking during reopen Fam Zheng
2016-05-24 16:28 ` Max Reitz
2016-05-27 7:48 ` Fam Zheng
2016-05-27 9:57 ` Max Reitz
2016-05-27 12:36 ` Fam Zheng
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 08/27] osdep: Add qemu_lock_fd and qemu_unlock_fd Fam Zheng
2016-05-24 16:42 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 09/27] osdep: Introduce qemu_dup Fam Zheng
2016-05-24 16:52 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 10/27] raw-posix: Use qemu_dup Fam Zheng
2016-05-24 16:55 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 11/27] raw-posix: Implement .bdrv_lockf Fam Zheng
2016-05-24 17:09 ` Max Reitz
2016-05-27 7:50 ` Fam Zheng
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 12/27] gluster: " Fam Zheng
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 13/27] qemu-io: Add "-L" option for BDRV_O_NO_LOCK Fam Zheng
2016-05-24 17:21 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 14/27] qemu-img: Add "-L" option to sub commands Fam Zheng
2016-05-24 18:06 ` Max Reitz
2016-06-01 5:34 ` Fam Zheng
2016-06-02 11:30 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 15/27] qemu-img: Update documentation of "-L" option Fam Zheng
2016-05-24 18:09 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 16/27] qemu-nbd: Add "--no-lock/-L" option Fam Zheng
2016-05-24 18:12 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 17/27] block: Don't lock drive-backup target image in none mode Fam Zheng
2016-05-24 18:16 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 18/27] mirror: Disable image locking on target backing chain Fam Zheng
2016-05-24 18:20 ` Max Reitz
2016-06-03 6:32 ` Fam Zheng
2016-06-03 13:24 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 19/27] qemu-iotests: 140: Disable image lock for qemu-io access Fam Zheng
2016-05-25 13:16 ` Max Reitz
2016-06-03 6:34 ` Fam Zheng
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 20/27] qemu-iotests: 046: Move version detection out from verify_io Fam Zheng
2016-05-25 13:23 ` Max Reitz
2016-06-03 6:43 ` Fam Zheng
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 21/27] qemu-iotests: Wait for QEMU processes before checking image in 091 Fam Zheng
2016-05-25 13:28 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 22/27] qemu-iotests: 030: Disable image lock when checking test image Fam Zheng
2016-05-25 13:30 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 23/27] iotests: 087: Disable image lock in cases where file is shared Fam Zheng
2016-05-25 13:41 ` Max Reitz
2016-05-25 13:41 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 24/27] iotests: Disable image locking in 085 Fam Zheng
2016-05-25 13:52 ` Max Reitz
2016-06-03 7:18 ` Fam Zheng
2016-06-03 14:41 ` Max Reitz [this message]
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 25/27] tests: Use null-co:// instead of /dev/null Fam Zheng
2016-05-25 13:57 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 26/27] block: Turn on image locking by default Fam Zheng
2016-05-25 13:57 ` Max Reitz
2016-05-17 7:35 ` [Qemu-devel] [PATCH v5 27/27] qemu-iotests: Add test case 153 for image locking Fam Zheng
2016-05-25 14:20 ` Max Reitz
2016-05-24 11:48 ` [Qemu-devel] [PATCH v5 00/27] block: Lock images when opening Richard W.M. Jones
2016-05-24 12:46 ` Kevin Wolf
2016-05-24 12:58 ` Richard W.M. Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46961ea9-7269-720f-ff04-aab7265d329e@redhat.com \
--to=mreitz@redhat.com \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=den@openvz.org \
--cc=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=jcody@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).