From: Chen Hanxiao <chenhanxiao(a)gmail.com>
This patch introduces QEMU_CAPS_SD_CARD for probing
whether qemu support SD card by:
{"execute": "device-list-properties",
"arguments":{"typename":"sd-card"}}
It will be helpful for apps which used
cmd 'virsh domcaps` etc.
Also helpful for:
https://bugzilla.redhat.com/show_bug.cgi?id=1387218
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
v2:
rebased on upstream
v2.1:
add doc/news.xml description
rebased on upstream
docs/news.xml | 9 +++++++++
src/qemu/qemu_capabilities.c | 9 +++++++--
src/qemu/qemu_capabilities.h | 1 +
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/docs/news.xml b/docs/news.xml
index 584c9af..b218463 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -26,6 +26,15 @@
don't start it with unsupported features.
</description>
</change>
+ <change>
+ <summary>
+ qemu_capabilities: introduce QEMU_CAPS_SD_CARD to probe sd-card drivers
+ </summary>
+ <description>
+ The new QEMU capability flag will allow libvirt to probe sd-card
+ drivers.
+ </description>
+ </change>
</section>
<section title="Bug fixes">
<change/>
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 5694d0b..1828b30 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -359,6 +359,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"query-cpu-model-expansion", /* 245 */
"virtio-net.host_mtu",
"spice-rendernode",
+ "sd-card",
);
@@ -1626,6 +1627,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "ivshmem-plain", QEMU_CAPS_DEVICE_IVSHMEM_PLAIN },
{ "ivshmem-doorbell", QEMU_CAPS_DEVICE_IVSHMEM_DOORBELL },
{ "vhost-scsi", QEMU_CAPS_DEVICE_VHOST_SCSI },
+ { "sd-card", QEMU_CAPS_SD_CARD },
};
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[] = {
@@ -5425,8 +5427,7 @@ virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr qemuCaps,
VIR_DOMAIN_CAPS_ENUM_SET(disk->bus,
VIR_DOMAIN_DISK_BUS_IDE,
VIR_DOMAIN_DISK_BUS_SCSI,
- VIR_DOMAIN_DISK_BUS_VIRTIO,
- /* VIR_DOMAIN_DISK_BUS_SD */);
+ VIR_DOMAIN_DISK_BUS_VIRTIO);
/* PowerPC pseries based VMs do not support floppy device */
if (!ARCH_IS_PPC64(qemuCaps->arch) ||
@@ -5435,6 +5436,10 @@ virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr qemuCaps,
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_USB_STORAGE))
VIR_DOMAIN_CAPS_ENUM_SET(disk->bus, VIR_DOMAIN_DISK_BUS_USB);
+
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SD_CARD))
+ VIR_DOMAIN_CAPS_ENUM_SET(disk->bus, VIR_DOMAIN_DISK_BUS_SD);
+
return 0;
}
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index cc9f46e..decca12 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -394,6 +394,7 @@ typedef enum {
QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION, /* qmp query-cpu-model-expansion */
QEMU_CAPS_VIRTIO_NET_HOST_MTU, /* virtio-net-*.host_mtu */
QEMU_CAPS_SPICE_RENDERNODE, /* -spice rendernode */
+ QEMU_CAPS_SD_CARD, /* -sd SD-card.img */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
--
2.7.4