5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-01-08 21:18:06 +03:00
Go to file
Mira Limbeck c06b7c8b90 iscsi: verify volume disks are part of target
We build the disk path by appending the last part of the volname to
/dev/disk/by-id. These could in theory be any other disk found under
there instead of a LUN provided by the target configured.

This patch adds a way to verify the disk used is actually provided by
the target. To do so `udevadm` is used to get the devpath
(/devices/...). This can then be checked under `/sys` for a session.
With the session the targetname can be looked up under /sys/class and
compared with the configured target of the storage.
In case of multipath, all disks backing the multipath device are checked
recursively (in case of nested device mapper devices), and verification
succeeds if at least one backing disk is part of the iSCSI target.
Mixing disks from different iSCSI targets is allowed as long as one
corresponds to the right target.

udevadm input is limited to `/dev/` paths since we only pass those either
explicitly, or via Cwd::realpath on a /dev/disk/by-id path returned by
filesystem_path.

According to [0] /sys/subsystems should be preferred over /sys/class if
available, but neither kernel 6.8 nor kernel 6.11 provided it. It is
mentioned that in the future this will be moved to /sys/subsystems. So
this has to be kept in mind for future kernels.

[0] https://www.kernel.org/doc/html/v6.11/admin-guide/sysfs-rules.html

Reported-by: Friedrich Weber <f.weber@proxmox.com>
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
Tested-by: Friedrich Weber <f.weber@proxmox.com>
Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2024-11-13 16:14:02 +01:00
debian d/control: dependencies: add bzip2, gzip, lzop, zstd 2024-11-11 10:30:53 +01:00
src iscsi: verify volume disks are part of target 2024-11-13 16:14:02 +01:00
.gitignore generate correct manual page and .pod 2011-10-20 08:21:56 +02:00
ApiChangeLog add disk rename feature 2021-11-09 17:02:29 +01:00
Makefile buildsys: derive upload dist automatically 2023-05-24 17:21:02 +02:00