qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 86b1cf: block: Separate blk_is_writable() and


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] 86b1cf: block: Separate blk_is_writable() and blk_supports...
Date: Thu, 28 Jan 2021 04:36:09 -0800

  Branch: refs/heads/staging
  Home:   https://github.com/qemu/qemu
  Commit: 86b1cf322789b79c8ace977430ac6a443d491cc0
      
https://github.com/qemu/qemu/commit/86b1cf322789b79c8ace977430ac6a443d491cc0
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-01-27 (Wed, 27 Jan 2021)

  Changed paths:
    M block/block-backend.c
    M hw/block/dataplane/xen-block.c
    M hw/block/fdc.c
    M hw/block/m25p80.c
    M hw/block/nand.c
    M hw/block/nvme-ns.c
    M hw/block/onenand.c
    M hw/block/pflash_cfi01.c
    M hw/block/pflash_cfi02.c
    M hw/block/swim.c
    M hw/block/virtio-blk.c
    M hw/block/xen-block.c
    M hw/ide/core.c
    M hw/misc/sifive_u_otp.c
    M hw/ppc/pnv_pnor.c
    M hw/scsi/scsi-disk.c
    M hw/scsi/scsi-generic.c
    M hw/sd/sd.c
    M hw/usb/dev-storage.c
    M include/sysemu/block-backend.h

  Log Message:
  -----------
  block: Separate blk_is_writable() and blk_supports_write_perm()

Currently, blk_is_read_only() tells whether a given BlockBackend can
only be used in read-only mode because its root node is read-only. Some
callers actually try to answer a slightly different question: Is the
BlockBackend configured to be writable, by taking write permissions on
the root node?

This can differ, for example, for CD-ROM devices which don't take write
permissions, but may be backed by a writable image file. scsi-cd allows
write requests to the drive if blk_is_read_only() returns false.
However, the write request will immediately run into an assertion
failure because the write permission is missing.

This patch introduces separate functions for both questions.
blk_supports_write_perm() answers the question whether the block
node/image file can support writable devices, whereas blk_is_writable()
tells whether the BlockBackend is currently configured to be writable.

All calls of blk_is_read_only() are converted to one of the two new
functions.

Fixes: https://bugs.launchpad.net/bugs/1906693
Cc: qemu-stable@nongnu.org
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210118123448.307825-2-kwolf@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 720d10d67b26be75132131577cd2c760a320e527
      
https://github.com/qemu/qemu/commit/720d10d67b26be75132131577cd2c760a320e527
  Author: Kevin Wolf <kwolf@redhat.com>
  Date:   2021-01-27 (Wed, 27 Jan 2021)

  Changed paths:
    M tests/qtest/virtio-scsi-test.c

  Log Message:
  -----------
  virtio-scsi-test: Test writing to scsi-cd device

This tests that trying to write to a (read-only) scsi-cd device backed
by a read-write image file doesn't crash and results in the correct
error.

This is a regression test for https://bugs.launchpad.net/bugs/1906693.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210118123448.307825-3-kwolf@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 362ef77f9b01878baeaa9030e467751c9c55debb
      
https://github.com/qemu/qemu/commit/362ef77f9b01878baeaa9030e467751c9c55debb
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-01-27 (Wed, 27 Jan 2021)

  Changed paths:
    M tests/qemu-iotests/146.out

  Log Message:
  -----------
  iotests: 146: drop extra whitespaces from .out file

check script will be stricter soon about whitespaces, so fix 146.out
now.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210125185056.129513-2-vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: b25a948875c5dd587b91e7fa0bfe0c3556488e7c
      
https://github.com/qemu/qemu/commit/b25a948875c5dd587b91e7fa0bfe0c3556488e7c
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-01-27 (Wed, 27 Jan 2021)

  Changed paths:
    M docs/devel/testing.rst
    A tests/qemu-iotests/findtests.py

  Log Message:
  -----------
  iotests: add findtests.py

