qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 80dd5a: block: add 'force' parameter to 'bloc


From: Richard Henderson
Subject: [Qemu-commits] [qemu/qemu] 80dd5a: block: add 'force' parameter to 'blockdev-change-m...
Date: Mon, 25 Apr 2022 16:32:48 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 80dd5aff1b3273e0ee5bec379df62647c0b39c1c
      
https://github.com/qemu/qemu/commit/80dd5aff1b3273e0ee5bec379df62647c0b39c1c
  Author: Denis V. Lunev <den@openvz.org>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M block/qapi-sysemu.c
    M hmp-commands.hx
    M monitor/hmp-cmds.c
    M qapi/block.json
    M ui/cocoa.m

  Log Message:
  -----------
  block: add 'force' parameter to 'blockdev-change-medium' command

'blockdev-change-medium' is a convinient wrapper for the following
sequence of commands:
 * blockdev-open-tray
 * blockdev-remove-medium
 * blockdev-insert-medium
 * blockdev-close-tray
and should be used f.e. to change ISO image inside the CD-ROM tray.
Though the guest could lock the tray and some linux guests like
CentOS 8.5 actually does that. In this case the execution if this
command results in the error like the following:
  Device 'scsi0-0-1-0' is locked and force was not specified,
  wait for tray to open and try again.

This situation is could be resolved 'blockdev-open-tray' by passing
flag 'force' inside. Thus is seems reasonable to add the same
capability for 'blockdev-change-medium' too.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@openvz.org>
Acked-by: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Hanna Reitz <hreitz@redhat.com>
CC: Eric Blake <eblake@redhat.com>
CC: Markus Armbruster <armbru@redhat.com>
Message-Id: <20220412221846.280723-1-den@openvz.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>


  Commit: 093a13acbf6be15de01cbf4afc27fb4193fd49ee
      
https://github.com/qemu/qemu/commit/093a13acbf6be15de01cbf4afc27fb4193fd49ee
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M tests/qemu-iotests/242
    M tests/qemu-iotests/255
    M tests/qemu-iotests/303

  Log Message:
  -----------
  iotests: replace calls to log(qemu_io(...)) with qemu_io_log()

This makes these callsites a little simpler, but the real motivation is
a forthcoming commit will change the return type of qemu_io(), so removing
users of the return value now is helpful.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220418211504.943969-2-jsnow@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>


  Commit: a19052496709d0999d777f0cb1fbd532958196c6
      
https://github.com/qemu/qemu/commit/a19052496709d0999d777f0cb1fbd532958196c6
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M tests/qemu-iotests/163

  Log Message:
  -----------
  iotests/163: Fix broken qemu-io invocation

The 'read' commands to qemu-io were malformed, and this invocation only
worked by coincidence because the error messages were identical. Oops.

There's no point in checking the patterning of the reference image, so
just check the empty image by itself instead.

(Note: as of this commit, nothing actually enforces that this command
completes successfully, but a forthcoming commit in this series will
enforce that qemu_io() must have a zero status code.)

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220418211504.943969-3-jsnow@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>


  Commit: e9039c045180c5929c1f440e8b0cb7c7ebfc3576
      
https://github.com/qemu/qemu/commit/e9039c045180c5929c1f440e8b0cb7c7ebfc3576
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M tests/qemu-iotests/040
    M tests/qemu-iotests/056

  Log Message:
  -----------
  iotests: Don't check qemu_io() output for specific error strings

A forthcoming commit updates qemu_io() to raise an exception on non-zero
return by default, and changes its return type.

In preparation, simplify some calls to qemu_io() that assert that
specific error message strings do not appear in qemu-io's
output. Asserting that all of these calls return a status code of zero
will be a more robust way to guard against failure.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220418211504.943969-4-jsnow@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>


  Commit: aaa0c0ef825cd9d6c8219d5fe1ffea8db87b1b5d
      
https://github.com/qemu/qemu/commit/aaa0c0ef825cd9d6c8219d5fe1ffea8db87b1b5d
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M tests/qemu-iotests/040

  Log Message:
  -----------
  iotests/040: Don't check image pattern on zero-length image

qemu-io fails on read/write beyond end-of-file on raw images, so skip
these invocations when running the zero-length image tests.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220418211504.943969-5-jsnow@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>


  Commit: 489762917386d00e3c585584742449a54f059272
      
https://github.com/qemu/qemu/commit/489762917386d00e3c585584742449a54f059272
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M tests/qemu-iotests/040

  Log Message:
  -----------
  iotests/040: Fix TestCommitWithFilters test

