Skip to contentSkip to conversation

Don't QAPI without need

PATCH In review Markus Armbruster 6 participants 14 messages Jul 28, 2017 – Dec 15, 2017

lore
Share & tools
lore
#0 lore raw

cover Don't QAPI without need

These are pretty trivial, probably simplest if I take them through my tree.

Markus Armbruster (3):
replay: Define ReplayMode without QAPI
COLO: Define COLOMode without QAPI
block: Remove unused BlockDeviceMapEntry

 include/migration/colo.h |  6 ++++++
 include/sysemu/replay.h  |  6 ++++++
 qapi-schema.json         | 34 ----------------------------------
 qapi/block-core.json     | 29 -----------------------------
 4 files changed, 12 insertions(+), 63 deletions(-)
Signature · 1 line
2.7.5
#1 lore raw

PATCH 1/3 replay: Define ReplayMode without QAPI

ReplayMode is defined in the QAPI schema, but not used there. Of the stuff QAPI generates for it only the typedef is actually used. Use of QAPI is pointless and only complicates things, so don't.

---
 include/sysemu/replay.h |  6 ++++++
 qapi-schema.json        | 18 ------------------
 2 files changed, 6 insertions(+), 18 deletions(-)
include/sysemu/replay.h +6 -0
index fa14d0e..621bc61 100644
@@ -42,6 +42,12 @@ typedef enum ReplayCheckpoint ReplayCheckpoint;
 
 typedef struct ReplayNetState ReplayNetState;
 
+typedef enum {
+    REPLAY_MODE_NONE,           /* replay / record disabled */
+    REPLAY_MODE_RECORD,         /* recording to replay log */
+    REPLAY_MODE_PLAY,           /* replaying log */
+} ReplayMode;
+
 extern ReplayMode replay_mode;
 
 /* Name of the initial VM snapshot */
qapi-schema.json +0 -18
index 9c6c3e1..9b6f6cb 100644
@@ -6258,24 +6258,6 @@
 { 'include': 'qapi/rocker.json' }
 
 ##
-# @ReplayMode:
-#
-# Mode of the replay subsystem.
-#
-# @none: normal execution mode. Replay or record are not enabled.
-#
-# @record: record mode. All non-deterministic data is written into the
-#          replay log.
-#
-# @play: replay mode. Non-deterministic data required for system execution
-#        is read from the log.
-#
-# Since: 2.5
-##
-{ 'enum': 'ReplayMode',
-  'data': [ 'none', 'record', 'play' ] }
-
-##
 # @xen-load-devices-state:
 #
 # Load the state of all devices from file. The RAM and the block devices
Signature · 1 line
2.7.5
#2 lore raw

Re: [Qemu-devel] [PATCH 1/3] replay: Define ReplayMode without QAPI

Quoted 4 lines

From: Markus Armbruster [mailto:[email protected]] ReplayMode is defined in the QAPI schema, but not used there. Of the stuff QAPI generates for it only the typedef is actually used. Use of QAPI is pointless and only complicates things, so don't.

This a bit useless now, but we plan to add more patches that include QAPI commands for controlling and inspecting the record/replay process.

Pavel Dovgalyuk

Quoted 56 lines
---
 include/sysemu/replay.h |  6 ++++++
 qapi-schema.json        | 18 ------------------
 2 files changed, 6 insertions(+), 18 deletions(-)
include/sysemu/replay.h +6 -0
index fa14d0e..621bc61 100644
@@ -42,6 +42,12 @@ typedef enum ReplayCheckpoint ReplayCheckpoint;
 
 typedef struct ReplayNetState ReplayNetState;
 
+typedef enum {
+    REPLAY_MODE_NONE,           /* replay / record disabled */
+    REPLAY_MODE_RECORD,         /* recording to replay log */
+    REPLAY_MODE_PLAY,           /* replaying log */
+} ReplayMode;
+
 extern ReplayMode replay_mode;
 
 /* Name of the initial VM snapshot */
qapi-schema.json +0 -19
index 9c6c3e1..9b6f6cb 100644
@@ -6258,24 +6258,6 @@
 { 'include': 'qapi/rocker.json' }
 
 ##
-# @ReplayMode:
-#
-# Mode of the replay subsystem.
-#
-# @none: normal execution mode. Replay or record are not enabled.
-#
-# @record: record mode. All non-deterministic data is written into the
-#          replay log.
-#
-# @play: replay mode. Non-deterministic data required for system execution
-#        is read from the log.
-#
-# Since: 2.5
-##
-{ 'enum': 'ReplayMode',
-  'data': [ 'none', 'record', 'play' ] }
-
-##
 # @xen-load-devices-state:
 #
 # Load the state of all devices from file. The RAM and the block devices
