[PATCH] qemu_capabilities: introduce QEMU_CAPS_SD_CARD to probe sd-card drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Chen Hanxiao <chenhanxiao@xxxxxxxxx>

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@xxxxxxxxx>
---
 src/qemu/qemu_capabilities.c | 9 +++++++--
 src/qemu/qemu_capabilities.h | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 3247d25..b200b37 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -357,6 +357,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
 
               "query-cpu-model-expansion", /* 245 */
               "virtio-net.host_mtu",
+              "sd-card",
     );
 
 
@@ -1624,6 +1625,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[] = {
@@ -5193,8 +5195,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) ||
@@ -5203,6 +5204,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 95bb67d..85e7959 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -393,6 +393,7 @@ typedef enum {
     /* 245 */
     QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION, /* qmp query-cpu-model-expansion */
     QEMU_CAPS_VIRTIO_NET_HOST_MTU, /* virtio-net-*.host_mtu */
+    QEMU_CAPS_SD_CARD, /* -sd abc.img */
 
     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
-- 
2.7.4


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux