diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index c324f24dbddb79c6b1504def610d0b377f63d168..a75ca0574db17502916478a9239611b6977dc080 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -564,6 +564,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
/* 355 */
"vhost-user-fs",
+ "query-named-block-nodes.flat",
);
@@ -1440,6 +1441,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
{ "blockdev-add/arg-type/+file/$dynamic-auto-read-only", QEMU_CAPS_BLOCK_FILE_AUTO_READONLY_DYNAMIC },
{ "human-monitor-command/$savevm-monitor-nodes", QEMU_CAPS_SAVEVM_MONITOR_NODES },
{ "blockdev-add/arg-type/+nvme", QEMU_CAPS_DRIVE_NVME },
+ { "query-named-block-nodes/arg-type/flat", QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT },
};
typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps;
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 5b483a241949a0509c60a90b603c290f26ff35b7..8b6145c327eb0e572c327852be1b049b6a6b15fa 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -545,6 +545,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
/* 355 */
QEMU_CAPS_DEVICE_VHOST_USER_FS, /* -device vhost-user-fs */
+ QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT, /* query-named-block-nodes supports the 'flat' option */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
index f215514f09b6e30731952538424927ac5382d368..f60338bf6ba69818faa9497a7a19589fb36fc7ce 100644
--- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
@@ -224,6 +224,7 @@
+
4002050
0
43100241