Without this change, asserting that qemu_io always returns 0 causes this
test to fail in a way we happened not to be catching previously:

 qemu.utils.VerboseProcessError: Command
  '('/home/jsnow/src/qemu/bin/git/tests/qemu-iotests/../../qemu-io',
  '--cache', 'writeback', '--aio', 'threads', '-f', 'qcow2', '-c',
  'read -P 4 3M 1M',
  '/home/jsnow/src/qemu/bin/git/tests/qemu-iotests/scratch/3.img')'
  returned non-zero exit status 1.
  ┏━ output ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  ┃ qemu-io: can't open device
  ┃ /home/jsnow/src/qemu/bin/git/tests/qemu-iotests/scratch/3.img:
  ┃ Could not open backing file: Could not open backing file: Throttle
  ┃ group 'tg' does not exist
  ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

The commit jobs changes the backing file string stored in the image file
header belonging to the node above the commit’s top node to point to the
commit target (the base node).  QEMU tries to be as accurate as
possible, and so in these test cases will include the filter that is
part of the block graph in that backing file string (by virtue of making
it a json:{} description of the post-commit subgraph).  This makes
little sense outside of QEMU, though: Specifically, the throttle node in
that subgraph will dearly miss its supposedly associated throttle group
object.

When starting the commit job, we can specify a custom backing file
string to write into said image file, so let’s use that feature to write
the plain filename of the backing chain’s next actual image file there.

Explicitly provide the backing file so that opening the file outside of
QEMU (Where we will not have throttle groups) will succeed.

Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <20220418211504.943969-6-jsnow@redhat.com>


  Commit: b2d68a8e56a1ee0602f91c6e8e5122cfd70bab90
      
https://github.com/qemu/qemu/commit/b2d68a8e56a1ee0602f91c6e8e5122cfd70bab90
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M tests/qemu-iotests/iotests.py

  Log Message:
  -----------
  iotests: create generic qemu_tool() function

reimplement qemu_img() in terms of qemu_tool() in preparation for doing
the same with qemu_io().

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220418211504.943969-7-jsnow@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>


  Commit: 6dede6a493d245170e90f316883c966542f05bb5
      
https://github.com/qemu/qemu/commit/6dede6a493d245170e90f316883c966542f05bb5
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M tests/qemu-iotests/030
    M tests/qemu-iotests/149
    M tests/qemu-iotests/205
    M tests/qemu-iotests/245
    M tests/qemu-iotests/iotests.py
    M tests/qemu-iotests/tests/migration-permissions

  Log Message:
  -----------
  iotests: rebase qemu_io() on top of qemu_tool()

Rework qemu_io() to be analogous to qemu_img(); a function that requires
a return code of zero by default unless disabled explicitly.

Tests that use qemu_io():
030 040 041 044 055 056 093 124 129 132 136 148 149 151 152 163 165 205
209 219 236 245 248 254 255 257 260 264 280 298 300 302 304
image-fleecing migrate-bitmaps-postcopy-test migrate-bitmaps-test
migrate-during-backup migration-permissions

Test that use qemu_io_log():
242 245 255 274 303 307 nbd-reconnect-on-open

Copy-pastables for testing/verification:

./check -qcow2 030 040 041 044 055 056 124 129 132 151 152 163 165 209 \
               219 236 242 245 248 254 255 257 260 264 274 \
               280 298 300 302 303 304 307 image-fleecing \
               migrate-bitmaps-postcopy-test migrate-bitmaps-test \
               migrate-during-backup nbd-reconnect-on-open
./check -raw 093 136 148 migration-permissions
./check -nbd 205

# ./configure configure --disable-gnutls --enable-gcrypt
# this ALSO requires passwordless sudo.
./check -luks 149

# Just the tests that were edited in this commit:
./check -qcow2 030 040 242 245
./check -raw migration-permissions
./check -nbd 205
./check -luks 149

Signed-off-by: John Snow <jsnow@redhat.com>
Message-Id: <20220418211504.943969-8-jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>


  Commit: 7acb2ddfece87fe0995388ae5f9269570530e2f9
      
https://github.com/qemu/qemu/commit/7acb2ddfece87fe0995388ae5f9269570530e2f9
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M tests/qemu-iotests/tests/migration-permissions

  Log Message:
  -----------
  iotests/migration-permissions: use assertRaises() for qemu_io() negative test

Modify this test to use assertRaises for its negative testing of
qemu_io. If the exception raised does not match the one we tell it to
expect, we get *that* exception unhandled. If we get no exception, we
get a unittest assertion failure and the provided emsg printed to
screen.

If we get the CalledProcessError exception but the output is not what we
expect, we re-raise the original CalledProcessError.

Tidy.

(Note: Yes, you can reference "with" objects after that block ends; it
just means that ctx.__exit__(...) will have been called on it. It does
not *actually* go out of scope. unittests expects you to want to inspect
the Exception object, so they leave it defined post-exit.)

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220418211504.943969-9-jsnow@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>


  Commit: db1646a63955aec075819d047a95ce9c074cffa6
      
https://github.com/qemu/qemu/commit/db1646a63955aec075819d047a95ce9c074cffa6
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M tests/qemu-iotests/tests/image-fleecing

  Log Message:
  -----------
  iotests/image-fleecing: switch to qemu_io()

This test expects failure ... but only sometimes. When? Why?

It's for reads of a region not defined by a bitmap. Adjust the test to
be more explicit about what it expects to fail and why.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220418211504.943969-10-jsnow@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>


  Commit: 23d44dcb7c247347a0c3e4565c4cd7e4d2a5183a
      
https://github.com/qemu/qemu/commit/23d44dcb7c247347a0c3e4565c4cd7e4d2a5183a
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M tests/qemu-iotests/iotests.py

  Log Message:
  -----------
  iotests: remove qemu_io_pipe_and_status()

I know we just added it, sorry. This is done in favor of qemu_io() which
*also* returns the console output and status, but with more robust error
handling on failure.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220418211504.943969-11-jsnow@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>


  Commit: 72cfb937b833ea6f49d022e1c7705eb9017a7c5d
      
https://github.com/qemu/qemu/commit/72cfb937b833ea6f49d022e1c7705eb9017a7c5d
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M tests/qemu-iotests/216
    M tests/qemu-iotests/218
    M tests/qemu-iotests/224
    M tests/qemu-iotests/258
    M tests/qemu-iotests/298
    M tests/qemu-iotests/310
    M tests/qemu-iotests/iotests.py
    M tests/qemu-iotests/tests/image-fleecing
    M tests/qemu-iotests/tests/mirror-ready-cancel-error
    M tests/qemu-iotests/tests/stream-error-on-reset

  Log Message:
  -----------
  iotests: remove qemu_io_silent() and qemu_io_silent_check().

Like qemu-img, qemu-io returning 0 should be the norm and not the
exception. Remove all calls to qemu_io_silent that just assert the
return code is zero (That's every last call, as it turns out), and
replace them with a normal qemu_io() call.

qemu_io_silent_check() appeared to have been unused already.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220418211504.943969-12-jsnow@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>


  Commit: 40bfeae1342cd1e4f3f204cf592fc089e839a002
      
https://github.com/qemu/qemu/commit/40bfeae1342cd1e4f3f204cf592fc089e839a002
  Author: John Snow <jsnow@redhat.com>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M tests/qemu-iotests/iotests.py
    M tests/qemu-iotests/tests/nbd-reconnect-on-open

  Log Message:
  -----------
  iotests: make qemu_io_log() check return codes by default

Just like qemu_img_log(), upgrade qemu_io_log() to enforce a return code
of zero by default.

Tests that use qemu_io_log(): 242 245 255 274 303 307 nbd-reconnect-on-open

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220418211504.943969-13-jsnow@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>


  Commit: 348a0740afc5b313599533eb69bbb2b95d2f1bba
      
https://github.com/qemu/qemu/commit/348a0740afc5b313599533eb69bbb2b95d2f1bba
  Author: Hanna Reitz <hreitz@redhat.com>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M tests/qemu-iotests/108

  Log Message:
  -----------
  iotests/108: Fix when missing user_allow_other

FUSE exports' allow-other option defaults to "auto", which means that it
will try passing allow_other as a mount option, and fall back to not
using it when an error occurs.  We make no effort to hide fusermount's
error message (because it would be difficult, and because users might
want to know about the fallback occurring), and so when allow_other does
not work (primarily when /etc/fuse.conf does not contain
user_allow_other), this error message will appear and break the
reference output.

We do not need allow_other here, though, so we can just pass
allow-other=off to fix that.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
Message-Id: <20220421142435.569600-1-hreitz@redhat.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Tested-by: Eric Blake <eblake@redhat.com>


  Commit: a1755db71e34df016ffc10aa0727360aae2c6036
      
https://github.com/qemu/qemu/commit/a1755db71e34df016ffc10aa0727360aae2c6036
  Author: Richard Henderson <richard.henderson@linaro.org>
  Date:   2022-04-25 (Mon, 25 Apr 2022)

  Changed paths:
    M block/qapi-sysemu.c
    M hmp-commands.hx
    M monitor/hmp-cmds.c
    M qapi/block.json
    M tests/qemu-iotests/030
    M tests/qemu-iotests/040
    M tests/qemu-iotests/056
    M tests/qemu-iotests/108
    M tests/qemu-iotests/149
    M tests/qemu-iotests/163
    M tests/qemu-iotests/205
    M tests/qemu-iotests/216
    M tests/qemu-iotests/218
    M tests/qemu-iotests/224
    M tests/qemu-iotests/242
    M tests/qemu-iotests/245
    M tests/qemu-iotests/255
    M tests/qemu-iotests/258
    M tests/qemu-iotests/298
    M tests/qemu-iotests/303
    M tests/qemu-iotests/310
    M tests/qemu-iotests/iotests.py
    M tests/qemu-iotests/tests/image-fleecing
    M tests/qemu-iotests/tests/migration-permissions
    M tests/qemu-iotests/tests/mirror-ready-cancel-error
    M tests/qemu-iotests/tests/nbd-reconnect-on-open
    M tests/qemu-iotests/tests/stream-error-on-reset
    M ui/cocoa.m

  Log Message:
  -----------
  Merge tag 'pull-block-2022-04-25' of https://gitlab.com/hreitz/qemu into 
staging

Block patches:
- New @force parameter for blockdev-change-medium
- Improvements to the iotests to help with debugging
- Fix iotest 108 on systems without user_allow_other in fuse.conf

# -----BEGIN PGP SIGNATURE-----
#
# iQJGBAABCAAwFiEEy2LXoO44KeRfAE00ofpA0JgBnN8FAmJmqyISHGhyZWl0ekBy
# ZWRoYXQuY29tAAoJEKH6QNCYAZzf7uEP/RKNblyIuFjHkPgaMzWqdGUjHpbRzKBi
# NFgO+ISRCSx/KXYBaanJP94qKLfpACJ1JHDUD3hipeO3kmVGmtF93cKypTQS4qhL
# bGmX+h38AK1omSR2iWRhu4ue4VAPeu9gLoHNYJ5vZlylWD3eHdppN7K2KFf7Aeo5
# /BnhwHiU2IQ7WkLlo5Pdb96+LqZfmCGYJGWO6eWx123+j+bpjLfpmV9+Kjzb1pDc
# FN60OFlp8RozXHKpqh4ZoThtJ+t3sYdlo6yvg1K18Y5JcXTx5d4D24HGo1ZIRxqz
# XgJbi+bSr8hnxCjvdUZlr3IpbjAE5DVbCjtDxyjGnim6vjIwhxCSWM7Bvzw2tm60
# TYNl2zxyIe5831v6Xv/YfYJFqtos/orZf87TSqx/uWrfinbxZ1nN/8zi5z9lC8tg
# S6IlNpKPK0wv33BmLVHcsnMABLY2YiJPx/Ngl0CvAEGvkQdaHzgcYGbmeEMrZTv7
# hVpBb1t+AKmnXYYZdCh4ulfJLUg3R9mXf0oI3otbcpNMwExB6hqcVI23VYC00Ct5
# m3Tb6bddIkBih25l9B7i6FPWfXG+0zu6Q4kIQiXmfNkqKseQ96aDY1aAU/GWoTZH
# MOOPqIhmLRgyYpJ3+am9AseczaMybC4DIfx1VXzjwS/X3YwHvHEbZ7iPR6C0630Z
# yslJbuH4ERl7
# =url0
# -----END PGP SIGNATURE-----
# gpg: Signature made Mon 25 Apr 2022 07:07:30 AM PDT
# gpg:                using RSA key CB62D7A0EE3829E45F004D34A1FA40D098019CDF
# gpg:                issuer "hreitz@redhat.com"
# gpg: Good signature from "Hanna Reitz <hreitz@redhat.com>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: CB62 D7A0 EE38 29E4 5F00  4D34 A1FA 40D0 9801 9CDF

* tag 'pull-block-2022-04-25' of https://gitlab.com/hreitz/qemu:
  iotests/108: Fix when missing user_allow_other
  iotests: make qemu_io_log() check return codes by default
  iotests: remove qemu_io_silent() and qemu_io_silent_check().
  iotests: remove qemu_io_pipe_and_status()
  iotests/image-fleecing: switch to qemu_io()
  iotests/migration-permissions: use assertRaises() for qemu_io() negative test
  iotests: rebase qemu_io() on top of qemu_tool()
  iotests: create generic qemu_tool() function
  iotests/040: Fix TestCommitWithFilters test
  iotests/040: Don't check image pattern on zero-length image
  iotests: Don't check qemu_io() output for specific error strings
  iotests/163: Fix broken qemu-io invocation
  iotests: replace calls to log(qemu_io(...)) with qemu_io_log()
  block: add 'force' parameter to 'blockdev-change-medium' command

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Compare: https://github.com/qemu/qemu/compare/c49abc840608...a1755db71e34



reply via email to

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