• H
    qemu: Build qemu command line for scsi host device · 0d70656a
    Han Cheng 提交于
    Except the scsi host device's controller is "lsilogic", mapping
    between the libvirt attributes and scsi-generic properties is:
    
      libvirt     qemu
    -----------------------------------------
      controller  bus ($libvirt_controller.0)
      bus         channel
      target      scsi-id
      unit        lun
    
    For scsi host device with "lsilogic" controller, the mapping is:
    ('target (libvirt)' must be 0, as it's not used; 'unit (libvirt)
    must <= 7).
    
      libvirt            qemu
    ----------------------------------------------------------
      controller && bus  bus ($libvirt_controller.$libvirt_bus)
      unit               scsi-id
    
    It's not good to hardcode/hard-check limits of these attributes,
    and even worse, these limits are not documented, one has to find
    out by either testing or reading the qemu code, I'm looking forward
    to qemu expose limits like these one day). For example, exposing
    "max_target", "max_lun" for megasas:
    
    static const struct SCSIBusInfo megasas_scsi_info = {
        .tcq = true,
        .max_target = MFI_MAX_LD,
        .max_lun = 255,
    
        .transfer_data = megasas_xfer_complete,
        .get_sg_list = megasas_get_sg_list,
        .complete = megasas_command_complete,
        .cancel = megasas_command_cancel,
    };
    
    Example of the qemu command line (lsilogic controller):
    
      -drive file=/dev/sg2,if=none,id=drive-hostdev-scsi_host7-0-0-0 \
      -device scsi-generic,bus=scsi0.0,scsi-id=8,\
      drive=drive-hostdev-scsi_host7-0-0-0,id=hostdev-scsi_host7-0-0-0
    
    Example of the qemu command line (virtio-scsi controller):
    
      -drive file=/dev/sg2,if=none,id=drive-hostdev-scsi_host7-0-0-0 \
      -device scsi-generic,bus=scsi0.0,channel=0,scsi-id=128,lun=128,\
      drive=drive-hostdev-scsi_host7-0-0-0,id=hostdev-scsi_host7-0-0-0
    Signed-off-by: NHan Cheng <hanc.fnst@cn.fujitsu.com>
    Signed-off-by: NOsier Yang <jyang@redhat.com>
    0d70656a
qemuxml2argv-hostdev-scsi-virtio-scsi.args 628 字节