From aee803b81dd69ffdbad8be6dee29843c161656d5 Mon Sep 17 00:00:00 2001 From: Colin Guthrie <colin@mageia.org> Date: Sat, 30 Aug 2014 12:23:39 +0100 Subject: [PATCH] Revert "Drop fedora-storage-init; conflict with older lvm & dmraid so we get the required versions that allow us to do so. (<prajnoha@redhat.com>)" This reverts commit 6091b58b60f532d8e3f317b99f7ea85d99853db3. Conflicts: Makefile We likely want to go the same way as Fedora, but not sure all the bits are in place right now... --- Makefile | 2 ++ initscripts.spec | 2 -- systemd/fedora-storage-init | 41 +++++++++++++++++++++++++ systemd/system/fedora-storage-init-late.service | 16 ++++++++++ systemd/system/fedora-storage-init.service | 16 ++++++++++ systemd/system/fedora-wait-storage.service | 18 +++++++++++ 6 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 systemd/fedora-storage-init create mode 100644 systemd/system/fedora-storage-init-late.service create mode 100644 systemd/system/fedora-storage-init.service create mode 100644 systemd/system/fedora-wait-storage.service diff --git a/Makefile b/Makefile index 1248e67..e0b7e5b 100644 --- a/Makefile +++ b/Makefile @@ -109,6 +109,8 @@ install: ln -s ../fedora-autorelabel-mark.service $(ROOT)/usr/lib/systemd/system/basic.target.wants ln -s ../fedora-readonly.service $(ROOT)/usr/lib/systemd/system/local-fs.target.wants ln -s ../fedora-import-state.service $(ROOT)/usr/lib/systemd/system/local-fs.target.wants + ln -s ../fedora-storage-init.service $(ROOT)/usr/lib/systemd/system/local-fs.target.wants + ln -s ../fedora-storage-init-late.service $(ROOT)/usr/lib/systemd/system/local-fs.target.wants ln -s ../mandriva-save-dmesg.service $(ROOT)/usr/lib/systemd/system/basic.target.wants ln -s ../mandriva-everytime.service $(ROOT)/usr/lib/systemd/system/basic.target.wants diff --git a/initscripts.spec b/initscripts.spec index 983a55b..a0f3280 100644 --- a/initscripts.spec +++ b/initscripts.spec @@ -16,8 +16,6 @@ Requires: bash >= 3.0 Requires: procps-ng >= 3.3.8-16 Conflicts: systemd < 23-1 Conflicts: systemd-units < 23-1 -Conflicts: lvm2 < 2.02.98-3 -Conflicts: dmraid < 1.0.0.rc16-18 Requires: systemd Requires: iproute, /sbin/arping, findutils # Not strictly required, but nothing else requires it diff --git a/systemd/fedora-storage-init b/systemd/fedora-storage-init new file mode 100755 index 0000000..565d811 --- /dev/null +++ b/systemd/fedora-storage-init @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Storage initialization + +. /etc/init.d/functions + +[ -z "${cmdline}" ] && cmdline=$(cat /proc/cmdline) + +if ! strstr "$cmdline" nompath && [ -f /etc/multipath.conf ] && \ + [ -x /sbin/multipath ]; then + modprobe dm-multipath > /dev/null 2>&1 + /sbin/multipath -u -v 0 + if [ -x /sbin/kpartx ]; then + /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx -u -a -p p" >/dev/null + fi +fi + +if ! strstr "$cmdline" nodmraid && [ -x /sbin/dmraid ]; then + modprobe dm-mirror >/dev/null 2>&1 + dmraidsets=$(LC_ALL=C /sbin/dmraid -s -c -i) + if [ "$?" = "0" ]; then + SAVEIFS=$IFS + IFS=$(echo -en "\n\b") + for dmname in $dmraidsets; do + if [[ "$dmname" == isw_* ]] && \ + ! strstr "$cmdline" noiswmd; then + continue + fi + /sbin/dmraid -ay -i --rm_partitions -p "$dmname" >/dev/null 2>&1 + /sbin/kpartx -u -a -p p "/dev/mapper/$dmname" + done + IFS=$SAVEIFS + fi +fi + +# Start any MD RAID arrays that haven't been started yet +[ -r /proc/mdstat ] && [ -r /dev/md/md-device-map ] && /sbin/mdadm -IRs + +if [ -x /sbin/lvm ]; then + action $"Setting up Logical Volume Management:" /sbin/lvm vgchange -a y --sysinit +fi diff --git a/systemd/system/fedora-storage-init-late.service b/systemd/system/fedora-storage-init-late.service new file mode 100644 index 0000000..69ad089 --- /dev/null +++ b/systemd/system/fedora-storage-init-late.service @@ -0,0 +1,16 @@ +[Unit] +Description=Initialize storage subsystems (RAID, LVM, etc.) +DefaultDependencies=no +Conflicts=shutdown.target +After=cryptsetup.target fedora-storage-init.service +Before=local-fs.target shutdown.target +Wants=fedora-wait-storage.service +ConditionFileIsExecutable=|/sbin/lvm +ConditionFileIsExecutable=|/sbin/dmraid +ConditionPathExists=|/etc/multipath.conf + +[Service] +ExecStart=/lib/systemd/fedora-storage-init +Type=oneshot +TimeoutSec=0 +RemainAfterExit=yes diff --git a/systemd/system/fedora-storage-init.service b/systemd/system/fedora-storage-init.service new file mode 100644 index 0000000..6d8e39f --- /dev/null +++ b/systemd/system/fedora-storage-init.service @@ -0,0 +1,16 @@ +[Unit] +Description=Initialize storage subsystems (RAID, LVM, etc.) +DefaultDependencies=no +Conflicts=shutdown.target +After=fedora-wait-storage.service +Before=local-fs.target shutdown.target +Wants=fedora-wait-storage.service +ConditionFileIsExecutable=|/sbin/lvm +ConditionFileIsExecutable=|/sbin/dmraid +ConditionPathExists=|/etc/multipath.conf + +[Service] +ExecStart=/lib/systemd/fedora-storage-init +Type=oneshot +TimeoutSec=0 +RemainAfterExit=yes diff --git a/systemd/system/fedora-wait-storage.service b/systemd/system/fedora-wait-storage.service new file mode 100644 index 0000000..9d3b6ae --- /dev/null +++ b/systemd/system/fedora-wait-storage.service @@ -0,0 +1,18 @@ +[Unit] +Description=Wait for storage scan +DefaultDependencies=no +Conflicts=shutdown.target +After=systemd-udev-settle.service +Before=local-fs.target shutdown.target +Wants=systemd-udev-settle.service + +[Service] +ExecStart=-/sbin/rmmod scsi_wait_scan +ExecStart=-/sbin/modprobe scsi_wait_scan +ExecStart=-/sbin/rmmod scsi_wait_scan +Type=oneshot +TimeoutSec=0 +RemainAfterExit=yes +StandardInput=null +StandardOutput=null +StandardError=null -- 1.9.2