summaryrefslogtreecommitdiffstats
path: root/discover/udev.c
diff options
context:
space:
mode:
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-04-07 15:29:02 +1000
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>2016-04-08 14:16:00 +1000
commit0739476294f6925b01ad12b1b198f85b41bc657d (patch)
treea2d1f20bd197ce8f6a441b299fcef300baf61333 /discover/udev.c
parent3b286d116f8fb8438b8ae52669d2c1778b7a370b (diff)
downloadtalos-petitboot-0739476294f6925b01ad12b1b198f85b41bc657d.tar.gz
talos-petitboot-0739476294f6925b01ad12b1b198f85b41bc657d.zip
discover/devmapper: Read device size from sysfs
If udev doesn't export the ID_PART_ENTRY_SIZE variable for a device we skip creating a snapshot for it. However in most cases the sysfs attribute which udev reads to find ID_PART_ENTRY_SIZE is still available. Therefore if we don't have access to ID_PART_ENTRY_SIZE try to find the size in sysfs directly. This allows us to create snapshots for devices which often don't have this udev variable set, such as software raid (md) devices and NVMe devices. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'discover/udev.c')
-rw-r--r--discover/udev.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/discover/udev.c b/discover/udev.c
index 537ef10..23057bf 100644
--- a/discover/udev.c
+++ b/discover/udev.c
@@ -176,10 +176,9 @@ static int udev_handle_block_add(struct pb_udev *udev, struct udev_device *dev,
udev_setup_device_params(dev, ddev);
- /* Create a snapshot for all disks, unless it is an assembled RAID array */
+ /* Create a snapshot for all disk devices */
if ((ddev->device->type == DEVICE_TYPE_DISK ||
- ddev->device->type == DEVICE_TYPE_USB) &&
- !udev_device_get_property_value(dev, "MD_LEVEL"))
+ ddev->device->type == DEVICE_TYPE_USB))
devmapper_init_snapshot(udev->handler, ddev);
device_handler_discover(udev->handler, ddev);
OpenPOWER on IntegriCloud