* [pve-devel] [RFC qemu-server] avoid setting lun number for drives when pvscsi controller is used @ 2021-04-13 8:24 Fabian Ebner 2021-06-14 6:29 ` Fabian Ebner 2021-06-16 18:27 ` [pve-devel] applied: " Thomas Lamprecht 0 siblings, 2 replies; 8+ messages in thread From: Fabian Ebner @ 2021-04-13 8:24 UTC (permalink / raw) To: pve-devel Reported in the community forum[0]. In QEMU's hw/scsi/vmw_pvscsi.c in the SCSIBusInfo struct, the max_lun property is set to 0. This means that in our stack, one cannot have multiple disks and use 'scsihw: pvscsi' currently, as kvm would fail with bad scsi device lun: 1 Instead of increasing the lun number, increase the scsi-id, as we already do for lsi.* (in hw/scsi/lsi53c895a.c the max_lun property is also 0). [0]: https://forum.proxmox.com/threads/kvm-bad-scsi-device-lun-1.84318/ Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> --- I'm not experienced in this area, so not at all sure if this is the proper solution/workaround. PVE/QemuServer.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index fdb2ac9..4ce663b 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -1451,7 +1451,7 @@ sub print_drivedevice_full { } } - if (!$conf->{scsihw} || ($conf->{scsihw} =~ m/^lsi/)){ + if (!$conf->{scsihw} || $conf->{scsihw} =~ m/^lsi/ || $conf->{scsihw} eq 'pvscsi') { $device = "scsi-$devicetype,bus=$controller_prefix$controller.0,scsi-id=$unit"; } else { $device = "scsi-$devicetype,bus=$controller_prefix$controller.0,channel=0,scsi-id=0" -- 2.20.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [pve-devel] [RFC qemu-server] avoid setting lun number for drives when pvscsi controller is used 2021-04-13 8:24 [pve-devel] [RFC qemu-server] avoid setting lun number for drives when pvscsi controller is used Fabian Ebner @ 2021-06-14 6:29 ` Fabian Ebner 2021-06-14 9:15 ` Stefan Reiter 2021-06-16 18:27 ` [pve-devel] applied: " Thomas Lamprecht 1 sibling, 1 reply; 8+ messages in thread From: Fabian Ebner @ 2021-06-14 6:29 UTC (permalink / raw) To: pve-devel Any feedback for this? Am 13.04.21 um 10:24 schrieb Fabian Ebner: > Reported in the community forum[0]. > > In QEMU's hw/scsi/vmw_pvscsi.c in the SCSIBusInfo struct, the max_lun property > is set to 0. This means that in our stack, one cannot have multiple disks and > use 'scsihw: pvscsi' currently, as kvm would fail with > bad scsi device lun: 1 > > Instead of increasing the lun number, increase the scsi-id, as we already do for > lsi.* (in hw/scsi/lsi53c895a.c the max_lun property is also 0). > > [0]: https://forum.proxmox.com/threads/kvm-bad-scsi-device-lun-1.84318/ > > Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> > --- > > I'm not experienced in this area, so not at all sure if this is the proper > solution/workaround. > > PVE/QemuServer.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm > index fdb2ac9..4ce663b 100644 > --- a/PVE/QemuServer.pm > +++ b/PVE/QemuServer.pm > @@ -1451,7 +1451,7 @@ sub print_drivedevice_full { > } > } > > - if (!$conf->{scsihw} || ($conf->{scsihw} =~ m/^lsi/)){ > + if (!$conf->{scsihw} || $conf->{scsihw} =~ m/^lsi/ || $conf->{scsihw} eq 'pvscsi') { > $device = "scsi-$devicetype,bus=$controller_prefix$controller.0,scsi-id=$unit"; > } else { > $device = "scsi-$devicetype,bus=$controller_prefix$controller.0,channel=0,scsi-id=0" > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [pve-devel] [RFC qemu-server] avoid setting lun number for drives when pvscsi controller is used 2021-06-14 6:29 ` Fabian Ebner @ 2021-06-14 9:15 ` Stefan Reiter 2021-06-15 8:04 ` Fabian Ebner 0 siblings, 1 reply; 8+ messages in thread From: Stefan Reiter @ 2021-06-14 9:15 UTC (permalink / raw) To: Proxmox VE development discussion, Fabian Ebner On 6/14/21 8:29 AM, Fabian Ebner wrote: > Any feedback for this? > Looks good to me and works as advertised: Reviewed-by: Stefan Reiter <s.reiter@proxmox.com> Tested-by: Stefan Reiter <s.reiter@proxmox.com> The `$unit = $drive->{index} % maxdev` logic doesn't seem useful here though, I think it's a copy/paste from the IDE/SATA code below (it was already used before this patch). How about this for a cleanup on top: diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index c00bde1..afd47b5 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -1424,7 +1424,6 @@ sub print_drivedevice_full { } elsif ($drive->{interface} eq 'scsi') { my ($maxdev, $controller, $controller_prefix) = scsihw_infos($conf, $drive); - my $unit = $drive->{index} % $maxdev; my $devicetype = 'hd'; my $path = ''; if (drive_is_cdrom($drive)) { @@ -1452,7 +1451,7 @@ sub print_drivedevice_full { } if (!$conf->{scsihw} || $conf->{scsihw} =~ m/^lsi/ || $conf->{scsihw} eq 'pvscsi') { - $device = "scsi-$devicetype,bus=$controller_prefix$controller.0,scsi-id=$unit"; + $device = "scsi-$devicetype,bus=$controller_prefix$controller.0,scsi-id=$drive->{index}"; } else { $device = "scsi-$devicetype,bus=$controller_prefix$controller.0,channel=0,scsi-id=0" .",lun=$drive->{index}"; > Am 13.04.21 um 10:24 schrieb Fabian Ebner: >> Reported in the community forum[0]. >> >> In QEMU's hw/scsi/vmw_pvscsi.c in the SCSIBusInfo struct, the max_lun property >> is set to 0. This means that in our stack, one cannot have multiple disks and >> use 'scsihw: pvscsi' currently, as kvm would fail with >> bad scsi device lun: 1 >> >> Instead of increasing the lun number, increase the scsi-id, as we already do for >> lsi.* (in hw/scsi/lsi53c895a.c the max_lun property is also 0). >> >> [0]: https://forum.proxmox.com/threads/kvm-bad-scsi-device-lun-1.84318/ >> >> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> >> --- >> >> I'm not experienced in this area, so not at all sure if this is the proper >> solution/workaround. >> >> PVE/QemuServer.pm | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm >> index fdb2ac9..4ce663b 100644 >> --- a/PVE/QemuServer.pm >> +++ b/PVE/QemuServer.pm >> @@ -1451,7 +1451,7 @@ sub print_drivedevice_full { >> } >> } >> >> - if (!$conf->{scsihw} || ($conf->{scsihw} =~ m/^lsi/)){ >> + if (!$conf->{scsihw} || $conf->{scsihw} =~ m/^lsi/ || $conf->{scsihw} eq 'pvscsi') { >> $device = "scsi-$devicetype,bus=$controller_prefix$controller.0,scsi-id=$unit"; >> } else { >> $device = "scsi-$devicetype,bus=$controller_prefix$controller.0,channel=0,scsi-id=0" >> > > > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [pve-devel] [RFC qemu-server] avoid setting lun number for drives when pvscsi controller is used 2021-06-14 9:15 ` Stefan Reiter @ 2021-06-15 8:04 ` Fabian Ebner 2021-06-15 8:36 ` Stefan Reiter 0 siblings, 1 reply; 8+ messages in thread From: Fabian Ebner @ 2021-06-15 8:04 UTC (permalink / raw) To: Stefan Reiter, Proxmox VE development discussion Am 14.06.21 um 11:15 schrieb Stefan Reiter: > On 6/14/21 8:29 AM, Fabian Ebner wrote: >> Any feedback for this? >> > > Looks good to me and works as advertised: > > Reviewed-by: Stefan Reiter <s.reiter@proxmox.com> > Tested-by: Stefan Reiter <s.reiter@proxmox.com> > Thanks for the review! > The `$unit = $drive->{index} % maxdev` logic doesn't seem useful here > though, I > think it's a copy/paste from the IDE/SATA code below (it was already > used before > this patch). How about this for a cleanup on top: > > > diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm > index c00bde1..afd47b5 100644 > --- a/PVE/QemuServer.pm > +++ b/PVE/QemuServer.pm > @@ -1424,7 +1424,6 @@ sub print_drivedevice_full { > } elsif ($drive->{interface} eq 'scsi') { > > my ($maxdev, $controller, $controller_prefix) = > scsihw_infos($conf, $drive); > - my $unit = $drive->{index} % $maxdev; Using LSI 53C895A controller and 9 disks I get kvm: -device scsi-hd,bus=scsihw1.0,scsi-id=8,drive=drive-scsi8,id=scsi8: bad scsi device id: 8 As long as scsihw_infos returns the correct thing, I don't see a problem sticking to the modular arithmetic ;) > my $devicetype = 'hd'; > my $path = ''; > if (drive_is_cdrom($drive)) { > @@ -1452,7 +1451,7 @@ sub print_drivedevice_full { > } > > if (!$conf->{scsihw} || $conf->{scsihw} =~ m/^lsi/ || > $conf->{scsihw} eq 'pvscsi') { > - $device = > "scsi-$devicetype,bus=$controller_prefix$controller.0,scsi-id=$unit"; > + $device = > "scsi-$devicetype,bus=$controller_prefix$controller.0,scsi-id=$drive->{index}"; > > } else { > $device = > "scsi-$devicetype,bus=$controller_prefix$controller.0,channel=0,scsi-id=0" > .",lun=$drive->{index}"; > > >> Am 13.04.21 um 10:24 schrieb Fabian Ebner: >>> Reported in the community forum[0]. >>> >>> In QEMU's hw/scsi/vmw_pvscsi.c in the SCSIBusInfo struct, the max_lun >>> property >>> is set to 0. This means that in our stack, one cannot have multiple >>> disks and >>> use 'scsihw: pvscsi' currently, as kvm would fail with >>> bad scsi device lun: 1 >>> >>> Instead of increasing the lun number, increase the scsi-id, as we >>> already do for >>> lsi.* (in hw/scsi/lsi53c895a.c the max_lun property is also 0). >>> >>> [0]: https://forum.proxmox.com/threads/kvm-bad-scsi-device-lun-1.84318/ >>> >>> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> >>> --- >>> >>> I'm not experienced in this area, so not at all sure if this is the >>> proper >>> solution/workaround. >>> >>> PVE/QemuServer.pm | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm >>> index fdb2ac9..4ce663b 100644 >>> --- a/PVE/QemuServer.pm >>> +++ b/PVE/QemuServer.pm >>> @@ -1451,7 +1451,7 @@ sub print_drivedevice_full { >>> } >>> } >>> - if (!$conf->{scsihw} || ($conf->{scsihw} =~ m/^lsi/)){ >>> + if (!$conf->{scsihw} || $conf->{scsihw} =~ m/^lsi/ || >>> $conf->{scsihw} eq 'pvscsi') { >>> $device = >>> "scsi-$devicetype,bus=$controller_prefix$controller.0,scsi-id=$unit"; >>> } else { >>> $device = >>> "scsi-$devicetype,bus=$controller_prefix$controller.0,channel=0,scsi-id=0" >>> >>> >> >> >> _______________________________________________ >> pve-devel mailing list >> pve-devel@lists.proxmox.com >> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel >> >> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [pve-devel] [RFC qemu-server] avoid setting lun number for drives when pvscsi controller is used 2021-06-15 8:04 ` Fabian Ebner @ 2021-06-15 8:36 ` Stefan Reiter 0 siblings, 0 replies; 8+ messages in thread From: Stefan Reiter @ 2021-06-15 8:36 UTC (permalink / raw) To: Fabian Ebner, Proxmox VE development discussion On 6/15/21 10:04 AM, Fabian Ebner wrote: > Am 14.06.21 um 11:15 schrieb Stefan Reiter: >> On 6/14/21 8:29 AM, Fabian Ebner wrote: >>> Any feedback for this? >>> >> >> Looks good to me and works as advertised: >> >> Reviewed-by: Stefan Reiter <s.reiter@proxmox.com> >> Tested-by: Stefan Reiter <s.reiter@proxmox.com> >> > > Thanks for the review! > >> The `$unit = $drive->{index} % maxdev` logic doesn't seem useful here >> though, I >> think it's a copy/paste from the IDE/SATA code below (it was already >> used before >> this patch). How about this for a cleanup on top: >> > >> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm >> index c00bde1..afd47b5 100644 >> --- a/PVE/QemuServer.pm >> +++ b/PVE/QemuServer.pm >> @@ -1424,7 +1424,6 @@ sub print_drivedevice_full { >> } elsif ($drive->{interface} eq 'scsi') { >> >> my ($maxdev, $controller, $controller_prefix) = >> scsihw_infos($conf, $drive); >> - my $unit = $drive->{index} % $maxdev; > > > Using LSI 53C895A controller and 9 disks I get > > kvm: -device > scsi-hd,bus=scsihw1.0,scsi-id=8,drive=drive-scsi8,id=scsi8: bad scsi > device id: 8 > > As long as scsihw_infos returns the correct thing, I don't see a problem > sticking to the modular arithmetic ;) > Ah yes, the LSI ones get a new controller every 8 drives, and with pvscsi $maxdev is 256 anyway... alright, ignore this then :) >> my $devicetype = 'hd'; >> my $path = ''; >> if (drive_is_cdrom($drive)) { >> @@ -1452,7 +1451,7 @@ sub print_drivedevice_full { >> } >> >> if (!$conf->{scsihw} || $conf->{scsihw} =~ m/^lsi/ || >> $conf->{scsihw} eq 'pvscsi') { >> - $device = >> "scsi-$devicetype,bus=$controller_prefix$controller.0,scsi-id=$unit"; >> + $device = >> "scsi-$devicetype,bus=$controller_prefix$controller.0,scsi-id=$drive->{index}"; >> >> } else { >> $device = >> "scsi-$devicetype,bus=$controller_prefix$controller.0,channel=0,scsi-id=0" >> .",lun=$drive->{index}"; >> >> >>> Am 13.04.21 um 10:24 schrieb Fabian Ebner: >>>> Reported in the community forum[0]. >>>> >>>> In QEMU's hw/scsi/vmw_pvscsi.c in the SCSIBusInfo struct, the max_lun >>>> property >>>> is set to 0. This means that in our stack, one cannot have multiple >>>> disks and >>>> use 'scsihw: pvscsi' currently, as kvm would fail with >>>> bad scsi device lun: 1 >>>> >>>> Instead of increasing the lun number, increase the scsi-id, as we >>>> already do for >>>> lsi.* (in hw/scsi/lsi53c895a.c the max_lun property is also 0). >>>> >>>> [0]: https://forum.proxmox.com/threads/kvm-bad-scsi-device-lun-1.84318/ >>>> >>>> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> >>>> --- >>>> >>>> I'm not experienced in this area, so not at all sure if this is the >>>> proper >>>> solution/workaround. >>>> >>>> PVE/QemuServer.pm | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm >>>> index fdb2ac9..4ce663b 100644 >>>> --- a/PVE/QemuServer.pm >>>> +++ b/PVE/QemuServer.pm >>>> @@ -1451,7 +1451,7 @@ sub print_drivedevice_full { >>>> } >>>> } >>>> - if (!$conf->{scsihw} || ($conf->{scsihw} =~ m/^lsi/)){ >>>> + if (!$conf->{scsihw} || $conf->{scsihw} =~ m/^lsi/ || >>>> $conf->{scsihw} eq 'pvscsi') { >>>> $device = >>>> "scsi-$devicetype,bus=$controller_prefix$controller.0,scsi-id=$unit"; >>>> } else { >>>> $device = >>>> "scsi-$devicetype,bus=$controller_prefix$controller.0,channel=0,scsi-id=0" >>>> >>>> >>> >>> >>> _______________________________________________ >>> pve-devel mailing list >>> pve-devel@lists.proxmox.com >>> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel >>> >>> ^ permalink raw reply [flat|nested] 8+ messages in thread
* [pve-devel] applied: [RFC qemu-server] avoid setting lun number for drives when pvscsi controller is used 2021-04-13 8:24 [pve-devel] [RFC qemu-server] avoid setting lun number for drives when pvscsi controller is used Fabian Ebner 2021-06-14 6:29 ` Fabian Ebner @ 2021-06-16 18:27 ` Thomas Lamprecht 2021-06-17 7:29 ` Stefan Reiter 1 sibling, 1 reply; 8+ messages in thread From: Thomas Lamprecht @ 2021-06-16 18:27 UTC (permalink / raw) To: Proxmox VE development discussion, Fabian Ebner On 13.04.21 10:24, Fabian Ebner wrote: > Reported in the community forum[0]. > > In QEMU's hw/scsi/vmw_pvscsi.c in the SCSIBusInfo struct, the max_lun property > is set to 0. This means that in our stack, one cannot have multiple disks and > use 'scsihw: pvscsi' currently, as kvm would fail with > bad scsi device lun: 1 > > Instead of increasing the lun number, increase the scsi-id, as we already do for > lsi.* (in hw/scsi/lsi53c895a.c the max_lun property is also 0). > > [0]: https://forum.proxmox.com/threads/kvm-bad-scsi-device-lun-1.84318/ > > Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> > --- > > I'm not experienced in this area, so not at all sure if this is the proper > solution/workaround. > > PVE/QemuServer.pm | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > applied, with Stefans R-b/T-b tag, thanks to both! just to be sure: I assume that migration from old -> new is OK and was tested? ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [pve-devel] applied: [RFC qemu-server] avoid setting lun number for drives when pvscsi controller is used 2021-06-16 18:27 ` [pve-devel] applied: " Thomas Lamprecht @ 2021-06-17 7:29 ` Stefan Reiter 2021-06-17 7:34 ` Thomas Lamprecht 0 siblings, 1 reply; 8+ messages in thread From: Stefan Reiter @ 2021-06-17 7:29 UTC (permalink / raw) To: Proxmox VE development discussion, Thomas Lamprecht, Fabian Ebner On 16/06/2021 20:27, Thomas Lamprecht wrote: > On 13.04.21 10:24, Fabian Ebner wrote: >> Reported in the community forum[0]. >> >> In QEMU's hw/scsi/vmw_pvscsi.c in the SCSIBusInfo struct, the max_lun property >> is set to 0. This means that in our stack, one cannot have multiple disks and >> use 'scsihw: pvscsi' currently, as kvm would fail with >> bad scsi device lun: 1 >> >> Instead of increasing the lun number, increase the scsi-id, as we already do for >> lsi.* (in hw/scsi/lsi53c895a.c the max_lun property is also 0). >> >> [0]: https://forum.proxmox.com/threads/kvm-bad-scsi-device-lun-1.84318/ >> >> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> >> --- >> >> I'm not experienced in this area, so not at all sure if this is the proper >> solution/workaround. >> >> PVE/QemuServer.pm | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> > > applied, with Stefans R-b/T-b tag, thanks to both! > > just to be sure: I assume that migration from old -> new is OK and was tested? > Yes, VMs with one pvscsi disk can be migrated forward, and ones with multiple (where it might have caused incompatibility) didn't work to begin with. > > _______________________________________________ > pve-devel mailing list > pve-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [pve-devel] applied: [RFC qemu-server] avoid setting lun number for drives when pvscsi controller is used 2021-06-17 7:29 ` Stefan Reiter @ 2021-06-17 7:34 ` Thomas Lamprecht 0 siblings, 0 replies; 8+ messages in thread From: Thomas Lamprecht @ 2021-06-17 7:34 UTC (permalink / raw) To: Stefan Reiter, Proxmox VE development discussion, Fabian Ebner On 17.06.21 09:29, Stefan Reiter wrote: > On 16/06/2021 20:27, Thomas Lamprecht wrote: >> On 13.04.21 10:24, Fabian Ebner wrote: >>> Reported in the community forum[0]. >>> >>> In QEMU's hw/scsi/vmw_pvscsi.c in the SCSIBusInfo struct, the max_lun property >>> is set to 0. This means that in our stack, one cannot have multiple disks and >>> use 'scsihw: pvscsi' currently, as kvm would fail with >>> bad scsi device lun: 1 >>> >>> Instead of increasing the lun number, increase the scsi-id, as we already do for >>> lsi.* (in hw/scsi/lsi53c895a.c the max_lun property is also 0). >>> >>> [0]: https://forum.proxmox.com/threads/kvm-bad-scsi-device-lun-1.84318/ >>> >>> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com> >>> --- >>> >>> I'm not experienced in this area, so not at all sure if this is the proper >>> solution/workaround. >>> >>> PVE/QemuServer.pm | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> >> >> applied, with Stefans R-b/T-b tag, thanks to both! >> >> just to be sure: I assume that migration from old -> new is OK and was tested? >> > > Yes, VMs with one pvscsi disk can be migrated forward, and ones with multiple (where it might have caused incompatibility) didn't work to begin with. Ack, thanks for the confirmation. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-06-17 7:34 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-04-13 8:24 [pve-devel] [RFC qemu-server] avoid setting lun number for drives when pvscsi controller is used Fabian Ebner 2021-06-14 6:29 ` Fabian Ebner 2021-06-14 9:15 ` Stefan Reiter 2021-06-15 8:04 ` Fabian Ebner 2021-06-15 8:36 ` Stefan Reiter 2021-06-16 18:27 ` [pve-devel] applied: " Thomas Lamprecht 2021-06-17 7:29 ` Stefan Reiter 2021-06-17 7:34 ` Thomas Lamprecht
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox