mbox series

[0/4] block: Relax restrictions for blockdev-snapshot

Message ID 20200305125100.386-1-kwolf@redhat.com
Headers show
Series block: Relax restrictions for blockdev-snapshot | expand

Message

Kevin Wolf March 5, 2020, 12:50 p.m. UTC
This series allows libvirt to fix a regression that its switch from
drive-mirror to blockdev-mirror caused: It currently requires that the
backing chain of the target image is already available when the mirror
operation is started.

In reality, the backing chain may only be copied while the operation is
in progress, so the backing file of the target image needs to stay
disabled until the operation completes and should be attached only at
that point. Without this series, we don't have a supported API to attach
the backing file at that later point.

Kevin Wolf (4):
  block: Make bdrv_get_cumulative_perm() public
  block: Relax restrictions for blockdev-snapshot
  iotests: Fix run_job() with use_log=False
  iotests: Test mirror with temporarily disabled target backing file

 include/block/block_int.h     |  3 ++
 block.c                       |  6 ++--
 blockdev.c                    | 14 +++++----
 tests/qemu-iotests/iotests.py |  5 +++-
 tests/qemu-iotests/155        | 54 +++++++++++++++++++++++++++++++----
 tests/qemu-iotests/155.out    |  4 +--
 6 files changed, 68 insertions(+), 18 deletions(-)

Comments

no-reply@patchew.org March 5, 2020, 1:33 p.m. UTC | #1
Patchew URL: https://patchew.org/QEMU/20200305125100.386-1-kwolf@redhat.com/



Hi,

This series failed the docker-quick@centos7 build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
make docker-image-centos7 V=1 NETWORK=1
time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1
=== TEST SCRIPT END ===

Submodule 'dtc' (https://git.qemu.org/git/dtc.git) registered for path 'dtc'
Cloning into 'dtc'...
remote: Counting objects: 5394, done.        
error: RPC failed; result=18, HTTP code = 200
fatal: The remote end hung up unexpectedly
fatal: protocol error: bad pack header
Clone of 'https://git.qemu.org/git/dtc.git' into submodule path 'dtc' failed
failed to update submodule dtc
Submodule 'dtc' (https://git.qemu.org/git/dtc.git) unregistered for path 'dtc'
make[1]: *** [/var/tmp/patchew-tester-tmp-pcg20kdn/src/docker-src.2020-03-05-08.26.25.29148] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-pcg20kdn/src'
make: *** [docker-run-test-quick@centos7] Error 2

real    6m50.721s
user    0m3.176s


The full log is available at
http://patchew.org/logs/20200305125100.386-1-kwolf@redhat.com/testing.docker-quick@centos7/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
no-reply@patchew.org March 5, 2020, 1:40 p.m. UTC | #2
Patchew URL: https://patchew.org/QEMU/20200305125100.386-1-kwolf@redhat.com/



Hi,

This series failed the docker-mingw@fedora build test. Please find the testing commands and
their output below. If you have Docker installed, you can probably reproduce it
locally.

=== TEST SCRIPT BEGIN ===
#! /bin/bash
export ARCH=x86_64
make docker-image-fedora V=1 NETWORK=1
time make docker-test-mingw@fedora J=14 NETWORK=1
=== TEST SCRIPT END ===

Submodule 'dtc' (https://git.qemu.org/git/dtc.git) registered for path 'dtc'
Cloning into 'dtc'...
remote: Counting objects: 5394, done.        
error: RPC failed; result=18, HTTP code = 200
fatal: The remote end hung up unexpectedly
fatal: protocol error: bad pack header
Clone of 'https://git.qemu.org/git/dtc.git' into submodule path 'dtc' failed
failed to update submodule dtc
Submodule 'dtc' (https://git.qemu.org/git/dtc.git) unregistered for path 'dtc'
make[1]: *** [/var/tmp/patchew-tester-tmp-yb2oz9s3/src/docker-src.2020-03-05-08.34.10.487] Error 1
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-yb2oz9s3/src'
make: *** [docker-run-test-mingw@fedora] Error 2

real    6m35.983s
user    0m3.008s


The full log is available at
http://patchew.org/logs/20200305125100.386-1-kwolf@redhat.com/testing.docker-mingw@fedora/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
Peter Krempa March 5, 2020, 2:24 p.m. UTC | #3
On Thu, Mar 05, 2020 at 13:50:56 +0100, Kevin Wolf wrote:
> This series allows libvirt to fix a regression that its switch from
> drive-mirror to blockdev-mirror caused: It currently requires that the
> backing chain of the target image is already available when the mirror
> operation is started.
> 
> In reality, the backing chain may only be copied while the operation is
> in progress, so the backing file of the target image needs to stay
> disabled until the operation completes and should be attached only at
> that point. Without this series, we don't have a supported API to attach
> the backing file at that later point.
> 
> Kevin Wolf (4):
>   block: Make bdrv_get_cumulative_perm() public
>   block: Relax restrictions for blockdev-snapshot
>   iotests: Fix run_job() with use_log=False
>   iotests: Test mirror with temporarily disabled target backing file

I've modified the libvirt code I have to try this. It works as expected
without iothreads, but I get the following error when iothread is used:

 error: internal error: unable to execute QEMU command 'transaction': Cannot change iothread of active block backend

I've tested it also with your Aio context patches for blockdev-reopen
applied and also added a feature flag for blockdev-snapshot

 https://gitlab.com/pipo.sk/qemu/-/commits/kevin-snapshot-blockcopy

I can post the feature patch if you want after I clean it up or perhaps
suggest a better name or wording for it.

The libvirt code is a subset of

 https://www.redhat.com/archives/libvir-list/2020-February/msg01125.html

with the blockdev-reopen bits removed and replaced by blockdev-snapshot.

You can have a look at the libvirt impl here:

 https://gitlab.com/pipo.sk/libvirt/-/commits/block-copy-reopen-snapshot

I'll post it for review if it's clear that iothreads can be supported
using this approach.