From 4db6ceb0b594e179fcbd46a351b8cebaa840bf0d Mon Sep 17 00:00:00 2001 From: John Snow Date: Tue, 12 Mar 2019 12:05:48 -0400 Subject: block/dirty-bitmap: add recording and busy properties The current API allows us to report a single status, which we've defined as: Frozen: has a successor, treated as qmp_locked, may or may not be enabled. Locked: no successor, qmp_locked. may or may not be enabled. Disabled: Not frozen or locked, disabled. Active: Not frozen, locked, or disabled. The problem is that both "Frozen" and "Locked" mean nearly the same thing, and that both of them do not intuit whether they are recording guest writes or not. This patch deprecates that status field and introduces two orthogonal properties instead to replace it. Signed-off-by: John Snow Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20190223000614.13894-2-jsnow@redhat.com Signed-off-by: John Snow --- qapi/block-core.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'qapi') diff --git a/qapi/block-core.json b/qapi/block-core.json index 919d0530b2..01a9d0b345 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -467,7 +467,14 @@ # # @granularity: granularity of the dirty bitmap in bytes (since 1.4) # -# @status: current status of the dirty bitmap (since 2.4) +# @status: Deprecated in favor of @recording and @locked. (since 2.4) +# +# @recording: true if the bitmap is recording new writes from the guest. +# Replaces `active` and `disabled` statuses. (since 4.0) +# +# @busy: true if the bitmap is in-use by some operation (NBD or jobs) +# and cannot be modified via QMP or used by another operation. +# Replaces `locked` and `frozen` statuses. (since 4.0) # # @persistent: true if the bitmap will eventually be flushed to persistent # storage (since 4.0) @@ -476,6 +483,7 @@ ## { 'struct': 'BlockDirtyInfo', 'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32', + 'recording': 'bool', 'busy': 'bool', 'status': 'DirtyBitmapStatus', 'persistent': 'bool' } } ## -- cgit v1.2.3 From b0f455599d0f092abc11aa3daba693be1453d29a Mon Sep 17 00:00:00 2001 From: John Snow Date: Tue, 12 Mar 2019 12:05:49 -0400 Subject: block/dirty-bitmaps: add inconsistent bit Add an inconsistent bit to dirty-bitmaps that allows us to report a bitmap as persistent but potentially inconsistent, i.e. if we find bitmaps on a qcow2 that have been marked as "in use". Signed-off-by: John Snow Reviewed-by: Eric Blake Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20190301191545.8728-2-jsnow@redhat.com Signed-off-by: John Snow --- qapi/block-core.json | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'qapi') diff --git a/qapi/block-core.json b/qapi/block-core.json index 01a9d0b345..1a1c52765a 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -476,15 +476,20 @@ # and cannot be modified via QMP or used by another operation. # Replaces `locked` and `frozen` statuses. (since 4.0) # -# @persistent: true if the bitmap will eventually be flushed to persistent -# storage (since 4.0) +# @persistent: true if the bitmap was stored on disk, is scheduled to be stored +# on disk, or both. (since 4.0) +# +# @inconsistent: true if this is a persistent bitmap that was improperly +# stored. Implies @persistent to be true; @recording and +# @busy to be false. This bitmap cannot be used. To remove +# it, use @block-dirty-bitmap-remove. (Since 4.0) # # Since: 1.3 ## { 'struct': 'BlockDirtyInfo', 'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32', - 'recording': 'bool', 'busy': 'bool', - 'status': 'DirtyBitmapStatus', 'persistent': 'bool' } } + 'recording': 'bool', 'busy': 'bool', 'status': 'DirtyBitmapStatus', + 'persistent': 'bool', '*inconsistent': 'bool' } } ## # @Qcow2BitmapInfoFlags: -- cgit v1.2.3 From 0064cfefa4e90c11e394befb7abe47602f2f30d7 Mon Sep 17 00:00:00 2001 From: John Snow Date: Tue, 12 Mar 2019 12:05:49 -0400 Subject: block/dirty-bitmap: add inconsistent status Even though the status field is deprecated, we still have to support it for a few more releases. Since this is a very new kind of bitmap state, it makes sense for it to have its own status field. Reviewed-by: Eric Blake Signed-off-by: John Snow Reviewed-by: Vladimir Sementsov-Ogievskiy Message-id: 20190301191545.8728-3-jsnow@redhat.com Signed-off-by: John Snow --- qapi/block-core.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'qapi') diff --git a/qapi/block-core.json b/qapi/block-core.json index 1a1c52765a..bbb9dcc141 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -451,10 +451,15 @@ # recording new writes. If the bitmap was @disabled, it is not # recording new writes. (Since 2.12) # +# @inconsistent: This is a persistent dirty bitmap that was marked in-use on +# disk, and is unusable by QEMU. It can only be deleted. +# Please rely on the inconsistent field in @BlockDirtyInfo +# instead, as the status field is deprecated. (Since 4.0) +# # Since: 2.4 ## { 'enum': 'DirtyBitmapStatus', - 'data': ['active', 'disabled', 'frozen', 'locked'] } + 'data': ['active', 'disabled', 'frozen', 'locked', 'inconsistent'] } ## # @BlockDirtyInfo: -- cgit v1.2.3