Add python script with new logic of searching for tests:

Current ./check behavior:
 - tests are named [0-9][0-9][0-9]
 - tests must be registered in group file (even if test doesn't belong
   to any group, like 142)

Behavior of findtests.py:
 - group file is dropped
 - tests are all files in tests/ subdirectory (except for .out files),
   so it's not needed more to "register the test", just create it with
   appropriate name in tests/ subdirectory. Old names like
   [0-9][0-9][0-9] (in root iotests directory) are supported too, but
   not recommended for new tests
 - groups are parsed from '# group: ' line inside test files
 - optional file group.local may be used to define some additional
   groups for downstreams
 - 'disabled' group is used to temporary disable tests. So instead of
   commenting tests in old 'group' file you now can add them to
   disabled group with help of 'group.local' file
 - selecting test ranges like 5-15 are not supported more
   (to support restarting failed ./check command from the middle of the
    process, new argument is added: --start-from)

Benefits:
 - no rebase conflicts in group file on patch porting from branch to
   branch
 - no conflicts in upstream, when different series want to occupy same
   test number
 - meaningful names for test files
   For example, with digital number, when some person wants to add some
   test about block-stream, he most probably will just create a new
   test. But if there would be test-block-stream test already, he will
   at first look at it and may be just add a test-case into it.
   And anyway meaningful names are better.

This commit doesn't update check behavior (which will be done in
further commit), still, the documentation changed like new behavior is
already here.  Let's live with this small inconsistency for the
following few commits, until final change.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20210125185056.129513-3-vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 2e5a2f57db481f18fcf70be2a36b1417370b8476
      
https://github.com/qemu/qemu/commit/2e5a2f57db481f18fcf70be2a36b1417370b8476
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-01-27 (Wed, 27 Jan 2021)

  Changed paths:
    A tests/qemu-iotests/testenv.py

  Log Message:
  -----------
  iotests: add testenv.py

Add TestEnv class, which will handle test environment in a new python
iotests running framework.

Don't add compat=1.1 for qcow2 IMGOPTS, as v3 is default anyway.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210125185056.129513-4-vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: d74c754c924ca34e90b7c96ce2f5609d82c0e628
      
https://github.com/qemu/qemu/commit/d74c754c924ca34e90b7c96ce2f5609d82c0e628
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-01-27 (Wed, 27 Jan 2021)

  Changed paths:
    A tests/qemu-iotests/testrunner.py

  Log Message:
  -----------
  iotests: add testrunner.py

Add TestRunner class, which will run tests in a new python iotests
running framework.

There are some differences with current ./check behavior, most
significant are:
- Consider all tests self-executable, just run them, don't run python
  by hand.
- Elapsed time is cached in json file
- Elapsed time precision increased a bit
- Instead of using "diff -w" which ignores all whitespace differences,
  manually strip whitespace at line end then use python difflib, which
  no longer ignores spacing mid-line

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210125185056.129513-5-vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: f203080bbd9f9e5b31041b1f2afcd6040c5aaec5
      
https://github.com/qemu/qemu/commit/f203080bbd9f9e5b31041b1f2afcd6040c5aaec5
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-01-27 (Wed, 27 Jan 2021)

  Changed paths:
    M Makefile
    M tests/check-block.sh
    M tests/qemu-iotests/check
    R tests/qemu-iotests/common.env.in
    R tests/qemu-iotests/group
    M tests/qemu-iotests/iotests.py
    M tests/qemu-iotests/meson.build

  Log Message:
  -----------
  iotests: rewrite check into python

Just use classes introduced in previous three commits. Behavior
difference is described in these three commits.

Drop group file, as it becomes unused.

Drop common.env: now check is in python, and for tests we use same
python interpreter that runs the check itself. Use build environment
PYTHON in check-block instead, to keep "make check" use the same
python.

