diff mbox

[v4,13/17] qcow2/overlaps: Add "memory limit reached" event

Message ID 1430766953-6913-14-git-send-email-mreitz@redhat.com
State New
Headers show

Commit Message

Max Reitz May 4, 2015, 7:15 p.m. UTC
Later, a mechanism to set a limit on how much memory may be used for the
overlap prevention structures will be introduced. If that limit is about
to be exceeded, a QMP event should be emitted. This very event is
specified by this patch.

Signed-off-by: Max Reitz <mreitz@redhat.com>
---
 docs/qmp/qmp-events.txt | 28 ++++++++++++++++++++++++++++
 qapi/event.json         | 27 +++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)

Comments

Eric Blake May 4, 2015, 7:32 p.m. UTC | #1
On 05/04/2015 01:15 PM, Max Reitz wrote:
> Later, a mechanism to set a limit on how much memory may be used for the
> overlap prevention structures will be introduced. If that limit is about
> to be exceeded, a QMP event should be emitted. This very event is
> specified by this patch.
> 
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
>  docs/qmp/qmp-events.txt | 28 ++++++++++++++++++++++++++++
>  qapi/event.json         | 27 +++++++++++++++++++++++++++
>  2 files changed, 55 insertions(+)

> +
> +Data:
> +- "reference": Device name if set; node name otherwise. (json-string)
> +- "start":     Offset of the range of clusters (possibly) no longer being
> +               checked for writes overlapping with existing metadata.
> +               (json-int, optional)
> +- "length":    Length of that range in bytes. (json-int, optional)
> +
> +Example:
> +
> +{ "event": "QCOW2_OVERLAP_CHECK_MEMORY_LIMIT_REACHED",
> +    "data": { "reference": "virtio0", "start": "805306368",
> +              "length": "268435456" },

s/"805306368"/805306368/ and likewise for length (a json-int does not
use quotes).

Otherwise seems okay.
Max Reitz May 6, 2015, 1:05 p.m. UTC | #2
On 04.05.2015 21:32, Eric Blake wrote:
> On 05/04/2015 01:15 PM, Max Reitz wrote:
>> Later, a mechanism to set a limit on how much memory may be used for the
>> overlap prevention structures will be introduced. If that limit is about
>> to be exceeded, a QMP event should be emitted. This very event is
>> specified by this patch.
>>
>> Signed-off-by: Max Reitz <mreitz@redhat.com>
>> ---
>>   docs/qmp/qmp-events.txt | 28 ++++++++++++++++++++++++++++
>>   qapi/event.json         | 27 +++++++++++++++++++++++++++
>>   2 files changed, 55 insertions(+)
>> +
>> +Data:
>> +- "reference": Device name if set; node name otherwise. (json-string)
>> +- "start":     Offset of the range of clusters (possibly) no longer being
>> +               checked for writes overlapping with existing metadata.
>> +               (json-int, optional)
>> +- "length":    Length of that range in bytes. (json-int, optional)
>> +
>> +Example:
>> +
>> +{ "event": "QCOW2_OVERLAP_CHECK_MEMORY_LIMIT_REACHED",
>> +    "data": { "reference": "virtio0", "start": "805306368",
>> +              "length": "268435456" },
> s/"805306368"/805306368/ and likewise for length (a json-int does not
> use quotes).

Oops, right. Will fix.

> Otherwise seems okay.

Good, thanks :-)

Max
diff mbox

Patch

diff --git a/docs/qmp/qmp-events.txt b/docs/qmp/qmp-events.txt
index b19e490..4ec257e 100644
--- a/docs/qmp/qmp-events.txt
+++ b/docs/qmp/qmp-events.txt
@@ -261,6 +261,34 @@  Example:
 { "event": "POWERDOWN",
     "timestamp": { "seconds": 1267040730, "microseconds": 682951 } }
 
+QCOW2_OVERLAP_CHECK_MEMORY_LIMIT_REACHED
+----------------------------------------
+
+Emitted by the qcow2 block driver if the preset size limit for the in-memory
+structures for metadata overlap prevention has been reached and an allocation
+of further resources has been denied. This means that it cannot be guaranteed
+that overlap checks will be performed for the specified range; if no range is
+given, no checks can be expected to be performed whatsoever.
+
+Note that this event does not guarantee that no check will be performed in the
+given range (or on the whole image, if no range is given), but only signals the
+possibility that this might be the case. The ability to check the full range or
+a part of it may be restored at any point in time.
+
+Data:
+- "reference": Device name if set; node name otherwise. (json-string)
+- "start":     Offset of the range of clusters (possibly) no longer being
+               checked for writes overlapping with existing metadata.
+               (json-int, optional)
+- "length":    Length of that range in bytes. (json-int, optional)
+
+Example:
+
+{ "event": "QCOW2_OVERLAP_CHECK_MEMORY_LIMIT_REACHED",
+    "data": { "reference": "virtio0", "start": "805306368",
+              "length": "268435456" },
+    "timestamp": { "seconds": 1429331400, "microseconds": 519454 } }
+
 QUORUM_FAILURE
 --------------
 
diff --git a/qapi/event.json b/qapi/event.json
index c51dc49..a6cd053 100644
--- a/qapi/event.json
+++ b/qapi/event.json
@@ -330,3 +330,30 @@ 
 ##
 { 'event': 'VSERPORT_CHANGE',
   'data': { 'id': 'str', 'open': 'bool' } }
+
+##
+# @QCOW2_OVERLAP_CHECK_MEMORY_LIMIT_REACHED
+#
+# Emitted by the qcow2 block driver if the preset size limit for the in-memory
+# structures for metadata overlap prevention has been reached and an allocation
+# of further resources has been denied. This means that no overlap checks will
+# be performed for the specified range.
+#
+# Note that this event does not guarantee that no check will be performed in the
+# given range (or on the whole image, if no range is given), but only signals
+# the possibility that this might be the case. The ability to check the full
+# range or a part of it may be restored at any point in time.
+#
+# @reference: device name if set; node name otherwise
+#
+# @start:     #optional offset of the range of clusters (possibly) no longer
+#             being checked for writes overlapping with existing metadata
+#
+# @length:    #optional length of that range in bytes
+#
+# Since: 2.4
+##
+{ 'event': 'QCOW2_OVERLAP_CHECK_MEMORY_LIMIT_REACHED',
+  'data': { 'reference': 'str',
+            '*start':    'int',
+            '*length':   'int' } }