[pve-devel] [PATCH v3 qemu-server 02/10] add print_drivedevice_controller && print_drivedevice_iothread
Fiona Ebner
f.ebner at proxmox.com
Thu Oct 2 14:30:10 CEST 2025
Am 22.08.25 um 4:19 PM schrieb Alexandre Derumier via pve-devel:
> - if ($drive->{interface} eq 'scsi') {
> -
> - my ($maxdev, $controller, $controller_prefix) = scsihw_infos($conf, $drive);
> -
> - die
> - "scsi$drive->{index}: machine version 4.1~pve2 or higher is required to use more than 14 SCSI disks\n"
> - if $drive->{index} > 13 && !&$version_guard(4, 1, 2);
This check is dropped without mentioning anything in the commit message.
Note that machine versions < 4.1 can still be used right now in Proxmox
VE 9, even if the are expected to be dropped during the current major
release cycle. Looking at the history, i.e. commit b8fb1c03
("version_guard scsi drive count"), this was only done as a protection
for live-migration to get a clean error up front, when the target node
was not updated with the increased limit. So this can be dropped
nowadays as all nodes are sure to support the increased limit, but
should be done in a separate commit up-front.
---snip 8<---
> +sub print_drivedevice_controller {
> + my ($conf, $drive, $scsihw, $arch, $bridges, $used_controller) = @_;
> +
> + if ($drive->{interface} eq 'scsi') {
> +
> + my ($maxdev, $controller, $controller_prefix) = scsihw_infos($conf, $drive);
> + return if $used_controller->{scsi}->{$controller};
> +
> + my $pciaddr = print_pci_addr("$controller_prefix$controller", $bridges, $arch);
> + my $scsihw_type = $scsihw =~ m/^virtio-scsi-single/ ? "virtio-scsi-pci" : $scsihw;
> +
> + my $iothread = '';
> + if (
> + $conf->{scsihw}
> + && $conf->{scsihw} eq "virtio-scsi-single"
> + && $drive->{iothread}
Instead of re-doing the check with the very same condition as below in
print_drivedevice_iothread(), can we pass along the name of the iothread
(or undef) from the callers and use that? Or do we not have the name of
the iothread readily available for all callers? In that case, it could
still be a short helper, which returns the iothread name or undef if no
iothread is used, to avoid the duplication.
> + ) {
> + $iothread .= ",iothread=iothread-$controller_prefix$controller";
> + }
> +
> + my $queues = '';
> + if (
> + $conf->{scsihw}
> + && $conf->{scsihw} eq "virtio-scsi-single"
> + && $drive->{queues}
> + ) {
> + $queues = ",num_queues=$drive->{queues}";
> + }
> +
> + $used_controller->{scsi}->{$controller} = 1;
> + return "$scsihw_type,id=$controller_prefix$controller$pciaddr$iothread$queues";
> + }
> +
> + if ($drive->{interface} eq 'sata') {
> + my $controller = int($drive->{index} / $PVE::QemuServer::Drive::MAX_SATA_DISKS);
> + return if $used_controller->{ahci}->{$controller};
> +
> + my $pciaddr = print_pci_addr("ahci$controller", $bridges, $arch);
> +
> + $used_controller->{ahci}->{$controller} = 1;
> + return "ahci,id=ahci$controller,multifunction=on$pciaddr";
> +
> + }
> +}
> +
> +sub print_drivedevice_iothread {
> + my ($conf, $drive) = @_;
This can now also take just $scsihw instead of the full config (see my
reply to 01/10).
> +
> + my $drive_id = PVE::QemuServer::Drive::get_drive_id($drive);
> +
> + if ($drive->{interface} eq 'virtio') {
> + return "iothread,id=iothread-$drive_id" if $drive->{iothread};
> + }
> +
> + if ($drive->{interface} eq 'scsi') {
> +
> + my ($maxdev, $controller, $controller_prefix) = scsihw_infos($conf, $drive);
> +
> + if (
> + $conf->{scsihw}
> + && $conf->{scsihw} eq "virtio-scsi-single"
> + && $drive->{iothread}
> + ) {
> + return "iothread,id=iothread-$controller_prefix$controller";
> + } elsif ($drive->{iothread}) {
> + log_warn(
> + "iothread is only valid with virtio disk or virtio-scsi-single controller, ignoring\n"
> + );
> + }
> + }
> +}
> +
> 1;
> --
> 2.47.2
>
>
More information about the pve-devel
mailing list