[pve-devel] [PATCH installer] fix behavior if zfs disks have no by-id path

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Feb 19 13:39:16 CET 2020


On 2/19/20 12:39 PM, Fabian Ebner wrote:
> On 2/18/20 5:55 PM, Aaron Lauterer wrote:
>> in some situations it is possible, that a disk does not have a
>> /dev/disk/by-id path, mainly AFAICT inside VMs with virtio disks.
>>
>> Commit e1b490865f750e08f6c9c6b7e162e7def9dcc411 forgot to handle this
>> situation which resultet in a failed installation.
>>
>> Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
>> ---
>> thanks @stoiko for helping me debugging this.
>>
>> tested with ZFS (3 disks, raidz1) and ext4 in UEFI and BIOS
>> mode.
>>
>>   proxinstall | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/proxinstall b/proxinstall
>> index c9d17f1..a87f1c7 100755
>> --- a/proxinstall
>> +++ b/proxinstall
>> @@ -1357,7 +1357,7 @@ sub extract_data {
>>             foreach my $hd (@$devlist) {
>>           my $devname = @$hd[1];
>> -        my $by_id = find_stable_path ("/dev/disk/by-id", $devname);
>> +        my $by_id = find_stable_path ("/dev/disk/by-id", $devname) || $devname;
>>
> 
> IMHO it feels a bit strange to assign $devname to the $by_id variable. Wouldn't it be nicer to instead do the replace below only conditionally?
> 

yeah, would make this a bit easier to read if we avoid a "replace with my
own value" and just guard the replacement with:

... if $by_id;


>>           $vdev =~ s/ $devname/ $by_id/;
>>           }
>>






More information about the pve-devel mailing list