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

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@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

2015-08-28 11:36 GMT+02:00 Michal Privoznik <mprivozn@redhat.com>:
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@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
It looks like you're dealing with this in the wrong part of the parser. But let me have a more detailed look at the reported issue. -- Matthias Bolte http://photron.blogspot.com

Ok here's my patch for this: https://www.redhat.com/archives/libvir-list/2015-September/msg00005.html Regards, Matthias 2015-08-28 12:08 GMT+02:00 Matthias Bolte <matthias.bolte@googlemail.com>:
2015-08-28 11:36 GMT+02:00 Michal Privoznik <mprivozn@redhat.com>:
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@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
It looks like you're dealing with this in the wrong part of the parser. But let me have a more detailed look at the reported issue.
-- Matthias Bolte http://photron.blogspot.com
-- Matthias Bolte http://photron.blogspot.com
participants (2)
-
Matthias Bolte
-
Michal Privoznik