Skip to contentSkip to conversation

block: Minor vhost-user-blk fixes

PATCH In review Philippe Mathieu-Daudé 4 participants 6 messages Dec 23, 2021 – Jan 14, 2022

lore
Share & tools
lore
#0 lore raw

v2 cover block: Minor vhost-user-blk fixes

- Add vhost-user-blk help to qemu-storage-daemon,
- Do not list vhost-user-blk in BlockExportType when CONFIG_VHOST_USER_BLK_SERVER is disabled.

Since v1:
- Reword patch 2 description (Markus)
- Fix BlockExportOptions enum build failure (Markus)

Philippe Mathieu-Daudé (2):
qemu-storage-daemon: Add vhost-user-blk help
qapi/block: Restrict vhost-user-blk to CONFIG_VHOST_USER_BLK_SERVER

 qapi/block-export.json               |  6 ++++--
 storage-daemon/qemu-storage-daemon.c | 13 +++++++++++++
 2 files changed, 17 insertions(+), 2 deletions(-)
Signature · 1 line
2.33.1
#1 lore raw

PATCH v2 1/2 qemu-storage-daemon: Add vhost-user-blk help

Add missing vhost-user-blk help:

  $ qemu-storage-daemon -h
  ...
    --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,
             addr.type=unix,addr.path=<socket-path>[,writable=on|off]
             [,logical-block-size=<block-size>][,num-queues=<num-queues>]
                           export the specified block node as a
                           vhosts-user-blk device over UNIX domain socket
    --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,
             fd,addr.str=<fd>[,writable=on|off]
             [,logical-block-size=<block-size>][,num-queues=<num-queues>]
                           export the specified block node as a
                           vhosts-user-blk device over file descriptor
  ...
Fixes 90fc91d50b7 ("convert vhost-user-blk server to block export API")
---
 storage-daemon/qemu-storage-daemon.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
storage-daemon/qemu-storage-daemon.c +13 -0
index 52cf17e8ace..0c19e128e3f 100644
@@ -104,6 +104,19 @@ static void help(void)
 "                         export the specified block node over FUSE\n"
 "\n"
 #endif /* CONFIG_FUSE */
+#ifdef CONFIG_VHOST_USER_BLK_SERVER
+"  --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,\n"
+"           addr.type=unix,addr.path=<socket-path>[,writable=on|off]\n"
+"           [,logical-block-size=<block-size>][,num-queues=<num-queues>]\n"
+"                         export the specified block node as a\n"
+"                         vhosts-user-blk device over UNIX domain socket\n"
+"  --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,\n"
+"           fd,addr.str=<fd>[,writable=on|off]\n"
+"           [,logical-block-size=<block-size>][,num-queues=<num-queues>]\n"
+"                         export the specified block node as a\n"
+"                         vhosts-user-blk device over file descriptor\n"
+"\n"
+#endif /* CONFIG_VHOST_USER_BLK_SERVER */
 "  --monitor [chardev=]name[,mode=control][,pretty[=on|off]]\n"
 "                         configure a QMP monitor\n"
 "\n"
Signature · 1 line
2.33.1
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] qemu-storage-daemon: Add vhost-user-blk help

Quoted 9 lines · Philippe Mathieu-Daudé

Add missing vhost-user-blk help:

  $ qemu-storage-daemon -h
  ...
    --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,
             addr.type=unix,addr.path=<socket-path>[,writable=on|off]
             [,logical-block-size=<block-size>][,num-queues=<num-queues>]
                           export the specified block node as a
                           vhosts-user-blk device over UNIX domain socket

Why 'vhosts-' here instead of 'vhost'?

Quoted 5 lines
    --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,
             fd,addr.str=<fd>[,writable=on|off]
             [,logical-block-size=<block-size>][,num-queues=<num-queues>]
                           export the specified block node as a
                           vhosts-user-blk device over file descriptor

here too.

Quoted 14 lines

...

Fixes 90fc91d50b7 ("convert vhost-user-blk server to block export API")
---
 storage-daemon/qemu-storage-daemon.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
storage-daemon/qemu-storage-daemon.c +0 -0
index 52cf17e8ace..0c19e128e3f 100644

storage-daemon/qemu-storage-daemon.c static void help(void) · line 112

Quoted 9 lines
storage-daemon/qemu-storage-daemon.c +6 -0
@@ -104,6 +104,19 @@ static void help(void)
 "                         export the specified block node over FUSE\n"
 "\n"
 #endif /* CONFIG_FUSE */
