Subject: [PATCH 00/15] qapi: Improve command response documentation
cover Subject: [PATCH 00/15] qapi: Improve command response documentation
We use doc comment "Returns" sections both for success and error response. This series moves the latter to new "Errors" sections. Enables some cleanup, visible in the diffstat.q
Markus Armbruster (13):
qapi: Memorize since & returns sections
qapi: Slightly clearer error message for invalid "Returns" section
qapi: New documentation section tag "Errors"
qapi: Move error documentation to new "Errors" sections
qapi: Delete useless "Returns" sections
qapi: Clean up "Returns" sections
qapi/yank: Tweak @yank's error description for consistency qga/qapi-schema: Move error documentation to new "Errors" sections qga/qapi-schema: Delete useless "Returns" sections qga/qapi-schema: Clean up "Returns" sections qga/qapi-schema: Tweak documentation of fsfreeze commands qga/qapi-schema: Fix guest-set-memory-blocks documentation
qapi: Reject "Returns" section when command doesn't return anything
docs/devel/qapi-code-gen.rst | 6 +- qapi/block-core.json | 74 ++++++++-------------- qapi/block-export.json | 23 ++++--- qapi/block.json | 10 ++- qapi/char.json | 6 -- qapi/dump.json | 2 - qapi/machine-target.json | 37 ++++++----- qapi/machine.json | 19 ++---- qapi/migration.json | 26 -------- qapi/misc-target.json | 3 - qapi/misc.json | 25 +++----- qapi/net.json | 17 +++-- qapi/qdev.json | 3 +- qapi/qom.json | 6 +- qapi/run-state.json | 5 +- qapi/tpm.json | 2 - qapi/transaction.json | 5 +- qapi/ui.json | 17 +---- qapi/yank.json | 5 +- qga/qapi-schema.json | 72 +++++++++------------ scripts/qapi/parser.py | 50 ++++++++++----- tests/qapi-schema/doc-good.json | 2 + tests/qapi-schema/doc-good.out | 2 + tests/qapi-schema/doc-good.txt | 6 ++ tests/qapi-schema/doc-invalid-return.err | 2 +- tests/qapi-schema/doc-invalid-return2.err | 1 + tests/qapi-schema/doc-invalid-return2.json | 7 ++ tests/qapi-schema/doc-invalid-return2.out | 0 tests/qapi-schema/meson.build | 1 + 29 files changed, 189 insertions(+), 245 deletions(-) create mode 100644 tests/qapi-schema/doc-invalid-return2.err create mode 100644 tests/qapi-schema/doc-invalid-return2.json create mode 100644 tests/qapi-schema/doc-invalid-return2.out
Signature · 1 line
2.43.0
PATCH 1/13 qapi: Memorize since & returns sections
This is chiefly to make code that looks up these sections easier to read.
--- scripts/qapi/parser.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-)
scripts/qapi/parser.py +17 -14
@@ -639,6 +639,10 @@ def __init__(self, info: QAPISourceInfo, symbol: Optional[str] = None): # dicts mapping parameter/feature names to their description self.args: Dict[str, QAPIDoc.ArgSection] = {} self.features: Dict[str, QAPIDoc.ArgSection] = {} + # a command's "Returns" section + self.returns: Optional[QAPIDoc.Section] = None + # "Since" section + self.since: Optional[QAPIDoc.Section] = None # sections other than .body, .args, .features self.sections: List[QAPIDoc.Section] = []
@@ -660,14 +664,17 @@ def ensure_untagged_section(self, info: QAPISourceInfo) -> None: self.all_sections.append(section) def new_tagged_section(self, info: QAPISourceInfo, tag: str) -> None: - if tag in ('Returns', 'Since'): - for section in self.all_sections: - if isinstance(section, self.ArgSection): - continue - if section.tag == tag: - raise QAPISemError( - info, "duplicated '%s' section" % tag) section = self.Section(info, tag) + if tag == 'Returns': + if self.returns: + raise QAPISemError( + info, "duplicated '%s' section" % tag) + self.returns = section + elif tag == 'Since': + if self.since: + raise QAPISemError( + info, "duplicated '%s' section" % tag) + self.since = section self.sections.append(section) self.all_sections.append(section)
@@ -708,13 +715,9 @@ def connect_feature(self, feature: 'QAPISchemaFeature') -> None: self.features[feature.name].connect(feature) def check_expr(self, expr: QAPIExpression) -> None: - if 'command' not in expr: - sec = next((sec for sec in self.sections - if sec.tag == 'Returns'), - None) - if sec: - raise QAPISemError(sec.info, - "'Returns:' is only valid for commands") + if self.returns and 'command' not in expr: + raise QAPISemError(self.returns.info, + "'Returns:' is only valid for commands") def check(self) -> None:
Signature · 1 line
2.43.0
PATCH 2/13 qapi: Slightly clearer error message for invalid "Returns" section
In reply to Markus ArmbrusterChange "'Returns:' is only valid for commands" to "'Returns' section is only valid for commands".
--- scripts/qapi/parser.py | 5 +++-- tests/qapi-schema/doc-invalid-return.err | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
scripts/qapi/parser.py +3 -2
@@ -716,8 +716,9 @@ def connect_feature(self, feature: 'QAPISchemaFeature') -> None: def check_expr(self, expr: QAPIExpression) -> None: if self.returns and 'command' not in expr: - raise QAPISemError(self.returns.info, - "'Returns:' is only valid for commands") + raise QAPISemError( + self.returns.info, + "'Returns' section is only valid for commands") def check(self) -> None:
tests/qapi-schema/doc-invalid-return.err +1 -1
@@ -1 +1 @@ -doc-invalid-return.json:6: 'Returns:' is only valid for commands +doc-invalid-return.json:6: 'Returns' section is only valid for commands
Signature · 1 line
2.43.0
PATCH 3/13 qapi: New documentation section tag "Errors"
In reply to Markus ArmbrusterWe use section "Returns" for documenting both success and error response of commands.
I intend to generate better command success response documentation. Easier when "Returns" documents just he success response.
Create new section tag "Errors". The next two commits will move error response documentation from "Returns" sections to "Errors" sections.
--- docs/devel/qapi-code-gen.rst | 6 +++++- scripts/qapi/parser.py | 23 +++++++++++++++++------ tests/qapi-schema/doc-good.json | 2 ++ tests/qapi-schema/doc-good.out | 2 ++ tests/qapi-schema/doc-good.txt | 6 ++++++ 5 files changed, 32 insertions(+), 7 deletions(-)
docs/devel/qapi-code-gen.rst +5 -1
@@ -996,7 +996,8 @@ line "Features:", like this:: A tagged section begins with a paragraph that starts with one of the following words: "Note:"/"Notes:", "Since:", "Example:"/"Examples:", -"Returns:", "TODO:". It ends with the start of a new section. +"Returns:", "Errors:", "TODO:". It ends with the start of a new +section. The second and subsequent lines of tagged sections must be indented like this::
@@ -1007,6 +1008,9 @@ like this:: # Duis aute irure dolor in reprehenderit in voluptate velit esse # cillum dolore eu fugiat nulla pariatur. +"Returns" and "Errors" sections are only valid for commands. They +document the success and the error response, respectively. + A "Since: x.y.z" tagged section lists the release that introduced the definition.
scripts/qapi/parser.py +17 -6
@@ -543,7 +543,7 @@ def get_doc(self) -> 'QAPIDoc': line = self.get_doc_indented(doc) no_more_args = True elif match := re.match( - r'(Returns|Since|Notes?|Examples?|TODO): *', + r'(Returns|Errors|Since|Notes?|Examples?|TODO): *', line): # tagged section doc.new_tagged_section(self.info, match.group(1))
@@ -639,8 +639,9 @@ def __init__(self, info: QAPISourceInfo, symbol: Optional[str] = None): # dicts mapping parameter/feature names to their description self.args: Dict[str, QAPIDoc.ArgSection] = {} self.features: Dict[str, QAPIDoc.ArgSection] = {} - # a command's "Returns" section + # a command's "Returns" and "Errors" section self.returns: Optional[QAPIDoc.Section] = None + self.errors: Optional[QAPIDoc.Section] = None # "Since" section self.since: Optional[QAPIDoc.Section] = None # sections other than .body, .args, .features
@@ -670,6 +671,11 @@ def new_tagged_section(self, info: QAPISourceInfo, tag: str) -> None: raise QAPISemError( info, "duplicated '%s' section" % tag) self.returns = section + elif tag == 'Errors': + if self.errors: + raise QAPISemError( + info, "duplicated '%s' section" % tag) + self.errors = section elif tag == 'Since': if self.since: raise QAPISemError(
@@ -715,10 +721,15 @@ def connect_feature(self, feature: 'QAPISchemaFeature') -> None: self.features[feature.name].connect(feature) def check_expr(self, expr: QAPIExpression) -> None: - if self.returns and 'command' not in expr: - raise QAPISemError( - self.returns.info, - "'Returns' section is only valid for commands") + if 'command' not in expr: + if self.returns: + raise QAPISemError( + self.returns.info, + "'Returns' section is only valid for commands") + if self.errors: + raise QAPISemError( + self.returns.info, + "'Errors' section is only valid for commands") def check(self) -> None:
tests/qapi-schema/doc-good.json +2 -0
@@ -159,6 +159,8 @@ # # Returns: @Object # +# Errors: some +# # TODO: frobnicate # # Notes:
tests/qapi-schema/doc-good.out +2 -0
@@ -173,6 +173,8 @@ another feature @arg3 is undocumented section=Returns @Object + section=Errors +some section=TODO frobnicate section=Notes
tests/qapi-schema/doc-good.txt +6 -0
@@ -206,6 +206,12 @@ Returns "Object" +Errors +~~~~~~ + +some + + Notes ~~~~~
Signature · 1 line
2.43.0
PATCH 4/13 qapi: Move error documentation to new "Errors" sections
In reply to Markus Armbruster--- qapi/block-core.json | 44 ++++++++++++++++++++++++++++++++++++++++ qapi/block-export.json | 23 ++++++++++++--------- qapi/block.json | 8 ++++++-- qapi/machine-target.json | 35 ++++++++++++++++++++------------ qapi/machine.json | 6 ++++++ qapi/misc.json | 10 +++++++-- qapi/net.json | 14 ++++++++++--- qapi/qdev.json | 2 ++ qapi/qom.json | 4 ++++ qapi/transaction.json | 3 ++- qapi/ui.json | 6 ++++++ qapi/yank.json | 2 ++ 12 files changed, 126 insertions(+), 31 deletions(-)
qapi/block-core.json +44 -0
@@ -1458,6 +1458,8 @@ # # Returns: # - nothing on success +# +# Errors: # - If @device is not a valid block device, DeviceNotFound # # Since: 0.14
@@ -1676,6 +1678,8 @@ # # Returns: # - nothing on success +# +# Errors: # - If @device is not a valid block device, DeviceNotFound # # Since: 0.14
@@ -1756,6 +1760,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If "device" does not exist or cannot be determined, # DeviceNotFound #
@@ -1856,6 +1862,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If @device does not exist, DeviceNotFound # - Any other error returns a GenericError. #
@@ -1896,6 +1904,8 @@ # # Returns: # - nothing on success +# +# Errors: # - If @device is not a valid block device, GenericError # # Since: 1.6
@@ -1923,6 +1933,8 @@ # # Returns: # - nothing on success +# +# Errors: # - If @device is not a valid block device, DeviceNotFound # # Since: 2.3
@@ -2129,6 +2141,8 @@ # # Returns: # - nothing on success +# +# Errors: # - If @device is not a valid block device, GenericError # # Since: 1.3
@@ -2306,6 +2320,8 @@ # # Returns: # - nothing on success +# +# Errors: # - If @node is not a valid block device or node, DeviceNotFound # - If @name is already taken, GenericError with an explanation #
@@ -2330,6 +2346,8 @@ # # Returns: # - nothing on success +# +# Errors: # - If @node is not a valid block device or node, DeviceNotFound # - If @name is not found, GenericError with an explanation # - if @name is frozen by an operation, GenericError
@@ -2355,6 +2373,8 @@ # # Returns: # - nothing on success +# +# Errors: # - If @node is not a valid block device, DeviceNotFound # - If @name is not found, GenericError with an explanation #
@@ -2377,6 +2397,8 @@ # # Returns: # - nothing on success +# +# Errors: # - If @node is not a valid block device, DeviceNotFound # - If @name is not found, GenericError with an explanation #
@@ -2399,6 +2421,8 @@ # # Returns: # - nothing on success +# +# Errors: # - If @node is not a valid block device, DeviceNotFound # - If @name is not found, GenericError with an explanation #
@@ -2429,6 +2453,8 @@ # # Returns: # - nothing on success +# +# Errors: # - If @node is not a valid block device, DeviceNotFound # - If any bitmap in @bitmaps or @target is not found, # GenericError
@@ -2471,6 +2497,8 @@ # # Returns: # - BlockDirtyBitmapSha256 on success +# +# Errors: # - If @node is not a valid block device, DeviceNotFound # - If @name is not found or if hashing has failed, GenericError # with an explanation
@@ -2868,6 +2896,8 @@ # # Returns: # - Nothing on success. +# +# Errors: # - If @device does not exist, DeviceNotFound. # # Since: 1.1
@@ -2907,6 +2937,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If no background operation is active on this device, # DeviceNotActive #
@@ -2952,6 +2984,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If no background operation is active on this device, # DeviceNotActive #
@@ -2979,6 +3013,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If no background operation is active on this device, # DeviceNotActive #
@@ -3004,6 +3040,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If no background operation is active on this device, # DeviceNotActive #
@@ -3036,6 +3074,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If no background operation is active on this device, # DeviceNotActive #
@@ -6072,6 +6112,8 @@ # # Returns: # - nothing on success +# +# Errors: # - If @device is not a valid block device, GenericError # - If any snapshot matching @name exists, or @name is empty, # GenericError
@@ -6109,6 +6151,8 @@ # # Returns: # - SnapshotInfo on success +# +# Errors: # - If @device is not a valid block device, GenericError # - If snapshot not found, GenericError # - If the format of the image used does not support it,
qapi/block-export.json +13 -10
@@ -65,7 +65,8 @@ # server from advertising multiple client support (since 5.2; # default: 0). # -# Returns: error if the server is already running. +# Errors: +# - if the server is already running # # Since: 1.3 ##
@@ -247,8 +248,9 @@ # @deprecated: This command is deprecated. Use @block-export-add # instead. # -# Returns: error if the server is not running, or export with the same -# name already exists. +# Errors: +# - if the server is not running +# - if an export with the same name already exists # # Since: 1.3 ##
@@ -294,11 +296,10 @@ # @deprecated: This command is deprecated. Use @block-export-del # instead. # -# Returns: error if -# -# - the server is not running -# - export is not found -# - mode is 'safe' and there are existing connections +# Errors: +# - if the server is not running +# - if export is not found +# - if mode is 'safe' and there are existing connections # # Since: 2.12 ##
@@ -415,8 +416,10 @@ # @mode: Mode of command operation. See @BlockExportRemoveMode # description. Default is 'safe'. # -# Returns: Error if the export is not found or @mode is 'safe' and the -# export is still in use (e.g. by existing client connections) +# Errors: +# - if the export is not found +# - if @mode is 'safe' and the export is still in use (e.g. by +# existing client connections) # # Since: 5.2 ##
qapi/block.json +6 -2
@@ -112,6 +112,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If @device is not a valid block device, DeviceNotFound # # Notes: Ejecting a device with no media results in success
@@ -461,6 +463,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If @device is not a valid block device, DeviceNotFound # # Since: 1.1
@@ -540,8 +544,8 @@ # @boundaries-flush: list of interval boundary values for flush # latency histogram. # -# Returns: error if device is not found or any boundary arrays are -# invalid. +# Errors: +# - if device is not found or any boundary arrays are invalid. # # Since: 4.0 #
qapi/machine-target.json +22 -13
@@ -154,10 +154,13 @@ # Some architectures may not support comparing CPU models. s390x # supports comparing CPU models. # -# Returns: a CpuModelBaselineInfo. Returns an error if comparing CPU -# models is not supported, if a model cannot be used, if a model -# contains an unknown cpu definition name, unknown properties or -# properties with wrong types. +# Returns: a CpuModelBaselineInfo +# +# Errors: +# - if comparing CPU models is not supported +# - if a model cannot be used +# - if a model contains an unknown cpu definition name, unknown +# properties or properties with wrong types. # # Note: this command isn't specific to s390x, but is only implemented # on this architecture currently.
@@ -201,10 +204,13 @@ # Some architectures may not support baselining CPU models. s390x # supports baselining CPU models. # -# Returns: a CpuModelBaselineInfo. Returns an error if baselining CPU -# models is not supported, if a model cannot be used, if a model -# contains an unknown cpu definition name, unknown properties or -# properties with wrong types. +# Returns: a CpuModelBaselineInfo +# +# Errors: +# - if baselining CPU models is not supported +# - if a model cannot be used +# - if a model contains an unknown cpu definition name, unknown +# properties or properties with wrong types. # # Note: this command isn't specific to s390x, but is only implemented # on this architecture currently.
@@ -263,11 +269,14 @@ # Some architectures may not support all expansion types. s390x # supports "full" and "static". Arm only supports "full". # -# Returns: a CpuModelExpansionInfo. Returns an error if expanding CPU -# models is not supported, if the model cannot be expanded, if the -# model contains an unknown CPU definition name, unknown -# properties or properties with a wrong type. Also returns an -# error if an expansion type is not supported. +# Returns: a CpuModelExpansionInfo +# +# Errors: +# - if expanding CPU models is not supported +# - if the model cannot be expanded +# - if the model contains an unknown CPU definition name, unknown +# properties or properties with a wrong type +# - if an expansion type is not supported # # Since: 2.8 ##
qapi/machine.json +6 -0
@@ -1062,6 +1062,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If the balloon driver is enabled but not functional because # the KVM kernel module cannot support it, KVMMissingCap # - If no balloon device is present, DeviceNotActive
@@ -1100,6 +1102,8 @@ # # Returns: # - @BalloonInfo on success +# +# Errors: # - If the balloon driver is enabled but not functional because # the KVM kernel module cannot support it, KVMMissingCap # - If no balloon device is present, DeviceNotActive
@@ -1164,6 +1168,8 @@ # # Returns: # - @HvBalloonInfo on success +# +# Errors: # - If no hv-balloon device is present, guest memory status # reporting is not enabled or no guest memory status report # received yet, GenericError
qapi/misc.json +8 -2
@@ -345,6 +345,8 @@ # # Returns: # - @AddfdInfo on success +# +# Errors: # - If file descriptor was not received, GenericError # - If @fdset-id is a negative value, GenericError #
@@ -376,6 +378,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If @fdset-id or @fd is not found, GenericError # # Since: 1.2
@@ -528,8 +532,10 @@ # @option: option name # # Returns: list of @CommandLineOptionInfo for all options (or for the -# given @option). Returns an error if the given @option doesn't -# exist. +# given @option). +# +# Errors: +# - if the given @option doesn't exist # # Since: 1.5 #
qapi/net.json +11 -3
@@ -19,6 +19,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If @name is not a valid network device, DeviceNotFound # # Since: 0.14
@@ -46,6 +48,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If @type is not a valid network backend, DeviceNotFound # # Example:
@@ -67,6 +71,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If @id is not a valid network backend, DeviceNotFound # # Since: 0.14
@@ -828,9 +834,11 @@ # @name: net client name # # Returns: list of @RxFilterInfo for all NICs (or for the given NIC). -# Returns an error if the given @name doesn't exist, or given NIC -# doesn't support rx-filter querying, or given net client isn't a -# NIC. +# +# Errors: +# - if the given @name doesn't exist +# - if the given NIC doesn't support rx-filter querying +# - if the given net client isn't a NIC # # Since: 1.6 #
qapi/qdev.json +2 -0
@@ -91,6 +91,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If @id is not a valid device, DeviceNotFound # # Notes: When this command completes, the device may not be removed
qapi/qom.json +4 -0
@@ -1058,6 +1058,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - Error if @qom-type is not a valid class name # # Since: 2.0
@@ -1081,6 +1083,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - Error if @id is not a valid id for a QOM object # # Since: 2.0
qapi/transaction.json +2 -1
@@ -236,7 +236,8 @@ # # Returns: nothing on success # -# Errors depend on the operations of the transaction +# Errors: +# Any errors from commands in the transaction # # Note: The transaction aborts on the first failure. Therefore, there # will be information on only one failed operation returned in an
qapi/ui.json +6 -0
@@ -80,6 +80,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If Spice is not enabled, DeviceNotFound # # Since: 0.14
@@ -142,6 +144,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If @protocol is 'spice' and Spice is not active, # DeviceNotFound #
@@ -1038,6 +1042,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - If key is unknown or redundant, GenericError # # Since: 1.3
qapi/yank.json +2 -0
@@ -80,6 +80,8 @@ # # Returns: # - Nothing on success +# +# Errors: # - @DeviceNotFound error, if any of the YankInstances doesn't exist # # Example:
Signature · 1 line
2.43.0
PATCH 5/13 qapi: Delete useless "Returns" sections
In reply to Markus Armbruster--- qapi/block-core.json | 66 ---------------------------------------- qapi/block.json | 6 ---- qapi/char.json | 6 ---- qapi/dump.json | 2 -- qapi/machine-target.json | 2 -- qapi/machine.json | 11 ------- qapi/migration.json | 26 ---------------- qapi/misc-target.json | 3 -- qapi/misc.json | 15 --------- qapi/net.json | 9 ------ qapi/qdev.json | 3 -- qapi/qom.json | 6 ---- qapi/run-state.json | 5 +-- qapi/tpm.json | 2 -- qapi/transaction.json | 2 -- qapi/ui.json | 17 ----------- qapi/yank.json | 3 -- 17 files changed, 1 insertion(+), 183 deletions(-)
qapi/block-core.json +0 -66
@@ -1456,9 +1456,6 @@ # # @size: new image size in bytes # -# Returns: -# - nothing on success -# # Errors: # - If @device is not a valid block device, DeviceNotFound #
@@ -1676,9 +1673,6 @@ # # For the arguments, see the documentation of BlockdevSnapshotSync. # -# Returns: -# - nothing on success -# # Errors: # - If @device is not a valid block device, DeviceNotFound #
@@ -1758,9 +1752,6 @@ # is not validated, so care should be taken when specifying the # string or the image chain may not be able to be reopened again. # -# Returns: -# - Nothing on success -# # Errors: # - If "device" does not exist or cannot be determined, # DeviceNotFound
@@ -1860,9 +1851,6 @@ # @deprecated: Members @base and @top are deprecated. Use @base-node # and @top-node instead. # -# Returns: -# - Nothing on success -# # Errors: # - If @device does not exist, DeviceNotFound # - Any other error returns a GenericError.
@@ -1902,9 +1890,6 @@ # @deprecated: This command is deprecated. Use @blockdev-backup # instead. # -# Returns: -# - nothing on success -# # Errors: # - If @device is not a valid block device, GenericError #
@@ -1931,9 +1916,6 @@ # 'backup'. The operation can be stopped before it has completed using # the block-job-cancel command. # -# Returns: -# - nothing on success -# # Errors: # - If @device is not a valid block device, DeviceNotFound #
@@ -2139,9 +2121,6 @@ # specifies the format of the mirror image, default is to probe if # mode='existing', else the format of the source. # -# Returns: -# - nothing on success -# # Errors: # - If @device is not a valid block device, GenericError #
@@ -2318,9 +2297,6 @@ # Create a dirty bitmap with a name on the node, and start tracking # the writes. # -# Returns: -# - nothing on success -# # Errors: # - If @node is not a valid block device or node, DeviceNotFound # - If @name is already taken, GenericError with an explanation
@@ -2344,9 +2320,6 @@ # with block-dirty-bitmap-add. If the bitmap is persistent, remove it # from its storage too. # -# Returns: -# - nothing on success -# # Errors: # - If @node is not a valid block device or node, DeviceNotFound # - If @name is not found, GenericError with an explanation
@@ -2371,9 +2344,6 @@ # backup from this point in time forward will only backup clusters # modified after this clear operation. # -# Returns: -# - nothing on success -# # Errors: # - If @node is not a valid block device, DeviceNotFound # - If @name is not found, GenericError with an explanation
@@ -2395,9 +2365,6 @@ # # Enables a dirty bitmap so that it will begin tracking disk changes. # -# Returns: -# - nothing on success -# # Errors: # - If @node is not a valid block device, DeviceNotFound # - If @name is not found, GenericError with an explanation
@@ -2419,9 +2386,6 @@ # # Disables a dirty bitmap so that it will stop tracking disk changes. # -# Returns: -# - nothing on success -# # Errors: # - If @node is not a valid block device, DeviceNotFound # - If @name is not found, GenericError with an explanation
@@ -2451,9 +2415,6 @@ # dirty in any of the source bitmaps. This can be used to achieve # backup checkpoints, or in simpler usages, to copy bitmaps. # -# Returns: -# - nothing on success -# # Errors: # - If @node is not a valid block device, DeviceNotFound # - If any bitmap in @bitmaps or @target is not found,
@@ -2570,8 +2531,6 @@ # disappear from the query list without user intervention. # Defaults to true. (Since 3.1) # -# Returns: nothing on success. -# # Since: 2.6 # # Example:
@@ -2894,9 +2853,6 @@ # disappear from the query list without user intervention. # Defaults to true. (Since 3.1) # -# Returns: -# - Nothing on success. -# # Errors: # - If @device does not exist, DeviceNotFound. #
@@ -2935,9 +2891,6 @@ # @speed: the maximum speed, in bytes per second, or 0 for unlimited. # Defaults to 0. # -# Returns: -# - Nothing on success -# # Errors: # - If no background operation is active on this device, # DeviceNotActive
@@ -2982,9 +2935,6 @@ # paused) instead of waiting for the destination to complete its # final synchronization (since 1.3) # -# Returns: -# - Nothing on success -# # Errors: # - If no background operation is active on this device, # DeviceNotActive
@@ -3011,9 +2961,6 @@ # the name of the parameter), but since QEMU 2.7 it can have other # values. # -# Returns: -# - Nothing on success -# # Errors: # - If no background operation is active on this device, # DeviceNotActive
@@ -3038,9 +2985,6 @@ # the name of the parameter), but since QEMU 2.7 it can have other # values. # -# Returns: -# - Nothing on success -# # Errors: # - If no background operation is active on this device, # DeviceNotActive
@@ -3072,9 +3016,6 @@ # the name of the parameter), but since QEMU 2.7 it can have other # values. # -# Returns: -# - Nothing on success -# # Errors: # - If no background operation is active on this device, # DeviceNotActive
@@ -3099,8 +3040,6 @@ # # @id: The job identifier. # -# Returns: Nothing on success -# # Since: 2.12 ## { 'command': 'block-job-dismiss', 'data': { 'id': 'str' },
@@ -3118,8 +3057,6 @@ # # @id: The job identifier. # -# Returns: Nothing on success -# # Since: 2.12 ## { 'command': 'block-job-finalize', 'data': { 'id': 'str' },
@@ -6110,9 +6047,6 @@ # For the arguments, see the documentation of # BlockdevSnapshotInternal. # -# Returns: -# - nothing on success -# # Errors: # - If @device is not a valid block device, GenericError # - If any snapshot matching @name exists, or @name is empty,
qapi/block.json +0 -6
@@ -110,9 +110,6 @@ # # @deprecated: Member @device is deprecated. Use @id instead. # -# Returns: -# - Nothing on success -# # Errors: # - If @device is not a valid block device, DeviceNotFound #
@@ -461,9 +458,6 @@ # the device will be removed from its group and the rest of its # members will not be affected. The 'group' parameter is ignored. # -# Returns: -# - Nothing on success -# # Errors: # - If @device is not a valid block device, DeviceNotFound #
qapi/char.json +0 -6
@@ -139,8 +139,6 @@ # - data itself is always Unicode regardless of format, like any # other string. # -# Returns: Nothing on success -# # Since: 1.4 # # Example:
@@ -772,8 +770,6 @@ # # @id: the chardev's ID, must exist and not be in use # -# Returns: Nothing on success -# # Since: 1.4 # # Example:
@@ -791,8 +787,6 @@ # # @id: the chardev's ID, must exist # -# Returns: Nothing on success -# # Since: 2.10 # # Example:
qapi/dump.json +0 -2
@@ -92,8 +92,6 @@ # # Note: All boolean arguments default to false # -# Returns: nothing on success -# # Since: 1.2 # # Example:
qapi/machine-target.json +0 -2
@@ -414,8 +414,6 @@ # # @unstable: This command is experimental. # -# Returns: Nothing on success. -# # Since: 8.2 ## { 'command': 'set-cpu-topology',
qapi/machine.json +0 -11
@@ -326,8 +326,6 @@ # # Since: 1.1 # -# Returns: nothing. -# # Note: prior to 4.0, this command does nothing in case the guest # isn't suspended. #
@@ -377,8 +375,6 @@ # all CPUs (ppc64). The command fails when the guest doesn't support # injecting. # -# Returns: If successful, nothing -# # Since: 0.14 # # Note: prior to 2.1, this command was only supported for x86 and s390
@@ -778,8 +774,6 @@ # @cpu-index: the index of the virtual CPU to use for translating the # virtual address (defaults to CPU 0) # -# Returns: Nothing on success -# # Since: 0.14 # # Notes: Errors were not reliably returned until 1.1
@@ -806,8 +800,6 @@ # # @filename: the file to save the memory to as binary data # -# Returns: Nothing on success -# # Since: 0.14 # # Notes: Errors were not reliably returned until 1.1
@@ -1060,9 +1052,6 @@ # # From it we have: balloon_size = vm_ram_size - @value # -# Returns: -# - Nothing on success -# # Errors: # - If the balloon driver is enabled but not functional because # the KVM kernel module cannot support it, KVMMissingCap
qapi/migration.json +0 -26
@@ -1555,8 +1555,6 @@ # # Cancel the current executing migration process. # -# Returns: nothing on success -# # Notes: This command succeeds even if there is no migration process # running. #
@@ -1576,8 +1574,6 @@ # # @state: The state the migration is currently expected to be in # -# Returns: nothing on success -# # Since: 2.11 # # Example:
@@ -1699,8 +1695,6 @@ # @deprecated: Members @inc and @blk are deprecated. Use # blockdev-mirror with NBD instead. # -# Returns: nothing on success -# # Since: 0.14 # # Notes:
@@ -1782,8 +1776,6 @@ # @channels: list of migration stream channels with each stream in the # list connected to a destination interface endpoint. # -# Returns: nothing on success -# # Since: 2.3 # # Notes:
@@ -1851,8 +1843,6 @@ # @live: Optional argument to ask QEMU to treat this command as part # of a live migration. Default to true. (since 2.11) # -# Returns: Nothing on success -# # Since: 1.1 # # Example:
@@ -1871,8 +1861,6 @@ # # @enable: true to enable, false to disable. # -# Returns: nothing -# # Since: 1.3 # # Example:
@@ -1915,8 +1903,6 @@ # @failover: true to do failover, false to stop. but cannot be # specified if 'enable' is true. default value is false. # -# Returns: nothing. -# # Example: # # -> { "execute": "xen-set-replication",
@@ -1968,8 +1954,6 @@ # # Xen uses this command to notify replication to trigger a checkpoint. # -# Returns: nothing. -# # Example: # # -> { "execute": "xen-colo-do-checkpoint" }
@@ -2026,8 +2010,6 @@ # # @uri: the URI to be used for the recovery of migration stream. # -# Returns: nothing. -# # Example: # # -> { "execute": "migrate-recover",
@@ -2045,8 +2027,6 @@ # # Pause a migration. Currently it only supports postcopy. # -# Returns: nothing. -# # Example: # # -> { "execute": "migrate-pause" }
@@ -2415,8 +2395,6 @@ # # If @tag already exists, an error will be reported # -# Returns: nothing -# # Example: # # -> { "execute": "snapshot-save",
@@ -2487,8 +2465,6 @@ # device nodes that can have changed since the original @snapshot-save # command execution. # -# Returns: nothing -# # Example: # # -> { "execute": "snapshot-load",
@@ -2550,8 +2526,6 @@ # to determine completion and to fetch details of any errors that # arise. # -# Returns: nothing -# # Example: # # -> { "execute": "snapshot-delete",
qapi/misc-target.json +0 -3
@@ -472,9 +472,6 @@ # # @port: The port number # -# Returns: -# - Nothing on success. -# # Since: 8.0 # # Example:
qapi/misc.json +0 -15
@@ -28,8 +28,6 @@ # # @tls: whether to perform TLS. Only applies to the "spice" protocol # -# Returns: nothing on success. -# # Since: 0.14 # # Example:
@@ -160,8 +158,6 @@ # # Since: 0.14 # -# Returns: If successful, nothing -# # Notes: This command will succeed if the guest is currently running. # It will also succeed if the guest is in the "inmigrate" state; # in this case, the effect of the command is to make sure the
@@ -196,8 +192,6 @@ # # Since: 3.0 # -# Returns: nothing -# # Example: # # -> { "execute": "x-exit-preconfig" }
@@ -256,8 +250,6 @@ # # @fdname: file descriptor name # -# Returns: Nothing on success -# # Since: 0.14 # # Notes: If @fdname already exists, the file descriptor assigned to it
@@ -285,8 +277,6 @@ # # @fdname: file descriptor name # -# Returns: Nothing on success -# # Since: 8.0 # # Notes: If @fdname already exists, the file descriptor assigned to it
@@ -309,8 +299,6 @@ # # @fdname: file descriptor name # -# Returns: Nothing on success -# # Since: 0.14 # # Example:
@@ -376,9 +364,6 @@ # # @fd: The file descriptor that is to be removed. # -# Returns: -# - Nothing on success -# # Errors: # - If @fdset-id or @fd is not found, GenericError #
qapi/net.json +0 -9
@@ -17,9 +17,6 @@ # # @up: true to set the link status to be up # -# Returns: -# - Nothing on success -# # Errors: # - If @name is not a valid network device, DeviceNotFound #
@@ -46,9 +43,6 @@ # # Since: 0.14 # -# Returns: -# - Nothing on success -# # Errors: # - If @type is not a valid network backend, DeviceNotFound #
@@ -69,9 +63,6 @@ # # @id: the name of the network backend to remove # -# Returns: -# - Nothing on success -# # Errors: # - If @id is not a valid network backend, DeviceNotFound #
qapi/qdev.json +0 -3
@@ -89,9 +89,6 @@ # # @id: the device's ID or QOM path # -# Returns: -# - Nothing on success -# # Errors: # - If @id is not a valid device, DeviceNotFound #
qapi/qom.json +0 -6
@@ -1056,9 +1056,6 @@ # # Create a QOM object. # -# Returns: -# - Nothing on success -# # Errors: # - Error if @qom-type is not a valid class name #
@@ -1081,9 +1078,6 @@ # # @id: the name of the QOM object to remove # -# Returns: -# - Nothing on success -# # Errors: # - Error if @id is not a valid id for a QOM object #
qapi/run-state.json +1 -4
@@ -395,10 +395,7 @@ # # @panic: @PanicAction action taken on guest panic. # -# @watchdog: @WatchdogAction action taken when watchdog timer expires -# . -# -# Returns: Nothing on success. +# @watchdog: @WatchdogAction action taken when watchdog timer expires. # # Since: 6.0 #
qapi/tpm.json +0 -2
@@ -166,8 +166,6 @@ # # Return information about the TPM device # -# Returns: @TPMInfo on success -# # Since: 1.5 # # Example:
qapi/transaction.json +0 -2
@@ -234,8 +234,6 @@ # execution of the transaction. See @TransactionProperties for # additional detail. # -# Returns: nothing on success -# # Errors: # Any errors from commands in the transaction #
qapi/ui.json +0 -17
@@ -78,9 +78,6 @@ # # Set the password of a remote display server. # -# Returns: -# - Nothing on success -# # Errors: # - If Spice is not enabled, DeviceNotFound #
@@ -142,9 +139,6 @@ # # Expire the password of a remote display server. # -# Returns: -# - Nothing on success -# # Errors: # - If @protocol is 'spice' and Spice is not active, # DeviceNotFound
@@ -191,8 +185,6 @@ # # @format: image format for screendump. (default: ppm) (Since 7.1) # -# Returns: Nothing on success -# # Since: 0.14 # # Example:
@@ -1040,9 +1032,6 @@ # @hold-time: time to delay key up events, milliseconds. Defaults to # 100 # -# Returns: -# - Nothing on success -# # Errors: # - If key is unknown or redundant, GenericError #
@@ -1265,8 +1254,6 @@ # # @events: List of InputEvent union. # -# Returns: Nothing on success. -# # Since: 2.6 # # Note: The consoles are visible in the qom tree, under
@@ -1611,8 +1598,6 @@ # # Reload display configuration. # -# Returns: Nothing on success. -# # Since: 6.0 # # Example:
@@ -1670,8 +1655,6 @@ # # Update display configuration. # -# Returns: Nothing on success. -# # Since: 7.1 # # Example:
qapi/yank.json +0 -3
@@ -78,9 +78,6 @@ # # @instances: the instances to be yanked # -# Returns: -# - Nothing on success -# # Errors: # - @DeviceNotFound error, if any of the YankInstances doesn't exist #
Signature · 1 line
2.43.0
PATCH 6/13 qapi: Clean up "Returns" sections
In reply to Markus ArmbrusterDrop list markup, since there's just one item left.
Drop "on success" where it is redundant with "Returns:".
--- qapi/block-core.json | 4 ++-- qapi/machine.json | 4 ++-- qapi/misc.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
qapi/block-core.json +2 -2
@@ -2457,7 +2457,7 @@ # @unstable: This command is meant for debugging. # # Returns: -# - BlockDirtyBitmapSha256 on success +# BlockDirtyBitmapSha256 # # Errors: # - If @node is not a valid block device, DeviceNotFound
@@ -6084,7 +6084,7 @@ # @name: optional the snapshot's name to be deleted # # Returns: -# - SnapshotInfo on success +# SnapshotInfo # # Errors: # - If @device is not a valid block device, GenericError
qapi/machine.json +2 -2
@@ -1090,7 +1090,7 @@ # Return information about the balloon device. # # Returns: -# - @BalloonInfo on success +# @BalloonInfo # # Errors: # - If the balloon driver is enabled but not functional because
@@ -1156,7 +1156,7 @@ # message from the guest. # # Returns: -# - @HvBalloonInfo on success +# @HvBalloonInfo # # Errors: # - If no hv-balloon device is present, guest memory status
qapi/misc.json +1 -1
@@ -332,7 +332,7 @@ # @opaque: A free-form string that can be used to describe the fd. # # Returns: -# - @AddfdInfo on success +# @AddfdInfo # # Errors: # - If file descriptor was not received, GenericError
Signature · 1 line
2.43.0
PATCH 7/13 qapi/yank: Tweak @yank's error description for consistency
In reply to Markus ArmbrusterPhrase it like "If <condition>, <error>", like we do elsewhere.
--- qapi/yank.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
qapi/yank.json +1 -1
@@ -79,7 +79,7 @@ # @instances: the instances to be yanked # # Errors: -# - @DeviceNotFound error, if any of the YankInstances doesn't exist +# - If any of the YankInstances doesn't exist, DeviceNotFound # # Example: #
Signature · 1 line
2.43.0
PATCH 8/13 qga/qapi-schema: Move error documentation to new "Errors" sections
In reply to Markus Armbruster--- qga/qapi-schema.json | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
qga/qapi-schema.json +10 -12
@@ -561,9 +561,8 @@ # could also exit (or set its status to "shutdown") due to other # reasons. # -# The following errors may be returned: -# -# - If suspend to disk is not supported, Unsupported +# Errors: +# - If suspend to disk is not supported, Unsupported # # Notes: It's strongly recommended to issue the guest-sync command # before sending commands when the guest resumes
@@ -598,9 +597,8 @@ # 2. Issue the query-status QMP command to confirm the VM status is # "suspended" # -# The following errors may be returned: -# -# - If suspend to ram is not supported, Unsupported +# Errors: +# - If suspend to ram is not supported, Unsupported # # Notes: It's strongly recommended to issue the guest-sync command # before sending commands when the guest resumes
@@ -634,9 +632,8 @@ # 2. Issue the query-status QMP command to confirm the VM status is # "suspended" # -# The following errors may be returned: -# -# - If hybrid suspend is not supported, Unsupported +# Errors: +# - If hybrid suspend is not supported, Unsupported # # Notes: It's strongly recommended to issue the guest-sync command # before sending commands when the guest resumes
@@ -796,9 +793,6 @@ # - 0: # if the @vcpus list was empty on input. Guest state has not # been changed. Otherwise, -# - Error: -# processing the first node of @vcpus failed for the reason -# returned. Guest state has not been changed. Otherwise, # - < length(@vcpus): # more than zero initial nodes have been processed, but not the # entire @vcpus list. Guest state has changed accordingly. To
@@ -808,6 +802,10 @@ # - length(@vcpus): # call successful. # +# Errors: +# - If the reconfiguration of the first node in @vcpus failed. +# Guest state has not been changed. +# # Since: 1.5 ## { 'command': 'guest-set-vcpus',
Signature · 1 line
2.43.0
Re: [PATCH 08/13] qga/qapi-schema: Move error documentation to new "Errors" sections
Quoted 70 lines · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>--- qga/qapi-schema.json | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)qga/qapi-schema.json +10
-13@@ -561,9 +561,8 @@ # could also exit (or set its status to "shutdown") due to other # reasons. # -# The following errors may be returned: -# -# - If suspend to disk is not supported, Unsupported +# Errors: +# - If suspend to disk is not supported, Unsupported # # Notes: It's strongly recommended to issue the guest-sync command # before sending commands when the guest resumes@@ -598,9 +597,8 @@ # 2. Issue the query-status QMP command to confirm the VM status is # "suspended" # -# The following errors may be returned: -# -# - If suspend to ram is not supported, Unsupported +# Errors: +# - If suspend to ram is not supported, Unsupported # # Notes: It's strongly recommended to issue the guest-sync command # before sending commands when the guest resumes@@ -634,9 +632,8 @@ # 2. Issue the query-status QMP command to confirm the VM status is # "suspended" # -# The following errors may be returned: -# -# - If hybrid suspend is not supported, Unsupported +# Errors: +# - If hybrid suspend is not supported, Unsupported # # Notes: It's strongly recommended to issue the guest-sync command # before sending commands when the guest resumes@@ -796,9 +793,6 @@ # - 0: # if the @vcpus list was empty on input. Guest state has not # been changed. Otherwise, -# - Error: -# processing the first node of @vcpus failed for the reason -# returned. Guest state has not been changed. Otherwise, # - < length(@vcpus): # more than zero initial nodes have been processed, but not the # entire @vcpus list. Guest state has changed accordingly. To@@ -808,6 +802,10 @@ # - length(@vcpus): # call successful. # +# Errors: +# - If the reconfiguration of the first node in @vcpus failed. +# Guest state has not been changed. +# # Since: 1.5 ## { 'command': 'guest-set-vcpus', --2.43.0
PATCH 9/13 qga/qapi-schema: Delete useless "Returns" sections
In reply to Markus Armbruster--- qga/qapi-schema.json | 12 ------------ 1 file changed, 12 deletions(-)
qga/qapi-schema.json +0 -12
@@ -153,8 +153,6 @@ # @time: time of nanoseconds, relative to the Epoch of 1970-01-01 in # UTC. # -# Returns: Nothing on success. -# # Since: 1.5 ## { 'command': 'guest-set-time',
@@ -245,8 +243,6 @@ # # @handle: filehandle returned by guest-file-open # -# Returns: Nothing on success. -# # Since: 0.15.0 ## { 'command': 'guest-file-close',
@@ -399,8 +395,6 @@ # # @handle: filehandle returned by guest-file-open # -# Returns: Nothing on success. -# # Since: 0.15.0 ## { 'command': 'guest-file-flush',
@@ -1077,8 +1071,6 @@ # transmission, even if already crypt()d, to ensure it is 8-bit safe # when passed as JSON. # -# Returns: Nothing on success. -# # Since: 2.3 ## { 'command': 'guest-set-user-password',
@@ -1602,8 +1594,6 @@ # # @reset: ignore the existing content, set it with the given keys only # -# Returns: Nothing on success. -# # Since: 5.2 ## { 'command': 'guest-ssh-add-authorized-keys',
@@ -1622,8 +1612,6 @@ # @keys: the public keys to remove (in OpenSSH/sshd(8) authorized_keys # format) # -# Returns: Nothing on success. -# # Since: 5.2 ## { 'command': 'guest-ssh-remove-authorized-keys',
Signature · 1 line
2.43.0
Re: [PATCH 09/13] qga/qapi-schema: Delete useless "Returns" sections
Quoted 67 lines · Markus Armbruster
Signed-off-by Markus Armbruster <[email protected]>--- qga/qapi-schema.json | 12 ------------ 1 file changed, 12 deletions(-)qga/qapi-schema.json +0
-13@@ -153,8 +153,6 @@ # @time: time of nanoseconds, relative to the Epoch of 1970-01-01 in # UTC. # -# Returns: Nothing on success. -# # Since: 1.5 ## { 'command': 'guest-set-time',@@ -245,8 +243,6 @@ # # @handle: filehandle returned by guest-file-open # -# Returns: Nothing on success. -# # Since: 0.15.0 ## { 'command': 'guest-file-close',@@ -399,8 +395,6 @@ # # @handle: filehandle returned by guest-file-open # -# Returns: Nothing on success. -# # Since: 0.15.0 ## { 'command': 'guest-file-flush',@@ -1077,8 +1071,6 @@ # transmission, even if already crypt()d, to ensure it is 8-bit safe # when passed as JSON. # -# Returns: Nothing on success. -# # Since: 2.3 ## { 'command': 'guest-set-user-password',@@ -1602,8 +1594,6 @@ # # @reset: ignore the existing content, set it with the given keys only # -# Returns: Nothing on success. -# # Since: 5.2 ## { 'command': 'guest-ssh-add-authorized-keys',@@ -1622,8 +1612,6 @@ # @keys: the public keys to remove (in OpenSSH/sshd(8) authorized_keys # format) # -# Returns: Nothing on success. -# # Since: 5.2 ## { 'command': 'guest-ssh-remove-authorized-keys', --2.43.0
PATCH 10/13 qga/qapi-schema: Clean up "Returns" sections
In reply to Markus ArmbrusterDrop "on success" where it is redundant with "Returns:".
--- qga/qapi-schema.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
qga/qapi-schema.json +8 -8
@@ -228,7 +228,7 @@ # # @mode: open mode, as per fopen(), "r" is the default. # -# Returns: Guest file handle on success. +# Returns: Guest file handle # # Since: 0.15.0 ##
@@ -277,7 +277,7 @@ # @count: maximum number of bytes to read (default is 4KB, maximum is # 48MB) # -# Returns: @GuestFileRead on success. +# Returns: @GuestFileRead # # Since: 0.15.0 ##
@@ -312,7 +312,7 @@ # @count: bytes to write (actual bytes, after base64-decode), default # is all content in buf-b64 buffer after base64 decoding # -# Returns: @GuestFileWrite on success. +# Returns: @GuestFileWrite # # Since: 0.15.0 ##
@@ -379,7 +379,7 @@ # # @whence: Symbolic or numeric code for interpreting offset # -# Returns: @GuestFileSeek on success. +# Returns: @GuestFileSeek # # Since: 0.15.0 ##
@@ -723,7 +723,7 @@ # # Get list of guest IP addresses, MAC addresses and netmasks. # -# Returns: List of GuestNetworkInterface on success. +# Returns: List of GuestNetworkInterface # # Since: 1.1 ##
@@ -1247,7 +1247,7 @@ # # @pid: pid returned from guest-exec # -# Returns: GuestExecStatus on success. +# Returns: GuestExecStatus # # Since: 2.5 ##
@@ -1315,7 +1315,7 @@ # @capture-output: bool flag to enable capture of stdout/stderr of # running process. defaults to false. # -# Returns: PID on success. +# Returns: PID # # Since: 2.5 ##
@@ -1344,7 +1344,7 @@ # or even present in DNS or some other name service at all. It need # not even be unique on your local network or site, but usually it is. # -# Returns: the host name of the machine on success +# Returns: the host name of the machine # # Since: 2.10 ##
Signature · 1 line
2.43.0
Re: [PATCH 10/13] qga/qapi-schema: Clean up "Returns" sections
Quoted 87 lines · Markus Armbruster
Drop "on success" where it is redundant with "Returns:".
Signed-off-by Markus Armbruster <[email protected]>--- qga/qapi-schema.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)qga/qapi-schema.json +8
-9@@ -228,7 +228,7 @@ # # @mode: open mode, as per fopen(), "r" is the default. # -# Returns: Guest file handle on success. +# Returns: Guest file handle # # Since: 0.15.0 ##@@ -277,7 +277,7 @@ # @count: maximum number of bytes to read (default is 4KB, maximum is # 48MB) # -# Returns: @GuestFileRead on success. +# Returns: @GuestFileRead # # Since: 0.15.0 ##@@ -312,7 +312,7 @@ # @count: bytes to write (actual bytes, after base64-decode), default # is all content in buf-b64 buffer after base64 decoding # -# Returns: @GuestFileWrite on success. +# Returns: @GuestFileWrite # # Since: 0.15.0 ##@@ -379,7 +379,7 @@ # # @whence: Symbolic or numeric code for interpreting offset # -# Returns: @GuestFileSeek on success. +# Returns: @GuestFileSeek # # Since: 0.15.0 ##@@ -723,7 +723,7 @@ # # Get list of guest IP addresses, MAC addresses and netmasks. # -# Returns: List of GuestNetworkInterface on success. +# Returns: List of GuestNetworkInterface # # Since: 1.1 ##@@ -1247,7 +1247,7 @@ # # @pid: pid returned from guest-exec # -# Returns: GuestExecStatus on success. +# Returns: GuestExecStatus # # Since: 2.5 ##@@ -1315,7 +1315,7 @@ # @capture-output: bool flag to enable capture of stdout/stderr of # running process. defaults to false. # -# Returns: PID on success. +# Returns: PID # # Since: 2.5 ##@@ -1344,7 +1344,7 @@ # or even present in DNS or some other name service at all. It need # not even be unique on your local network or site, but usually it is. # -# Returns: the host name of the machine on success +# Returns: the host name of the machine # # Since: 2.10 ## --2.43.0
PATCH 11/13 qga/qapi-schema: Tweak documentation of fsfreeze commands
In reply to Markus Armbruster"Returns:" sections of guest-fsfreeze-freeze and guest-fsfreeze-freeze-list describe both command behavior and success response. Move behavior out, so "Returns:" is only about success response.
--- qga/qapi-schema.json | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
qga/qapi-schema.json +9 -7
@@ -437,15 +437,16 @@ # command succeeded, you may call @guest-fsfreeze-thaw later to # unfreeze. # +# On error, all filesystems will be thawed. If no filesystems are +# frozen as a result of this call, then @guest-fsfreeze-status will +# remain "thawed" and calling @guest-fsfreeze-thaw is not necessary. +# +# Returns: Number of file systems currently frozen. +# # Note: On Windows, the command is implemented with the help of a # Volume Shadow-copy Service DLL helper. The frozen state is # limited for up to 10 seconds by VSS. # -# Returns: Number of file systems currently frozen. On error, all -# filesystems will be thawed. If no filesystems are frozen as a -# result of this call, then @guest-fsfreeze-status will remain -# "thawed" and calling @guest-fsfreeze-thaw is not necessary. -# # Since: 0.15.0 ## { 'command': 'guest-fsfreeze-freeze',
@@ -457,12 +458,13 @@ # Sync and freeze specified guest filesystems. See also # @guest-fsfreeze-freeze. # +# On error, all filesystems will be thawed. +# # @mountpoints: an array of mountpoints of filesystems to be frozen. # If omitted, every mounted filesystem is frozen. Invalid mount # points are ignored. # -# Returns: Number of file systems currently frozen. On error, all -# filesystems will be thawed. +# Returns: Number of file systems currently frozen. # # Since: 2.2 ##
Signature · 1 line
2.43.0
Re: [PATCH 11/13] qga/qapi-schema: Tweak documentation of fsfreeze commands
Quoted 56 lines · Markus Armbruster
"Returns:" sections of guest-fsfreeze-freeze and guest-fsfreeze-freeze-list describe both command behavior and success response. Move behavior out, so "Returns:" is only about success response.
Signed-off-by Markus Armbruster <[email protected]>--- qga/qapi-schema.json | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)qga/qapi-schema.json +9
-8@@ -437,15 +437,16 @@ # command succeeded, you may call @guest-fsfreeze-thaw later to # unfreeze. # +# On error, all filesystems will be thawed. If no filesystems are +# frozen as a result of this call, then @guest-fsfreeze-status will +# remain "thawed" and calling @guest-fsfreeze-thaw is not necessary. +# +# Returns: Number of file systems currently frozen. +# # Note: On Windows, the command is implemented with the help of a # Volume Shadow-copy Service DLL helper. The frozen state is # limited for up to 10 seconds by VSS. # -# Returns: Number of file systems currently frozen. On error, all -# filesystems will be thawed. If no filesystems are frozen as a -# result of this call, then @guest-fsfreeze-status will remain -# "thawed" and calling @guest-fsfreeze-thaw is not necessary. -# # Since: 0.15.0 ## { 'command': 'guest-fsfreeze-freeze',@@ -457,12 +458,13 @@ # Sync and freeze specified guest filesystems. See also # @guest-fsfreeze-freeze. # +# On error, all filesystems will be thawed. +# # @mountpoints: an array of mountpoints of filesystems to be frozen. # If omitted, every mounted filesystem is frozen. Invalid mount # points are ignored. # -# Returns: Number of file systems currently frozen. On error, all -# filesystems will be thawed. +# Returns: Number of file systems currently frozen. # # Since: 2.2 ## --2.43.0
PATCH 12/13 qga/qapi-schema: Fix guest-set-memory-blocks documentation
In reply to Markus ArmbrusterDocumentation claims the command can "return NULL". "NULL" doesn't exist in JSON. "null" does, but the command returns lists, and null isn't. Correct documentation to "return an empty list".
--- qga/qapi-schema.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
qga/qapi-schema.json +3 -3
@@ -1176,9 +1176,9 @@ # @GuestMemoryBlockResponse, which is corresponding to the input # list. # -# Note: it will return NULL if the @mem-blks list was empty on -# input, or there is an error, and in this case, guest state will -# not be changed. +# Note: it will return an empty list if the @mem-blks list was +# empty on input, or there is an error, and in this case, guest +# state will not be changed. # # Since: 2.3 ##
Signature · 1 line
2.43.0
Re: [PATCH 12/13] qga/qapi-schema: Fix guest-set-memory-blocks documentation
Quoted 30 lines · Markus Armbruster
Documentation claims the command can "return NULL". "NULL" doesn't exist in JSON. "null" does, but the command returns lists, and null isn't. Correct documentation to "return an empty list".
Signed-off-by Markus Armbruster <[email protected]>--- qga/qapi-schema.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)qga/qapi-schema.json +3
-4@@ -1176,9 +1176,9 @@ # @GuestMemoryBlockResponse, which is corresponding to the input # list. # -# Note: it will return NULL if the @mem-blks list was empty on -# input, or there is an error, and in this case, guest state will -# not be changed. +# Note: it will return an empty list if the @mem-blks list was +# empty on input, or there is an error, and in this case, guest +# state will not be changed. # # Since: 2.3 ## --2.43.0
PATCH 13/13 qapi: Reject "Returns" section when command doesn't return anything
In reply to Markus Armbruster--- scripts/qapi/parser.py | 7 ++++++- tests/qapi-schema/doc-invalid-return2.err | 1 + tests/qapi-schema/doc-invalid-return2.json | 7 +++++++ tests/qapi-schema/doc-invalid-return2.out | 0 tests/qapi-schema/meson.build | 1 + 5 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tests/qapi-schema/doc-invalid-return2.err create mode 100644 tests/qapi-schema/doc-invalid-return2.json create mode 100644 tests/qapi-schema/doc-invalid-return2.out
scripts/qapi/parser.py +6 -1
@@ -721,7 +721,12 @@ def connect_feature(self, feature: 'QAPISchemaFeature') -> None: self.features[feature.name].connect(feature) def check_expr(self, expr: QAPIExpression) -> None: - if 'command' not in expr: + if 'command' in expr: + if self.returns and 'returns' not in expr: + raise QAPISemError( + self.returns.info, + "'Returns' section, but command doesn't return anything") + else: if self.returns: raise QAPISemError( self.returns.info,
tests/qapi-schema/doc-invalid-return2.err new file +1 -0
@@ -0,0 +1 @@ +doc-invalid-return2.json:5: 'Returns' section, but command doesn't return anything
tests/qapi-schema/doc-invalid-return2.json new file +7 -0
@@ -0,0 +1,7 @@ +# Command doesn't return anything + +## +# @foo: +# Returns: blah +## +{ 'command': 'foo' }
tests/qapi-schema/doc-invalid-return2.out new file +0 -0
tests/qapi-schema/meson.build +1 -0
@@ -79,6 +79,7 @@ schemas = [ 'doc-invalid-end.json', 'doc-invalid-end2.json', 'doc-invalid-return.json', + 'doc-invalid-return2.json', 'doc-invalid-section.json', 'doc-invalid-start.json', 'doc-missing-colon.json',
Signature · 1 line
2.43.0
Hi Markus,
I will merge qga-related patches in my PULL.
Best Regards,
Konstantin Kostiuk.
Quoted 57 lines · Markus Armbruster
We use doc comment "Returns" sections both for success and error response. This series moves the latter to new "Errors" sections. Enables some cleanup, visible in the diffstat.q
Markus Armbruster (13):
qapi: Memorize since & returns sections
qapi: Slightly clearer error message for invalid "Returns" section
qapi: New documentation section tag "Errors"
qapi: Move error documentation to new "Errors" sections
qapi: Delete useless "Returns" sections
qapi: Clean up "Returns" sections
qapi/yank: Tweak @yank's error description for consistency qga/qapi-schema: Move error documentation to new "Errors" sections qga/qapi-schema: Delete useless "Returns" sections qga/qapi-schema: Clean up "Returns" sections qga/qapi-schema: Tweak documentation of fsfreeze commands qga/qapi-schema: Fix guest-set-memory-blocks documentation
qapi: Reject "Returns" section when command doesn't return anythingdocs/devel/qapi-code-gen.rst | 6 +- qapi/block-core.json | 74 ++++++++-------------- qapi/block-export.json | 23 ++++--- qapi/block.json | 10 ++- qapi/char.json | 6 -- qapi/dump.json | 2 - qapi/machine-target.json | 37 ++++++----- qapi/machine.json | 19 ++---- qapi/migration.json | 26 -------- qapi/misc-target.json | 3 - qapi/misc.json | 25 +++----- qapi/net.json | 17 +++-- qapi/qdev.json | 3 +- qapi/qom.json | 6 +- qapi/run-state.json | 5 +- qapi/tpm.json | 2 - qapi/transaction.json | 5 +- qapi/ui.json | 17 +---- qapi/yank.json | 5 +- qga/qapi-schema.json | 72 +++++++++------------ scripts/qapi/parser.py | 50 ++++++++++----- tests/qapi-schema/doc-good.json | 2 + tests/qapi-schema/doc-good.out | 2 + tests/qapi-schema/doc-good.txt | 6 ++ tests/qapi-schema/doc-invalid-return.err | 2 +- tests/qapi-schema/doc-invalid-return2.err | 1 + tests/qapi-schema/doc-invalid-return2.json | 7 ++ tests/qapi-schema/doc-invalid-return2.out | 0 tests/qapi-schema/meson.build | 1 + 29 files changed, 189 insertions(+), 245 deletions(-) create mode 100644 tests/qapi-schema/doc-invalid-return2.err create mode 100644 tests/qapi-schema/doc-invalid-return2.json create mode 100644 tests/qapi-schema/doc-invalid-return2.out--
2.43.0