[libvirt] [PATCH v2 04/10] qemu: New cap flag for scsi-generic

Osier Yang jyang at redhat.com
Wed Apr 3 03:41:44 UTC 2013


On 01/04/13 20:00, Han Cheng wrote:
> Adding two caps to support scsi-generic:
>
>    QEMU_CAPS_SCSI_GENERIC
>    QEMU_CAPS_SCSI_GENERIC_BOOTINDEX
>
> Signed-off-by: Han Cheng <hanc.fnst at cn.fujitsu.com>
> ---
>   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 861d3c4..3ec0750 100644
> --- a/src/qemu/qemu_capabilities.c
> +++ b/src/qemu/qemu_capabilities.c
> @@ -213,6 +213,9 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
>                 "virtio-ccw",
>                 "dtb",
>                 "megasas",
> +
> +              "scsi-generic", /* 135 */
> +              "scsi-generic.bootindex",
>       );
>   
>   struct _virQEMUCaps {
> @@ -1341,13 +1344,14 @@ 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 },
>       { "virtio-rng-s390", QEMU_CAPS_DEVICE_VIRTIO_RNG },
>       { "virtio-rng-ccw", 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 },
>   };
>   
>   static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
> @@ -1393,6 +1397,10 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsUsbHost[] = {
>       { "bootindex", QEMU_CAPS_USB_HOST_BOOTINDEX },
>   };
>   
> +static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsScsiHost[] = {
> +    { "bootindex", QEMU_CAPS_SCSI_GENERIC_BOOTINDEX },
> +};
> +
>   struct virQEMUCapsObjectTypeProps {
>       const char *type;
>       struct virQEMUCapsStringFlags *props;
> @@ -1426,6 +1434,8 @@ static struct virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = {
>         ARRAY_CARDINALITY(virQEMUCapsObjectPropsUsbRedir) },
>       { "usb-host", virQEMUCapsObjectPropsUsbHost,
>         ARRAY_CARDINALITY(virQEMUCapsObjectPropsUsbHost) },
> +    { "scsi-generic", virQEMUCapsObjectPropsScsiHost,
> +      ARRAY_CARDINALITY(virQEMUCapsObjectPropsScsiHost) },
>   };
>   
>   
> @@ -1623,6 +1633,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 7101f67..a3d8595 100644
> --- a/src/qemu/qemu_capabilities.h
> +++ b/src/qemu/qemu_capabilities.h
> @@ -174,6 +174,8 @@ enum virQEMUCapsFlags {
>       QEMU_CAPS_VIRTIO_CCW         = 132, /* -device virtio-*-ccw */
>       QEMU_CAPS_DTB                = 133, /* -dtb file */
>       QEMU_CAPS_SCSI_MEGASAS       = 134, /* -device megasas */
> +    QEMU_CAPS_SCSI_GENERIC       = 135, /* -device scsi-generic */
> +    QEMU_CAPS_SCSI_GENERIC_BOOTINDEX = 136, /* scsi-generic.bootindex */
>   
>       QEMU_CAPS_LAST,                   /* this must always be the last item */
>   };

Looks good, but don't you need to update qemuhelptestdata to make
sure the "make check" is not broken?

Osier




More information about the libvir-list mailing list