[libvirt] [PATCH] virVMXParseDisk: Recognize scsi-passthru

Michal Privoznik mprivozn at redhat.com
Fri Aug 28 09:36:06 UTC 2015


https://bugzilla.redhat.com/show_bug.cgi?id=1172544

So, imagine you have this config:

    scsi0:1.present = "TRUE"
    scsi0:1.deviceType = "scsi-passthru"
    scsi0:1.fileName = "/vmfs/devices/cdrom/mpx.vmhba32:C0:T0:L0"
    scsi0:1.allowGuestConnectionControl = "FALSE"

So far, libvirt does not recognize this pattern and fails. What
if we produce the following XML to it?

    <disk type='block' device='disk'>
      <source dev='/vmfs/devices/cdrom/mpx.vmhba32:C0:T0:L0'/>
      <target dev='sdb' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/vmx/vmx.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 36e2891..6d83d81 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -2187,6 +2187,17 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
              * function to parse a CDROM device may handle it.
              */
             goto ignore;
+        } else if (STREQ_NULLABLE(deviceType, "scsi-passthru")) {
+            char *tmp;
+
+            virDomainDiskSetType(*def, VIR_STORAGE_TYPE_BLOCK);
+            if (!(tmp = ctx->parseFileName(fileName, ctx->opaque)))
+                goto cleanup;
+            if (virDomainDiskSetSource(*def, tmp) < 0) {
+                VIR_FREE(tmp);
+                goto cleanup;
+            }
+            VIR_FREE(tmp);
         } else {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Invalid or not yet handled value '%s' "
-- 
2.4.6




More information about the libvir-list mailing list