KVM: Problems with different emulated scsi controllers

375gnu

New Member
Jun 17, 2014
17
0
1
Yesterday I was experimenting with different SCSI controllers emulation (I had a problem with VM migrated from VMWare), and I've found problems with LSI 53C810 and VMware PVSCSI.

  • LSI 53C810 — seabios doesn't see it.
  • VMware PVSCSI — 1) seabios doesn't see it, 2) kvm doesn't with 2 scsi drives, see below.

kvm: -device scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi1,id=scsi1: bad scsi device lun: 1
kvm: -device scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi1,id=scsi1: Device initialization failed.
kvm: -device scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi1,id=scsi1: Device 'scsi-hd' could not be initialized
TASK ERROR: start failed: command '/usr/bin/kvm -id 115 -chardev 'socket,id=qmp,path=/var/run/qemu-server/115.qmp,server,nowait' -mon 'chardev=qmp,mode=control' -vnc unix:/var/run/qemu-server/115.vnc,x509,password -pidfile /var/run/qemu-server/115.pid -daemonize -name test -smp 'sockets=1,cores=1' -nodefaults -boot 'menu=on' -vga cirrus -cpu kvm64,+lahf_lm,+x2apic,+sep -k en-us -m 512 -cpuunits 1000 -device 'piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2' -device 'usb-tablet,id=tablet,bus=uhci.0,port=1' -device 'virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3' -device 'pvscsi,id=scsihw0,bus=pci.0,addr=0x5' -drive 'file=/var/lib/vz/images/115/vm-115-disk-2.qcow2,if=none,id=drive-scsi1,format=qcow2,aio=native,cache=none' -device 'scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi1,id=scsi1' -drive 'if=none,id=drive-ide2,media=cdrom,aio=native' -device 'ide-cd,bus=ide.1,unit=0,drive=drive-ide2,id=ide2,bootindex=200' -drive 'file=/var/lib/vz/images/115/vm-115-disk-1.qcow2,if=none,id=drive-scsi0,format=qcow2,aio=native,cache=none' -device 'scsi-hd,bus=scsihw0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0,id=scsi0,bootindex=101' -netdev 'type=tap,id=net0,ifname=tap115i0,script=/var/lib/qemu-server/pve-bridge' -device 'e1000,mac=0A:BA:8E:22:C8:1B,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=300'' failed: exit code 1
 
Last edited:
the current seabios has issue with scsi, seems fixed in latest version. but so far we did not released packages with these fixes (qemu 2.0 only available via git).
 
I had a similar issue migrating a VMware prebuilt image that had (3) disks using the necessary PVSCSI controller. This referenced patch worked for me: https://techdoc.puma-it.systems/dok..._mit_mehr_als_einer_festplatte_nutzbar_machen [from forum https://forum.proxmox.com/threads/error-at-startup-after-adding-lvm-disk.42293/]

Not sure if this is a patch that can be incorporated for future updates // or what the implications are.


/// snip from referenced patch ///

So that you don't have to do this manually after you create the hard drives, you can change this behavior in the file /usr/share/perl5/PVE/QemuServer.pm: from

if (!$conf->{scsihw} || ($conf->{scsihw} =~ m/^lsi/)){
$device = "scsi-$devicetype,bus=$controller_prefix$controller.0,scsi-id=$unit,drive=drive-$drive->{interface}$drive->{index},id=$drive->{interface}$drive->{index}";
} else {
$device = "scsi-$devicetype,bus=$controller_prefix$controller.0,channel=0,scsi-id=0,lun=$drive->{index},drive=drive-$drive->{interface}$drive->{index},id=$drive->{interface}$drive->{index}";
}

*To*

if (!$conf->{scsihw} || ($conf->{scsihw} =~ m/^lsi/)){
$device = "scsi-$devicetype,bus=$controller_prefix$controller.0,scsi-id=$unit,drive=drive-$drive->{interface}$drive->{index},id=$drive->{interface}$drive->{index}";
} else {
$device = "scsi-$devicetype,bus=$controller_prefix$controller.0,channel=0,scsi-id=$drive->{index},lun=0,drive=drive-$drive->{interface}$drive->{index},id=$drive->{interface}$drive->{index}";
}

This always leaves the Lun at 0 and sets the ID to the respective hard drive number.

A final step to make it all effective:

systemctl restart pvedaemon.service

/// end of snip ///
 
Last edited: