diff options
Diffstat (limited to 'blockdev.c')
-rw-r--r-- | blockdev.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/blockdev.c b/blockdev.c index 2ef731b1f7..b7c1449146 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1984,6 +1984,7 @@ static void block_dirty_bitmap_add_prepare(BlkActionState *common, qmp_block_dirty_bitmap_add(action->node, action->name, action->has_granularity, action->granularity, action->has_persistent, action->persistent, + action->has_autoload, action->autoload, &local_err); if (!local_err) { @@ -2710,6 +2711,7 @@ out: void qmp_block_dirty_bitmap_add(const char *node, const char *name, bool has_granularity, uint32_t granularity, bool has_persistent, bool persistent, + bool has_autoload, bool autoload, Error **errp) { BlockDriverState *bs; @@ -2739,6 +2741,15 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name, if (!has_persistent) { persistent = false; } + if (!has_autoload) { + autoload = false; + } + + if (has_autoload && !persistent) { + error_setg(errp, "Autoload flag must be used only for persistent " + "bitmaps"); + return; + } if (persistent && !bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp)) @@ -2747,9 +2758,12 @@ void qmp_block_dirty_bitmap_add(const char *node, const char *name, } bitmap = bdrv_create_dirty_bitmap(bs, granularity, name, errp); - if (bitmap != NULL) { - bdrv_dirty_bitmap_set_persistance(bitmap, persistent); + if (bitmap == NULL) { + return; } + + bdrv_dirty_bitmap_set_persistance(bitmap, persistent); + bdrv_dirty_bitmap_set_autoload(bitmap, autoload); } void qmp_block_dirty_bitmap_remove(const char *node, const char *name, |