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

Matthias Bolte matthias.bolte at googlemail.com
Fri Aug 28 10:08:40 UTC 2015


2015-08-28 11:36 GMT+02:00 Michal Privoznik <mprivozn at 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 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
>

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




More information about the libvir-list mailing list