Message ID | 20190517152111.206494-3-vsementsov@virtuozzo.com |
---|---|
State | New |
Headers | show |
Series | bitmaps: merge bitmaps from differentnodes | expand |
On 5/17/19 11:21 AM, Vladimir Sementsov-Ogievskiy wrote: > This test shows that external snapshots and incremental backups are > friends. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> > --- > tests/qemu-iotests/254 | 52 ++++++++++++++++++++++++++++++++++++++ > tests/qemu-iotests/254.out | 52 ++++++++++++++++++++++++++++++++++++++ > tests/qemu-iotests/group | 1 + > 3 files changed, 105 insertions(+) > create mode 100755 tests/qemu-iotests/254 > create mode 100644 tests/qemu-iotests/254.out > > diff --git a/tests/qemu-iotests/254 b/tests/qemu-iotests/254 > new file mode 100755 > index 0000000000..33cb80a512 > --- /dev/null > +++ b/tests/qemu-iotests/254 > @@ -0,0 +1,52 @@ > +#!/usr/bin/env python > +# > +# Test external snapshot with bitmap copying. > +# > +# Copyright (c) 2019 Virtuozzo International GmbH. All rights reserved. > +# > +# 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/>. > +# > + > +import iotests > +from iotests import qemu_img_create, file_path, log > + > +disk, top = file_path('disk', 'top') > +size = 1024 * 1024 > + > +qemu_img_create('-f', iotests.imgfmt, disk, str(size)) > + > +vm = iotests.VM().add_drive(disk, opts='node-name=base') > +vm.launch() > + > +vm.qmp_log('block-dirty-bitmap-add', node='drive0', name='bitmap0') > + > +vm.hmp_qemu_io('drive0', 'write 0 512K') > + > +vm.qmp_log('transaction', indent=2, actions=[ > + {'type': 'blockdev-snapshot-sync', > + 'data': {'device': 'drive0', 'snapshot-file': top, > + 'snapshot-node-name': 'snap'}}, > + {'type': 'block-dirty-bitmap-add', > + 'data': {'node': 'snap', 'name': 'bitmap0'}}, > + {'type': 'block-dirty-bitmap-merge', > + 'data': {'node': 'snap', 'target': 'bitmap0', > + 'bitmaps': [{'node': 'base', 'name': 'bitmap0'}]}} > +], filters=[iotests.filter_qmp_testfiles]) > + > +result = vm.qmp('query-block')['return'][0] > +log("query-block: device = {}, node-name = {}, dirty-bitmaps:".format( > + result['device'], result['inserted']['node-name'])) > +log(result['dirty-bitmaps'], indent=2) > + > +vm.shutdown() > diff --git a/tests/qemu-iotests/254.out b/tests/qemu-iotests/254.out > new file mode 100644 > index 0000000000..d7394cf002 > --- /dev/null > +++ b/tests/qemu-iotests/254.out > @@ -0,0 +1,52 @@ > +{"execute": "block-dirty-bitmap-add", "arguments": {"name": "bitmap0", "node": "drive0"}} > +{"return": {}} > +{ > + "execute": "transaction", > + "arguments": { > + "actions": [ > + { > + "data": { > + "device": "drive0", > + "snapshot-file": "TEST_DIR/PID-top", > + "snapshot-node-name": "snap" > + }, > + "type": "blockdev-snapshot-sync" > + }, > + { > + "data": { > + "name": "bitmap0", > + "node": "snap" > + }, > + "type": "block-dirty-bitmap-add" > + }, > + { > + "data": { > + "bitmaps": [ > + { > + "name": "bitmap0", > + "node": "base" > + } > + ], > + "node": "snap", > + "target": "bitmap0" > + }, > + "type": "block-dirty-bitmap-merge" > + } > + ] > + } > +} > +{ > + "return": {} > +} > +query-block: device = drive0, node-name = snap, dirty-bitmaps: > +[ > + { > + "busy": false, > + "count": 524288, > + "granularity": 65536, > + "name": "bitmap0", > + "persistent": false, > + "recording": true, > + "status": "active" > + } > +] > diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group > index 00e474ab0a..5552d0153c 100644 > --- a/tests/qemu-iotests/group > +++ b/tests/qemu-iotests/group > @@ -250,3 +250,4 @@ > 248 rw auto quick > 249 rw auto quick > 252 rw auto backing quick > +254 rw auto backing quick > Reviewed-by: John Snow <jsnow@redhat.com> We will eventually want something more rigorous in terms of a full workflow, but for the purposes of testing cross-node merge I think this demonstrates it fine. I'll stage these shortly. --js
18.05.2019 4:31, John Snow wrote: > > > On 5/17/19 11:21 AM, Vladimir Sementsov-Ogievskiy wrote: >> This test shows that external snapshots and incremental backups are >> friends. >> >> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> >> --- >> tests/qemu-iotests/254 | 52 ++++++++++++++++++++++++++++++++++++++ >> tests/qemu-iotests/254.out | 52 ++++++++++++++++++++++++++++++++++++++ >> tests/qemu-iotests/group | 1 + >> 3 files changed, 105 insertions(+) >> create mode 100755 tests/qemu-iotests/254 >> create mode 100644 tests/qemu-iotests/254.out >> >> diff --git a/tests/qemu-iotests/254 b/tests/qemu-iotests/254 >> new file mode 100755 >> index 0000000000..33cb80a512 >> --- /dev/null >> +++ b/tests/qemu-iotests/254 >> @@ -0,0 +1,52 @@ >> +#!/usr/bin/env python >> +# >> +# Test external snapshot with bitmap copying. >> +# >> +# Copyright (c) 2019 Virtuozzo International GmbH. All rights reserved. >> +# >> +# 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/>. >> +# >> + >> +import iotests >> +from iotests import qemu_img_create, file_path, log >> + >> +disk, top = file_path('disk', 'top') >> +size = 1024 * 1024 >> + >> +qemu_img_create('-f', iotests.imgfmt, disk, str(size)) >> + >> +vm = iotests.VM().add_drive(disk, opts='node-name=base') >> +vm.launch() >> + >> +vm.qmp_log('block-dirty-bitmap-add', node='drive0', name='bitmap0') >> + >> +vm.hmp_qemu_io('drive0', 'write 0 512K') >> + >> +vm.qmp_log('transaction', indent=2, actions=[ >> + {'type': 'blockdev-snapshot-sync', >> + 'data': {'device': 'drive0', 'snapshot-file': top, >> + 'snapshot-node-name': 'snap'}}, >> + {'type': 'block-dirty-bitmap-add', >> + 'data': {'node': 'snap', 'name': 'bitmap0'}}, >> + {'type': 'block-dirty-bitmap-merge', >> + 'data': {'node': 'snap', 'target': 'bitmap0', >> + 'bitmaps': [{'node': 'base', 'name': 'bitmap0'}]}} >> +], filters=[iotests.filter_qmp_testfiles]) >> + >> +result = vm.qmp('query-block')['return'][0] >> +log("query-block: device = {}, node-name = {}, dirty-bitmaps:".format( >> + result['device'], result['inserted']['node-name'])) >> +log(result['dirty-bitmaps'], indent=2) >> + >> +vm.shutdown() >> diff --git a/tests/qemu-iotests/254.out b/tests/qemu-iotests/254.out >> new file mode 100644 >> index 0000000000..d7394cf002 >> --- /dev/null >> +++ b/tests/qemu-iotests/254.out >> @@ -0,0 +1,52 @@ >> +{"execute": "block-dirty-bitmap-add", "arguments": {"name": "bitmap0", "node": "drive0"}} >> +{"return": {}} >> +{ >> + "execute": "transaction", >> + "arguments": { >> + "actions": [ >> + { >> + "data": { >> + "device": "drive0", >> + "snapshot-file": "TEST_DIR/PID-top", >> + "snapshot-node-name": "snap" >> + }, >> + "type": "blockdev-snapshot-sync" >> + }, >> + { >> + "data": { >> + "name": "bitmap0", >> + "node": "snap" >> + }, >> + "type": "block-dirty-bitmap-add" >> + }, >> + { >> + "data": { >> + "bitmaps": [ >> + { >> + "name": "bitmap0", >> + "node": "base" >> + } >> + ], >> + "node": "snap", >> + "target": "bitmap0" >> + }, >> + "type": "block-dirty-bitmap-merge" >> + } >> + ] >> + } >> +} >> +{ >> + "return": {} >> +} >> +query-block: device = drive0, node-name = snap, dirty-bitmaps: >> +[ >> + { >> + "busy": false, >> + "count": 524288, >> + "granularity": 65536, >> + "name": "bitmap0", >> + "persistent": false, >> + "recording": true, >> + "status": "active" >> + } >> +] >> diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group >> index 00e474ab0a..5552d0153c 100644 >> --- a/tests/qemu-iotests/group >> +++ b/tests/qemu-iotests/group >> @@ -250,3 +250,4 @@ >> 248 rw auto quick >> 249 rw auto quick >> 252 rw auto backing quick >> +254 rw auto backing quick >> > > Reviewed-by: John Snow <jsnow@redhat.com> > > We will eventually want something more rigorous in terms of a full > workflow, but for the purposes of testing cross-node merge I think this > demonstrates it fine. > > I'll stage these shortly. > Thank you!
On 5/20/19 3:47 AM, Vladimir Sementsov-Ogievskiy wrote: > 18.05.2019 4:31, John Snow wrote: >> >> >> On 5/17/19 11:21 AM, Vladimir Sementsov-Ogievskiy wrote: >>> This test shows that external snapshots and incremental backups are >>> friends. >>> >>> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> ... >> Reviewed-by: John Snow <jsnow@redhat.com> >> >> We will eventually want something more rigorous in terms of a full >> workflow, but for the purposes of testing cross-node merge I think this >> demonstrates it fine. >> >> I'll stage these shortly. >> > > Thank you! > > Staged: https://github.com/jnsnow/qemu/tree/bitmaps
On 17.05.19 17:21, Vladimir Sementsov-Ogievskiy wrote: > This test shows that external snapshots and incremental backups are > friends. > > Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> > --- > tests/qemu-iotests/254 | 52 ++++++++++++++++++++++++++++++++++++++ > tests/qemu-iotests/254.out | 52 ++++++++++++++++++++++++++++++++++++++ > tests/qemu-iotests/group | 1 + > 3 files changed, 105 insertions(+) > create mode 100755 tests/qemu-iotests/254 > create mode 100644 tests/qemu-iotests/254.out This test fails for me with qcow (v1). Max
05.06.2019 17:51, Max Reitz wrote: > On 17.05.19 17:21, Vladimir Sementsov-Ogievskiy wrote: >> This test shows that external snapshots and incremental backups are >> friends. >> >> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> >> --- >> tests/qemu-iotests/254 | 52 ++++++++++++++++++++++++++++++++++++++ >> tests/qemu-iotests/254.out | 52 ++++++++++++++++++++++++++++++++++++++ >> tests/qemu-iotests/group | 1 + >> 3 files changed, 105 insertions(+) >> create mode 100755 tests/qemu-iotests/254 >> create mode 100644 tests/qemu-iotests/254.out > > This test fails for me with qcow (v1). > > Max > Thanks, will fix somehow soon.
diff --git a/tests/qemu-iotests/254 b/tests/qemu-iotests/254 new file mode 100755 index 0000000000..33cb80a512 --- /dev/null +++ b/tests/qemu-iotests/254 @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# +# Test external snapshot with bitmap copying. +# +# Copyright (c) 2019 Virtuozzo International GmbH. All rights reserved. +# +# 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/>. +# + +import iotests +from iotests import qemu_img_create, file_path, log + +disk, top = file_path('disk', 'top') +size = 1024 * 1024 + +qemu_img_create('-f', iotests.imgfmt, disk, str(size)) + +vm = iotests.VM().add_drive(disk, opts='node-name=base') +vm.launch() + +vm.qmp_log('block-dirty-bitmap-add', node='drive0', name='bitmap0') + +vm.hmp_qemu_io('drive0', 'write 0 512K') + +vm.qmp_log('transaction', indent=2, actions=[ + {'type': 'blockdev-snapshot-sync', + 'data': {'device': 'drive0', 'snapshot-file': top, + 'snapshot-node-name': 'snap'}}, + {'type': 'block-dirty-bitmap-add', + 'data': {'node': 'snap', 'name': 'bitmap0'}}, + {'type': 'block-dirty-bitmap-merge', + 'data': {'node': 'snap', 'target': 'bitmap0', + 'bitmaps': [{'node': 'base', 'name': 'bitmap0'}]}} +], filters=[iotests.filter_qmp_testfiles]) + +result = vm.qmp('query-block')['return'][0] +log("query-block: device = {}, node-name = {}, dirty-bitmaps:".format( + result['device'], result['inserted']['node-name'])) +log(result['dirty-bitmaps'], indent=2) + +vm.shutdown() diff --git a/tests/qemu-iotests/254.out b/tests/qemu-iotests/254.out new file mode 100644 index 0000000000..d7394cf002 --- /dev/null +++ b/tests/qemu-iotests/254.out @@ -0,0 +1,52 @@ +{"execute": "block-dirty-bitmap-add", "arguments": {"name": "bitmap0", "node": "drive0"}} +{"return": {}} +{ + "execute": "transaction", + "arguments": { + "actions": [ + { + "data": { + "device": "drive0", + "snapshot-file": "TEST_DIR/PID-top", + "snapshot-node-name": "snap" + }, + "type": "blockdev-snapshot-sync" + }, + { + "data": { + "name": "bitmap0", + "node": "snap" + }, + "type": "block-dirty-bitmap-add" + }, + { + "data": { + "bitmaps": [ + { + "name": "bitmap0", + "node": "base" + } + ], + "node": "snap", + "target": "bitmap0" + }, + "type": "block-dirty-bitmap-merge" + } + ] + } +} +{ + "return": {} +} +query-block: device = drive0, node-name = snap, dirty-bitmaps: +[ + { + "busy": false, + "count": 524288, + "granularity": 65536, + "name": "bitmap0", + "persistent": false, + "recording": true, + "status": "active" + } +] diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 00e474ab0a..5552d0153c 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -250,3 +250,4 @@ 248 rw auto quick 249 rw auto quick 252 rw auto backing quick +254 rw auto backing quick
This test shows that external snapshots and incremental backups are friends. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> --- tests/qemu-iotests/254 | 52 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/254.out | 52 ++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 105 insertions(+) create mode 100755 tests/qemu-iotests/254 create mode 100644 tests/qemu-iotests/254.out