external backup api
v2 cover external backup api
Hi all.
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
There are three things are done:
- add query-block-dirty-bitmap-ranges qmp command
- add qmp commands for dirty-bitmap functions: create_successor, abdicate, reclaim.
- make create-successor command transaction-able
Then, external backup should be done like this:
1. qmp transaction {
external-snapshot
bitmap-create-successor
}2. qmp query frozen bitmap, not acquiring aio context.
3. do external backup, using snapshot and bitmap
4. if (success backup)
qmp bitmap-abdicate
else
qmp bitmap-reclaime
5. qmp merge snapshot
v2: a lot of additions and changes, no sense to compare with v1
Vladimir Sementsov-Ogievskiy (6):
block dirty bitmap: add next_zero function
qmp: add query-block-dirty-bitmap-ranges
iotests: test query-block-dirty-bitmap-ranges
qapi: add qmp commands for some dirty bitmap functions
qapi: make block-dirty-bitmap-create-successor transaction-able
iotests: test external backup api
block/dirty-bitmap.c | 60 ++++++++++++++++++++++ blockdev.c | 113 +++++++++++++++++++++++++++++++++++++++++ include/block/dirty-bitmap.h | 9 ++++ include/qemu/hbitmap.h | 8 +++ qapi-schema.json | 4 +- qapi/block-core.json | 90 +++++++++++++++++++++++++++++++++ qmp-commands.hx | 118 +++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/150 | 88 ++++++++++++++++++++++++++++++++ tests/qemu-iotests/150.out | 21 ++++++++ tests/qemu-iotests/151 | 77 ++++++++++++++++++++++++++++ tests/qemu-iotests/151.out | 7 +++ tests/qemu-iotests/group | 2 + util/hbitmap.c | 26 ++++++++++ 13 files changed, 622 insertions(+), 1 deletion(-) create mode 100755 tests/qemu-iotests/150 create mode 100644 tests/qemu-iotests/150.out create mode 100755 tests/qemu-iotests/151 create mode 100644 tests/qemu-iotests/151.out
Signature · 1 line
1.8.3.1
PATCH v2 1/6 block dirty bitmap: add next_zero function
The function searches for next zero bit (corresponding to next not-dirty bit).
--- block/dirty-bitmap.c | 5 +++++ include/block/dirty-bitmap.h | 2 ++ include/qemu/hbitmap.h | 8 ++++++++ util/hbitmap.c | 26 ++++++++++++++++++++++++++ 4 files changed, 41 insertions(+)
block/dirty-bitmap.c +5 -0
@@ -490,3 +490,8 @@ int64_t bdrv_get_dirty_count(BdrvDirtyBitmap *bitmap) {return hbitmap_count (bitmap->bitmap); } + +int64_t bdrv_dirty_bitmap_next_zero (BdrvDirtyBitmap *bitmap,uint64_t start) +{ +return hbitmap_next_zero (bitmap->bitmap, start); +}
include/block/dirty-bitmap.h +2 -0
@@ -68,4 +68,6 @@ void bdrv_dirty_bitmap_deserialize_zeroes(BdrvDirtyBitmap *bitmap, bool finish);void bdrv_dirty_bitmap_deserialize_finish (BdrvDirtyBitmap *bitmap); +int64_t bdrv_dirty_bitmap_next_zero (BdrvDirtyBitmap *bitmap,uint64_t start); +#endif
include/qemu/hbitmap.h +8 -0
@@ -259,6 +259,14 @@ void hbitmap_iter_init(HBitmapIter *hbi, const HBitmap *hb, uint64_t first);*/ unsigned long hbitmap_iter_skip_words (HBitmapIter *hbi); +/* hbitmap_next_zero: +* @hb: The HBitmap to operate on +* @start: The bit to start from. +* +* Find next not dirty bit. +*/ +int64_t hbitmap_next_zero (const HBitmap *hb,uint64_t start); +/* hbitmap_create_meta: * Create a "meta" hbitmap to track dirtiness of the bits in this HBitmap. * The caller owns the created bitmap and must call hbitmap_free_meta(hb) to
util/hbitmap.c +26 -0
@@ -169,6 +169,32 @@ void hbitmap_iter_init(HBitmapIter *hbi, const HBitmap *hb, uint64_t first) } } +int64_t hbitmap_next_zero (const HBitmap *hb,uint64_t start) +{ +size_t pos = (start >> hb->granularity) >>BITS_PER_LEVEL ; +unsigned long *last_lev = hb->levels[HBITMAP_LEVELS -1 ]; +uint64_t sz = hb->sizes[HBITMAP_LEVELS -1 ]; +unsigned long cur = last_lev[pos]; +unsigned start_bit_offset = + (start >> hb->granularity) & (BITS_PER_LONG -1 ); + cur |= (1UL << start_bit_offset) -1 ; + +if (cur == (unsigned long )-1 ) { +do { + pos++; + }while (pos < sz && last_lev[pos] == (unsigned long )-1 ); + +if (pos >= sz) { +return -1 ; + } + + cur = last_lev[pos]; + } + +return MIN ((pos <<BITS_PER_LEVEL ) +ctol (cur), hb->size -1 ) + << hb->granularity; +} +bool hbitmap_empty (const HBitmap *hb) {return hb->count ==0 ;
Signature · 1 line
1.8.3.1
PATCH v2 2/6 qmp: add query-block-dirty-bitmap-ranges
In reply to Vladimir Sementsov-OgievskiyAdd qmp command to query dirty bitmap contents. This is needed for external backup.
--- block/dirty-bitmap.c | 55 +++++++++++++++++++++++++++++++++++++++ blockdev.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ include/block/dirty-bitmap.h | 7 +++++ qapi/block-core.json | 54 ++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 33 +++++++++++++++++++++++ 5 files changed, 211 insertions(+)
block/dirty-bitmap.c +55 -0
@@ -495,3 +495,58 @@ int64_t bdrv_dirty_bitmap_next_zero(BdrvDirtyBitmap *bitmap, uint64_t start) {return hbitmap_next_zero (bitmap->bitmap, start); } + +/* bdrv_query_dirty_bitmap_ranges +* start, count and resulting ranges are all in bytes +*/ +BlockDirtyRangeList *bdrv_query_dirty_bitmap_ranges (BlockDriverState *bs, +BdrvDirtyBitmap *bitmap,uint64_t start,uint64_t count, +uint32_t max_ranges) +{ +BlockDirtyRangeList *list =NULL , *last_entry =NULL ; +BlockDirtyRangeList **plist = &list; +uint64_t begin, end; +uint64_t start_sector = start >>BDRV_SECTOR_BITS ; +uint64_t last_sector = (start + count -1 ) >>BDRV_SECTOR_BITS ; +uint32_t nb_ranges =0 ; + +BdrvDirtyBitmapIter *it =bdrv_dirty_iter_new (bitmap, start_sector); + +while ((begin =bdrv_dirty_iter_next (it)) !=-1 && nb_ranges < max_ranges) { +BlockDirtyRange *region; +if (begin > last_sector) { +break ; + } + + end =bdrv_dirty_bitmap_next_zero (bitmap, begin +1 ); + + region =g_new0 (BlockDirtyRange,1 ); + region->start = begin <<BDRV_SECTOR_BITS ; + region->count = (end - begin) <<BDRV_SECTOR_BITS ; + + last_entry =g_new0 (BlockDirtyRangeList,1 ); + last_entry->value = region; + + *plist = last_entry; + plist = &last_entry->next; + nb_ranges++; + +bdrv_set_dirty_iter (it, end +1 ); + } + +bdrv_dirty_iter_free (it); + +if (list !=NULL ) { +if (list->value->start < start) { + list->value->count -= start - list->value->start; + list->value->start = start; + } + +if (last_entry->value->start + + last_entry->value->count > start + count) { + last_entry->value->count = start + count - last_entry->value->start; + } + } + +return list; +}
blockdev.c +62 -0
68 lines not on this page · raw message
include/block/dirty-bitmap.h +7 -0
@@ -70,4 +70,11 @@ void bdrv_dirty_bitmap_deserialize_finish(BdrvDirtyBitmap *bitmap);int64_t bdrv_dirty_bitmap_next_zero (BdrvDirtyBitmap *bitmap,uint64_t start); +/* bdrv_query_dirty_bitmap_ranges +* start, count and resulting ranges are all in bytes +*/ +BlockDirtyRangeList *bdrv_query_dirty_bitmap_ranges (BlockDriverState *bs, +BdrvDirtyBitmap *bitmap,uint64_t start,uint64_t count, +uint32_t max_ranges); +#endif
qapi/block-core.json +54 -0
60 lines not on this page · raw message
qmp-commands.hx +33 -0
@@ -1457,6 +1457,39 @@ Example: EQMP { + .name = "query-block-dirty-bitmap-ranges", + .args_type = "node:B,name:s,start:i?,count:i?,max-ranges:i," + "block-io:b?", + .mhandler.cmd_new = qmp_marshal_query_block_dirty_bitmap_ranges, + }, + +SQMP + +query-block-dirty-bitmap-ranges +------------------------ +Since 2.6 + +Get contens of specified dirty bitmap. Bitmap data is returned as array of +dirty ranges. + +Arguments: + +- "node": device/node on which to remove dirty bitmap (json-string) +- "name": name of the dirty bitmap (json-string) +- "start": start of quered range in bytes (json-int, optional, default 0) +- "count": lenght of quered range in bytes + (json-int, optional, default (disk-size - @start)) +- "max-ranges": max dirty ranges to be returned. If there are more than + @max-ranges dirty ranges within quered range, then first + @max-ranges dirty ranges from quered range will be returned. + (json-int) +- "block-io": wheter aio-context should be acquired while oparating. False + value is allowed only for frozen or disabled bitmaps. + (json-bool, optional, default true) + +EQMP + + { .name = "blockdev-snapshot-sync", .args_type = "device:s?,node-name:s?,snapshot-file:s,snapshot-node-name:s?,format:s?,mode:s?", .mhandler.cmd_new = qmp_marshal_blockdev_snapshot_sync,
Signature · 1 line
1.8.3.1
Re: [Qemu-devel] [PATCH 2/6] qmp: add query-block-dirty-bitmap-ranges
Quoted 11 lines · Vladimir Sementsov-Ogievskiy
Add qmp command to query dirty bitmap contents. This is needed for external backup.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>--- block/dirty-bitmap.c | 55 +++++++++++++++++++++++++++++++++++++++ blockdev.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ include/block/dirty-bitmap.h | 7 +++++ qapi/block-core.json | 54 ++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 33 +++++++++++++++++++++++ 5 files changed, 211 insertions(+)
This API produces large replies and/or requires many calls to fetch all bitmap data. The worst case is a 101010... bitmap.
I consider the dirty bitmap to be data (vs control) and not something that should be sent over a control channel like the QMP monitor.
How about writing the dirty bitmap to a file? The new bitmap file format that Fam is working on could be used. That way the dirty bitmap can be saved asynchronously without hogging the QMP monitor.
Re: [Qemu-devel] [PATCH 2/6] qmp: add query-block-dirty-bitmap-ranges
Quoted 15 lines · Stefan Hajnoczi
Quoted 11 lines · Vladimir Sementsov-Ogievskiy
Add qmp command to query dirty bitmap contents. This is needed for external backup.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>--- block/dirty-bitmap.c | 55 +++++++++++++++++++++++++++++++++++++++ blockdev.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ include/block/dirty-bitmap.h | 7 +++++ qapi/block-core.json | 54 ++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 33 +++++++++++++++++++++++ 5 files changed, 211 insertions(+)This API produces large replies and/or requires many calls to fetch all bitmap data. The worst case is a 101010... bitmap.
Quoted 6 lines
I consider the dirty bitmap to be data (vs control) and not something that should be sent over a control channel like the QMP monitor.
How about writing the dirty bitmap to a file? The new bitmap file format that Fam is working on could be used. That way the dirty bitmap can be saved asynchronously without hogging the QMP monitor.
Reasonable point.
May be it would be better to setup "special" NBD server inside QEMU which will allow to directly "read" bitmap data.
Any opinion?
Den
Re: [Qemu-devel] [PATCH 2/6] qmp: add query-block-dirty-bitmap-ranges
Quoted 26 lines · Denis V. Lunev
Quoted 19 lines · Stefan Hajnoczi
Quoted 4 lines · Vladimir Sementsov-Ogievskiy
Add qmp command to query dirty bitmap contents. This is needed for external backup.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Quoted 10 lines
--- block/dirty-bitmap.c | 55 +++++++++++++++++++++++++++++++++++++++ blockdev.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ include/block/dirty-bitmap.h | 7 +++++ qapi/block-core.json | 54 ++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 33 +++++++++++++++++++++++ 5 files changed, 211 insertions(+)This API produces large replies and/or requires many calls to fetch all bitmap data. The worst case is a 101010... bitmap.
Quoted 6 lines
I consider the dirty bitmap to be data (vs control) and not something that should be sent over a control channel like the QMP monitor.
How about writing the dirty bitmap to a file? The new bitmap file format that Fam is working on could be used. That way the dirty bitmap can be saved asynchronously without hogging the QMP monitor.
Quoted 8 lines
Reasonable point.
May be it would be better to setup "special" NBD server inside QEMU which will allow to directly "read" bitmap data.
Any opinion?
Den
Or perhaps something like migration, where the client receiving the data opens a socket of some sort, and QEMU connects to that socket to send the data.
Re: [Qemu-devel] [PATCH 2/6] qmp: add query-block-dirty-bitmap-ranges
Quoted 33 lines · John Snow
Quoted 31 lines · Denis V. Lunev
Quoted 19 lines · Stefan Hajnoczi
Quoted 4 lines · Vladimir Sementsov-Ogievskiy
Add qmp command to query dirty bitmap contents. This is needed for external backup.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Quoted 10 lines
--- block/dirty-bitmap.c | 55 +++++++++++++++++++++++++++++++++++++++ blockdev.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ include/block/dirty-bitmap.h | 7 +++++ qapi/block-core.json | 54 ++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 33 +++++++++++++++++++++++ 5 files changed, 211 insertions(+)This API produces large replies and/or requires many calls to fetch all bitmap data. The worst case is a 101010... bitmap.
Quoted 6 lines
I consider the dirty bitmap to be data (vs control) and not something that should be sent over a control channel like the QMP monitor.
How about writing the dirty bitmap to a file? The new bitmap file format that Fam is working on could be used. That way the dirty bitmap can be saved asynchronously without hogging the QMP monitor.
Reasonable point.
May be it would be better to setup "special" NBD server inside QEMU which will allow to directly "read" bitmap data.
Quoted 6 lines
Quoted 3 lines
Any opinion?
Den
Or perhaps something like migration, where the client receiving the data opens a socket of some sort, and QEMU connects to that socket to send the data.
no. The point is that QEMU should be queried for data. May be even via several sockets to provide it in parallel.
Den
Re: [Qemu-devel] [PATCH 2/6] qmp: add query-block-dirty-bitmap-ranges
Quoted 37 lines · Denis V. Lunev
Quoted 36 lines · John Snow
Quoted 34 lines · Denis V. Lunev
Quoted 19 lines · Stefan Hajnoczi
Quoted 4 lines · Vladimir Sementsov-Ogievskiy
Add qmp command to query dirty bitmap contents. This is needed for external backup.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Quoted 10 lines
--- block/dirty-bitmap.c | 55 +++++++++++++++++++++++++++++++++++++++ blockdev.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ include/block/dirty-bitmap.h | 7 +++++ qapi/block-core.json | 54 ++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 33 +++++++++++++++++++++++ 5 files changed, 211 insertions(+)This API produces large replies and/or requires many calls to fetch all bitmap data. The worst case is a 101010... bitmap.
Quoted 6 lines
I consider the dirty bitmap to be data (vs control) and not something that should be sent over a control channel like the QMP monitor.
How about writing the dirty bitmap to a file? The new bitmap file format that Fam is working on could be used. That way the dirty bitmap can be saved asynchronously without hogging the QMP monitor.
Reasonable point.
May be it would be better to setup "special" NBD server inside QEMU which will allow to directly "read" bitmap data.
Any opinion?
Den
Quoted 8 lines
Quoted 3 lines
Or perhaps something like migration, where the client receiving the data opens a socket of some sort, and QEMU connects to that socket to send the data.
no. The point is that QEMU should be queried for data. May be even via several sockets to provide it in parallel.
Den
I don't follow.
You'd use a QMP command to tell QEMU where to connect to send the data. You're still "querying" QEMU, it's just not acting as the server for the data channel.
Re: [Qemu-devel] [PATCH 2/6] qmp: add query-block-dirty-bitmap-ranges
Quoted 45 lines · John Snow
Quoted 43 lines · Denis V. Lunev
Quoted 32 lines · John Snow
Quoted 31 lines · Denis V. Lunev
Quoted 19 lines · Stefan Hajnoczi
Quoted 4 lines · Vladimir Sementsov-Ogievskiy
Add qmp command to query dirty bitmap contents. This is needed for external backup.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>Quoted 10 lines
--- block/dirty-bitmap.c | 55 +++++++++++++++++++++++++++++++++++++++ blockdev.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ include/block/dirty-bitmap.h | 7 +++++ qapi/block-core.json | 54 ++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 33 +++++++++++++++++++++++ 5 files changed, 211 insertions(+)This API produces large replies and/or requires many calls to fetch all bitmap data. The worst case is a 101010... bitmap.
Quoted 6 lines
I consider the dirty bitmap to be data (vs control) and not something that should be sent over a control channel like the QMP monitor.
How about writing the dirty bitmap to a file? The new bitmap file format that Fam is working on could be used. That way the dirty bitmap can be saved asynchronously without hogging the QMP monitor.
Reasonable point.
May be it would be better to setup "special" NBD server inside QEMU which will allow to directly "read" bitmap data.
Quoted 6 lines
Quoted 3 lines
Any opinion?
Den
Or perhaps something like migration, where the client receiving the data opens a socket of some sort, and QEMU connects to that socket to send the data.
no. The point is that QEMU should be queried for data. May be even via several sockets to provide it in parallel.
Quoted 6 lines
Quoted 1 line
Den
I don't follow.
You'd use a QMP command to tell QEMU where to connect to send the data. You're still "querying" QEMU, it's just not acting as the server for the data channel.
ok, I have understood you wrong. This looks working at the first glance.
Re: [Qemu-devel] [PATCH 2/6] qmp: add query-block-dirty-bitmap-ranges
In reply to Denis V. LunevQuoted 22 lines · Denis V. Lunev
Quoted 15 lines · Stefan Hajnoczi
Quoted 11 lines · Vladimir Sementsov-Ogievskiy
Add qmp command to query dirty bitmap contents. This is needed for external backup.
Signed-off-by Vladimir Sementsov-Ogievskiy <[email protected]>--- block/dirty-bitmap.c | 55 +++++++++++++++++++++++++++++++++++++++ blockdev.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ include/block/dirty-bitmap.h | 7 +++++ qapi/block-core.json | 54 ++++++++++++++++++++++++++++++++++++++ qmp-commands.hx | 33 +++++++++++++++++++++++ 5 files changed, 211 insertions(+)This API produces large replies and/or requires many calls to fetch all bitmap data. The worst case is a 101010... bitmap.
Quoted 6 lines
I consider the dirty bitmap to be data (vs control) and not something that should be sent over a control channel like the QMP monitor.
How about writing the dirty bitmap to a file? The new bitmap file format that Fam is working on could be used. That way the dirty bitmap can be saved asynchronously without hogging the QMP monitor.
Quoted 6 lines
Reasonable point.
May be it would be better to setup "special" NBD server inside QEMU which will allow to directly "read" bitmap data.
Any opinion?
Since Stefan has mentioned "the format" I'm working on, yes, I think it will be possible to expose the persistent bitmap through NBD if the driver assigns node-names to the bitmap BDS.
Let me prototype this on top of my branch.
Fam
PATCH v2 3/6 iotests: test query-block-dirty-bitmap-ranges
In reply to Vladimir Sementsov-OgievskiyAdd test for QMP command query-block-dirty-bitmap-ranges.
--- tests/qemu-iotests/150 | 88 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/150.out | 21 +++++++++++ tests/qemu-iotests/group | 1 + 3 files changed, 110 insertions(+) create mode 100755 tests/qemu-iotests/150 create mode 100644 tests/qemu-iotests/150.out
tests/qemu-iotests/150 new file +88 -0
@@ -0,0 +1,88 @@ +#!/usr/bin/env python +# +# Test qmp command query-block-dirty-bitmap-ranges +# +# (C) Vladimir Sementsov-Ogievskiy 2015 +# +# 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 os +import iotests +import time +from iotests import qemu_img + +disk = os.path.join(iotests.test_dir, 'disk') + +size = 0x40000000 # 1G +sector_size = 512 +granularity = 0x10000 +regions = [ + { 'start': 0, 'count': 0x100000 }, + { 'start': 0x10000000, 'count': 0x20000 }, + { 'start': 0x39990000, 'count': 0x10000 } + ] + +class TestQueryDirtyBitmap(iotests.QMPTestCase): + + def setUp(self): + qemu_img('create', '-f', iotests.imgfmt, disk, str(size)) + self.vm = iotests.VM().add_drive(disk) + self.vm.launch() + + def tearDown(self): + self.vm.shutdown() + os.remove(disk) + + def printRange(self, begin, end): + print self.vm.qmp('query-block-dirty-bitmap-ranges', node='drive0', + name='bitmap', start=begin, count=(end - begin), + max_ranges=100); + + def printWhole(self, max_ranges=100): + print self.vm.qmp('query-block-dirty-bitmap-ranges', node='drive0', + name='bitmap', max_ranges=max_ranges); + + def test_query_bitmap(self): + result = self.vm.qmp('block-dirty-bitmap-add', node='drive0', + name='bitmap', granularity=granularity) + self.assert_qmp(result, 'return', {}); + + for r in regions: + self.vm.hmp_qemu_io('drive0', + 'write %d %d' % (r['start'], r['count'])) + + self.printWhole() + self.printWhole(2) + self.printRange(100, 200) + self.printRange(0x100000 - 10, 0x10000000 + 10) + print + + self.printRange(0x100000 - 10, 0x10000000 + 1) + self.printRange(0x100000 - 10, 0x10000000) + self.printRange(0x100000 - 10, 0x10000000 - 1) + print + + self.printRange(0x100000 + 1, 0x10000000 - 1) + self.printRange(0x100000 + 1, 0x10000000) + self.printRange(0x100000 + 1, 0x10000000 + 1) + print + + self.printRange(0x100000, 0x10000000 - 1) + self.printRange(0x100000, 0x10000000) + self.printRange(0x100000, 0x10000000 + 1) + + +if __name__ == '__main__': + iotests.main()
tests/qemu-iotests/150.out new file +21 -0
@@ -0,0 +1,21 @@ +. +---------------------------------------------------------------------- +Ran 1 tests + +OK +{u'return': [{u'count': 1048576, u'start': 0}, {u'count': 131072, u'start': 268435456}, {u'count': 65536, u'start': 966328320}]} +{u'return': [{u'count': 1048576, u'start': 0}, {u'count': 131072, u'start': 268435456}]} +{u'return': [{u'count': 100, u'start': 100}]} +{u'return': [{u'count': 10, u'start': 1048566}, {u'count': 10, u'start': 268435456}]} + +{u'return': [{u'count': 10, u'start': 1048566}, {u'count': 1, u'start': 268435456}]} +{u'return': [{u'count': 10, u'start': 1048566}]} +{u'return': [{u'count': 10, u'start': 1048566}]} + +{u'return': []} +{u'return': []} +{u'return': [{u'count': 1, u'start': 268435456}]} + +{u'return': []} +{u'return': []} +{u'return': [{u'count': 1, u'start': 268435456}]}
tests/qemu-iotests/group +1 -0
@@ -142,3 +142,4 @@ 138 rw auto quick 139 rw auto quick 142 auto +150 auto
Signature · 1 line
1.8.3.1
PATCH v2 4/6 qapi: add qmp commands for some dirty bitmap functions
In reply to Vladimir Sementsov-OgievskiyAdd access to bdrv_dirty_bitmap_create_successor, bdrv_dirty_bitmap_abdicate, bdrv_reclaim_dirty_bitmap.
--- blockdev.c | 51 +++++++++++++++++++++++++++++++ qapi/block-core.json | 36 ++++++++++++++++++++++ qmp-commands.hx | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 172 insertions(+)
blockdev.c +51 -0
@@ -2733,6 +2733,57 @@ void qmp_block_dirty_bitmap_clear(const char *node, const char *name,aio_context_release (aio_context); } +void qmp_block_dirty_bitmap_create_successor (const char *node, +const char *name,Error **errp) +{ +AioContext *aio_context; +BdrvDirtyBitmap *bitmap; +BlockDriverState *bs; + + bitmap =block_dirty_bitmap_lookup (node, name, &bs, &aio_context, errp); +if (!bitmap || !bs) { +return ; + } + +bdrv_dirty_bitmap_create_successor (bs, bitmap, errp); + +aio_context_release (aio_context); +} + +void qmp_block_dirty_bitmap_abdicate (const char *node,const char *name, +Error **errp) +{ +AioContext *aio_context; +BdrvDirtyBitmap *bitmap; +BlockDriverState *bs; + + bitmap =block_dirty_bitmap_lookup (node, name, &bs, &aio_context, errp); +if (!bitmap || !bs) { +return ; + } + +bdrv_dirty_bitmap_abdicate (bs, bitmap, errp); + +aio_context_release (aio_context); +} + +void qmp_block_dirty_bitmap_reclaim (const char *node,const char *name, +Error **errp) +{ +AioContext *aio_context; +BdrvDirtyBitmap *bitmap; +BlockDriverState *bs; + + bitmap =block_dirty_bitmap_lookup (node, name, &bs, &aio_context, errp); +if (!bitmap || !bs) { +return ; + } + +bdrv_reclaim_dirty_bitmap (bs, bitmap, errp); + +aio_context_release (aio_context); +} + BlockDirtyRangeList *qmp_query_block_dirty_bitmap_ranges(const char *node, const char *name, bool has_start, uint64_t start, bool has_count, uint64_t count, uint32_t max_ranges, bool has_block_io, bool block_io,
qapi/block-core.json +36 -0
@@ -1238,6 +1238,42 @@ 'data': 'BlockDirtyBitmap' } ## +# @block-dirty-bitmap-create-successor +# +# Interface to bdrv_dirty_bitmap_create_successor +# +# Returns: nothing on success +# +# Since 2.6 +## +{ 'command': 'block-dirty-bitmap-create-successor', + 'data': 'BlockDirtyBitmap' } + +## +# @block-dirty-bitmap-abdicate +# +# Interface to bdrv_dirty_bitmap_abdicate +# +# Returns: nothing on success +# +# Since 2.6 +## +{ 'command': 'block-dirty-bitmap-abdicate', + 'data': 'BlockDirtyBitmap' } + +## +# @block-dirty-bitmap-reclaim +# +# Interface to bdrv_reclaim_dirty_bitmap +# +# Returns: nothing on success +# +# Since 2.6 +## +{ 'command': 'block-dirty-bitmap-reclaim', + 'data': 'BlockDirtyBitmap' } + +## # @blockdev-mirror # # Start mirroring a block device's writes to a new destination.
qmp-commands.hx +85 -0
91 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 5/6 qapi: make block-dirty-bitmap-create-successor transaction-able
In reply to Vladimir Sementsov-Ogievskiy--- qapi-schema.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
qapi-schema.json +3 -1
@@ -1650,6 +1650,7 @@ # blockdev-snapshot since 2.5 # block-dirty-bitmap-add since 2.5 # block-dirty-bitmap-clear since 2.5 +# block-dirty-bitmap-create-successor since 2.6 ## { 'union': 'TransactionAction', 'data': {
@@ -1660,7 +1661,8 @@ 'abort': 'Abort', 'blockdev-snapshot-internal-sync': 'BlockdevSnapshotInternal', 'block-dirty-bitmap-add': 'BlockDirtyBitmapAdd', - 'block-dirty-bitmap-clear': 'BlockDirtyBitmap' + 'block-dirty-bitmap-clear': 'BlockDirtyBitmap', + 'block-dirty-bitmap-create-successor': 'BlockDirtyBitmap' } } ##
Signature · 1 line
1.8.3.1
PATCH v2 6/6 iotests: test external backup api
In reply to Vladimir Sementsov-Ogievskiy--- tests/qemu-iotests/151 | 77 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/151.out | 7 +++++ tests/qemu-iotests/group | 1 + 3 files changed, 85 insertions(+) create mode 100755 tests/qemu-iotests/151 create mode 100644 tests/qemu-iotests/151.out
tests/qemu-iotests/151 new file +77 -0
@@ -0,0 +1,77 @@ +#!/usr/bin/env python +# +# Test external backup api +# +# (C) Vladimir Sementsov-Ogievskiy 2016 +# +# 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 os +import iotests +import time +from iotests import qemu_img + +disk = os.path.join(iotests.test_dir, 'disk') + +size = 0x40000000 # 1G +sector_size = 512 +granularity = 0x10000 +regions = [ + { 'start': 0, 'count': 0x100000 }, + { 'start': 0x10000000, 'count': 0x20000 }, + { 'start': 0x39990000, 'count': 0x10000 } + ] + +class TestExternalBackupApi(iotests.QMPTestCase): + + def setUp(self): + qemu_img('create', '-f', iotests.imgfmt, disk, str(size)) + self.vm = iotests.VM().add_drive(disk) + self.vm.launch() + + def tearDown(self): + self.vm.shutdown() + os.remove(disk) + + def printBitmap(self, block_io): + print self.vm.qmp('query-block-dirty-bitmap-ranges', node='drive0', + name='bitmap', block_io=(block_io if 'on' else 'off'), + max_ranges=100); + + def test_api(self): + result = self.vm.qmp('block-dirty-bitmap-add', node='drive0', + name='bitmap', granularity=granularity) + self.assert_qmp(result, 'return', {}); + + for r in regions: + self.vm.hmp_qemu_io('drive0', + 'write %d %d' % (r['start'], r['count'])) + + result = self.vm.qmp('block-dirty-bitmap-create-successor', + node='drive0', name='bitmap') + self.assert_qmp(result, 'return', {}); + + self.printBitmap(False) + + result = self.vm.qmp('block-dirty-bitmap-abdicate', + node='drive0', name='bitmap') + self.assert_qmp(result, 'return', {}); + + self.printBitmap(True) + + + +if __name__ == '__main__': + iotests.main()
tests/qemu-iotests/151.out new file +7 -0
@@ -0,0 +1,7 @@ +. +---------------------------------------------------------------------- +Ran 1 tests + +OK +{u'return': [{u'count': 1048576, u'start': 0}, {u'count': 131072, u'start': 268435456}, {u'count': 65536, u'start': 966328320}]} +{u'return': []}
tests/qemu-iotests/group +1 -0
@@ -143,3 +143,4 @@ 139 rw auto quick 142 auto 150 auto +151 auto
Signature · 1 line
1.8.3.1
Quoted 6 lines · Vladimir Sementsov-Ogievskiy
Hi all.
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
Quoted 7 lines
There are three things are done:
- add query-block-dirty-bitmap-ranges qmp command
- add qmp commands for dirty-bitmap functions:create_successor, abdicate, reclaim.
- make create-successor command transaction-able
Quoted 8 lines
Then, external backup should be done like this:
1. qmp transaction { external-snapshot bitmap-create-successor }2. qmp query frozen bitmap, not acquiring aio context.
What do you do with the query response, read the snapshot image with an external tool?
Fam
Quoted 45 lines
3. do external backup, using snapshot and bitmap
4. if (success backup)
qmp bitmap-abdicate
else
qmp bitmap-reclaime5. qmp merge snapshot
v2: a lot of additions and changes, no sense to compare with v1
Vladimir Sementsov-Ogievskiy (6):
block dirty bitmap: addnext_zerofunction
qmp: add query-block-dirty-bitmap-ranges
iotests: test query-block-dirty-bitmap-ranges
qapi: add qmp commands for some dirty bitmap functions
qapi: make block-dirty-bitmap-create-successor transaction-able
iotests: test external backup apiblock/dirty-bitmap.c | 60 ++++++++++++++++++++++ blockdev.c | 113 +++++++++++++++++++++++++++++++++++++++++ include/block/dirty-bitmap.h | 9 ++++ include/qemu/hbitmap.h | 8 +++ qapi-schema.json | 4 +- qapi/block-core.json | 90 +++++++++++++++++++++++++++++++++ qmp-commands.hx | 118 +++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/150 | 88 ++++++++++++++++++++++++++++++++ tests/qemu-iotests/150.out | 21 ++++++++ tests/qemu-iotests/151 | 77 ++++++++++++++++++++++++++++ tests/qemu-iotests/151.out | 7 +++ tests/qemu-iotests/group | 2 + util/hbitmap.c | 26 ++++++++++ 13 files changed, 622 insertions(+), 1 deletion(-) create mode 100755 tests/qemu-iotests/150 create mode 100644 tests/qemu-iotests/150.out create mode 100755 tests/qemu-iotests/151 create mode 100644 tests/qemu-iotests/151.outSignature · 1 line
1.8.3.1
Quoted 9 lines · Fam Zheng
Quoted 6 lines · Vladimir Sementsov-Ogievskiy
Hi all.
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
Hmm, you are asking about advantage of external backup over internal? It depends on external backup tool.
Quoted 9 lines
Quoted 9 lines
There are three things are done:
- add query-block-dirty-bitmap-ranges qmp command
- add qmp commands for dirty-bitmap functions:create_successor, abdicate, reclaim.
- make create-successor command transaction-ableThen, external backup should be done like this:
Quoted 8 lines
Quoted 6 lines
1. qmp transaction { external-snapshot bitmap-create-successor }2. qmp query frozen bitmap, not acquiring aio context.
What do you do with the query response, read the snapshot image with an external tool?
Yes. Alternatively, image fleecing may be used instead of snapshot.
Quoted 47 lines
Fam
Quoted 44 lines
3. do external backup, using snapshot and bitmap
4. if (success backup)
qmp bitmap-abdicate
else
qmp bitmap-reclaime5. qmp merge snapshot
v2: a lot of additions and changes, no sense to compare with v1
Vladimir Sementsov-Ogievskiy (6):
block dirty bitmap: addnext_zerofunction
qmp: add query-block-dirty-bitmap-ranges
iotests: test query-block-dirty-bitmap-ranges
qapi: add qmp commands for some dirty bitmap functions
qapi: make block-dirty-bitmap-create-successor transaction-able
iotests: test external backup apiblock/dirty-bitmap.c | 60 ++++++++++++++++++++++ blockdev.c | 113 +++++++++++++++++++++++++++++++++++++++++ include/block/dirty-bitmap.h | 9 ++++ include/qemu/hbitmap.h | 8 +++ qapi-schema.json | 4 +- qapi/block-core.json | 90 +++++++++++++++++++++++++++++++++ qmp-commands.hx | 118 +++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/150 | 88 ++++++++++++++++++++++++++++++++ tests/qemu-iotests/150.out | 21 ++++++++ tests/qemu-iotests/151 | 77 ++++++++++++++++++++++++++++ tests/qemu-iotests/151.out | 7 +++ tests/qemu-iotests/group | 2 + util/hbitmap.c | 26 ++++++++++ 13 files changed, 622 insertions(+), 1 deletion(-)create mode 100755 tests/qemu-iotests/150
create mode 100644 tests/qemu-iotests/150.out
create mode 100755 tests/qemu-iotests/151
create mode 100644 tests/qemu-iotests/151.outSignature · 1 line
1.8.3.1
Signature · 2 lines
Best regards, Vladimir
Quoted 7 lines · Vladimir Sementsov-Ogievskiy
Quoted 6 lines · Fam Zheng
Quoted 5 lines · Vladimir Sementsov-Ogievskiy
Hi all.
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
Hmm, you are asking about advantage of external backup over internal? It depends on external backup tool.
I'm asking why the tool can't use drive-backup to achieve what you want. They seem very comparable.
Fam
Quoted 74 lines
Quoted 10 lines
Quoted 10 lines
There are three things are done:
- add query-block-dirty-bitmap-ranges qmp command
- add qmp commands for dirty-bitmap functions:create_successor, abdicate, reclaim.
- make create-successor command transaction-ableThen, external backup should be done like this:
Quoted 8 lines
Quoted 6 lines
1. qmp transaction { external-snapshot bitmap-create-successor }2. qmp query frozen bitmap, not acquiring aio context.
What do you do with the query response, read the snapshot image with an external tool?
Yes. Alternatively, image fleecing may be used instead of snapshot.
Quoted 47 lines
Fam
Quoted 44 lines
3. do external backup, using snapshot and bitmap
4. if (success backup)
qmp bitmap-abdicate
else
qmp bitmap-reclaime5. qmp merge snapshot
v2: a lot of additions and changes, no sense to compare with v1
Vladimir Sementsov-Ogievskiy (6):
block dirty bitmap: addnext_zerofunction
qmp: add query-block-dirty-bitmap-ranges
iotests: test query-block-dirty-bitmap-ranges
qapi: add qmp commands for some dirty bitmap functions
qapi: make block-dirty-bitmap-create-successor transaction-able
iotests: test external backup apiblock/dirty-bitmap.c | 60 ++++++++++++++++++++++ blockdev.c | 113 +++++++++++++++++++++++++++++++++++++++++ include/block/dirty-bitmap.h | 9 ++++ include/qemu/hbitmap.h | 8 +++ qapi-schema.json | 4 +- qapi/block-core.json | 90 +++++++++++++++++++++++++++++++++ qmp-commands.hx | 118 +++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/150 | 88 ++++++++++++++++++++++++++++++++ tests/qemu-iotests/150.out | 21 ++++++++ tests/qemu-iotests/151 | 77 ++++++++++++++++++++++++++++ tests/qemu-iotests/151.out | 7 +++ tests/qemu-iotests/group | 2 + util/hbitmap.c | 26 ++++++++++ 13 files changed, 622 insertions(+), 1 deletion(-) create mode 100755 tests/qemu-iotests/150 create mode 100644 tests/qemu-iotests/150.out create mode 100755 tests/qemu-iotests/151 create mode 100644 tests/qemu-iotests/151.outSignature · 1 line
1.8.3.1Signature · 2 lines
Best regards, Vladimir
Quoted 8 lines · Fam Zheng
Quoted 7 lines · Vladimir Sementsov-Ogievskiy
Quoted 6 lines · Fam Zheng
Quoted 5 lines · Vladimir Sementsov-Ogievskiy
Hi all.
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
Hmm, you are asking about advantage of external backup over internal? It depends on external backup tool.
I'm asking why the tool can't use drive-backup to achieve what you want. They seem very comparable.
drive-backup has limited range of maintained by qemu targets.. Third party tool uses its own internal targets. If we use drvie-backup there will be two copies instead of one: from qemu to drive-backup produced backup and then to internal target in third-party tool.
Quoted 72 lines
Fam
Quoted 69 lines
Quoted 8 lines
Quoted 8 lines
There are three things are done:
- add query-block-dirty-bitmap-ranges qmp command
- add qmp commands for dirty-bitmap functions:create_successor, abdicate, reclaim.
- make create-successor command transaction-ableThen, external backup should be done like this:
Quoted 8 lines
Quoted 6 lines
1. qmp transaction { external-snapshot bitmap-create-successor }2. qmp query frozen bitmap, not acquiring aio context.
What do you do with the query response, read the snapshot image with an external tool?
Yes. Alternatively, image fleecing may be used instead of snapshot.
Quoted 46 lines
Fam
Quoted 44 lines
3. do external backup, using snapshot and bitmap
4. if (success backup)
qmp bitmap-abdicate
else
qmp bitmap-reclaime5. qmp merge snapshot
v2: a lot of additions and changes, no sense to compare with v1
Vladimir Sementsov-Ogievskiy (6):
block dirty bitmap: addnext_zerofunction
qmp: add query-block-dirty-bitmap-ranges
iotests: test query-block-dirty-bitmap-ranges
qapi: add qmp commands for some dirty bitmap functions
qapi: make block-dirty-bitmap-create-successor transaction-able
iotests: test external backup apiblock/dirty-bitmap.c | 60 ++++++++++++++++++++++ blockdev.c | 113 +++++++++++++++++++++++++++++++++++++++++ include/block/dirty-bitmap.h | 9 ++++ include/qemu/hbitmap.h | 8 +++ qapi-schema.json | 4 +- qapi/block-core.json | 90 +++++++++++++++++++++++++++++++++ qmp-commands.hx | 118 +++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/150 | 88 ++++++++++++++++++++++++++++++++ tests/qemu-iotests/150.out | 21 ++++++++ tests/qemu-iotests/151 | 77 ++++++++++++++++++++++++++++ tests/qemu-iotests/151.out | 7 +++ tests/qemu-iotests/group | 2 + util/hbitmap.c | 26 ++++++++++ 13 files changed, 622 insertions(+), 1 deletion(-)create mode 100755 tests/qemu-iotests/150
create mode 100644 tests/qemu-iotests/150.out
create mode 100755 tests/qemu-iotests/151
create mode 100644 tests/qemu-iotests/151.outSignature · 1 line
1.8.3.1Signature · 2 lines
Best regards, Vladimir
Signature · 2 lines
Best regards, Vladimir
Quoted 9 lines · Fam Zheng
Quoted 6 lines · Vladimir Sementsov-Ogievskiy
Hi all.
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
Quoted 7 lines · Denis V. Lunev
Quoted 6 lines · Fam Zheng
Quoted 5 lines · Vladimir Sementsov-Ogievskiy
Hi all.
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
Yes, I see, thanks for explaining.
Quoted 7 lines · Denis V. Lunev
Quoted 6 lines · Fam Zheng
Quoted 5 lines · Vladimir Sementsov-Ogievskiy
Hi all.
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
Backup software can implement NBD to receive the incremental blocks from QEMU. Use drive-backup sync=incremental and the backup appliance as the NBD target.
It's more complicated to add this QMP command flow to backup software than to implement NBD.
Stefan
Quoted 13 lines · Stefan Hajnoczi
Quoted 4 lines · Denis V. Lunev
Quoted 3 lines · Fam Zheng
Quoted 2 lines · Vladimir Sementsov-Ogievskiy
Hi all.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
Quoted 8 lines
Backup software can implement NBD to receive the incremental blocks from QEMU. Use drive-backup sync=incremental and the backup appliance as the NBD target.
It's more complicated to add this QMP command flow to backup software than to implement NBD.
Stefan
it can, but this is a matter of problem due to the nature of how this software is implemented. Usually it is written in a semi-standard way and it uses "plugins" to actually collect the data, i.e. the code is written in standard interface/real implementation pattern and interfaces are basically the same.
With this standard approach backup software is working as an active side of the process, i.e. it performs operations and controls the flow.
This means that "non-standard" QEMU technology will be pain here.
Den
Quoted 31 lines · Denis V. Lunev
Quoted 15 lines · Stefan Hajnoczi
Quoted 8 lines · Denis V. Lunev
Quoted 7 lines · Fam Zheng
Quoted 6 lines · Vladimir Sementsov-Ogievskiy
Hi all.
These series which aims to add external backup api. This is needed to allow
backup software use our dirty bitmaps.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental
..."?This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
Quoted 8 lines
Backup software can implement NBD to receive the incremental blocks from QEMU. Use drive-backup sync=incremental and the backup appliance as the NBD target.
It's more complicated to add this QMP command flow to backup software than to implement NBD.
Stefan
it can, but this is a matter of problem due to the nature of how this software is implemented. Usually it is written in a semi-standard way and it uses "plugins" to actually collect the data, i.e. the code is written in standard interface/real implementation pattern and interfaces are basically the same.
Quoted 8 lines
With this standard approach backup software is working as an active side of the process, i.e. it performs operations and controls the flow.
This means that "non-standard" QEMU technology will be pain here.
Den
Am I to understand that for e.g. VMWare the backup appliance is literally reading the disk image from storage directly while the VM is running?
I'd be a bit surprised if that were true.
My biggest concern here is that there is not a safe way, today, to read from a disk image atomically while the VM is running. I think that'd take a lot of work to do and you'll not find a lot of support in implementing it.
Of course, while the VM is paused/off is a different story, but for now I still feel like NBD is the right answer for getting block data from QEMU.
What am I missing?
--js
Quoted 40 lines · John Snow
Quoted 38 lines · Denis V. Lunev
Quoted 15 lines · Stefan Hajnoczi
Quoted 8 lines · Denis V. Lunev
Quoted 7 lines · Fam Zheng
Quoted 6 lines · Vladimir Sementsov-Ogievskiy
Hi all.
These series which aims to add external backup api. This is needed to allow
backup software use our dirty bitmaps.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental
..."?This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
Quoted 8 lines
Backup software can implement NBD to receive the incremental blocks from QEMU. Use drive-backup sync=incremental and the backup appliance as the NBD target.
It's more complicated to add this QMP command flow to backup software than to implement NBD.
Stefan
it can, but this is a matter of problem due to the nature of how this software is implemented. Usually it is written in a semi-standard way and it uses "plugins" to actually collect the data, i.e. the code is written in standard interface/real implementation pattern and interfaces are basically the same.
With this standard approach backup software is working as an active side of the process, i.e. it performs operations and controls the flow.
This means that "non-standard" QEMU technology will be pain here.
Quoted 6 lines
Quoted 1 line
Den
Am I to understand that for e.g. VMWare the backup appliance is literally reading the disk image from storage directly while the VM is running?
I'd be a bit surprised if that were true.
I think that backup software is asking alive VM about the data.
Quoted 11 lines
My biggest concern here is that there is not a safe way, today, to read from a disk image atomically while the VM is running. I think that'd take a lot of work to do and you'll not find a lot of support in implementing it.
Of course, while the VM is paused/off is a different story, but for now I still feel like NBD is the right answer for getting block data from QEMU.
What am I missing?
--js
In general, in Parallels Server the backup was created using the
following approach:
- create external snapshot. In this case the base image (backing store in QEMU terminology) will be READ-ONLY and could be safely read by any entity
- backup that read-only disk image (any way)
- merge snapshots
In this process backup software is active while PCS is passive. With QEMU the approach looks the same to me:
- start a backup
- ask QEMU to give a data to be backuped (using NBD server in QEMU with Fam's image fleecing)
- finish backup
Important bit here is that dirty bitmap should be provided by QEMU by request. This dirty bitmap will be read-only at that moment, current active dirty bitmap should be replaced with new at backup start operation.
Den
Quoted 62 lines · Denis V. Lunev
Quoted 42 lines · John Snow
Quoted 40 lines · Denis V. Lunev
Quoted 21 lines · Stefan Hajnoczi
Quoted 8 lines · Denis V. Lunev
Quoted 7 lines · Fam Zheng
Quoted 6 lines · Vladimir Sementsov-Ogievskiy
Hi all.
These series which aims to add external backup api. This is needed to allow
backup software use our dirty bitmaps.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental
..."?This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
Backup software can implement NBD to receive the incremental blocks from
QEMU. Use drive-backup sync=incremental and the backup appliance as the
NBD target.Quoted 4 lines
It's more complicated to add this QMP command flow to backup software than to implement NBD.
Stefan
it can, but this is a matter of problem due to the nature of how this software is implemented. Usually it is written in a semi-standard way and it uses "plugins" to actually collect the data, i.e. the code is written in standard interface/real implementation pattern and interfaces are basically the same.
With this standard approach backup software is working as an active side of the process, i.e. it performs operations and controls the flow.
This means that "non-standard" QEMU technology will be pain here.
Quoted 6 lines
Quoted 1 line
Den
Am I to understand that for e.g. VMWare the backup appliance is literally reading the disk image from storage directly while the VM is running?
I'd be a bit surprised if that were true.
I think that backup software is asking alive VM about the data.
Quoted 11 lines
My biggest concern here is that there is not a safe way, today, to read from a disk image atomically while the VM is running. I think that'd take a lot of work to do and you'll not find a lot of support in implementing it.
Of course, while the VM is paused/off is a different story, but for now I still feel like NBD is the right answer for getting block data from QEMU.
What am I missing?
Quoted 9 lines
Quoted 1 line
--js
In general, in Parallels Server the backup was created using the following approach:
- create external snapshot. In this case the base image (backing store in QEMU terminology)
will be READ-ONLY and could be safely read by any entity
- backup that read-only disk image (any way)
- merge snapshots
I see.
Quoted 1 line
In this process backup software is active while PCS is passive.
PCS?
Quoted 6 lines
With QEMU the approach looks the same to me:
- start a backup
- ask QEMU to give a data to be backuped (using NBD server in QEMU with Fam's image fleecing)
- finish backup
Quoted 6 lines
Important bit here is that dirty bitmap should be provided by QEMU by request. This dirty bitmap will be read-only at that moment, current active dirty bitmap should be replaced with new at backup start operation.
Den
I don't have any problems providing the bitmap data through an external API, but the part I want to be 100% clear on before I ACK it is the API portion where we allow an external client to split or merge bitmaps externally -- that's functionality you don't need if you query the data from QEMU itself.
If using NBD (either through the incremental backup tool or image fleecing) that is completely fine, too.
My only reservations are over making direct reads to image files outside of QEMU while the VM is running.
--js
Quoted 72 lines · John Snow
Quoted 61 lines · Denis V. Lunev
Quoted 41 lines · John Snow
Quoted 40 lines · Denis V. Lunev
Quoted 21 lines · Stefan Hajnoczi
Quoted 8 lines · Denis V. Lunev
Quoted 7 lines · Fam Zheng
Quoted 6 lines · Vladimir Sementsov-Ogievskiy
Hi all.
These series which aims to add external backup api. This is needed to allow
backup software use our dirty bitmaps.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental
..."?This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
Backup software can implement NBD to receive the incremental blocks from
QEMU. Use drive-backup sync=incremental and the backup appliance as the
NBD target.Quoted 4 lines
It's more complicated to add this QMP command flow to backup software than to implement NBD.
Stefan
it can, but this is a matter of problem due to the nature of how this software is implemented. Usually it is written in a semi-standard way and it uses "plugins" to actually collect the data, i.e. the code is written in standard interface/real implementation pattern and interfaces are basically the same.
With this standard approach backup software is working as an active side of the process, i.e. it performs operations and controls the flow.
This means that "non-standard" QEMU technology will be pain here.
Quoted 6 lines
Quoted 1 line
Den
Am I to understand that for e.g. VMWare the backup appliance is literally reading the disk image from storage directly while the VM is running?
I'd be a bit surprised if that were true.
I think that backup software is asking alive VM about the data.
Quoted 11 lines
My biggest concern here is that there is not a safe way, today, to read from a disk image atomically while the VM is running. I think that'd take a lot of work to do and you'll not find a lot of support in implementing it.
Of course, while the VM is paused/off is a different story, but for now I still feel like NBD is the right answer for getting block data from QEMU.
What am I missing?
Quoted 9 lines
Quoted 1 line
--js
In general, in Parallels Server the backup was created using the following approach:
- create external snapshot. In this case the base image (backing store in QEMU terminology)
will be READ-ONLY and could be safely read by any entity
- backup that read-only disk image (any way)
- merge snapshots
Quoted 4 lines
I see.
Quoted 1 line
In this process backup software is active while PCS is passive.
PCS?
Parallels Cloud Server. Sorry for abbreviation :(
Quoted 11 lines
Quoted 11 lines
With QEMU the approach looks the same to me:
- start a backup
- ask QEMU to give a data to be backuped (using NBD server in QEMU with Fam's image fleecing)
- finish backupImportant bit here is that dirty bitmap should be provided by QEMU by request. This dirty bitmap will be read-only at that moment, current active dirty bitmap should be replaced with new at backup start operation.
Quoted 6 lines
Quoted 1 line
Den
I don't have any problems providing the bitmap data through an external API, but the part I want to be 100% clear on before I ACK it is the API portion where we allow an external client to split or merge bitmaps externally -- that's functionality you don't need if you query the data from QEMU itself.
That is fine :)
Quoted 5 lines
If using NBD (either through the incremental backup tool or image fleecing) that is completely fine, too.
My only reservations are over making direct reads to image files outside of QEMU while the VM is running.
Perfect :) We are on the same page. I would not going to go something unsafe is this very sensitive area.
Den
Quoted 91 lines · Denis V. Lunev
Quoted 72 lines · John Snow
Quoted 61 lines · Denis V. Lunev
Quoted 41 lines · John Snow
Quoted 40 lines · Denis V. Lunev
Quoted 21 lines · Stefan Hajnoczi
Quoted 8 lines · Denis V. Lunev
Quoted 7 lines · Fam Zheng
Quoted 6 lines · Vladimir Sementsov-Ogievskiy
Hi all.
These series which aims to add external backup api. This is needed to allow
backup software use our dirty bitmaps.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental
..."?This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
Backup software can implement NBD to receive the incremental blocks from
QEMU. Use drive-backup sync=incremental and the backup appliance as the
NBD target.Quoted 4 lines
It's more complicated to add this QMP command flow to backup software than to implement NBD.
Stefan
it can, but this is a matter of problem due to the nature of how this software is implemented. Usually it is written in a semi-standard way and it uses "plugins" to actually collect the data, i.e. the code is written in standard interface/real implementation pattern and interfaces are basically the same.
With this standard approach backup software is working as an active side of the process, i.e. it performs operations and controls the flow.
This means that "non-standard" QEMU technology will be pain here.
Quoted 6 lines
Quoted 1 line
Den
Am I to understand that for e.g. VMWare the backup appliance is literally reading the disk image from storage directly while the VM is running?
I'd be a bit surprised if that were true.
I think that backup software is asking alive VM about the data.
Quoted 11 lines
My biggest concern here is that there is not a safe way, today, to read from a disk image atomically while the VM is running. I think that'd take a lot of work to do and you'll not find a lot of support in implementing it.
Of course, while the VM is paused/off is a different story, but for now I still feel like NBD is the right answer for getting block data from QEMU.
What am I missing?
Quoted 9 lines
Quoted 1 line
--js
In general, in Parallels Server the backup was created using the following approach:
- create external snapshot. In this case the base image (backing store in QEMU terminology)
will be READ-ONLY and could be safely read by any entity
- backup that read-only disk image (any way)
- merge snapshotsQuoted 4 lines
I see.
Quoted 1 line
In this process backup software is active while PCS is passive.
PCS?
Parallels Cloud Server. Sorry for abbreviation :(
Quoted 11 lines
Quoted 11 lines
With QEMU the approach looks the same to me:
- start a backup
- ask QEMU to give a data to be backuped (using NBD server in QEMU with Fam's image fleecing)
- finish backupImportant bit here is that dirty bitmap should be provided by QEMU by request. This dirty bitmap will be read-only at that moment, current active dirty bitmap should be replaced with new at backup start operation.
Quoted 7 lines
Quoted 6 lines
Quoted 1 line
Den
I don't have any problems providing the bitmap data through an external API, but the part I want to be 100% clear on before I ACK it is the API portion where we allow an external client to split or merge bitmaps externally -- that's functionality you don't need if you query the data from QEMU itself.
That is fine :)
OOPS. This could be mistake!
The client should not perform operations on the bitmap manually, but it should instruct QEMU to do this job for him. Bitmap child should be created by request of backup software and its existence should also be controlled by the backup software. This could be either hidden or not, but the state should be controlled.
Lets again discuss the sequence:
1. call guest-fsfreeze-freeze to make consistent backup. This means that the guest ensures that all its journals are committed and there are no pending writes. Filesystem is in a good state.
2. start backup. At this moment original dirty bitmap child should be created to track new writes. There are no writes from the guest thanks to step (1). Thus we could avoid to move QEMU to VM_PAUSED state to perform the operation. This requires to 2.1 start image fleecing
2.2 create bitmap child (successor)
3. call guest-fsfreeze-thaw to unfreeze the guest
4. get dirty bitmap (parent). It is read-only and could be safely extracted
5. collect data from QEMU using NBD server inside QEMU (image fleecing)
6a. finish backup successfully. This implies the following ops:
6a.1 remove fleecing image
6a.2 drop old dirty (parent) bitmap (abdicate)
6b. finish backup unsuccessfully:
6b.1 remove fleecing image
6b.2(a) merge child to parent (reclaim)
or alternatively
6b.2(b) drop both child and parent dirty bitmaps and stop tracking
to facilitate new full backup next round
Constraints:
- step (4) is slow. We do not want to do it before step (3)
- paired operations aka (6.1)/(6.2) and (2.1)/(2.2) could be done either by the single QMP command or by two different commands, we do not care much on this
There are also troubles on guest snapshot operations. For now we drop dirty bitmaps in Parallels Server on switch-to-snapshot operations as it is unclear how to properly make dirty bitmap for the case.
Den
Quoted 7 lines · Denis V. Lunev
Quoted 6 lines · Fam Zheng
Quoted 5 lines · Vladimir Sementsov-Ogievskiy
Hi all.
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
As an example, there is a third-party backup format called VMA from Proxmox. A few years ago I posted a proof-of-concept external backup tool in Python:
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01536.html
It takes a full backup using drive-backup NBD (plus RAM/device state) but the same can be done with incremental backups.
Does this NBD approach meet your requirements?
Stefan
Quoted 17 lines · Stefan Hajnoczi
Quoted 4 lines · Denis V. Lunev
Quoted 3 lines · Fam Zheng
Quoted 2 lines · Vladimir Sementsov-Ogievskiy
Hi all.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
As an example, there is a third-party backup format called VMA from Proxmox. A few years ago I posted a proof-of-concept external backup tool in Python:
Quoted 8 lines
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01536.html
It takes a full backup using drive-backup NBD (plus RAM/device state) but the same can be done with incremental backups.
Does this NBD approach meet your requirements?
Stefan
for us we should somehow provide implementation of calls posted by Vladimir. They are available in Parallels Server version 6 and should be available in the next QEMU based release using "Parallels SDK to libvirt" convertor. The problem for us is that this old approach is used in the other side of the product - in containers implementation while this SDK is a universal access tool to both things.
Den
Quoted 25 lines · Denis V. Lunev
Quoted 24 lines · Stefan Hajnoczi
Quoted 4 lines · Denis V. Lunev
Quoted 3 lines · Fam Zheng
Quoted 2 lines · Vladimir Sementsov-Ogievskiy
Hi all.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
As an example, there is a third-party backup format called VMA from Proxmox. A few years ago I posted a proof-of-concept external backup tool in Python:
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01536.html
It takes a full backup using drive-backup NBD (plus RAM/device state) but the same can be done with incremental backups.
Does this NBD approach meet your requirements?
Quoted 8 lines
Quoted 1 line
Stefan
for us we should somehow provide implementation of calls posted by Vladimir. They are available in Parallels Server version 6 and should be available in the next QEMU based release using "Parallels SDK to libvirt" convertor. The problem for us is that this old approach is used in the other side of the product - in containers implementation while this SDK is a universal access tool to both things.
Point taken. I think many other backup applications will expect a similar API, so it's pragmatic to provide something compatible.
Stefan
Quoted 35 lines · Stefan Hajnoczi
Quoted 25 lines · Denis V. Lunev
Quoted 24 lines · Stefan Hajnoczi
Quoted 4 lines · Denis V. Lunev
Quoted 3 lines · Fam Zheng
Quoted 2 lines · Vladimir Sementsov-Ogievskiy
Hi all.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
As an example, there is a third-party backup format called VMA from Proxmox. A few years ago I posted a proof-of-concept external backup tool in Python:
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01536.html
It takes a full backup using drive-backup NBD (plus RAM/device state) but the same can be done with incremental backups.
Does this NBD approach meet your requirements?
Quoted 8 lines
Quoted 1 line
Stefan
for us we should somehow provide implementation of calls posted by Vladimir. They are available in Parallels Server version 6 and should be available in the next QEMU based release using "Parallels SDK to libvirt" convertor. The problem for us is that this old approach is used in the other side of the product - in containers implementation while this SDK is a universal access tool to both things.
Quoted 2 lines
Point taken. I think many other backup applications will expect a similar API, so it's pragmatic to provide something compatible.
Kevin Wolf and Daniel Berrange proposed an elegant way to avoid the concerns about the QMP monitor:
Previously I described incremental backup in "push" mode (already supported today with drive-backup). QEMU connects to a remote NBD server and writes out the contents of all dirty blocks:
QEMU ---Write dirty blocks--> Backup appliance (server)
This doesn't lend itself well to existing backup applications that expect to iterate the dirty bitmap manually.
Let's add a "pull" mode where the connection of the NBD connection is reversed. The backup application connects to QEMU's NBD server (image fleecing). The NBD protocol is extended to support the SCSI Get LBA Status command for querying block provisioning information. Now the backup application can use Get LBA Status to fetch the dirty block information from QEMU.
QEMU (server) <--Get LBA Status or Read dirty blocks-- Backup appliance
The dirty block information goes over the same NBD connection used to read the contents of the dirty blocks. The QMP monitor is not used to transfer dirty block information.
It may be necessary to extend the nbd-server-add command so that a bitmap name can be passed. This bitmap will be used to answer Get LBA Status queries instead of using on bdrv_co_get_block_status(). This would be necessary if image fleecing (point in time snapshot) is used.
Stefan
Quoted 62 lines · Stefan Hajnoczi
Quoted 34 lines · Stefan Hajnoczi
Quoted 25 lines · Denis V. Lunev
Quoted 24 lines · Stefan Hajnoczi
Quoted 4 lines · Denis V. Lunev
Quoted 3 lines · Fam Zheng
Quoted 2 lines · Vladimir Sementsov-Ogievskiy
Hi all.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
As an example, there is a third-party backup format called VMA from Proxmox. A few years ago I posted a proof-of-concept external backup tool in Python:
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01536.html
It takes a full backup using drive-backup NBD (plus RAM/device state) but the same can be done with incremental backups.
Does this NBD approach meet your requirements?
Quoted 8 lines
Quoted 1 line
Stefan
for us we should somehow provide implementation of calls posted by Vladimir. They are available in Parallels Server version 6 and should be available in the next QEMU based release using "Parallels SDK to libvirt" convertor. The problem for us is that this old approach is used in the other side of the product - in containers implementation while this SDK is a universal access tool to both things.
Quoted 2 lines
Point taken. I think many other backup applications will expect a similar API, so it's pragmatic to provide something compatible.
Kevin Wolf and Daniel Berrange proposed an elegant way to avoid the concerns about the QMP monitor:
Previously I described incremental backup in "push" mode (already supported today with drive-backup). QEMU connects to a remote NBD server and writes out the contents of all dirty blocks:
QEMU ---Write dirty blocks--> Backup appliance (server)
This doesn't lend itself well to existing backup applications that expect to iterate the dirty bitmap manually.
Let's add a "pull" mode where the connection of the NBD connection is reversed. The backup application connects to QEMU's NBD server (image fleecing). The NBD protocol is extended to support the SCSI Get LBA Status command for querying block provisioning information. Now the backup application can use Get LBA Status to fetch the dirty block information from QEMU.
QEMU (server) <--Get LBA Status or Read dirty blocks-- Backup appliance
The dirty block information goes over the same NBD connection used to read the contents of the dirty blocks. The QMP monitor is not used to transfer dirty block information.
Quoted 6 lines
It may be necessary to extend the nbd-server-add command so that a bitmap name can be passed. This bitmap will be used to answer Get LBA Status queries instead of using on
bdrv_co_get_block_status(). This would be necessary if image fleecing (point in time snapshot) is used.Stefan
Looks much easier than implement nbd-server for dirty bitmap, thanks.
Signature · 2 lines
Best regards, Vladimir
Quoted 62 lines · Stefan Hajnoczi
Quoted 34 lines · Stefan Hajnoczi
Quoted 25 lines · Denis V. Lunev
Quoted 24 lines · Stefan Hajnoczi
Quoted 4 lines · Denis V. Lunev
Quoted 3 lines · Fam Zheng
Quoted 2 lines · Vladimir Sementsov-Ogievskiy
Hi all.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
As an example, there is a third-party backup format called VMA from Proxmox. A few years ago I posted a proof-of-concept external backup tool in Python:
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01536.html
It takes a full backup using drive-backup NBD (plus RAM/device state) but the same can be done with incremental backups.
Does this NBD approach meet your requirements?
Quoted 8 lines
Quoted 1 line
Stefan
for us we should somehow provide implementation of calls posted by Vladimir. They are available in Parallels Server version 6 and should be available in the next QEMU based release using "Parallels SDK to libvirt" convertor. The problem for us is that this old approach is used in the other side of the product - in containers implementation while this SDK is a universal access tool to both things.
Quoted 2 lines
Point taken. I think many other backup applications will expect a similar API, so it's pragmatic to provide something compatible.
Kevin Wolf and Daniel Berrange proposed an elegant way to avoid the concerns about the QMP monitor:
Previously I described incremental backup in "push" mode (already supported today with drive-backup). QEMU connects to a remote NBD server and writes out the contents of all dirty blocks:
QEMU ---Write dirty blocks--> Backup appliance (server)
This doesn't lend itself well to existing backup applications that expect to iterate the dirty bitmap manually.
Let's add a "pull" mode where the connection of the NBD connection is reversed. The backup application connects to QEMU's NBD server (image fleecing). The NBD protocol is extended to support the SCSI Get LBA Status command for querying block provisioning information. Now the backup application can use Get LBA Status to fetch the dirty block information from QEMU.
QEMU (server) <--Get LBA Status or Read dirty blocks-- Backup appliance
The dirty block information goes over the same NBD connection used to read the contents of the dirty blocks. The QMP monitor is not used to transfer dirty block information.
Quoted 6 lines
It may be necessary to extend the nbd-server-add command so that a bitmap name can be passed. This bitmap will be used to answer Get LBA Status queries instead of using on
bdrv_co_get_block_status(). This would be necessary if image fleecing (point in time snapshot) is used.Stefan
the idea seems feasible at the first glance. I'll need to check the amount of the overhead of this approach. If we'll need to perform an additional request for each <granularity> block - the overhead is toooooo much.
Do you have the link to the spec/implementation?
Den
Quoted 4 lines · Denis V. Lunev
the idea seems feasible at the first glance. I'll need to check the amount of the overhead of this approach. If we'll need to perform an additional request for each <granularity> block - the overhead is toooooo much.
Regarding overhead, thankfully it's not one-block-at-a-time :).
Quoted 1 line
Do you have the link to the spec/implementation?
You can reference SCSI Block Commands (SBC-3) 5.4 GET LBA STATUS command. The filename is sbc3r25.pdf and it's available from t10.org although other sites seem to host copies too.
The approach is similar to the QMP command you have proposed. Input parameters are "starting LBA" and "allocation length". Outputs are a list of "status descriptors" which consists of an LBA, number of blocks, and a provisioning status field (allocated/unallocated/etc).
This means a single call can retrieve information for a whole range of the disk. It's slightly more efficient than QMP since the data is binary and not JSON text.
Stefan
Quoted 14 lines · Stefan Hajnoczi
Quoted 4 lines · Denis V. Lunev
the idea seems feasible at the first glance. I'll need to check the amount of the overhead of this approach. If we'll need to perform an additional request for each <granularity> block - the overhead is toooooo much.
Regarding overhead, thankfully it's not one-block-at-a-time :).
Quoted 1 line
Do you have the link to the spec/implementation?
You can reference SCSI Block Commands (SBC-3) 5.4 GET LBA STATUS command. The filename is sbc3r25.pdf and it's available from t10.org although other sites seem to host copies too.
Quoted 8 lines
The approach is similar to the QMP command you have proposed. Input parameters are "starting LBA" and "allocation length". Outputs are a list of "status descriptors" which consists of an LBA, number of blocks, and a provisioning status field (allocated/unallocated/etc).
This means a single call can retrieve information for a whole range of the disk. It's slightly more efficient than QMP since the data is binary and not JSON text.
Moreover, it avoids abusing control-plane QMP as data plane.
Quoted 62 lines · Stefan Hajnoczi
Quoted 34 lines · Stefan Hajnoczi
Quoted 25 lines · Denis V. Lunev
Quoted 24 lines · Stefan Hajnoczi
Quoted 4 lines · Denis V. Lunev
Quoted 3 lines · Fam Zheng
Quoted 2 lines · Vladimir Sementsov-Ogievskiy
Hi all.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
As an example, there is a third-party backup format called VMA from Proxmox. A few years ago I posted a proof-of-concept external backup tool in Python:
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01536.html
It takes a full backup using drive-backup NBD (plus RAM/device state) but the same can be done with incremental backups.
Does this NBD approach meet your requirements?
Quoted 8 lines
Quoted 1 line
Stefan
for us we should somehow provide implementation of calls posted by Vladimir. They are available in Parallels Server version 6 and should be available in the next QEMU based release using "Parallels SDK to libvirt" convertor. The problem for us is that this old approach is used in the other side of the product - in containers implementation while this SDK is a universal access tool to both things.
Quoted 2 lines
Point taken. I think many other backup applications will expect a similar API, so it's pragmatic to provide something compatible.
Kevin Wolf and Daniel Berrange proposed an elegant way to avoid the concerns about the QMP monitor:
Previously I described incremental backup in "push" mode (already supported today with drive-backup). QEMU connects to a remote NBD server and writes out the contents of all dirty blocks:
QEMU ---Write dirty blocks--> Backup appliance (server)
This doesn't lend itself well to existing backup applications that expect to iterate the dirty bitmap manually.
Let's add a "pull" mode where the connection of the NBD connection is reversed. The backup application connects to QEMU's NBD server (image fleecing). The NBD protocol is extended to support the SCSI Get LBA Status command for querying block provisioning information. Now the backup application can use Get LBA Status to fetch the dirty block information from QEMU.
QEMU (server) <--Get LBA Status or Read dirty blocks-- Backup appliance
The dirty block information goes over the same NBD connection used to read the contents of the dirty blocks. The QMP monitor is not used to transfer dirty block information.
Quoted 6 lines
It may be necessary to extend the nbd-server-add command so that a bitmap name can be passed. This bitmap will be used to answer Get LBA Status queries instead of using on
bdrv_co_get_block_status(). This would be necessary if image fleecing (point in time snapshot) is used.Stefan
There are no such commands in nbd spec here:
https://github.com/yoe/nbd/blob/master/doc/proto.md
So, I'm not sure, that adding something qemu-specific to this external protocol will be simple or even true way. Is Qemu already extending original nbd?
What about exporting bitmap as separate nbd entity? Just implement block driver, which will read from bitmap? If consider only read access and disabled (or frozen) bitmaps it should be simple enough.
Signature · 2 lines
Best regards, Vladimir
Quoted 3 lines · Vladimir Sementsov-Ogievskiy
What about exporting bitmap as separate nbd entity? Just implement block driver, which will read from bitmap? If consider only read access and disabled (or frozen) bitmaps it should be simple enough.
Yes, I think this idea also makes sense. The driver could implement .bdrv_read by memcpy from the bitmap.
Fam
Quoted 70 lines · Vladimir Sementsov-Ogievskiy
Quoted 62 lines · Stefan Hajnoczi
Quoted 34 lines · Stefan Hajnoczi
Quoted 25 lines · Denis V. Lunev
Quoted 24 lines · Stefan Hajnoczi
Quoted 4 lines · Denis V. Lunev
Quoted 3 lines · Fam Zheng
Quoted 2 lines · Vladimir Sementsov-Ogievskiy
Hi all.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
As an example, there is a third-party backup format called VMA from Proxmox. A few years ago I posted a proof-of-concept external backup tool in Python:
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01536.html
It takes a full backup using drive-backup NBD (plus RAM/device state) but the same can be done with incremental backups.
Does this NBD approach meet your requirements?
Quoted 8 lines
Quoted 1 line
Stefan
for us we should somehow provide implementation of calls posted by Vladimir. They are available in Parallels Server version 6 and should be available in the next QEMU based release using "Parallels SDK to libvirt" convertor. The problem for us is that this old approach is used in the other side of the product - in containers implementation while this SDK is a universal access tool to both things.
Quoted 2 lines
Point taken. I think many other backup applications will expect a similar API, so it's pragmatic to provide something compatible.
Kevin Wolf and Daniel Berrange proposed an elegant way to avoid the concerns about the QMP monitor:
Previously I described incremental backup in "push" mode (already supported today with drive-backup). QEMU connects to a remote NBD server and writes out the contents of all dirty blocks:
QEMU ---Write dirty blocks--> Backup appliance (server)
This doesn't lend itself well to existing backup applications that expect to iterate the dirty bitmap manually.
Let's add a "pull" mode where the connection of the NBD connection is reversed. The backup application connects to QEMU's NBD server (image fleecing). The NBD protocol is extended to support the SCSI Get LBA Status command for querying block provisioning information. Now the backup application can use Get LBA Status to fetch the dirty block information from QEMU.
QEMU (server) <--Get LBA Status or Read dirty blocks-- Backup appliance
The dirty block information goes over the same NBD connection used to read the contents of the dirty blocks. The QMP monitor is not used to transfer dirty block information.
Quoted 6 lines
It may be necessary to extend the nbd-server-add command so that a bitmap name can be passed. This bitmap will be used to answer Get LBA Status queries instead of using on
bdrv_co_get_block_status(). This would be necessary if image fleecing (point in time snapshot) is used.Stefan
Quoted 8 lines
There are no such commands in nbd spec here:
https://github.com/yoe/nbd/blob/master/doc/proto.md
So, I'm not sure, that adding something qemu-specific to this external protocol will be simple or even true way. Is Qemu already extending original nbd?
No, we don't do any QEMU specific extensions. The point of the approach Stefan suggests here though, is that it is *not* an inherantly QEMU-specific concept, it is relevant to any NBD server implementation.
For example, consider you were using a regular NBD server to export a sparse LVM volume. This proposed extension would be relevant to such a use case. As such this proposed extension is something that is likely to be acceptable for the generic NBD specification.
Quoted 3 lines
What about exporting bitmap as separate nbd entity? Just implement block driver, which will read from bitmap? If consider only read access and disabled (or frozen) bitmaps it should be simple enough.
IMHO that's not a desirable idea, since that *is* creating a QEMU specific solution to the problem.
Regards,
Daniel
Signature · 4 lines
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Quoted 80 lines · Daniel P. Berrange
Quoted 70 lines · Vladimir Sementsov-Ogievskiy
Quoted 62 lines · Stefan Hajnoczi
Quoted 34 lines · Stefan Hajnoczi
Quoted 25 lines · Denis V. Lunev
Quoted 24 lines · Stefan Hajnoczi
Quoted 4 lines · Denis V. Lunev
Quoted 3 lines · Fam Zheng
Quoted 2 lines · Vladimir Sementsov-Ogievskiy
Hi all.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
As an example, there is a third-party backup format called VMA from Proxmox. A few years ago I posted a proof-of-concept external backup tool in Python:
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01536.html
It takes a full backup using drive-backup NBD (plus RAM/device state) but the same can be done with incremental backups.
Does this NBD approach meet your requirements?
Quoted 8 lines
Quoted 1 line
Stefan
for us we should somehow provide implementation of calls posted by Vladimir. They are available in Parallels Server version 6 and should be available in the next QEMU based release using "Parallels SDK to libvirt" convertor. The problem for us is that this old approach is used in the other side of the product - in containers implementation while this SDK is a universal access tool to both things.
Quoted 2 lines
Point taken. I think many other backup applications will expect a similar API, so it's pragmatic to provide something compatible.
Kevin Wolf and Daniel Berrange proposed an elegant way to avoid the concerns about the QMP monitor:
Previously I described incremental backup in "push" mode (already supported today with drive-backup). QEMU connects to a remote NBD server and writes out the contents of all dirty blocks:
QEMU ---Write dirty blocks--> Backup appliance (server)
This doesn't lend itself well to existing backup applications that expect to iterate the dirty bitmap manually.
Let's add a "pull" mode where the connection of the NBD connection is reversed. The backup application connects to QEMU's NBD server (image fleecing). The NBD protocol is extended to support the SCSI Get LBA Status command for querying block provisioning information. Now the backup application can use Get LBA Status to fetch the dirty block information from QEMU.
QEMU (server) <--Get LBA Status or Read dirty blocks-- Backup appliance
The dirty block information goes over the same NBD connection used to read the contents of the dirty blocks. The QMP monitor is not used to transfer dirty block information.
Quoted 6 lines
It may be necessary to extend the nbd-server-add command so that a bitmap name can be passed. This bitmap will be used to answer Get LBA Status queries instead of using on
bdrv_co_get_block_status(). This would be necessary if image fleecing (point in time snapshot) is used.Stefan
Quoted 8 lines
There are no such commands in nbd spec here:
https://github.com/yoe/nbd/blob/master/doc/proto.md
So, I'm not sure, that adding something qemu-specific to this external protocol will be simple or even true way. Is Qemu already extending original nbd?
Quoted 8 lines
No, we don't do any QEMU specific extensions. The point of the approach Stefan suggests here though, is that it is *not* an inherantly QEMU-specific concept, it is relevant to any NBD server implementation.
For example, consider you were using a regular NBD server to export a sparse LVM volume. This proposed extension would be relevant to such a use case. As such this proposed extension is something that is likely to be acceptable for the generic NBD specification.
Yes, Get LBA Status could be useful for non-QEMU NBD users too.
NBD already supports a TRIM command so the ability to query the allocation status is a natural feature to add.
Stefan
Quoted 90 lines · Stefan Hajnoczi
Quoted 80 lines · Daniel P. Berrange
Quoted 70 lines · Vladimir Sementsov-Ogievskiy
Quoted 62 lines · Stefan Hajnoczi
Quoted 34 lines · Stefan Hajnoczi
Quoted 25 lines · Denis V. Lunev
Quoted 24 lines · Stefan Hajnoczi
Quoted 4 lines · Denis V. Lunev
Quoted 3 lines · Fam Zheng
Quoted 2 lines · Vladimir Sementsov-Ogievskiy
Hi all.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
As an example, there is a third-party backup format called VMA from Proxmox. A few years ago I posted a proof-of-concept external backup tool in Python:
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01536.html
It takes a full backup using drive-backup NBD (plus RAM/device state) but the same can be done with incremental backups.
Does this NBD approach meet your requirements?
Quoted 8 lines
Quoted 1 line
Stefan
for us we should somehow provide implementation of calls posted by Vladimir. They are available in Parallels Server version 6 and should be available in the next QEMU based release using "Parallels SDK to libvirt" convertor. The problem for us is that this old approach is used in the other side of the product - in containers implementation while this SDK is a universal access tool to both things.
Quoted 2 lines
Point taken. I think many other backup applications will expect a similar API, so it's pragmatic to provide something compatible.
Kevin Wolf and Daniel Berrange proposed an elegant way to avoid the concerns about the QMP monitor:
Previously I described incremental backup in "push" mode (already supported today with drive-backup). QEMU connects to a remote NBD server and writes out the contents of all dirty blocks:
QEMU ---Write dirty blocks--> Backup appliance (server)
This doesn't lend itself well to existing backup applications that expect to iterate the dirty bitmap manually.
Let's add a "pull" mode where the connection of the NBD connection is reversed. The backup application connects to QEMU's NBD server (image fleecing). The NBD protocol is extended to support the SCSI Get LBA Status command for querying block provisioning information. Now the backup application can use Get LBA Status to fetch the dirty block information from QEMU.
QEMU (server) <--Get LBA Status or Read dirty blocks-- Backup appliance
The dirty block information goes over the same NBD connection used to read the contents of the dirty blocks. The QMP monitor is not used to transfer dirty block information.
Quoted 6 lines
It may be necessary to extend the nbd-server-add command so that a bitmap name can be passed. This bitmap will be used to answer Get LBA Status queries instead of using on
bdrv_co_get_block_status(). This would be necessary if image fleecing (point in time snapshot) is used.Stefan
Quoted 8 lines
There are no such commands in nbd spec here:
https://github.com/yoe/nbd/blob/master/doc/proto.md
So, I'm not sure, that adding something qemu-specific to this external protocol will be simple or even true way. Is Qemu already extending original nbd?
Quoted 8 lines
No, we don't do any QEMU specific extensions. The point of the approach Stefan suggests here though, is that it is *not* an inherantly QEMU-specific concept, it is relevant to any NBD server implementation.
For example, consider you were using a regular NBD server to export a sparse LVM volume. This proposed extension would be relevant to such a use case. As such this proposed extension is something that is likely to be acceptable for the generic NBD specification.
Quoted 4 lines
Yes, Get LBA Status could be useful for non-QEMU NBD users too.
NBD already supports a TRIM command so the ability to query the allocation status is a natural feature to add.
Is it an abuse to "Get LBA Status" to return dirty information? Because in SCSI the command reports "mapped", "allocated" and "anchored" statuses. Does that mean NBD will use a different status set?
Fam
Quoted 91 lines · Fam Zheng
Quoted 90 lines · Stefan Hajnoczi
Quoted 88 lines · Daniel P. Berrange
Quoted 70 lines · Vladimir Sementsov-Ogievskiy
Quoted 62 lines · Stefan Hajnoczi
Quoted 34 lines · Stefan Hajnoczi
Quoted 25 lines · Denis V. Lunev
Quoted 24 lines · Stefan Hajnoczi
Quoted 4 lines · Denis V. Lunev
Quoted 3 lines · Fam Zheng
Quoted 2 lines · Vladimir Sementsov-Ogievskiy
Hi all.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
As an example, there is a third-party backup format called VMA from Proxmox. A few years ago I posted a proof-of-concept external backup tool in Python:
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01536.html
It takes a full backup using drive-backup NBD (plus RAM/device state) but the same can be done with incremental backups.
Does this NBD approach meet your requirements?
Quoted 8 lines
Quoted 1 line
Stefan
for us we should somehow provide implementation of calls posted by Vladimir. They are available in Parallels Server version 6 and should be available in the next QEMU based release using "Parallels SDK to libvirt" convertor. The problem for us is that this old approach is used in the other side of the product - in containers implementation while this SDK is a universal access tool to both things.
Quoted 2 lines
Point taken. I think many other backup applications will expect a similar API, so it's pragmatic to provide something compatible.
Kevin Wolf and Daniel Berrange proposed an elegant way to avoid the concerns about the QMP monitor:
Previously I described incremental backup in "push" mode (already supported today with drive-backup). QEMU connects to a remote NBD server and writes out the contents of all dirty blocks:
QEMU ---Write dirty blocks--> Backup appliance (server)
This doesn't lend itself well to existing backup applications that expect to iterate the dirty bitmap manually.
Let's add a "pull" mode where the connection of the NBD connection is reversed. The backup application connects to QEMU's NBD server (image fleecing). The NBD protocol is extended to support the SCSI Get LBA Status command for querying block provisioning information. Now the backup application can use Get LBA Status to fetch the dirty block information from QEMU.
QEMU (server) <--Get LBA Status or Read dirty blocks-- Backup appliance
The dirty block information goes over the same NBD connection used to read the contents of the dirty blocks. The QMP monitor is not used to transfer dirty block information.
Quoted 6 lines
It may be necessary to extend the nbd-server-add command so that a bitmap name can be passed. This bitmap will be used to answer Get LBA Status queries instead of using on
bdrv_co_get_block_status(). This would be necessary if image fleecing (point in time snapshot) is used.Stefan
Quoted 8 lines
There are no such commands in nbd spec here:
https://github.com/yoe/nbd/blob/master/doc/proto.md
So, I'm not sure, that adding something qemu-specific to this external protocol will be simple or even true way. Is Qemu already extending original nbd?
No, we don't do any QEMU specific extensions. The point of the approach Stefan suggests here though, is that it is *not* an inherantly QEMU-specific concept, it is relevant to any NBD server implementation.
For example, consider you were using a regular NBD server to export a sparse LVM volume. This proposed extension would be relevant to such a use case. As such this proposed extension is something that is likely to be acceptable for the generic NBD specification.
Quoted 8 lines
Quoted 4 lines
Yes, Get LBA Status could be useful for non-QEMU NBD users too.
NBD already supports a TRIM command so the ability to query the allocation status is a natural feature to add.
Is it an abuse to "Get LBA Status" to return dirty information? Because in SCSI the command reports "mapped", "allocated" and "anchored" statuses. Does that mean NBD will use a different status set?
Perhaps some conceptual gymnastics can get us to standard semantics.
Incremental backup wants to copy out an image's "dirty" blocks.
We can view this as a bitmap telling us which of the image's blocks are dirty.
An alternative view would be base image + dirty delta image. In the the dirty delta, exactly the dirty blocks are allocated. The delta image may be conceptual.
Now, consider the dirty delta *without* its backing image. You can find its allocated blocks with Get LBA Status. As usual, you can read even unallocated blocks, see SBC3 table 9.
If we NBD-export exactly that, we can use standard semantics, can't we?
Quoted 113 lines · Markus Armbruster
Quoted 91 lines · Fam Zheng
Quoted 90 lines · Stefan Hajnoczi
Quoted 88 lines · Daniel P. Berrange
Quoted 70 lines · Vladimir Sementsov-Ogievskiy
Quoted 62 lines · Stefan Hajnoczi
Quoted 34 lines · Stefan Hajnoczi
Quoted 25 lines · Denis V. Lunev
Quoted 24 lines · Stefan Hajnoczi
Quoted 4 lines · Denis V. Lunev
Quoted 3 lines · Fam Zheng
Quoted 2 lines · Vladimir Sementsov-Ogievskiy
Hi all.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
These series which aims to add external backup api. This is needed to allow backup software use our dirty bitmaps.
Vmware and Parallels Cloud Server have this feature.
What is the advantage of this appraoch over "drive-backup sync=incremental ..."?
This will allow third-party vendors to backup QEMU VMs into their own formats or to the cloud etc.
As an example, there is a third-party backup format called VMA from Proxmox. A few years ago I posted a proof-of-concept external backup tool in Python:
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01536.html
It takes a full backup using drive-backup NBD (plus RAM/device state) but the same can be done with incremental backups.
Does this NBD approach meet your requirements?
Quoted 8 lines
Quoted 1 line
Stefan
for us we should somehow provide implementation of calls posted by Vladimir. They are available in Parallels Server version 6 and should be available in the next QEMU based release using "Parallels SDK to libvirt" convertor. The problem for us is that this old approach is used in the other side of the product - in containers implementation while this SDK is a universal access tool to both things.
Quoted 2 lines
Point taken. I think many other backup applications will expect a similar API, so it's pragmatic to provide something compatible.
Kevin Wolf and Daniel Berrange proposed an elegant way to avoid the concerns about the QMP monitor:
Previously I described incremental backup in "push" mode (already supported today with drive-backup). QEMU connects to a remote NBD server and writes out the contents of all dirty blocks:
QEMU ---Write dirty blocks--> Backup appliance (server)
This doesn't lend itself well to existing backup applications that expect to iterate the dirty bitmap manually.
Let's add a "pull" mode where the connection of the NBD connection is reversed. The backup application connects to QEMU's NBD server (image fleecing). The NBD protocol is extended to support the SCSI Get LBA Status command for querying block provisioning information. Now the backup application can use Get LBA Status to fetch the dirty block information from QEMU.
QEMU (server) <--Get LBA Status or Read dirty blocks-- Backup appliance
The dirty block information goes over the same NBD connection used to read the contents of the dirty blocks. The QMP monitor is not used to transfer dirty block information.
Quoted 6 lines
It may be necessary to extend the nbd-server-add command so that a bitmap name can be passed. This bitmap will be used to answer Get LBA Status queries instead of using on
bdrv_co_get_block_status(). This would be necessary if image fleecing (point in time snapshot) is used.Stefan
Quoted 8 lines
There are no such commands in nbd spec here:
https://github.com/yoe/nbd/blob/master/doc/proto.md
So, I'm not sure, that adding something qemu-specific to this external protocol will be simple or even true way. Is Qemu already extending original nbd?
No, we don't do any QEMU specific extensions. The point of the approach Stefan suggests here though, is that it is *not* an inherantly QEMU-specific concept, it is relevant to any NBD server implementation.
For example, consider you were using a regular NBD server to export a sparse LVM volume. This proposed extension would be relevant to such a use case. As such this proposed extension is something that is likely to be acceptable for the generic NBD specification.
Quoted 8 lines
Quoted 4 lines
Yes, Get LBA Status could be useful for non-QEMU NBD users too.
NBD already supports a TRIM command so the ability to query the allocation status is a natural feature to add.
Is it an abuse to "Get LBA Status" to return dirty information? Because in SCSI the command reports "mapped", "allocated" and "anchored" statuses. Does that mean NBD will use a different status set?
Perhaps some conceptual gymnastics can get us to standard semantics.
Incremental backup wants to copy out an image's "dirty" blocks.
We can view this as a bitmap telling us which of the image's blocks are dirty.
An alternative view would be base image + dirty delta image. In the the dirty delta, exactly the dirty blocks are allocated. The delta image may be conceptual.
Quoted 6 lines
Now, consider the dirty delta *without* its backing image. You can find its allocated blocks with Get LBA Status. As usual, you can read even unallocated blocks, see SBC3 table 9.
If we NBD-export exactly that, we can use standard semantics, can't we?
Sounds exactly appropriate to me, from this perspective. If absolutely necessary we could disguise this behind a macro QMP command that implied these exact kind of semantics for the fleecing/NBD export -- one that accepted the bitmap name to tie to the export for this reason.
--js
Quoted 6 lines · Markus Armbruster
Quoted 3 lines
Is it an abuse to "Get LBA Status" to return dirty information? Because in SCSI the command reports "mapped", "allocated" and "anchored" statuses. Does that mean NBD will use a different status set?
Perhaps some conceptual gymnastics can get us to standard semantics.
Quoted 8 lines
Incremental backup wants to copy out an image's "dirty" blocks.
We can view this as a bitmap telling us which of the image's blocks are dirty.
An alternative view would be base image + dirty delta image. In the the dirty delta, exactly the dirty blocks are allocated. The delta image may be conceptual.
I see a problem here. On one hand I agree that the "GET LBA STATUS" is a natural extension to the NBD protocol.
On the other hand, the Get LBA Status command in SCSI reflects the state over the whole chain, not only the top element. It is the equivalent of bdrv_get_block_status_above(bs, NULL, ...), rather than bdrv_get_block_status(bs, ...). My understanding is that the dirty block information would require the latter, especially in the "conceptual delta image" model that Markus describes above.
Having NBD implement subtly different semantics compared to SCSI is a bad idea in my opinion.
Of course if we call it "READ DIRTY BLOCKS" that would work, but I don't think such a command would be something that it makes sense to have in the general purpose NBD spec, so you would need a mechanism for vendor-specific extensions.
Paolo
Quoted 5 lines
Now, consider the dirty delta *without* its backing image. You can find its allocated blocks with Get LBA Status. As usual, you can read even unallocated blocks, see SBC3 table 9.
If we NBD-export exactly that, we can use standard semantics, can't we?
Quoted 28 lines · Paolo Bonzini
Quoted 6 lines · Markus Armbruster
Quoted 3 lines
Is it an abuse to "Get LBA Status" to return dirty information? Because in SCSI the command reports "mapped", "allocated" and "anchored" statuses. Does that mean NBD will use a different status set?
Perhaps some conceptual gymnastics can get us to standard semantics.
Quoted 8 lines
Incremental backup wants to copy out an image's "dirty" blocks.
We can view this as a bitmap telling us which of the image's blocks are dirty.
An alternative view would be base image + dirty delta image. In the the dirty delta, exactly the dirty blocks are allocated. The delta image may be conceptual.
I see a problem here. On one hand I agree that the "GET LBA STATUS" is a natural extension to the NBD protocol.
On the other hand, the Get LBA Status command in SCSI reflects the state over the whole chain, not only the top element. It is the equivalent of
bdrv_get_block_status_above(bs, NULL, ...), rather thanbdrv_get_block_status(bs, ...). My understanding is that the dirty block information would require the latter, especially in the "conceptual delta image" model that Markus describes above.
Quoted 7 lines
Having NBD implement subtly different semantics compared to SCSI is a bad idea in my opinion.
Of course if we call it "READ DIRTY BLOCKS" that would work, but I don't think such a command would be something that it makes sense to have in the general purpose NBD spec, so you would need a mechanism for vendor-specific extensions.
Trying to be constructive: shall we instead have a simple mini-protocol with commands like "read bitmap slice", "clear bitmap slice", "query next 0 bit", "query next 1 bit"?
Not necessarily QMP, just a little socket thing. It could be JSON or ASCII or binary. It sucks to implement a new protocol, but perhaps it could be something compatible with VMware or Parallels.
Sorry if this has already been proposed, I'm late to the game and I only read this subthread.
Paolo
Quoted 38 lines · Paolo Bonzini
Quoted 25 lines · Paolo Bonzini
Quoted 5 lines · Markus Armbruster
Quoted 3 lines
Is it an abuse to "Get LBA Status" to return dirty information? Because in SCSI the command reports "mapped", "allocated" and "anchored" statuses. Does that mean NBD will use a different status set?
Perhaps some conceptual gymnastics can get us to standard semantics.
Quoted 8 lines
Incremental backup wants to copy out an image's "dirty" blocks.
We can view this as a bitmap telling us which of the image's blocks are dirty.
An alternative view would be base image + dirty delta image. In the the dirty delta, exactly the dirty blocks are allocated. The delta image may be conceptual.
I see a problem here. On one hand I agree that the "GET LBA STATUS" is a natural extension to the NBD protocol.
On the other hand, the Get LBA Status command in SCSI reflects the state over the whole chain, not only the top element. It is the equivalent of
bdrv_get_block_status_above(bs, NULL, ...), rather thanbdrv_get_block_status(bs, ...). My understanding is that the dirty block information would require the latter, especially in the "conceptual delta image" model that Markus describes above.Quoted 7 lines
Having NBD implement subtly different semantics compared to SCSI is a bad idea in my opinion.
Of course if we call it "READ DIRTY BLOCKS" that would work, but I don't think such a command would be something that it makes sense to have in the general purpose NBD spec, so you would need a mechanism for vendor-specific extensions.
Trying to be constructive: shall we instead have a simple mini-protocol with commands like "read bitmap slice", "clear bitmap slice", "query next 0 bit", "query next 1 bit"?
Quoted 8 lines
Not necessarily QMP, just a little socket thing. It could be JSON or ASCII or binary. It sucks to implement a new protocol, but perhaps it could be something compatible with VMware or Parallels.
Sorry if this has already been proposed, I'm late to the game and I only read this subthread.
Paolo
there was a proposal in the thread to export bitmap itself as NBD block device. We have also discuss to transfer entire bitmap over QMP but this idea is not that good according to Eric/Markus.
Den
Quoted 24 lines · Paolo Bonzini
Quoted 21 lines · Paolo Bonzini
Quoted 6 lines · Markus Armbruster
Quoted 3 lines
Is it an abuse to "Get LBA Status" to return dirty information? Because in SCSI the command reports "mapped", "allocated" and "anchored" statuses. Does that mean NBD will use a different status set?
Perhaps some conceptual gymnastics can get us to standard semantics.
Quoted 8 lines
Incremental backup wants to copy out an image's "dirty" blocks.
We can view this as a bitmap telling us which of the image's blocks are dirty.
An alternative view would be base image + dirty delta image. In the the dirty delta, exactly the dirty blocks are allocated. The delta image may be conceptual.
I see a problem here. On one hand I agree that the "GET LBA STATUS" is a natural extension to the NBD protocol.
Quoted 7 lines
Quoted 7 lines
On the other hand, the Get LBA Status command in SCSI reflects the state over the whole chain, not only the top element. It is the equivalent of
bdrv_get_block_status_above(bs, NULL, ...), rather thanbdrv_get_block_status(bs, ...). My understanding is that the dirty block information would require the latter, especially in the "conceptual delta image" model that Markus describes above.
This is unfortunate.
Quoted 12 lines
Quoted 7 lines
Having NBD implement subtly different semantics compared to SCSI is a bad idea in my opinion.
Of course if we call it "READ DIRTY BLOCKS" that would work, but I don't think such a command would be something that it makes sense to have in the general purpose NBD spec, so you would need a mechanism for vendor-specific extensions.
Trying to be constructive: shall we instead have a simple mini-protocol with commands like "read bitmap slice", "clear bitmap slice", "query next 0 bit", "query next 1 bit"?
Quoted 9 lines
Not necessarily QMP, just a little socket thing. It could be JSON or ASCII or binary. It sucks to implement a new protocol, but perhaps it could be something compatible with VMware or Parallels.
Sorry if this has already been proposed, I'm late to the game and I only read this subthread.
Paolo
The solution I proposed prior to the LBA status idea (which I did like, pending its suitability which looks... compromised, now. sigh.) was a simple binary protocol.
Something akin to this:
{ "execute": "dirty-bitmap-export",
"arguments": {
"node": "drive0",
"bitmap": "bitmap0",
"uri": "tcp:127.0.0.1:31337" }
}
We'll open up a socket to the URI provided, and push data akin to the following:
Bytes 0-3: "QBMP" (Qemu Bit Map Protocol) Bytes 4-11: number of dirty bits (As a lazy checksum) Bytes 12-19: granularity of bits
Bytes 20+: raw bitmap data
EOF
A simple, non-glorious format that just gets the data out there. Then the client has the info it needs to poll dirty blocks as necessary.
The other suggestion is to literally fetch the bitmap over NBD. How would this work -- would the export just be sized to the number of bytes of the bitmap data, and the client queries it?
I can't help but feel like this is slightly hacky, but I can't think of any truly solid reasons against it either.
--js
Quoted 28 lines · Paolo Bonzini
Quoted 5 lines · Markus Armbruster
Quoted 3 lines
Is it an abuse to "Get LBA Status" to return dirty information? Because in SCSI the command reports "mapped", "allocated" and "anchored" statuses. Does that mean NBD will use a different status set?
Perhaps some conceptual gymnastics can get us to standard semantics.
Quoted 8 lines
Incremental backup wants to copy out an image's "dirty" blocks.
We can view this as a bitmap telling us which of the image's blocks are dirty.
An alternative view would be base image + dirty delta image. In the the dirty delta, exactly the dirty blocks are allocated. The delta image may be conceptual.
I see a problem here. On one hand I agree that the "GET LBA STATUS" is a natural extension to the NBD protocol.
On the other hand, the Get LBA Status command in SCSI reflects the state over the whole chain, not only the top element. It is the equivalent of
bdrv_get_block_status_above(bs, NULL, ...), rather thanbdrv_get_block_status(bs, ...). My understanding is that the dirty block information would require the latter, especially in the "conceptual delta image" model that Markus describes above.Having NBD implement subtly different semantics compared to SCSI is a bad idea in my opinion.
Quoted 7 lines
Of course if we call it "READ DIRTY BLOCKS" that would work, but I don't think such a command would be something that it makes sense to have in the general purpose NBD spec, so you would need a mechanism for vendor-specific extensions.
Paolo
In general, the idea to bind DIRTY BITMAP to GET STATUS command is not that bad. First of all, NBD has no relation to the SCSI at all thus we are not bound to the SCSI protocol. This is good thing.
Next, it is generally good to query state of the data block before reading to reduce amount of transfers over the network. This is useful even for a full backup operation to avoid zero block transfers.
Thus, if we have created special NBD share, we can provide STATUS bitmap in the way we want, f.e. with the proposed semantics. This will not be a violation of the protocol.
Den
Quoted 40 lines · Denis V. Lunev
Quoted 28 lines · Paolo Bonzini
Quoted 5 lines · Markus Armbruster
Quoted 3 lines
Is it an abuse to "Get LBA Status" to return dirty information? Because in SCSI the command reports "mapped", "allocated" and "anchored" statuses. Does that mean NBD will use a different status set?
Perhaps some conceptual gymnastics can get us to standard semantics.
Quoted 8 lines
Incremental backup wants to copy out an image's "dirty" blocks.
We can view this as a bitmap telling us which of the image's blocks are dirty.
An alternative view would be base image + dirty delta image. In the the dirty delta, exactly the dirty blocks are allocated. The delta image may be conceptual.
I see a problem here. On one hand I agree that the "GET LBA STATUS" is a natural extension to the NBD protocol.
On the other hand, the Get LBA Status command in SCSI reflects the state over the whole chain, not only the top element. It is the equivalent of
bdrv_get_block_status_above(bs, NULL, ...), rather thanbdrv_get_block_status(bs, ...). My understanding is that the dirty block information would require the latter, especially in the "conceptual delta image" model that Markus describes above.Having NBD implement subtly different semantics compared to SCSI is a bad idea in my opinion.
Quoted 7 lines
Of course if we call it "READ DIRTY BLOCKS" that would work, but I don't think such a command would be something that it makes sense to have in the general purpose NBD spec, so you would need a mechanism for vendor-specific extensions.
Paolo
In general, the idea to bind DIRTY BITMAP to GET STATUS command is not that bad. First of all, NBD has no relation to the SCSI at all thus we are not bound to the SCSI protocol. This is good thing.
Quoted 7 lines
Next, it is generally good to query state of the data block before reading to reduce amount of transfers over the network. This is useful even for a full backup operation to avoid zero block transfers.
Thus, if we have created special NBD share, we can provide STATUS bitmap in the way we want, f.e. with the proposed semantics. This will not be a violation of the protocol.
Paolo described what I was trying to say, but way clearer then what I said. :) And I agree a dedicated bitmap status seems better here.
Fam
Quoted 26 lines · Paolo Bonzini
Quoted 6 lines · Markus Armbruster
Quoted 3 lines
Is it an abuse to "Get LBA Status" to return dirty information? Because in SCSI the command reports "mapped", "allocated" and "anchored" statuses. Does that mean NBD will use a different status set?
Perhaps some conceptual gymnastics can get us to standard semantics.
Quoted 8 lines
Incremental backup wants to copy out an image's "dirty" blocks.
We can view this as a bitmap telling us which of the image's blocks are dirty.
An alternative view would be base image + dirty delta image. In the the dirty delta, exactly the dirty blocks are allocated. The delta image may be conceptual.
I see a problem here. On one hand I agree that the "GET LBA STATUS" is a natural extension to the NBD protocol.
On the other hand, the Get LBA Status command in SCSI reflects the state over the whole chain, not only the top element. It is the equivalent of
bdrv_get_block_status_above(bs, NULL, ...), rather thanbdrv_get_block_status(bs, ...). My understanding is that the dirty block information would require the latter, especially in the "conceptual delta image" model that Markus describes above.
Quoted 2 lines
Having NBD implement subtly different semantics compared to SCSI is a bad idea in my opinion.
I completely agree with you that Get LBA Status cannot just reflect the top layer. But that's not what I meant to propose. Let me try to explain myself more clearly.
Consider a QCOW2 image D (for delta) with a backing file B (for base). If you open it normally, you see "D over B". Get LBA Status should certainly claim the "deallocated" state only for blocks that are allocated neither in D nor B.
However, you can also open D *without* its backing file. Then you see "D over nothing". Here, get LBA Status should claim "deallocated" state for anything not allocated in D.
My proposal is to expose a "just the dirty blocks" view of a block backend similarly: it's a *separate* backend that contains *only* the dirty blocks. Attempts to read a clean block behave exactly like reading an unmapped block from any other thinly provisioned backend (QCOW2 gives you zeroes, if I remember correctly). I think it's only natural to make Get LBA Status claim "deallocated" for exactly the clean blocks then.
Quoted 12 lines
Of course if we call it "READ DIRTY BLOCKS" that would work, but I don't think such a command would be something that it makes sense to have in the general purpose NBD spec, so you would need a mechanism for vendor-specific extensions.
Paolo
Quoted 5 lines
Now, consider the dirty delta *without* its backing image. You can find its allocated blocks with Get LBA Status. As usual, you can read even unallocated blocks, see SBC3 table 9.
If we NBD-export exactly that, we can use standard semantics, can't we?
Quoted 4 lines · Markus Armbruster
I completely agree with you that Get LBA Status cannot just reflect the top layer. But that's not what I meant to propose. Let me try to explain myself more clearly.
Quoted 8 lines
Consider a QCOW2 image D (for delta) with a backing file B (for base). If you open it normally, you see "D over B". Get LBA Status should certainly claim the "deallocated" state only for blocks that are allocated neither in D nor B.
However, you can also open D *without* its backing file. Then you see "D over nothing". Here, get LBA Status should claim "deallocated" state for anything not allocated in D.
Ok, this makes more sense.
The question then is whether to implement this NBD server inside QEMU, or outside it as a separate process to which QEMU "pushes" blocks as in the existing backup job. I would prefer the latter, so that it is possible to implement various APIs (get block status, but also VMware or Parallels or whatever).
Basically the same points made in
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01969.html
still apply.
Paolo
Quoted 24 lines · Paolo Bonzini
Quoted 4 lines · Markus Armbruster
I completely agree with you that Get LBA Status cannot just reflect the top layer. But that's not what I meant to propose. Let me try to explain myself more clearly.
Quoted 8 lines
Consider a QCOW2 image D (for delta) with a backing file B (for base). If you open it normally, you see "D over B". Get LBA Status should certainly claim the "deallocated" state only for blocks that are allocated neither in D nor B.
However, you can also open D *without* its backing file. Then you see "D over nothing". Here, get LBA Status should claim "deallocated" state for anything not allocated in D.
Ok, this makes more sense.
The question then is whether to implement this NBD server inside QEMU, or outside it as a separate process to which QEMU "pushes" blocks as in the existing backup job. I would prefer the latter, so that it is possible to implement various APIs (get block status, but also VMware or Parallels or whatever).
Quoted 3 lines
Basically the same points made in
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01969.html
still apply.
Talked a bit to Fam now and I noted Denis's observation that QEMU would still use the backup block job, plus the NBD server as in Fam's fleecing. Then the NBD server is already the push->pull adapter. It's a bit clearer now.
Opening D without backing file still feels a bit weird, because the NBD server would provide wrong data for clean blocks. I would think that a "stupid" backup software could always ignore the get LBA status command and get a full backup. Is this a requirement or not, and if not, why?
I don't have any particular opinion against an NBD get LBA status command that returns deallocated/allocated _and_ clean/dirty. But reusing one as the other feels like the kind of hack that seems clever and that you regret down the road.
I'm not sure whether the clean/dirty status is data plane or control plane either. I don't think the terms have a well-defined meaning in terms of storage. In the networking world, stuff like routing protocols (OSPF, BGP, etc.) is control plane, and based on this analogy dirty bitmaps seem like control plane to me.
So I wouldn't rule out QMP-based export of the dirty bitmap---either directly or optimized through a separate socket as in
http://article.gmane.org/gmane.comp.emulators.qemu/397083. Dirty bitmaps should also compress well, so perhaps gzip+base64 over JSON might work as well. I'm not saying we certainly won't regret it, but it seems "less different". Don't really know how to put it better...
Paolo
Quoted 36 lines · Paolo Bonzini
Quoted 24 lines · Paolo Bonzini
Quoted 4 lines · Markus Armbruster
I completely agree with you that Get LBA Status cannot just reflect the top layer. But that's not what I meant to propose. Let me try to explain myself more clearly.
Quoted 8 lines
Consider a QCOW2 image D (for delta) with a backing file B (for base). If you open it normally, you see "D over B". Get LBA Status should certainly claim the "deallocated" state only for blocks that are allocated neither in D nor B.
However, you can also open D *without* its backing file. Then you see "D over nothing". Here, get LBA Status should claim "deallocated" state for anything not allocated in D.
Ok, this makes more sense.
The question then is whether to implement this NBD server inside QEMU, or outside it as a separate process to which QEMU "pushes" blocks as in the existing backup job. I would prefer the latter, so that it is possible to implement various APIs (get block status, but also VMware or Parallels or whatever).
Quoted 3 lines
Basically the same points made in
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01969.html
still apply.Talked a bit to Fam now and I noted Denis's observation that QEMU would still use the backup block job, plus the NBD server as in Fam's fleecing. Then the NBD server is already the
push->pulladapter. It's a bit clearer now.
Quoted 4 lines
Opening D without backing file still feels a bit weird, because the NBD server would provide wrong data for clean blocks. I would think that a "stupid" backup software could always ignore the get LBA status command and get a full backup. Is this a requirement or not, and if not, why?
Can we return -EIO instead of zero for unallocated/clean sectors?
Quoted 5 lines
I don't have any particular opinion against an NBD get LBA status command that returns deallocated/allocated _and_ clean/dirty. But reusing one as the other feels like the kind of hack that seems clever and that you regret down the road.
Yes, I second this, my preference is also leaning towards separate states for allocation and dirtiness in "Get LBA State" command.
Quoted 7 lines
I'm not sure whether the clean/dirty status is data plane or control plane either. I don't think the terms have a well-defined meaning in terms of storage. In the networking world, stuff like routing protocols (OSPF, BGP, etc.) is control plane, and based on this analogy dirty bitmaps seem like control plane to me.
Quoted 6 lines
So I wouldn't rule out QMP-based export of the dirty bitmap---either directly or optimized through a separate socket as in
http://article.gmane.org/gmane.comp.emulators.qemu/397083. Dirty bitmaps should also compress well, so perhaps gzip+base64 over JSON might work as well. I'm not saying we certainly won't regret it, but it seems "less different". Don't really know how to put it better...
One more side point here: a backup archive is useless until it has fully completed, so in this particular use case, push or pull model doesn't matter in sending the dirty bitmap. But while we are at it, probably just be future proof and do a pull iterface to allow more potential use cases? For example, during data inspecting (a fleecing client is checking whether a particular file in the guest file system has changed), only certain ranges in the dirty bitmap is interesting.
Fam
Quoted 41 lines · Paolo Bonzini
Quoted 24 lines · Paolo Bonzini
Quoted 4 lines · Markus Armbruster
I completely agree with you that Get LBA Status cannot just reflect the top layer. But that's not what I meant to propose. Let me try to explain myself more clearly.
Quoted 8 lines
Consider a QCOW2 image D (for delta) with a backing file B (for base). If you open it normally, you see "D over B". Get LBA Status should certainly claim the "deallocated" state only for blocks that are allocated neither in D nor B.
However, you can also open D *without* its backing file. Then you see "D over nothing". Here, get LBA Status should claim "deallocated" state for anything not allocated in D.
Ok, this makes more sense.
The question then is whether to implement this NBD server inside QEMU, or outside it as a separate process to which QEMU "pushes" blocks as in the existing backup job. I would prefer the latter, so that it is possible to implement various APIs (get block status, but also VMware or Parallels or whatever).
Quoted 3 lines
Basically the same points made in
https://lists.gnu.org/archive/html/qemu-devel/2013-03/msg01969.html
still apply.Talked a bit to Fam now and I noted Denis's observation that QEMU would still use the backup block job, plus the NBD server as in Fam's fleecing. Then the NBD server is already the
push->pulladapter. It's a bit clearer now.Opening D without backing file still feels a bit weird, because the NBD server would provide wrong data for clean blocks. I would think that a "stupid" backup software could always ignore the get LBA status command and get a full backup. Is this a requirement or not, and if not, why?
Quoted 4 lines
I don't have any particular opinion against an NBD get LBA status command that returns deallocated/allocated _and_ clean/dirty. But reusing one as the other feels like the kind of hack that seems clever and that you regret down the road.
I suggest giving the new NBD command a "type" argument:
0 - SCSI mapped/anchored values according to SCSI Get LBA Status
1 - Dirty/clean, useful for incremental backup and other blocking tracking cases
This way we don't impinge on SCSI semantics and the command can be used for both traditional logical block provisioning and dirty bitmap info.
When the NBD export is started in QEMU you can optionally associate it with a bitmap. This bitmap is used to provide type=1 (dirty/clean) status information.
Stefan
Quoted 11 lines · Stefan Hajnoczi
I suggest giving the new NBD command a "type" argument:
0 - SCSI mapped/anchored values according to SCSI Get LBA Status
1 - Dirty/clean, useful for incremental backup and other blocking tracking casesThis way we don't impinge on SCSI semantics and the command can be used for both traditional logical block provisioning and dirty bitmap info.
When the NBD export is started in QEMU you can optionally associate it with a bitmap. This bitmap is used to provide type=1 (dirty/clean) status information.
Good idea. The precedent in NBD is to use bits 16..31 of the command for flags, so it could go there.
Paolo
Quoted 10 lines · Paolo Bonzini
Quoted 8 lines · Stefan Hajnoczi
I suggest giving the new NBD command a "type" argument:
0 - SCSI mapped/anchored values according to SCSI Get LBA Status
1 - Dirty/clean, useful for incremental backup and other blocking tracking casesThis way we don't impinge on SCSI semantics and the command can be used for both traditional logical block provisioning and dirty bitmap info.
Quoted 7 lines
Quoted 3 lines
When the NBD export is started in QEMU you can optionally associate it with a bitmap. This bitmap is used to provide type=1 (dirty/clean) status information.
Good idea. The precedent in NBD is to use bits 16..31 of the command for flags, so it could go there.
Paolo
like this too.
Den
Markus Armbruster <[email protected]> writes:
[...]
Quoted 9 lines
Consider a QCOW2 image D (for delta) with a backing file B (for base). If you open it normally, you see "D over B". Get LBA Status should certainly claim the "deallocated" state only for blocks that are allocated neither in D nor B.
However, you can also open D *without* its backing file. Then you see "D over nothing". Here, get LBA Status should claim "deallocated" state for anything not allocated in D.
Quoted 7 lines
My proposal is to expose a "just the dirty blocks" view of a block backend similarly: it's a *separate* backend that contains *only* the dirty blocks. Attempts to read a clean block behave exactly like reading an unmapped block from any other thinly provisioned backend (QCOW2 gives you zeroes, if I remember correctly). I think it's only natural to make Get LBA Status claim "deallocated" for exactly the clean blocks then.
Regarding implementation: perhaps we can have a "bitmap filter" block driver that masks out blocks based on a bitmap. Read-only, at least until somebody comes up with sane semantics for writing, and a use case :)
Digression: masking out blocks based on a bitmap is is vaguely similar to how a COW block driver replaces blocks based on delta. What makes such a COW block driver a *format* is persistence. Same for bitmap filters. The question whether we want a bitmap filter *format* is being discussed elsewhere. Even if the answer should be "no", we could still have a non-persistent filter if it's useful.
[...]