+#ifdef CONFIG_VHOST_USER_BLK_SERVER
+"  --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,\n"
+"           addr.type=unix,addr.path=<socket-path>[,writable=on|off]\n"
+"           [,logical-block-size=<block-size>][,num-queues=<num-queues>]\n"
+"                         export the specified block node as a\n"
+"                         vhosts-user-blk device over UNIX domain socket\n"

This...

storage-daemon/qemu-storage-daemon.c static void help(void) · line 117

Quoted 5 lines
storage-daemon/qemu-storage-daemon.c +5 -0
+"  --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,\n"
+"           fd,addr.str=<fd>[,writable=on|off]\n"
+"           [,logical-block-size=<block-size>][,num-queues=<num-queues>]\n"
+"                         export the specified block node as a\n"
+"                         vhosts-user-blk device over file descriptor\n"

...and this line would need the same tweak.

If you agree that it's a typo, then let's fix it, and you can have

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

Re: [PATCH v2 1/2] qemu-storage-daemon: Add vhost-user-blk help

Quoted 11 lines · Eric Blake
Quoted 9 lines · Philippe Mathieu-Daudé

Add missing vhost-user-blk help:

  $ qemu-storage-daemon -h
  ...
    --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,
             addr.type=unix,addr.path=<socket-path>[,writable=on|off]
             [,logical-block-size=<block-size>][,num-queues=<num-queues>]
                           export the specified block node as a
                           vhosts-user-blk device over UNIX domain socket
Quoted 1 line

Why 'vhosts-' here instead of 'vhost'?

Oops, I copy/pasted from qemu-storage-daemon.rst.

Quoted 40 lines
Quoted 5 lines
    --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,
             fd,addr.str=<fd>[,writable=on|off]
             [,logical-block-size=<block-size>][,num-queues=<num-queues>]
                           export the specified block node as a
                           vhosts-user-blk device over file descriptor

here too.

Quoted 14 lines

...

Fixes 90fc91d50b7 ("convert vhost-user-blk server to block export API")
---
 storage-daemon/qemu-storage-daemon.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
storage-daemon/qemu-storage-daemon.c +0 -0
index 52cf17e8ace..0c19e128e3f 100644

storage-daemon/qemu-storage-daemon.c static void help(void) · line 112

Quoted 9 lines
storage-daemon/qemu-storage-daemon.c +6 -0
@@ -104,6 +104,19 @@ static void help(void)
 "                         export the specified block node over FUSE\n"
 "\n"
 #endif /* CONFIG_FUSE */
+#ifdef CONFIG_VHOST_USER_BLK_SERVER
+"  --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,\n"
+"           addr.type=unix,addr.path=<socket-path>[,writable=on|off]\n"
+"           [,logical-block-size=<block-size>][,num-queues=<num-queues>]\n"
+"                         export the specified block node as a\n"
+"                         vhosts-user-blk device over UNIX domain socket\n"

This...

storage-daemon/qemu-storage-daemon.c static void help(void) · line 117

Quoted 5 lines
storage-daemon/qemu-storage-daemon.c +5 -0
+"  --export [type=]vhost-user-blk,id=<id>,node-name=<node-name>,\n"
+"           fd,addr.str=<fd>[,writable=on|off]\n"
+"           [,logical-block-size=<block-size>][,num-queues=<num-queues>]\n"
+"                         export the specified block node as a\n"
+"                         vhosts-user-blk device over file descriptor\n"
Quoted 5 lines

...and this line would need the same tweak.

If you agree that it's a typo, then let's fix it, and you can have

Yes (I will also update qemu-storage-daemon.rst). Thank you!

Phil.

#4 lore raw

PATCH v2 2/2 qapi/block: Restrict vhost-user-blk to CONFIG_VHOST_USER_BLK_SERVER

In reply to Philippe Mathieu-Daudé

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")

---
v2: Reword + restrict BlockExportOptions union (armbru)

---
 qapi/block-export.json | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
qapi/block-export.json +4 -2
index c1b92ce1c1c..f9ce79a974b 100644
@@ -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' }
    } }
Signature · 1 line
2.33.1
Acked-by on v2 2/2
#5 lore raw

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

Quoted 42 lines · Philippe Mathieu-Daudé

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")

---
v2: Reword + restrict BlockExportOptions union (armbru)

---
 qapi/block-export.json | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
qapi/block-export.json +0 -0
index c1b92ce1c1c..f9ce79a974b 100644

qapi/block-export.json line 281

Quoted 6 lines
qapi/block-export.json +2 -1
@@ -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' },

qapi/block-export.json line 327

Quoted 13 lines
qapi/block-export.json +2 -1
             { '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' }
    } }