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

Aaron Lauterer a.lauterer at proxmox.com
Mon Feb 24 09:37:23 CET 2020


in some situations it is possible, that a disk does not have a
/dev/disk/by-id path. Reported cases are KVM with virtio-blk [0] and
with VMware player / workstation when using the paravirtual SCSI disk
types [1]. It can be reproduced in Proxmox VE by using virtio-blk disks
for the VM.

> The issue at hand happens because udev does not create the
> /dev/disk/by-id symlink in
> '/lib/udev/rules.d/60-persistent-storage.rules', since it does
> not have a serial-number for the device (which in the virtio-blk case
> is in turn maybe caused by qemu-server not adding one to the
> commandline).
Quoted from [2]

This regression was introduced with commit
e1b490865f750e08f6c9c6b7e162e7def9dcc411 which always replaced the disks
in the $vdev variable even if the result of the by-id lookup was
`undef`. Thus the paths did not point to any valid disk and the zpool
creation failed.

This patch replaces the disk paths with by-id paths only if they are
present.

[0] https://forum.proxmox.com/threads/installation-on-raidz-1-fails.65603/
[1] https://forum.proxmox.com/threads/not-install-promox-6-1-zfs-0-04-disk-vmware-15-pro.65269/
[2] https://pve.proxmox.com/pipermail/pve-devel/2020-February/041841.html

Signed-off-by: Aaron Lauterer <a.lauterer at proxmox.com>
---

v1 -> v2:
* use if clause instead of overwriting $by_id as suggested by Fabian [3]
* write a more thorough commit message

[3] https://pve.proxmox.com/pipermail/pve-devel/2020-February/041843.html

 proxinstall | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxinstall b/proxinstall
index bad877f..e9dd50a 100755
--- a/proxinstall
+++ b/proxinstall
@@ -1359,7 +1359,7 @@ sub extract_data {
 		my $devname = @$hd[1];
 		my $by_id = find_stable_path ("/dev/disk/by-id", $devname);
 
-		$vdev =~ s/ $devname/ $by_id/;
+		$vdev =~ s/ $devname/ $by_id/ if $by_id;
 	    }
 
 	    zfs_create_rpool($vdev);
-- 
2.20.1




More information about the pve-devel mailing list