diff mbox series

[v2,2/2] qapi/block: Restrict vhost-user-blk to CONFIG_VHOST_USER_BLK_SERVER

Message ID 20211223101426.3143647-3-philmd@redhat.com
State New
Headers show
Series block: Minor vhost-user-blk fixes | expand

Commit Message

Philippe Mathieu-Daudé Dec. 23, 2021, 10:14 a.m. UTC
When building QEMU with --disable-vhost-user and using introspection,
query-qmp-schema lists vhost-user-blk even though it's not actually
available:

  { "execute": "query-qmp-schema" }
  {
      "return": [
          ...
          {
              "name": "312",
              "members": [
                  {
                      "name": "nbd"
                  },
                  {
                      "name": "vhost-user-blk"
                  }
              ],
              "meta-type": "enum",
              "values": [
                  "nbd",
                  "vhost-user-blk"
              ]
          },

Restrict vhost-user-blk in BlockExportType when
CONFIG_VHOST_USER_BLK_SERVER is disabled, so it
doesn't end listed by query-qmp-schema.

Fixes: 90fc91d50b7 ("convert vhost-user-blk server to block export API")
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
v2: Reword + restrict BlockExportOptions union (armbru)
---
 qapi/block-export.json | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Markus Armbruster Jan. 14, 2022, 10:56 a.m. UTC | #1
Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> When building QEMU with --disable-vhost-user and using introspection,
> query-qmp-schema lists vhost-user-blk even though it's not actually
> available:
>
>   { "execute": "query-qmp-schema" }
>   {
>       "return": [
>           ...
>           {
>               "name": "312",
>               "members": [
>                   {
>                       "name": "nbd"
>                   },
>                   {
>                       "name": "vhost-user-blk"
>                   }
>               ],
>               "meta-type": "enum",
>               "values": [
>                   "nbd",
>                   "vhost-user-blk"
>               ]
>           },
>
> Restrict vhost-user-blk in BlockExportType when
> CONFIG_VHOST_USER_BLK_SERVER is disabled, so it
> doesn't end listed by query-qmp-schema.
>
> Fixes: 90fc91d50b7 ("convert vhost-user-blk server to block export API")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> v2: Reword + restrict BlockExportOptions union (armbru)
> ---
>  qapi/block-export.json | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/qapi/block-export.json b/qapi/block-export.json
> index c1b92ce1c1c..f9ce79a974b 100644
> --- a/qapi/block-export.json
> +++ b/qapi/block-export.json
> @@ -277,7 +277,8 @@
>  # Since: 4.2
>  ##
>  { 'enum': 'BlockExportType',
> -  'data': [ 'nbd', 'vhost-user-blk',
> +  'data': [ 'nbd',
> +            { 'name': 'vhost-user-blk', 'if': 'CONFIG_VHOST_USER_BLK_SERVER' },

Please break this line like

               { 'name': 'vhost-user-blk',
                 'if': 'CONFIG_VHOST_USER_BLK_SERVER' },

>              { 'name': 'fuse', 'if': 'CONFIG_FUSE' } ] }
>  
>  ##
> @@ -319,7 +320,8 @@
>    'discriminator': 'type',
>    'data': {
>        'nbd': 'BlockExportOptionsNbd',
> -      'vhost-user-blk': 'BlockExportOptionsVhostUserBlk',
> +      'vhost-user-blk': { 'type': 'BlockExportOptionsVhostUserBlk',
> +                          'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
>        'fuse': { 'type': 'BlockExportOptionsFuse',
>                  'if': 'CONFIG_FUSE' }
>     } }

Acked-by: Markus Armbruster <armbru@redhat.com>
diff mbox series

Patch

diff --git a/qapi/block-export.json b/qapi/block-export.json
index c1b92ce1c1c..f9ce79a974b 100644
--- a/qapi/block-export.json
+++ b/qapi/block-export.json
@@ -277,7 +277,8 @@ 
 # Since: 4.2
 ##
 { 'enum': 'BlockExportType',
-  'data': [ 'nbd', 'vhost-user-blk',
+  'data': [ 'nbd',
+            { 'name': 'vhost-user-blk', 'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
             { 'name': 'fuse', 'if': 'CONFIG_FUSE' } ] }
 
 ##
@@ -319,7 +320,8 @@ 
   'discriminator': 'type',
   'data': {
       'nbd': 'BlockExportOptionsNbd',
-      'vhost-user-blk': 'BlockExportOptionsVhostUserBlk',
+      'vhost-user-blk': { 'type': 'BlockExportOptionsVhostUserBlk',
+                          'if': 'CONFIG_VHOST_USER_BLK_SERVER' },
       'fuse': { 'type': 'BlockExportOptionsFuse',
                 'if': 'CONFIG_FUSE' }
    } }