From 0695911d5c355932b3cd48644373ee4a3ef95d54 Mon Sep 17 00:00:00 2001 From: Achilleas Koutsou Date: Mon, 26 Aug 2024 09:23:27 +0200 Subject: [PATCH] devices: add new `vg_partnum` parameter This is needed for bootc where all mounts need to be from the same physical disk/loop so that bootupd works. The idea is that in the manifest the new option `vg_partnum` is added and the parent VG is found via the partition number of the full image similar to the `partnum` from https://github.com/osbuild/osbuild/pull/1501 A manifest using this feature looks like this: ```json "devices": { "disk": { "type": "org.osbuild.loopback", "options": { "filename": "disk.raw", "partscan": true } }, "rootlv": { "type": "org.osbuild.lvm2.lv", "parent": "disk", "options": { "volume": "rootlv", "vg_partnum": 4 } } } ``` Co-authored-by: Michael Vogt --- devices/org.osbuild.lvm2.lv | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/devices/org.osbuild.lvm2.lv b/devices/org.osbuild.lvm2.lv index 2f8fe4f4..8de7fc2b 100755 --- a/devices/org.osbuild.lvm2.lv +++ b/devices/org.osbuild.lvm2.lv @@ -44,6 +44,10 @@ SCHEMA = """ "volume": { "type": "string", "description": "Logical volume to active" + }, + "vg_partnum": { + "type": "number", + "description": "Partition number on the parent device where the LV's volume group is located" } } """ @@ -182,6 +186,9 @@ class LVService(devices.DeviceService): # Find the volume group that belongs to the device specified # via `parent` + part = options.get("vg_partnum") + if part: + parent_path += f"p{part}" vg = self.volume_group_for_device(parent_path) # Activate the logical volume