Checking for virtio-blk moved to iotests.py, as it actually iotests.py
dependency. Actually not all python iotests depend on it, so in future
it may be refactored to checked only when really needed.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210125185056.129513-6-vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: a44be0334beae3a9affb4a3a92cc6852993d7a84
      
https://github.com/qemu/qemu/commit/a44be0334beae3a9affb4a3a92cc6852993d7a84
  Author: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
  Date:   2021-01-27 (Wed, 27 Jan 2021)

  Changed paths:
    R tests/qemu-iotests/169
    R tests/qemu-iotests/169.out
    R tests/qemu-iotests/199
    R tests/qemu-iotests/199.out
    A tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test
    A tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test.out
    A tests/qemu-iotests/tests/migrate-bitmaps-test
    A tests/qemu-iotests/tests/migrate-bitmaps-test.out

  Log Message:
  -----------
  iotests: rename and move 169 and 199 tests

Rename bitmaps migration tests and move them to tests subdirectory to
demonstrate new human-friendly test naming.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210125185056.129513-7-vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>


  Commit: 0bcd12fb1513bad44f05f2d3a8eef2a99b3077b6
      
https://github.com/qemu/qemu/commit/0bcd12fb1513bad44f05f2d3a8eef2a99b3077b6
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-01-28 (Thu, 28 Jan 2021)

  Changed paths:
    M Makefile
    M block/block-backend.c
    M docs/devel/testing.rst
    M hw/block/dataplane/xen-block.c
    M hw/block/fdc.c
    M hw/block/m25p80.c
    M hw/block/nand.c
    M hw/block/nvme-ns.c
    M hw/block/onenand.c
    M hw/block/pflash_cfi01.c
    M hw/block/pflash_cfi02.c
    M hw/block/swim.c
    M hw/block/virtio-blk.c
    M hw/block/xen-block.c
    M hw/ide/core.c
    M hw/misc/sifive_u_otp.c
    M hw/ppc/pnv_pnor.c
    M hw/scsi/scsi-disk.c
    M hw/scsi/scsi-generic.c
    M hw/sd/sd.c
    M hw/usb/dev-storage.c
    M include/sysemu/block-backend.h
    M tests/check-block.sh
    M tests/qemu-iotests/146.out
    R tests/qemu-iotests/169
    R tests/qemu-iotests/169.out
    R tests/qemu-iotests/199
    R tests/qemu-iotests/199.out
    M tests/qemu-iotests/check
    R tests/qemu-iotests/common.env.in
    A tests/qemu-iotests/findtests.py
    R tests/qemu-iotests/group
    M tests/qemu-iotests/iotests.py
    M tests/qemu-iotests/meson.build
    A tests/qemu-iotests/testenv.py
    A tests/qemu-iotests/testrunner.py
    A tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test
    A tests/qemu-iotests/tests/migrate-bitmaps-postcopy-test.out
    A tests/qemu-iotests/tests/migrate-bitmaps-test
    A tests/qemu-iotests/tests/migrate-bitmaps-test.out
    M tests/qtest/virtio-scsi-test.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches:

- Fix crash on write to read-only devices
- iotests: Rewrite 'check' in Python, get rid of 'groups' and allow
  non-numeric test case names

# gpg: Signature made Wed 27 Jan 2021 19:56:00 GMT
# gpg:                using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6
# gpg:                issuer "kwolf@redhat.com"
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full]
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream:
  iotests: rename and move 169 and 199 tests
  iotests: rewrite check into python
  iotests: add testrunner.py
  iotests: add testenv.py
  iotests: add findtests.py
  iotests: 146: drop extra whitespaces from .out file
  virtio-scsi-test: Test writing to scsi-cd device
  block: Separate blk_is_writable() and blk_supports_write_perm()

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/091f255b89e8...0bcd12fb1513



reply via email to

[Prev in Thread] Current Thread [Next in Thread]