--

2.7.5

#3 lore raw

Re: [Qemu-devel] [PATCH 1/3] replay: Define ReplayMode without QAPI

Quoted 7 lines · Pavel Dovgalyuk
Quoted 4 lines

From: Markus Armbruster [mailto:[email protected]] ReplayMode is defined in the QAPI schema, but not used there. Of the stuff QAPI generates for it only the typedef is actually used. Use of QAPI is pointless and only complicates things, so don't.

This a bit useless now, but we plan to add more patches that include QAPI commands for controlling and inspecting the record/replay process.

I assume YAGNI until proven otherwise.

Posting patches putting ReplayMode to use could serve as proof.

#4 lore raw

Re: [Qemu-devel] [PATCH 1/3] replay: Define ReplayMode without QAPI

Quoted 8 lines

From: Markus Armbruster [mailto:[email protected]]

Quoted 5 lines · Pavel Dovgalyuk
Quoted 4 lines

From: Markus Armbruster [mailto:[email protected]] ReplayMode is defined in the QAPI schema, but not used there. Of the stuff QAPI generates for it only the typedef is actually used. Use of QAPI is pointless and only complicates things, so don't.

Quoted 6 lines
Quoted 2 lines

This a bit useless now, but we plan to add more patches that include QAPI commands for controlling and inspecting the record/replay process.

I assume YAGNI until proven otherwise.

Posting patches putting ReplayMode to use could serve as proof.

This is a sample of not yet included patch.

https://lists.nongnu.org/archive/html/qemu-devel/2014-07/msg04278.html

Pavel Dovgalyuk

#5 lore raw

PATCH 2/3 COLO: Define COLOMode without QAPI

In reply to Markus Armbruster

COLOMode is defined in the QAPI schema, but not used there. Of the stuff QAPI generates for it only the typedef is actually used. Use of QAPI is pointless and only complicates things, so don't.

---
 include/migration/colo.h |  6 ++++++
 qapi-schema.json         | 16 ----------------
 2 files changed, 6 insertions(+), 16 deletions(-)
include/migration/colo.h +6 -0
index ff9874e..5d7c500 100644
@@ -26,6 +26,12 @@ void migration_incoming_exit_colo(void);
 void *colo_process_incoming_thread(void *opaque);
 bool migration_incoming_in_colo_state(void);
 
+typedef enum {
+    COLO_MODE_UNKNOWN,
+    COLO_MODE_PRIMARY,
+    COLO_MODE_SECONDARY,
+} COLOMode;
+
 COLOMode get_colo_mode(void);
 
 /* failover */
qapi-schema.json +0 -16
index 9b6f6cb..3f0eb05 100644
@@ -1304,22 +1304,6 @@
             'vmstate-loaded' ] }
 
 ##
-# @COLOMode:
-#
-# The colo mode
-#
-# @unknown: unknown mode
-#
-# @primary: master side
-#
-# @secondary: slave side
-#
-# Since: 2.8
-##
-{ 'enum': 'COLOMode',
-  'data': [ 'unknown', 'primary', 'secondary'] }
-
-##
 # @FailoverStatus:
 #
 # An enumeration of COLO failover status
Signature · 1 line
2.7.5
#6 lore raw

Re: [Qemu-devel] [PATCH 2/3] COLO: Define COLOMode without QAPI

Quoted 3 lines · * Markus Armbruster ([email protected]) wrote:

COLOMode is defined in the QAPI schema, but not used there. Of the stuff QAPI generates for it only the typedef is actually used. Use of QAPI is pointless and only complicates things, so don't.

Hmm, in one of the old COLO worlds I have, there's code to emit an event on exiting from COLO and that event includes the mode it was in.

If the intent is to bring that or similar back then it would be worth keeping.

Dave

Quoted 55 lines
---
 include/migration/colo.h |  6 ++++++
 qapi-schema.json         | 16 ----------------
 2 files changed, 6 insertions(+), 16 deletions(-)
include/migration/colo.h +6 -0
index ff9874e..5d7c500 100644
@@ -26,6 +26,12 @@ void migration_incoming_exit_colo(void);
 void *colo_process_incoming_thread(void *opaque);
 bool migration_incoming_in_colo_state(void);
 
+typedef enum {
+    COLO_MODE_UNKNOWN,
+    COLO_MODE_PRIMARY,
+    COLO_MODE_SECONDARY,
+} COLOMode;
+
 COLOMode get_colo_mode(void);
 
 /* failover */
