Skip to contentSkip to conversation

block: Add bdrv_runtime_opts to query-command-line-options

PATCH In review Kevin Wolf 4 participants 5 messages Oct 6, 2016 – Oct 7, 2016

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 block: Add bdrv_runtime_opts to query-command-line-options

Recently we moved a few options from QemuOptsLists in blockdev.c to bdrv_runtime_opts in block.c in order to make them accissble using blockdev-add. However, this has the side effect that these options are missing from query-command-line-options now, and libvirt consequently disables the corresponding feature.

This problem was reported as a regression for the 'discard' option, introduced in commit 818584a4. However, it is more general than that.

Fix it by adding bdrv_runtime_opts to the list of QemuOptsLists that are returned in query-command-line-options. For the future, libvirt is advised to use QMP schema introspection for block device options.

---
 block.c                 | 2 +-
 include/sysemu/sysemu.h | 1 +
 util/qemu-config.c      | 2 +-
 vl.c                    | 1 +
 4 files changed, 4 insertions(+), 2 deletions(-)
block.c +1 -1
index bb1f1ec..40eb570 100644
@@ -926,7 +926,7 @@ out:
     g_free(gen_node_name);
 }
 
-static QemuOptsList bdrv_runtime_opts = {
+QemuOptsList bdrv_runtime_opts = {
     .name = "bdrv_common",
     .head = QTAILQ_HEAD_INITIALIZER(bdrv_runtime_opts.head),
     .desc = {
include/sysemu/sysemu.h +1 -0
index ef2c50b..b668833 100644
@@ -235,6 +235,7 @@ bool defaults_enabled(void);
 extern QemuOptsList qemu_legacy_drive_opts;
 extern QemuOptsList qemu_common_drive_opts;
 extern QemuOptsList qemu_drive_opts;
+extern QemuOptsList bdrv_runtime_opts;
 extern QemuOptsList qemu_chardev_opts;
 extern QemuOptsList qemu_device_opts;
 extern QemuOptsList qemu_netdev_opts;
util/qemu-config.c +1 -1
index fb97307..5527100 100644
@@ -6,7 +6,7 @@
 #include "qmp-commands.h"
 
 static QemuOptsList *vm_config_groups[48];
-static QemuOptsList *drive_config_groups[4];
+static QemuOptsList *drive_config_groups[5];
 
 static QemuOptsList *find_list(QemuOptsList **lists, const char *group,
                                Error **errp)
vl.c +1 -0
index f3abd99..9a2e7d5 100644
@@ -3035,6 +3035,7 @@ int main(int argc, char **argv, char **envp)
     qemu_add_drive_opts(&qemu_legacy_drive_opts);
     qemu_add_drive_opts(&qemu_common_drive_opts);
     qemu_add_drive_opts(&qemu_drive_opts);
+    qemu_add_drive_opts(&bdrv_runtime_opts);
     qemu_add_opts(&qemu_chardev_opts);
     qemu_add_opts(&qemu_device_opts);
     qemu_add_opts(&qemu_netdev_opts);
Signature · 1 line
1.8.3.1
Tested-by on v1 1/1
#1 lore raw
Quoted 9 lines · Kevin Wolf

Recently we moved a few options from QemuOptsLists in blockdev.c to bdrv_runtime_opts in block.c in order to make them accissble using blockdev-add. However, this has the side effect that these options are missing from query-command-line-options now, and libvirt consequently disables the corresponding feature.

This problem was reported as a regression for the 'discard' option, introduced in commit 818584a4. However, it is more general than that.

Quoted 6 lines

Fix it by adding bdrv_runtime_opts to the list of QemuOptsLists that are returned in query-command-line-options. For the future, libvirt is advised to use QMP schema introspection for block device options.

Thank you for such a prompt fix!

Michal

#2 lore raw
In reply to Kevin Wolf
Quoted 65 lines · Kevin Wolf

Recently we moved a few options from QemuOptsLists in blockdev.c to bdrv_runtime_opts in block.c in order to make them accissble using blockdev-add. However, this has the side effect that these options are missing from query-command-line-options now, and libvirt consequently disables the corresponding feature.

This problem was reported as a regression for the 'discard' option, introduced in commit 818584a4. However, it is more general than that.

Fix it by adding bdrv_runtime_opts to the list of QemuOptsLists that are returned in query-command-line-options. For the future, libvirt is advised to use QMP schema introspection for block device options.

---

block.c                 | 2 +-
include/sysemu/sysemu.h | 1 +
util/qemu-config.c      | 2 +-
vl.c                    | 1 +
4 files changed, 4 insertions(+), 2 deletions(-)
block.c +1 -1
index bb1f1ec..40eb570 100644
@@ -926,7 +926,7 @@ out:
    g_free(gen_node_name);
 }
 
-static QemuOptsList bdrv_runtime_opts = {
+QemuOptsList bdrv_runtime_opts = {
    .name = "bdrv_common",
    .head = QTAILQ_HEAD_INITIALIZER(bdrv_runtime_opts.head),
    .desc = {
include/sysemu/sysemu.h +1 -0
index ef2c50b..b668833 100644
@@ -235,6 +235,7 @@ bool defaults_enabled(void);
 extern QemuOptsList qemu_legacy_drive_opts;
 extern QemuOptsList qemu_common_drive_opts;
 extern QemuOptsList qemu_drive_opts;
+extern QemuOptsList bdrv_runtime_opts;
 extern QemuOptsList qemu_chardev_opts;
 extern QemuOptsList qemu_device_opts;
 extern QemuOptsList qemu_netdev_opts;
util/qemu-config.c +1 -1
index fb97307..5527100 100644
@@ -6,7 +6,7 @@
 #include "qmp-commands.h"
 
 static QemuOptsList *vm_config_groups[48];
-static QemuOptsList *drive_config_groups[4];
+static QemuOptsList *drive_config_groups[5];
 
 static QemuOptsList *find_list(QemuOptsList **lists, const char *group,
                               Error **errp)
vl.c +0 -0
index f3abd99..9a2e7d5 100644

vl.c int main(int argc, char **argv, char **envp) · line 3036

Quoted 2 lines
vl.c +0 -0
@@ -3035,6 +3035,7 @@ int main(int argc, char **argv, char **envp)
    qemu_add_drive_opts(&qemu_legacy_drive_opts);
    qemu_add_drive_opts(&qemu_common_drive_opts);

I'm guessing this doesn't pose a problem with e.g.g "detect-zeroes" which is in this (&qemu_common_drive_opts) as well as

vl.c int main(int argc, char **argv, char **envp) · line 3038

Quoted 2 lines
vl.c +1 -0
    qemu_add_drive_opts(&qemu_drive_opts);
+    qemu_add_drive_opts(&bdrv_runtime_opts);

here ^^, right? Just wanted to make sure ;) Thanks for the fix.

Quoted 6 lines
vl.c +0 -1
    qemu_add_opts(&qemu_chardev_opts);
    qemu_add_opts(&qemu_device_opts);
    qemu_add_opts(&qemu_netdev_opts);
--

1.8.3.1

author
#3 lore raw

Am 06.10.2016 um 12:58 hat Martin Kletzander geschrieben:

Quoted 72 lines · Kevin Wolf
Quoted 65 lines

Recently we moved a few options from QemuOptsLists in blockdev.c to bdrv_runtime_opts in block.c in order to make them accissble using blockdev-add. However, this has the side effect that these options are missing from query-command-line-options now, and libvirt consequently disables the corresponding feature.

This problem was reported as a regression for the 'discard' option, introduced in commit 818584a4. However, it is more general than that.

Fix it by adding bdrv_runtime_opts to the list of QemuOptsLists that are returned in query-command-line-options. For the future, libvirt is advised to use QMP schema introspection for block device options.

---

block.c                 | 2 +-
include/sysemu/sysemu.h | 1 +
util/qemu-config.c      | 2 +-
vl.c                    | 1 +
4 files changed, 4 insertions(+), 2 deletions(-)
block.c +1 -1
index bb1f1ec..40eb570 100644
@@ -926,7 +926,7 @@ out:
   g_free(gen_node_name);
 }
 
-static QemuOptsList bdrv_runtime_opts = {
+QemuOptsList bdrv_runtime_opts = {
   .name = "bdrv_common",
   .head = QTAILQ_HEAD_INITIALIZER(bdrv_runtime_opts.head),
   .desc = {
include/sysemu/sysemu.h +1 -0
index ef2c50b..b668833 100644
@@ -235,6 +235,7 @@ bool defaults_enabled(void);
 extern QemuOptsList qemu_legacy_drive_opts;
 extern QemuOptsList qemu_common_drive_opts;
 extern QemuOptsList qemu_drive_opts;
+extern QemuOptsList bdrv_runtime_opts;
 extern QemuOptsList qemu_chardev_opts;
 extern QemuOptsList qemu_device_opts;
 extern QemuOptsList qemu_netdev_opts;
util/qemu-config.c +1 -1
index fb97307..5527100 100644
@@ -6,7 +6,7 @@
 #include "qmp-commands.h"
 
 static QemuOptsList *vm_config_groups[48];
-static QemuOptsList *drive_config_groups[4];
+static QemuOptsList *drive_config_groups[5];
 
 static QemuOptsList *find_list(QemuOptsList **lists, const char *group,
                              Error **errp)
vl.c +0 -0
index f3abd99..9a2e7d5 100644

vl.c int main(int argc, char **argv, char **envp) · line 3036

Quoted 2 lines
vl.c +0 -0
@@ -3035,6 +3035,7 @@ int main(int argc, char **argv, char **envp)
   qemu_add_drive_opts(&qemu_legacy_drive_opts);
   qemu_add_drive_opts(&qemu_common_drive_opts);

I'm guessing this doesn't pose a problem with e.g.g "detect-zeroes" which is in this (&qemu_common_drive_opts) as well as

Quoted 4 lines

vl.c int main(int argc, char **argv, char **envp) · line 3038

Quoted 2 lines
vl.c +1 -0
   qemu_add_drive_opts(&qemu_drive_opts);
+    qemu_add_drive_opts(&bdrv_runtime_opts);

here ^^, right? Just wanted to make sure ;) Thanks for the fix.

Yes, cleanup_infolist() removes duplicates before they are sent to the client.

Kevin

Tested-by on v1 1/1
#4 lore raw
In reply to Kevin Wolf
Quoted 9 lines · Kevin Wolf

Recently we moved a few options from QemuOptsLists in blockdev.c to bdrv_runtime_opts in block.c in order to make them accissble using blockdev-add. However, this has the side effect that these options are missing from query-command-line-options now, and libvirt consequently disables the corresponding feature.

This problem was reported as a regression for the 'discard' option, introduced in commit 818584a4. However, it is more general than that.

Quoted 6 lines

Fix it by adding bdrv_runtime_opts to the list of QemuOptsLists that are returned in query-command-line-options. For the future, libvirt is advised to use QMP schema introspection for block device options.

Quoted 57 lines
---
 block.c                 | 2 +-
 include/sysemu/sysemu.h | 1 +
 util/qemu-config.c      | 2 +-
 vl.c                    | 1 +
 4 files changed, 4 insertions(+), 2 deletions(-)
block.c +1 -1
index bb1f1ec..40eb570 100644
@@ -926,7 +926,7 @@ out:
     g_free(gen_node_name);
 }
 
-static QemuOptsList bdrv_runtime_opts = {
+QemuOptsList bdrv_runtime_opts = {
     .name = "bdrv_common",
     .head = QTAILQ_HEAD_INITIALIZER(bdrv_runtime_opts.head),
     .desc = {
include/sysemu/sysemu.h +1 -0
index ef2c50b..b668833 100644
@@ -235,6 +235,7 @@ bool defaults_enabled(void);
 extern QemuOptsList qemu_legacy_drive_opts;
 extern QemuOptsList qemu_common_drive_opts;
 extern QemuOptsList qemu_drive_opts;
+extern QemuOptsList bdrv_runtime_opts;
 extern QemuOptsList qemu_chardev_opts;
 extern QemuOptsList qemu_device_opts;
 extern QemuOptsList qemu_netdev_opts;
util/qemu-config.c +1 -1
index fb97307..5527100 100644
@@ -6,7 +6,7 @@
 #include "qmp-commands.h"
 
 static QemuOptsList *vm_config_groups[48];
-static QemuOptsList *drive_config_groups[4];
+static QemuOptsList *drive_config_groups[5];
 
 static QemuOptsList *find_list(QemuOptsList **lists, const char *group,
                                Error **errp)
vl.c +1 -0
index f3abd99..9a2e7d5 100644
@@ -3035,6 +3035,7 @@ int main(int argc, char **argv, char **envp)
     qemu_add_drive_opts(&qemu_legacy_drive_opts);
     qemu_add_drive_opts(&qemu_common_drive_opts);
     qemu_add_drive_opts(&qemu_drive_opts);
+    qemu_add_drive_opts(&bdrv_runtime_opts);
     qemu_add_opts(&qemu_chardev_opts);
     qemu_add_opts(&qemu_device_opts);
     qemu_add_opts(&qemu_netdev_opts);