Skip to contentSkip to conversation

qom: Fix device-list-properties & friends to show legacy-FOO props

PATCH In review Markus Armbruster 2 participants 2 messages Jul 8

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qom: Fix device-list-properties & friends to show legacy-FOO props

qmp_device_list_properties() skips properties whose name starts with "legacy-". This is a flawed test for "is a legacy property".

The test is flawed because non-legacy properties can and do start with "legacy-". Back when it was added, no such properties existed. Right now, three such properties do: property "legacy-cmb" of device "nvme", and properties "legacy-cache" and "legacy-multi-node" of devices "x86_64-cpu", "i386-cpu", and its children.

This affects QMP command "device-list-properties", HMP command "device_add T,help", and command line option "-device T,help".

Legacy properties are gone since commit a61383f7ab (qdev: Legacy properties are now unused internally, drop, 2025-10-22). This makes the fix easy: delete the code that skips them.

Reproducer: -device nvme,help doesn't show legacy-cmb before the patch, and does after.

Fixes f4eb32b590 (qmp: show QOM properties in device-list-properties, 2014-05-20)
---
 qom/qom-qmp-cmds.c | 7 -------
 1 file changed, 7 deletions(-)
qom/qom-qmp-cmds.c +0 -7
index 48b38d2b7f..330895361d 100644
@@ -218,13 +218,6 @@ ObjectPropertyInfoList *qmp_device_list_properties(const char *typename,
             continue;
         }
 
-        /* Skip legacy properties since they are just string versions of
-         * properties that we already list.
-         */
-        if (strstart(prop->name, "legacy-", NULL)) {
-            continue;
-        }
-
         info = g_new0(ObjectPropertyInfo, 1);
         info->name = g_strdup(prop->name);
         info->type = g_strdup(prop->type);
Signature · 1 line
2.54.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 16 lines · Markus Armbruster

qmp_device_list_properties() skips properties whose name starts with "legacy-". This is a flawed test for "is a legacy property".

The test is flawed because non-legacy properties can and do start with "legacy-". Back when it was added, no such properties existed. Right now, three such properties do: property "legacy-cmb" of device "nvme", and properties "legacy-cache" and "legacy-multi-node" of devices "x86_64-cpu", "i386-cpu", and its children.

This affects QMP command "device-list-properties", HMP command "device_add T,help", and command line option "-device T,help".

Legacy properties are gone since commit a61383f7ab (qdev: Legacy properties are now unused internally, drop, 2025-10-22). This makes the fix easy: delete the code that skips them.

Quoted 8 lines

Reproducer: -device nvme,help doesn't show legacy-cmb before the patch, and does after.

Fixes f4eb32b590 (qmp: show QOM properties in device-list-properties, 2014-05-20)
---
 qom/qom-qmp-cmds.c | 7 -------
 1 file changed, 7 deletions(-)

With regards,
Daniel

Signature · 3 lines
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|