Block patches for 5.1.0-rc4:

- Fix abort when running a backup job on an image whose size is not
   aligned to the backup job's cluster size
 -----BEGIN PGP SIGNATURE-----
 
 iQFGBAABCAAwFiEEkb62CjDbPohX0Rgp9AfbAGHVz0AFAl8yZPcSHG1yZWl0ekBy
 ZWRoYXQuY29tAAoJEPQH2wBh1c9AzsMIAMCapgITYAakNx8tC02YShFYCzwQxt90
 N/+gyMXR1pZ48j1Ui4gCCRU2XJvbUIxfwzO2K0H432mkg4Y7fwIyJx7BOmDMyiNs
 NPWSMN6/ORZz0dIHwb0Days9vJMsLnuUmc6FmGaVsAyBa6pDFNfkX0GCQQURKags
 jvOp7fPsOrX65SCHv/UIlhooo1z3+7VCN6BQNPNz2bWv4UBpi5nZhXxZFagzT1/l
 zJ5MbIe+5yQcTkSgOoNNTAIP4XZHQPXpGx7nPTyK/trOGigCM8aVLB0vffUoEJfJ
 hFKjKODJsRJTL9IlTnqdUdqoYT8GJpzqzTLRf+TrOCA/vOZkwuqIyp4=
 =iw8l
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/maxreitz/tags/pull-block-2020-08-11' into staging

Block patches for 5.1.0-rc4:
- Fix abort when running a backup job on an image whose size is not
  aligned to the backup job's cluster size

# gpg: Signature made Tue 11 Aug 2020 10:29:27 BST
# gpg:                using RSA key 91BEB60A30DB3E8857D11829F407DB0061D5CF40
# gpg:                issuer "mreitz@redhat.com"
# gpg: Good signature from "Max Reitz <mreitz@redhat.com>" [full]
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40

* remotes/maxreitz/tags/pull-block-2020-08-11:
  iotests: add test for unaligned granularity bitmap backup
  block/block-copy: always align copied region to cluster size

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2020-08-19 22:19:11 +01:00
commit 1d806cef0e
4 changed files with 66 additions and 0 deletions

View file

@ -142,6 +142,9 @@ static BlockCopyTask *block_copy_task_create(BlockCopyState *s,
return NULL;
}
assert(QEMU_IS_ALIGNED(offset, s->cluster_size));
bytes = QEMU_ALIGN_UP(bytes, s->cluster_size);
/* region is dirty, so no existent tasks possible in it */
assert(!find_conflicting_task(s, offset, bytes));

60
tests/qemu-iotests/304 Executable file
View file

@ -0,0 +1,60 @@
#!/usr/bin/env python3
#
# Tests dirty-bitmap backup with unaligned bitmap granularity
#
# Copyright (c) 2020 Proxmox Server Solutions
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# owner=s.reiter@proxmox.com
import iotests
from iotests import qemu_img_create, qemu_img_log, file_path
iotests.script_initialize(supported_fmts=['qcow2'],
supported_protocols=['file'])
test_img = file_path('test.qcow2')
target_img = file_path('target.qcow2')
# unaligned by one byte
image_len = 4097
bitmap_granularity = 4096
qemu_img_create('-f', iotests.imgfmt, test_img, str(image_len))
# create VM
vm = iotests.VM().add_drive(test_img)
vm.launch()
# write to the entire image
vm.hmp_qemu_io('drive0', 'write -P0x16 0 4096');
vm.hmp_qemu_io('drive0', 'write -P0x17 4096 1');
# do backup and wait for completion
vm.qmp('drive-backup', **{
'device': 'drive0',
'sync': 'full',
'target': target_img
})
event = vm.event_wait(name='BLOCK_JOB_COMPLETED',
match={'data': {'device': 'drive0'}},
timeout=5.0)
# shutdown to sync images
vm.shutdown()
# backup succeeded, check if image is correct
qemu_img_log('compare', test_img, target_img)

View file

@ -0,0 +1,2 @@
Images are identical.

View file

@ -309,3 +309,4 @@
299 auto quick
301 backing quick
302 quick
304 rw quick