qapi-schema.json +0 -16
index 9b6f6cb..3f0eb05 100644
@@ -1304,22 +1304,6 @@
             'vmstate-loaded' ] }
 
 ##
-# @COLOMode:
-#
-# The colo mode
-#
-# @unknown: unknown mode
-#
-# @primary: master side
-#
-# @secondary: slave side
-#
-# Since: 2.8
-##
-{ 'enum': 'COLOMode',
-  'data': [ 'unknown', 'primary', 'secondary'] }
-
-##
 # @FailoverStatus:
 #
 # An enumeration of COLO failover status
Signature · 1 line
2.7.5

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

#7 lore raw

Re: [Qemu-devel] [PATCH 2/3] COLO: Define COLOMode without QAPI

Quoted 10 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Markus Armbruster ([email protected]) wrote:

COLOMode is defined in the QAPI schema, but not used there. Of the stuff QAPI generates for it only the typedef is actually used. Use of QAPI is pointless and only complicates things, so don't.

Hmm, in one of the old COLO worlds I have, there's code to emit an event on exiting from COLO and that event includes the mode it was in.

If the intent is to bring that or similar back then it would be worth keeping.

We can always revert the removal once there is a user.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#8 lore raw

Re: [Qemu-devel] [PATCH 2/3] COLO: Define COLOMode without QAPI

Quoted 6 lines · Eric Blake
Quoted 5 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Markus Armbruster ([email protected]) wrote:

COLOMode is defined in the QAPI schema, but not used there. Of the stuff QAPI generates for it only the typedef is actually used. Use of QAPI is pointless and only complicates things, so don't.

Quoted 7 lines
Quoted 5 lines

Hmm, in one of the old COLO worlds I have, there's code to emit an event on exiting from COLO and that event includes the mode it was in.

If the intent is to bring that or similar back then it would be worth keeping.

We can always revert the removal once there is a user.

I assume YAGNI until proven otherwise.

Posting patches putting COLOMode to use could serve as proof.

#9 lore raw

Re: [Qemu-devel] [PATCH 2/3] COLO: Define COLOMode without QAPI

In reply to Dr. David Alan Gilbert
Quoted 6 lines · Dr. David Alan Gilbert
Quoted 3 lines · * Markus Armbruster ([email protected]) wrote:

COLOMode is defined in the QAPI schema, but not used there. Of the stuff QAPI generates for it only the typedef is actually used. Use of QAPI is pointless and only complicates things, so don't.

Hmm, in one of the old COLO worlds I have, there's code to emit an event on exiting from COLO and that event includes the mode it was in.

Yes, we need it in the later series.

Quoted 2 lines

If the intent is to bring that or similar back then it would be worth keeping.

Agreed. ;)

Quoted 62 lines

Dave

Quoted 55 lines
---
  include/migration/colo.h |  6 ++++++
  qapi-schema.json         | 16 ----------------
  2 files changed, 6 insertions(+), 16 deletions(-)
include/migration/colo.h +6 -0
index ff9874e..5d7c500 100644
@@ -26,6 +26,12 @@ void migration_incoming_exit_colo(void);
  void *colo_process_incoming_thread(void *opaque);
  bool migration_incoming_in_colo_state(void);
 
+typedef enum {
+    COLO_MODE_UNKNOWN,
+    COLO_MODE_PRIMARY,
+    COLO_MODE_SECONDARY,
+} COLOMode;
+
  COLOMode get_colo_mode(void);
 
  /* failover */
qapi-schema.json +0 -16
index 9b6f6cb..3f0eb05 100644
@@ -1304,22 +1304,6 @@
              'vmstate-loaded' ] }
 
  ##
-# @COLOMode:
-#
-# The colo mode
-#
-# @unknown: unknown mode
-#
-# @primary: master side
-#
-# @secondary: slave side
-#
-# Since: 2.8
-##
-{ 'enum': 'COLOMode',
-  'data': [ 'unknown', 'primary', 'secondary'] }
-
-##
  # @FailoverStatus:
  #
  # An enumeration of COLO failover status
Signature · 1 line
2.7.5

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK

.

#10 lore raw

PATCH 3/3 block: Remove unused BlockDeviceMapEntry

In reply to Markus Armbruster

BlockDeviceMapEntry has never been used. It was added in commit facd6e2 "so that it is published through the introspection mechanism." What exactly introspecting types that aren't used for anything could accomplish isn't clear. What "introspection mechanism" to use is also nebulous. To the best of my knowledge, there has never been one that covered this type. Certainly not query-qmp-schema, which includes only types that are actually used in QMP.

