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

[libvirt] [PATCH 02/10] qemu: New cap flags for scsi-generic



From: Han Cheng <hanc fnst cn fujitsu com>

Adding two cap flags for scsi-generic:
  QEMU_CAPS_SCSI_GENERIC
  QEMU_CAPS_SCSI_GENERIC_BOOTINDEX

Signed-off-by: Han Cheng <hanc fnst cn fujitsu com>
---
 src/qemu/qemu_capabilities.c             | 14 ++++++++++++--
 src/qemu/qemu_capabilities.h             |  2 ++
 tests/qemuhelpdata/qemu-1.0-device       | 10 ++++++++++
 tests/qemuhelpdata/qemu-1.1.0-device     | 10 ++++++++++
 tests/qemuhelpdata/qemu-1.2.0-device     |  5 +++++
 tests/qemuhelpdata/qemu-kvm-1.2.0-device |  5 +++++
 tests/qemuhelptest.c                     | 19 ++++++++++++++-----
 7 files changed, 58 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 1d54477..c3e134e 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -222,6 +222,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
               "tpm-tis",
 
               "nvram",  /* 140 */
+              "scsi-generic",
+              "scsi-generic.bootindex",
     );
 
 struct _virQEMUCaps {
@@ -1342,14 +1344,15 @@ 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 },
     { "spapr-nvram", QEMU_CAPS_DEVICE_NVRAM },
+    { "scsi-generic", QEMU_CAPS_DEVICE_SCSI_GENERIC },
 };
 
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
@@ -1395,6 +1398,10 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsUsbHost[] = {
     { "bootindex", QEMU_CAPS_USB_HOST_BOOTINDEX },
 };
 
+static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsScsiGeneric[] = {
+    { "bootindex", QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX },
+};
+
 struct virQEMUCapsObjectTypeProps {
     const char *type;
     struct virQEMUCapsStringFlags *props;
@@ -1428,6 +1435,8 @@ static struct virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = {
       ARRAY_CARDINALITY(virQEMUCapsObjectPropsUsbRedir) },
     { "usb-host", virQEMUCapsObjectPropsUsbHost,
       ARRAY_CARDINALITY(virQEMUCapsObjectPropsUsbHost) },
+    { "scsi-generic", virQEMUCapsObjectPropsScsiGeneric,
+      ARRAY_CARDINALITY(virQEMUCapsObjectPropsScsiGeneric) },
 };
 
 
@@ -1625,6 +1634,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 9c2bf57..c7346bc 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -180,6 +180,8 @@ enum virQEMUCapsFlags {
     QEMU_CAPS_DEVICE_TPM_TIS     = 139, /* -device tpm_tis */
 
     QEMU_CAPS_DEVICE_NVRAM       = 140,  /* -global spapr-nvram.reg=xxxx */
+    QEMU_CAPS_DEVICE_SCSI_GENERIC = 141,  /* -device scsi-generic */
+    QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX = 142,  /* -device scsi-generic.bootindex */
 
     QEMU_CAPS_LAST,                   /* this must always be the last item */
 };
diff --git a/tests/qemuhelpdata/qemu-1.0-device b/tests/qemuhelpdata/qemu-1.0-device
index 0bdfbbd..d557f0e 100644
--- a/tests/qemuhelpdata/qemu-1.0-device
+++ b/tests/qemuhelpdata/qemu-1.0-device
@@ -136,3 +136,13 @@ virtio-net-pci.romfile=string
 virtio-net-pci.rombar=uint32
 virtio-net-pci.multifunction=on/off
 virtio-net-pci.command_serr_enable=on/off
+scsi-generic.drive=drive
+scsi-generic.logical_block_size=uint16
+scsi-generic.physical_block_size=uint16
+scsi-generic.min_io_size=uint16
+scsi-generic.opt_io_size=uint32
+scsi-generic.bootindex=int32
+scsi-generic.discard_granularity=uint32
+scsi-generic.channel=uint32
+scsi-generic.scsi-id=uint32
+scsi-generic.lun=uint32
diff --git a/tests/qemuhelpdata/qemu-1.1.0-device b/tests/qemuhelpdata/qemu-1.1.0-device
index abbf850..7313a34 100644
--- a/tests/qemuhelpdata/qemu-1.1.0-device
+++ b/tests/qemuhelpdata/qemu-1.1.0-device
@@ -158,3 +158,13 @@ scsi-disk.dpofua=on/off
 scsi-disk.channel=uint32
 scsi-disk.scsi-id=uint32
 scsi-disk.lun=uint32
+scsi-generic.drive=drive
+scsi-generic.logical_block_size=blocksize
+scsi-generic.physical_block_size=blocksize
+scsi-generic.min_io_size=uint16
+scsi-generic.opt_io_size=uint32
+scsi-generic.bootindex=int32
+scsi-generic.discard_granularity=uint32
+scsi-generic.channel=uint32
+scsi-generic.scsi-id=uint32
+scsi-generic.lun=uint32
diff --git a/tests/qemuhelpdata/qemu-1.2.0-device b/tests/qemuhelpdata/qemu-1.2.0-device
index 5613e00..40845e4 100644
--- a/tests/qemuhelpdata/qemu-1.2.0-device
+++ b/tests/qemuhelpdata/qemu-1.2.0-device
@@ -208,3 +208,8 @@ usb-host.bootindex=int32
 usb-host.pipeline=on/off
 usb-host.port=string
 usb-host.full-path=on/off
+scsi-generic.drive=drive
+scsi-generic.bootindex=int32
+scsi-generic.channel=uint32
+scsi-generic.scsi-id=uint32
+scsi-generic.lun=uint32
diff --git a/tests/qemuhelpdata/qemu-kvm-1.2.0-device b/tests/qemuhelpdata/qemu-kvm-1.2.0-device
index 879a049..09e3ef7 100644
--- a/tests/qemuhelpdata/qemu-kvm-1.2.0-device
+++ b/tests/qemuhelpdata/qemu-kvm-1.2.0-device
@@ -220,3 +220,8 @@ usb-host.bootindex=int32
 usb-host.pipeline=on/off
 usb-host.port=string
 usb-host.full-path=on/off
+scsi-generic.drive=drive
+scsi-generic.bootindex=int32
+scsi-generic.channel=uint32
+scsi-generic.scsi-id=uint32
+scsi-generic.lun=uint32
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 7290183..25aa55b 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -507,7 +507,8 @@ mymain(void)
             QEMU_CAPS_DEVICE_CIRRUS_VGA,
             QEMU_CAPS_DEVICE_VMWARE_SVGA,
             QEMU_CAPS_DEVICE_USB_SERIAL,
-            QEMU_CAPS_DEVICE_USB_NET);
+            QEMU_CAPS_DEVICE_USB_NET,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC);
     DO_TEST("qemu-kvm-0.12.1.2-rhel61", 12001, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -725,7 +726,9 @@ mymain(void)
             QEMU_CAPS_DEVICE_CIRRUS_VGA,
             QEMU_CAPS_DEVICE_VMWARE_SVGA,
             QEMU_CAPS_DEVICE_USB_SERIAL,
-            QEMU_CAPS_DEVICE_USB_NET);
+            QEMU_CAPS_DEVICE_USB_NET,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX);
     DO_TEST("qemu-1.1.0", 1001000, 0, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -816,7 +819,9 @@ mymain(void)
             QEMU_CAPS_DEVICE_USB_SERIAL,
             QEMU_CAPS_DEVICE_USB_NET,
             QEMU_CAPS_DTB,
-            QEMU_CAPS_IPV6_MIGRATION);
+            QEMU_CAPS_IPV6_MIGRATION,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX);
     DO_TEST("qemu-1.2.0", 1002000, 0, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -919,7 +924,9 @@ mymain(void)
             QEMU_CAPS_DEVICE_USB_NET,
             QEMU_CAPS_DTB,
             QEMU_CAPS_SCSI_MEGASAS,
-            QEMU_CAPS_IPV6_MIGRATION);
+            QEMU_CAPS_IPV6_MIGRATION,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX);
     DO_TEST("qemu-kvm-1.2.0", 1002000, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -1027,7 +1034,9 @@ mymain(void)
             QEMU_CAPS_DEVICE_USB_NET,
             QEMU_CAPS_DTB,
             QEMU_CAPS_SCSI_MEGASAS,
-            QEMU_CAPS_IPV6_MIGRATION);
+            QEMU_CAPS_IPV6_MIGRATION,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX);
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
-- 
1.8.1.4


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