diff options
author | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2016-04-07 15:29:02 +1000 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2016-04-08 14:16:00 +1000 |
commit | 0739476294f6925b01ad12b1b198f85b41bc657d (patch) | |
tree | a2d1f20bd197ce8f6a441b299fcef300baf61333 /discover/udev.c | |
parent | 3b286d116f8fb8438b8ae52669d2c1778b7a370b (diff) | |
download | talos-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.c | 5 |
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); |