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

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

 



From: Han Cheng <hanc.fnst@xxxxxxxxxxxxxx>

Adding two cap flags for scsi-generic:
  QEMU_CAPS_SCSI_GENERIC
  QEMU_CAPS_SCSI_GENERIC_BOOTINDEX

Signed-off-by: Han Cheng <hanc.fnst@xxxxxxxxxxxxxx>
Signed-off-by: Osier Yang <hanc.fnst@xxxxxxxxxxxxxx>
---
 src/qemu/qemu_capabilities.c             | 21 ++++++++++++++++-----
 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, 62 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index a3a8d1f..430e893 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -221,9 +221,12 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
               "tpm-tis",
 
               "nvram",  /* 140 */
-              "pci-bridge", /* 141 */
-              "vfio-pci", /* 142 */
-              "vfio-pci.bootindex", /* 143 */
+              "pci-bridge",
+              "vfio-pci",
+              "vfio-pci.bootindex",
+              "scsi-generic",
+
+              "scsi-generic.bootindex", /* 145 */
     );
 
 struct _virQEMUCaps {
@@ -1344,8 +1347,8 @@ 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 },
@@ -1354,6 +1357,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
     { "spapr-nvram", QEMU_CAPS_DEVICE_NVRAM },
     { "pci-bridge", QEMU_CAPS_DEVICE_PCI_BRIDGE },
     { "vfio-pci", QEMU_CAPS_DEVICE_VFIO_PCI },
+    { "scsi-generic", QEMU_CAPS_DEVICE_SCSI_GENERIC },
 };
 
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
@@ -1403,6 +1407,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;
@@ -1438,6 +1446,8 @@ static struct virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = {
       ARRAY_CARDINALITY(virQEMUCapsObjectPropsUsbRedir) },
     { "usb-host", virQEMUCapsObjectPropsUsbHost,
       ARRAY_CARDINALITY(virQEMUCapsObjectPropsUsbHost) },
+    { "scsi-generic", virQEMUCapsObjectPropsScsiGeneric,
+      ARRAY_CARDINALITY(virQEMUCapsObjectPropsScsiGeneric) },
 };
 
 
@@ -1635,6 +1645,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 213f63c..a9eea4e 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -182,6 +182,8 @@ enum virQEMUCapsFlags {
     QEMU_CAPS_DEVICE_PCI_BRIDGE  = 141, /* -device pci-bridge */
     QEMU_CAPS_DEVICE_VFIO_PCI    = 142, /* -device vfio-pci */
     QEMU_CAPS_VFIO_PCI_BOOTINDEX = 143, /* bootindex param for vfio-pci device */
+    QEMU_CAPS_DEVICE_SCSI_GENERIC = 144,  /* -device scsi-generic */
+    QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX = 145,  /* -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 fa56406..f7f88d0 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -510,7 +510,8 @@ mymain(void)
             QEMU_CAPS_DEVICE_VMWARE_SVGA,
             QEMU_CAPS_DEVICE_USB_SERIAL,
             QEMU_CAPS_DEVICE_USB_NET,
-            QEMU_CAPS_DEVICE_PCI_BRIDGE);
+            QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            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,
@@ -730,7 +731,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,
@@ -822,7 +825,9 @@ mymain(void)
             QEMU_CAPS_DEVICE_USB_NET,
             QEMU_CAPS_DTB,
             QEMU_CAPS_IPV6_MIGRATION,
-            QEMU_CAPS_DEVICE_PCI_BRIDGE);
+            QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            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,
@@ -926,7 +931,9 @@ mymain(void)
             QEMU_CAPS_DTB,
             QEMU_CAPS_SCSI_MEGASAS,
             QEMU_CAPS_IPV6_MIGRATION,
-            QEMU_CAPS_DEVICE_PCI_BRIDGE);
+            QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            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,
@@ -1035,7 +1042,9 @@ mymain(void)
             QEMU_CAPS_DTB,
             QEMU_CAPS_SCSI_MEGASAS,
             QEMU_CAPS_IPV6_MIGRATION,
-            QEMU_CAPS_DEVICE_PCI_BRIDGE);
+            QEMU_CAPS_DEVICE_PCI_BRIDGE,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC,
+            QEMU_CAPS_DEVICE_SCSI_GENERIC_BOOTINDEX);
 
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
-- 
1.8.1.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]