1
0
mirror of https://github.com/coreos/fedora-coreos-config.git synced 2026-02-05 09:45:30 +01:00

tree: import changes from testing-devel at 2a5cc10aa3

This commit is contained in:
CoreOS Bot
2025-10-22 19:44:07 +00:00
parent 9660abd393
commit 965252dad8
7 changed files with 93 additions and 23 deletions

View File

@@ -4,7 +4,7 @@ ACTION!="add|change", GOTO="stable_boot_end"
SUBSYSTEM!="block", GOTO="stable_boot_end"
ENV{DEVTYPE}=="disk" \
, PROGRAM=="coreos-disk-contains-fs $name boot" \
, PROGRAM=="coreos-disk-contains-partition-name $name boot" \
, SYMLINK+="disk/by-id/coreos-boot-disk"
LABEL="stable_boot_end"

View File

@@ -1,20 +0,0 @@
#!/bin/bash
# checks whether `disk` contains filesystem labeled `label`
set -euo pipefail
disk=$1
label=$2
# during execution of udev rules on disks 'lsblk' returns empty fields
for pt in /sys/block/$disk/*; do
name=$(basename $pt)
if [[ "$name" =~ ${disk}p?[[:digit:]] ]] && [[ -e "/sys/block/$disk/$name/start" ]];
then
eval $(udevadm info --query=property -n /dev/$name | grep -e ID_FS_LABEL -e PARTNAME)
if [[ "${ID_FS_LABEL:-}" == "$label" ]] || [[ "${PARTNAME:-}" == "$label" ]]; then
exit 0
fi
fi
done
exit 1

View File

@@ -0,0 +1,33 @@
#!/bin/bash
# checks whether `disk` contains partition labeled `label`
set -euo pipefail
disk=$1
label=$2
# copied from generator-lib.sh
karg() {
local name="$1" value="${2:-}"
local cmdline=( $(</proc/cmdline) )
for arg in "${cmdline[@]}"; do
if [[ "${arg%%=*}" == "${name}" ]]; then
value="${arg#*=}"
break
fi
done
echo "${value}"
}
multipath=$(karg "rd.multipath")
if [[ -n ${multipath} ]]; then
if [[ ! -f /sys/block/${disk}/dm/name ]]; then
exit 1
fi
fi
if sfdisk "/dev/${disk}" --json | jq -e '.partitiontable.partitions | any(.name == "'"${label}"'")'; then
exit 0
fi
exit 1

View File

@@ -59,8 +59,8 @@ install() {
inst_simple "$moddir/80-coreos-boot-disk.rules" \
"/usr/lib/coreos/80-coreos-boot-disk.rules"
inst_script "$moddir/coreos-disk-contains-fs.sh" \
"/usr/lib/udev/coreos-disk-contains-fs"
inst_script "$moddir/coreos-disk-contains-partition-name.sh" \
"/usr/lib/udev/coreos-disk-contains-partition-name"
inst_script "$moddir/coreos-ignition-setup-user.sh" \
"/usr/sbin/coreos-ignition-setup-user"

View File

@@ -0,0 +1,22 @@
variant: fcos
version: 1.6.0
storage:
disks:
- device: /dev/disk/by-id/coreos-boot-disk
wipe_table: false
partitions:
- number: 4
label: root
size_mib: 10240
resize: true
- number: 5
label: var
size_mib: 0
filesystems:
- path: /var
device: /dev/disk/by-partlabel/var
format: ext4
with_mount_unit: true
wipe_filesystem: true
label: var

View File

@@ -0,0 +1 @@
../../../data/commonlib.sh

View File

@@ -0,0 +1,34 @@
#!/bin/bash
## kola:
## # This uses appendKernelArgs and multipath, which is QEMU only
## platforms: qemu
## description: Verify if multipath works with a custom partitioning
## appendKernelArgs: "rd.multipath=default"
## primaryDisk: "15G:mpath"
set -xeuo pipefail
# shellcheck disable=SC1091
. "$KOLA_EXT_DATA/commonlib.sh"
if ! cat /proc/cmdline | grep -q rd.multipath=default; then
fatal "kernel argument rd.multipath=default not defined"
fi
multipath -l -v 1
dm_mpath="/dev/mapper/$(multipath -l -v 1)"
if ! udevadm info --query=property "${dm_mpath}" | grep -q MPATH_DEVICE_READY=1; then
fatal "device mapper ${dm_mpath} is not MPATH_DEVICE_READY"
fi
var_src=$(findmnt -nvr -o SOURCE /var)
if ! udevadm info --query=property "${var_src}" | grep "ID_FS_LABEL=var"; then
fatal "/var partition do not have the label var"
fi
if ! udevadm info --query=property "${var_src}" | grep "DM_PART=5"; then
fatal "/var partition number is not 5 as expected"
fi