On 2013年03月04日 14:01, Han Cheng wrote:
Adding two caps to support scsi-generic:
QEMU_CAPS_SCSI_GENERIC
QEMU_CAPS_SCSI_HOST_BOOTINDEX
---
src/qemu/qemu_capabilities.c | 15 +++++++++++++--
src/qemu/qemu_capabilities.h | 2 ++
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 40022c1..01580d1 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -210,6 +210,9 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"rng-random", /* 130 */
"rng-egd",
+ "scsi-generic",
+ "scsi-generic.bootindex",
+
);
struct _virQEMUCaps {
@@ -1331,11 +1334,12 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "VGA", QEMU_CAPS_DEVICE_VGA },
{ "cirrus-vga", QEMU_CAPS_DEVICE_CIRRUS_VGA },
{ "vmware-svga", QEMU_CAPS_DEVICE_VMWARE_SVGA },
- { "usb-serial", QEMU_CAPS_DEVICE_USB_SERIAL},
- { "usb-net", QEMU_CAPS_DEVICE_USB_NET},
+ { "usb-serial", QEMU_CAPS_DEVICE_USB_SERIAL },
+ { "usb-net", QEMU_CAPS_DEVICE_USB_NET },
{ "virtio-rng-pci", QEMU_CAPS_DEVICE_VIRTIO_RNG },
{ "rng-random", QEMU_CAPS_OBJECT_RNG_RANDOM },
{ "rng-egd", QEMU_CAPS_OBJECT_RNG_EGD },
+ { "scsi-generic", QEMU_CAPS_SCSI_GENERIC },
};
@@ -1382,6 +1386,10 @@ static struct virQEMUCapsStringFlags
virQEMUCapsObjectPropsUsbHost[] = {
{ "bootindex", QEMU_CAPS_USB_HOST_BOOTINDEX },
};
+static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsScsiHost[] = {
+ { "bootindex", QEMU_CAPS_SCSI_HOST_BOOTINDEX },
+};
+
struct virQEMUCapsObjectTypeProps {
const char *type;
struct virQEMUCapsStringFlags *props;
@@ -1411,6 +1419,8 @@ static struct virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] =
{
ARRAY_CARDINALITY(virQEMUCapsObjectPropsUsbRedir) },
{ "usb-host", virQEMUCapsObjectPropsUsbHost,
ARRAY_CARDINALITY(virQEMUCapsObjectPropsUsbHost) },
+ { "scsi-generic", virQEMUCapsObjectPropsScsiHost,
+ ARRAY_CARDINALITY(virQEMUCapsObjectPropsScsiHost) },
};
@@ -1608,6 +1618,7 @@ virQEMUCapsExtractDeviceStr(const char *qemu,
"-device", "usb-redir,?",
"-device", "ide-drive,?",
"-device", "usb-host,?",
+ "-device", "scsi-generic,?",
NULL);
/* qemu -help goes to stdout, but qemu -device ? goes to stderr. */
virCommandSetErrorBuffer(cmd,&output);
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index a895867..7d45e30 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -171,6 +171,8 @@ enum virQEMUCapsFlags {
QEMU_CAPS_OBJECT_RNG_RANDOM = 130, /* the rng-random backend for
virtio rng */
QEMU_CAPS_OBJECT_RNG_EGD = 131, /* EGD protocol daemon for rng */
+ QEMU_CAPS_SCSI_GENERIC = 132, /* -device scsi-generic */
+ QEMU_CAPS_SCSI_HOST_BOOTINDEX = 133, /* scsi-generic.bootindex */
Why it's named as "SCSI_HOST_BOOTINDEX", but the comment says
"scsi-generic.bootindex"? It's a confused, as we also have
terms like "SCSI_HOST" for "scsi-host" across.
QEMU_CAPS_LAST, /* this must always be the last item */
};