[libvirt] [PATCH 3/4] qemu: Add caps to indentify if setting wwn is supported by qemu

Osier Yang jyang at redhat.com
Tue Sep 18 02:47:11 UTC 2012


This assumes ide-drive.wwn, ide-hd.wwn, ide-cd.wwn were supported
at the same time, similar for scsi-disk.wwn, scsi-hd.wwn, and
scsi-cd.wwn. So only two new caps (QEMU_CAPS_IDE_DRIVE_WWN,
and QEMU_CAPS_SCSI_DISK_WWN) are introduced.
---
 src/qemu/qemu_capabilities.c |    8 ++++++++
 src/qemu/qemu_capabilities.h |    2 ++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 7742db5..edfe1e7 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -177,6 +177,8 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
 
               "disable-s4", /* 105 */
               "usb-redir.filter",
+              "ide-drive.wwn",
+              "scsi-disk.wwn",
     );
 
 struct _qemuCaps {
@@ -1466,6 +1468,7 @@ qemuCapsExtractDeviceStr(const char *qemu,
                          "-device", "scsi-disk,?",
                          "-device", "PIIX4_PM,?",
                          "-device", "usb-redir,?",
+                         "-device", "ide-drive,?",
                          NULL);
     /* qemu -help goes to stdout, but qemu -device ? goes to stderr.  */
     virCommandSetErrorBuffer(cmd, &output);
@@ -1558,12 +1561,17 @@ qemuCapsParseDeviceStr(const char *str, qemuCapsPtr caps)
         qemuCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_SCSI);
     if (strstr(str, "scsi-disk.channel"))
         qemuCapsSet(caps, QEMU_CAPS_SCSI_DISK_CHANNEL);
+    if (strstr(str, "scsi-disk.wwn"))
+        qemuCapsSet(caps, QEMU_CAPS_SCSI_DISK_WWN);
     if (strstr(str, "scsi-block"))
         qemuCapsSet(caps, QEMU_CAPS_SCSI_BLOCK);
     if (strstr(str, "scsi-cd"))
         qemuCapsSet(caps, QEMU_CAPS_SCSI_CD);
     if (strstr(str, "ide-cd"))
         qemuCapsSet(caps, QEMU_CAPS_IDE_CD);
+    if (strstr(str, "ide-drive.wwn"))
+        qemuCapsSet(caps, QEMU_CAPS_IDE_DRIVE_WWN);
+
     /*
      * the iolimit detection is not really straight forward:
      * in qemu this is a capability of the block layer, if
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index c1519ed..fb1841a 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -142,6 +142,8 @@ enum qemuCapsFlags {
     QEMU_CAPS_DISABLE_S3         = 104, /* S3 BIOS Advertisement on/off */
     QEMU_CAPS_DISABLE_S4         = 105, /* S4 BIOS Advertisement on/off */
     QEMU_CAPS_USB_REDIR_FILTER   = 106, /* usb-redir.filter */
+    QEMU_CAPS_IDE_DRIVE_WWN      = 107, /* Is ide-drive.wwn available? */
+    QEMU_CAPS_SCSI_DISK_WWN      = 108, /* Is scsi-disk.wwn available? */
 
     QEMU_CAPS_LAST,                   /* this must always be the last item */
 };
-- 
1.7.7.3




More information about the libvir-list mailing list