[pve-devel] [PATCH qemu-server 18/22] print drive device: don't reference any drive for 'none' starting with machine version 10.0
Fiona Ebner
f.ebner at proxmox.com
Tue Jun 17 09:54:16 CEST 2025
Am 13.06.25 um 13:14 schrieb Fabian Grünbichler:
> On June 12, 2025 4:02 pm, Fiona Ebner wrote:
>> There will be no block node for 'none' after switching to '-blockdev'.
>>
>> Co-developed-by: Alexandre Derumier <alexandre.derumier at groupe-cyllene.com>
>> [FE: split out from larger patch
>> do it also for non-SCSI cases]
>> Signed-off-by: Fiona Ebner <f.ebner at proxmox.com>
>> ---
>> PVE/QemuServer.pm | 22 +++++++++++++++++++---
>> 1 file changed, 19 insertions(+), 3 deletions(-)
>>
>> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
>> index 90d07cee..e5f8a607 100644
>> --- a/PVE/QemuServer.pm
>> +++ b/PVE/QemuServer.pm
>> @@ -1322,7 +1322,13 @@ sub print_drivedevice_full {
>> my $drive_id = PVE::QemuServer::Drive::get_drive_id($drive);
>> if ($drive->{interface} eq 'virtio') {
>> my $pciaddr = print_pci_addr("$drive_id", $bridges, $arch, $machine_type);
>> - $device = "virtio-blk-pci,drive=drive-$drive_id,id=${drive_id}${pciaddr}";
>> + $device = 'virtio-blk-pci';
>> + if (min_version($machine_version, 10, 0)) { # there is no blockdev for 'none'
>> + $device .= ",drive=drive-$drive_id" if $drive->{file} ne 'none';
>> + $device .= ",id=${drive_id}${pciaddr}";
>> + } else {
>> + $device .= ",drive=drive-$drive_id,id=${drive_id}${pciaddr}";
>
> the ID is the same in both branches, so this could be (some variant of)
>
> # blockdev has no drive for 'none'
> if (!(min_version($machine_version, 10, 0) && $drive->{file} eq 'none'))
> {
> $device .= "$drive=drive-$drive_id";
> }
>
> $device .= ",id=${drive_id}${pciaddr}";
Ack, I'll go with the following in v2:
if (!min_version($machine_version, 10, 0) || $drive->{file} ne 'none') {
$device .= ",drive=drive-$drive_id";
}
$device .= ",id=${drive_id}${pciaddr}";
More information about the pve-devel
mailing list