diff mbox series

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

Message ID 20211220200034.2233987-3-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series block: Minor vhost-user-blk fixes | expand

Commit Message

Philippe Mathieu-Daudé Dec. 20, 2021, 8 p.m. UTC
Do not list vhost-user-blk in BlockExportType
when CONFIG_VHOST_USER_BLK_SERVER is disabled.

Fixes: 90fc91d50b7 ("convert vhost-user-blk server to block export API")
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 qapi/block-export.json | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Markus Armbruster Dec. 22, 2021, 7:05 a.m. UTC | #1
Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> Do not list vhost-user-blk in BlockExportType
> when CONFIG_VHOST_USER_BLK_SERVER is disabled.
>
> Fixes: 90fc91d50b7 ("convert vhost-user-blk server to block export API")

My immediate reaction was "what exactly is broken before this patch?"

I think it's introspection: query-qmp-schema has vhost-user-blk even
though it's not actually available.  Let's spell that out.

> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  qapi/block-export.json | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/qapi/block-export.json b/qapi/block-export.json
> index c1b92ce1c1c..6bc29a75dc0 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' } ] }
>  
>  ##

Doesn't compile when I configure --disable-vhost-user.  Fix:

diff --git a/qapi/block-export.json b/qapi/block-export.json
index 6bc29a75dc..f9ce79a974 100644
--- a/qapi/block-export.json
+++ b/qapi/block-export.json
@@ -320,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' }
    } }
Philippe Mathieu-Daudé Dec. 22, 2021, 6:27 p.m. UTC | #2
On 12/22/21 08:05, Markus Armbruster wrote:
> Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> 
>> Do not list vhost-user-blk in BlockExportType
>> when CONFIG_VHOST_USER_BLK_SERVER is disabled.
>>
>> Fixes: 90fc91d50b7 ("convert vhost-user-blk server to block export API")
> 
> My immediate reaction was "what exactly is broken before this patch?"
> 
> I think it's introspection: query-qmp-schema has vhost-user-blk even
> though it's not actually available.  Let's spell that out.

Yes, OK.

>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>  qapi/block-export.json | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/qapi/block-export.json b/qapi/block-export.json
>> index c1b92ce1c1c..6bc29a75dc0 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' } ] }
>>  
>>  ##
> 
> Doesn't compile when I configure --disable-vhost-user.  Fix:
> 
> diff --git a/qapi/block-export.json b/qapi/block-export.json
> index 6bc29a75dc..f9ce79a974 100644
> --- a/qapi/block-export.json
> +++ b/qapi/block-export.json
> @@ -320,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' }
>     } }

Oh, thank you very much for fixing this part!
diff mbox series

Patch

diff --git a/qapi/block-export.json b/qapi/block-export.json
index c1b92ce1c1c..6bc29a75dc0 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' } ] }
 
 ##