Not being able to introspect BlockDeviceMapEntry hasn't bothered anyone enough to complain in almost four years. Get rid of it.

---
 qapi/block-core.json | 29 -----------------------------
 1 file changed, 29 deletions(-)
qapi/block-core.json +0 -29
index 833c602..27790f3 100644
@@ -383,35 +383,6 @@
 { 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] }
 
 ##
-# @BlockDeviceMapEntry:
-#
-# Entry in the metadata map of the device (returned by "qemu-img map")
-#
-# @start: Offset in the image of the first byte described by this entry
-#         (in bytes)
-#
-# @length: Length of the range described by this entry (in bytes)
-#
-# @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.)
-#         before reaching one for which the range is allocated.  The value is
-#         in the range 0 to the depth of the image chain - 1.
-#
-# @zero: the sectors in this range read as zeros
-#
-# @data: reading the image will actually read data from a file (in particular,
-#        if @offset is present this means that the sectors are not simply
-#        preallocated, but contain actual data in raw format)
-#
-# @offset: if present, the image file stores the data for this range in
-#          raw format at the given offset.
-#
-# Since: 1.7
-##
-{ 'struct': 'BlockDeviceMapEntry',
-  'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool',
-            'data': 'bool', '*offset': 'int' } }
-
-##
 # @DirtyBitmapStatus:
 #
 # An enumeration of possible states that a dirty bitmap can report to the user.
Signature · 1 line
2.7.5
#11 lore raw

Re: [Qemu-devel] [PATCH 3/3] block: Remove unused BlockDeviceMapEntry

Quoted 10 lines · Markus Armbruster

BlockDeviceMapEntry has never been used. It was added in commit facd6e2 "so that it is published through the introspection mechanism." What exactly introspecting types that aren't used for anything could accomplish isn't clear. What "introspection mechanism" to use is also nebulous. To the best of my knowledge, there has never been one that covered this type. Certainly not query-qmp-schema, which includes only types that are actually used in QMP.

Not being able to introspect BlockDeviceMapEntry hasn't bothered anyone enough to complain in almost four years. Get rid of it.

This type is the schema for 'qemu-img map --output=json'. And I had a patch once (that I need to revive) that added a JSON Output visitor; at which point I fixed qemu-img to convert from QAPI to JSON instead of open-coding its construction of its output string, at which point the QAPI generated code for this type is useful.

But that's a revert away for when I rebase my series to actually use it; and in the meantime, pruning unused types isn't hurting anything.

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#12 lore raw

Re: [Qemu-devel] [PATCH 3/3] block: Remove unused BlockDeviceMapEntry

Quoted 9 lines · Eric Blake
Quoted 8 lines · Markus Armbruster

BlockDeviceMapEntry has never been used. It was added in commit facd6e2 "so that it is published through the introspection mechanism." What exactly introspecting types that aren't used for anything could accomplish isn't clear. What "introspection mechanism" to use is also nebulous. To the best of my knowledge, there has never been one that covered this type. Certainly not query-qmp-schema, which includes only types that are actually used in QMP.

Quoted 8 lines
Quoted 2 lines

Not being able to introspect BlockDeviceMapEntry hasn't bothered anyone enough to complain in almost four years. Get rid of it.

This type is the schema for 'qemu-img map --output=json'. And I had a patch once (that I need to revive) that added a JSON Output visitor; at which point I fixed qemu-img to convert from QAPI to JSON instead of open-coding its construction of its output string, at which point the QAPI generated code for this type is useful.

(Very late reply, I know, I just stumbled over *MapEntry when looking over block-core.json what we might want to deprecate in 3.0)

We already use MapEntry there -- why don't we output just that instead? The only difference seems to be an additional @filename parameter which would probably be actually nice to include in the output.

Except that BlockDeviceMapEntry's documentation is better, so we should merge that into MapEntry before removing the former.

Max

Reviewed-by on the v1 series
#13 lore raw
In reply to Markus Armbruster
Quoted 8 lines · Markus Armbruster

These are pretty trivial, probably simplest if I take them through my tree.

Markus Armbruster (3):
replay: Define ReplayMode without QAPI
COLO: Define COLOMode without QAPI
block: Remove unused BlockDeviceMapEntry

Quoted 6 lines
 include/migration/colo.h |  6 ++++++
 include/sysemu/replay.h  |  6 ++++++
 qapi-schema.json         | 34 ----------------------------------
 qapi/block-core.json     | 29 -----------------------------
 4 files changed, 12 insertions(+), 63 deletions(-)
Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org