[libvirt] qemu: hotplug virtio_scsi over lsilogic when sicsi controller is not present?

Martin Kletzander mkletzan at redhat.com
Fri Jul 14 07:56:34 UTC 2017


On Tue, Jul 11, 2017 at 03:47:55PM -0400, Liang Yan wrote:
>Hi,
>
>We hit some problems when we attached some lun devices in our vm, turns
>out that libvirt created lsilogic scsi controller automatically for
>these scsi devices, however these device works well under virtio_scsi
>controller.
>
>the current code logic is check lsilogic first, if qemu could not
>support it, then check virtio_scsi, however is it better to check
>virtio_scsi earlier? since it is supported better in qemu level?
>

It is not in older QEMUs which we need to stay compatible with.

>I am wondering which solution is better?
>1. simple switch sequence and check virtio_scsi first
>

We can't do that.  We have to keep parsing older XMLs (that did not have
the model in them) the same way as we were before so that we keep stable
guest ABI.

>2. add extra option for "virsh attach-disk" to choose specific
>controller type
>

Or you can first attach the controller and then attach-device with the
xml that specifies that particular controller.  attach-disk is a
syntactic sugar for attach-device IIRC.

>Thanks,
>Liang
>
>
>====================================
>Code part is like below
>
>qemu_hotplug.c  qemuDomainFindOrCreateSCSIDiskController
>
>    /* No SCSI controller present, for backward compatibility we
>     * now hotplug a controller */
>    if (VIR_ALLOC(cont) < 0)
>        return NULL;
>    cont->type = VIR_DOMAIN_CONTROLLER_TYPE_SCSI;
>    cont->idx = controller;
>    cont->model = -1;
>
>    VIR_INFO("No SCSI controller present, hotplugging one");
>    if (qemuDomainAttachControllerDevice(driver,
>
>
>
>qemu_domain_address.c  qemuDomainSetSCSIControllerModel
>
>        if (qemuDomainIsPSeries(def)) {
>            *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI;
>        } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) {
>            *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC;
>        } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI)) {
>            *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI;
>        } else {
>            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>                           _("Unable to determine model for scsi
>controller"));
>            return -1;
>
>
>--
>libvir-list mailing list
>libvir-list at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170714/f0addb72/attachment-0001.sig>


More information about the libvir-list mailing list