From 0eac2148de54312c9a27fe86a65b350974696bb5b153fdb398f518796001eaa5 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Mon, 26 Aug 2013 11:12:14 +0000 Subject: [PATCH 1/3] Accepting request 195669 from home:deanraccoon:branches:Base:System add systemd support to lvm2 package, split device-mapper to another package OBS-URL: https://build.opensuse.org/request/show/195669 OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=64 --- 64-lvm2.rules | 23 - LVM2.2.02.98.tgz | 4 +- boot.device-mapper | 45 -- boot.lvm | 69 -- clvmd.ocf | 174 ++++- cmirrord.ocf | 222 ++++++ collect_lvm | 69 -- device-mapper-dmsetup-deps-export.patch | 53 -- device-mapper-dmsetup-export.patch | 152 ----- lvm.conf | 641 +++++++++++++++++- lvm2.changes | 6 + lvm2.spec | 226 +++--- mkinitrd-devmapper-boot.sh | 25 - mkinitrd-devmapper-setup.sh | 40 -- sleep-try-open-count.diff | 34 - udev-rules_update.diff | 52 -- ..._set-1-on-each-dm_task_set_cookie-ca.patch | 66 -- 17 files changed, 1082 insertions(+), 819 deletions(-) delete mode 100644 64-lvm2.rules delete mode 100644 boot.device-mapper delete mode 100644 boot.lvm create mode 100644 cmirrord.ocf delete mode 100644 collect_lvm delete mode 100644 device-mapper-dmsetup-deps-export.patch delete mode 100644 device-mapper-dmsetup-export.patch delete mode 100644 mkinitrd-devmapper-boot.sh delete mode 100644 mkinitrd-devmapper-setup.sh delete mode 100644 sleep-try-open-count.diff delete mode 100644 udev-rules_update.diff delete mode 100644 udev_sync-cookie_set-1-on-each-dm_task_set_cookie-ca.patch diff --git a/64-lvm2.rules b/64-lvm2.rules deleted file mode 100644 index fe02775..0000000 --- a/64-lvm2.rules +++ /dev/null @@ -1,23 +0,0 @@ -# This file causes block devices with LVM signatures to be automatically -# added to their volume group. -# See udev(8) for syntax - -SUBSYSTEM!="block", GOTO="lvm_end" -ACTION!="add|change", GOTO="lvm_end" - -ENV{ID_FS_TYPE}!="LVM2_member", GOTO="lvm_end" - -ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-id/lvm2-pvuuid-$env{ID_FS_UUID_ENC}" - -ENV{DMDEPS}=="0", GOTO="lvm_end" - -IMPORT{PROGRAM}="collect_lvm $tempnode" - -ENV{VGUUID}!="?*", GOTO="lvm_end" - -ENV{VGNAME}!="?*", GOTO="lvm_end" - -# If all related PV's available already, active all LVs inside. -ENV{COLLECT}=="0", RUN+="/sbin/vgchange -a y $env{VGNAME}" - -LABEL="lvm_end" diff --git a/LVM2.2.02.98.tgz b/LVM2.2.02.98.tgz index 70a61c8..6898723 100644 --- a/LVM2.2.02.98.tgz +++ b/LVM2.2.02.98.tgz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:71030a58fef7e00d82ca4144334548e46aad24551a3cfbe7c3059b1bd137d864 -size 1227919 +oid sha256:621961bddbcb232281c127802f6bfb1758d8d219f346cb2bd38eefae3f077353 +size 970745 diff --git a/boot.device-mapper b/boot.device-mapper deleted file mode 100644 index 212ecba..0000000 --- a/boot.device-mapper +++ /dev/null @@ -1,45 +0,0 @@ -#! /bin/sh -# -# Copyright (c) 2001 SuSE GmbH Nuernberg, Germany. All rights reserved. -# -# /etc/init.d/boot.device-mapper -# -### BEGIN INIT INFO -# Provides: boot.device-mapper -# Required-Start: boot.udev boot.rootfsck -# Required-Stop: boot.udev -# Default-Start: B -# Default-Stop: -# Short-Description: DM -# Description: activate device mapper -### END INIT INFO - -. /etc/rc.status - -rc_reset - -case "$1" in - start) - echo -n "Activating device mapper..." - modprobe dm-mod || rc_failed 1 - rc_status -v - ;; - stop) - rc_failed 3 - rc_status -v - ;; - reload) - rc_failed 3 - rc_status -v - ;; - status) - rc_failed 4 - rc_status -v - ;; - *) - echo "Usage: $0 {start|stop|status}" - exit 1 - ;; -esac - -rc_exit diff --git a/boot.lvm b/boot.lvm deleted file mode 100644 index cf5ad1a..0000000 --- a/boot.lvm +++ /dev/null @@ -1,69 +0,0 @@ -#! /bin/sh -# -# Copyright (c) 2001 SuSE GmbH Nuernberg, Germany. All rights reserved. -# -# /etc/init.d/boot.lvm -# -### BEGIN INIT INFO -# Provides: boot.lvm -# Required-Start: boot.udev boot.rootfsck -# Should-Start: boot.device-mapper boot.multipath boot.md boot.dmraid -# Required-Stop: $null -# Should-Stop: $null -# Default-Start: B -# Default-Stop: -# Short-Description: Start LVM2 -# Description: start logical volumes -### END INIT INFO - -. /etc/rc.status -. /etc/sysconfig/lvm - -# udev interaction -if [ -x /sbin/udevadm ] ; then - [ -z "$LVM_DEVICE_TIMEOUT" ] && LVM_DEVICE_TIMEOUT=60 -else - LVM_DEVICE_TIMEOUT=0 -fi - -rc_reset - -case "$1" in - start) - # - # Find and activate volume groups (HM 1/1/1999) - # - if test -d /etc/lvm -a -x /sbin/vgscan -a -x /sbin/vgchange ; then - # Waiting for udev to settle - if [ "$LVM_DEVICE_TIMEOUT" -gt 0 ] ; then - echo "Waiting for udev to settle..." - /sbin/udevadm settle --timeout=$LVM_DEVICE_TIMEOUT - fi - echo "Scanning for LVM volume groups..." - /sbin/vgscan --mknodes - echo "Activating LVM volume groups..." - /sbin/vgchange -a y $LVM_VGS_ACTIVATED_ON_BOOT - - rc_status -v -r - fi - ;; - stop) - if test -d /etc/lvm -a -x /sbin/vgchange ; then - /sbin/vgchange -a n - fi - rc_status -v - ;; - status) - rc_failed 4 - rc_status -v - ;; - reload) - $0 start - ;; - *) - echo "Usage: $0 {start|stop|status|reload}" - exit 1 - ;; -esac - -rc_exit diff --git a/clvmd.ocf b/clvmd.ocf index a10a3ee..c4e18ea 100644 --- a/clvmd.ocf +++ b/clvmd.ocf @@ -27,14 +27,25 @@ . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs # Parameter defaults -: ${OCF_RESKEY_CRM_meta_gloablly_unique:="false"} +: ${OCF_RESKEY_CRM_meta_globally_unique:="false"} : ${OCF_RESKEY_daemon_timeout:="80"} -: ${OCF_RESKEY_daemon_options:="-d0"} +: ${OCF_RESKEY_daemon_options:="-d2"} # Common variables DAEMON="/usr/sbin/clvmd" +CMIRRORD="/usr/sbin/cmirrord" -status_daemon() +status_daemons() +{ + PID=`pidofproc "$DAEMON"` + NPID=`pidofproc "$CMIRRORD"` + if [ -n "$PID" -a -n "$NPID" ]; then + return $OCF_SUCCESS + fi + return $OCF_NOT_RUNNING +} + +status_clvmd() { PID=`pidofproc "$DAEMON"` if [ -n "$PID" ]; then @@ -43,7 +54,16 @@ status_daemon() return $OCF_NOT_RUNNING } -bringup_daemon() +status_cmirrord() +{ + PID=`pidofproc "$CMIRRORD"` + if [ -n "$PID" ]; then + return $OCF_SUCCESS + fi + return $OCF_NOT_RUNNING +} + +bringup_clvmd() { if [ ! -e "$DAEMON" ]; then ocf_log err "Required binary not found: $DAEMON" @@ -66,16 +86,47 @@ bringup_daemon() ocf_log err "`basename $DAEMON` did not come up" return $OCF_ERR_GENERIC fi - status_daemon; rc=$? + status_clvmd; rc=$? sleep 1 done return $rc } -kill_daemon() +bringup_cmirrord() { - status_daemon; rc=$? + if [ ! -e "$CMIRRORD" ]; then + ocf_log err "Required binary not found: $DAEMON" + return $OCF_ERR_INSTALLED + fi + + start_daemon "$CMIRRORD" "$OCF_RESKEY_daemon_options"; rc=$? + if [ $rc != 0 ]; then + ocf_log err "Could not start $CMIRRORD" + return $OCF_ERR_GENERIC + fi + + sleep 1 + COUNT=0 + rc=$OCF_NOT_RUNNING + + while [ $rc = $OCF_NOT_RUNNING ]; do + COUNT=`expr $COUNT + 1` + if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then + ocf_log err "`basename $DAEMON` did not come up" + return $OCF_ERR_GENERIC + fi + status_cmirrord; rc=$? + sleep 1 + done + + return $rc +} + + +kill_clvmd() +{ + status_clvmd; rc=$? if [ $rc != $OCF_SUCCESS ]; then return rc fi @@ -84,7 +135,7 @@ kill_daemon() killproc -INT "$DAEMON" sleep 1 - status_daemon; rc=$? + status_daemons; rc=$? COUNT=0 while [ $rc = $OCF_SUCCESS ]; do @@ -92,7 +143,7 @@ kill_daemon() if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then ocf_log err "`basename $DAEMON` shutdown emergency" killproc -9 "$DAEMON" - status_daemon; rc=$? + status_clvmd; rc=$? if [ $rc = $OCF_NOT_RUNNING ]; then return $OCF_SUCCESS else @@ -101,40 +152,101 @@ kill_daemon() fi killproc -INT "$DAEMON" sleep 1 - status_daemon; rc=$? + status_clvmd; rc=$? done return $OCF_SUCCESS } -clvmd_start() { - - clvmd_monitor; rc=$? - if [ $rc != $OCF_NOT_RUNNING ]; then - return $rc +kill_cmirrord() +{ + status_cmirrord; rc=$? + if [ $rc != $OCF_SUCCESS ]; then + return rc fi - ocf_log info "Starting $OCF_RESOURCE_INSTANCE" + ocf_log info "Stopping `basename "$CMIRRORD"`" + killproc -INT "$CMIRRORD" - bringup_daemon - return $? + sleep 1 + status_cmirrord; rc=$? + + COUNT=0 + while [ $rc = $OCF_SUCCESS ]; do + COUNT=`expr $COUNT + 1` + if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then + ocf_log err "`basename $CMIRRORD` shutdown emergency" + killproc -9 "$CMIRRORD" + status_cmirrord; rc=$? + if [ $rc = $OCF_NOT_RUNNING ]; then + return $OCF_SUCCESS + else + return $OCF_ERR_GENERIC + fi + fi + killproc -INT "$CMIRRORD" + sleep 1 + status_cmirrord; rc=$? + done + + return $OCF_SUCCESS +} + + +clvmd_start() +{ + clvmd_validate + ocf_log info "Starting $OCF_RESOURCE_INSTANCE" + + status_clvmd; rc=$? + if [ $rc == $OCF_NOT_RUNNING ]; then + bringup_clvmd; rc=$? + if [ $rc != $OCF_SUCCESS ]; then + return $OCF_ERR_GENERIC + fi + fi + + status_cmirrord; rc=$? + if [ $rc == $OCF_NOT_RUNNING ]; then + bringup_cmirrord; rc=$? + if [ $rc != $OCF_SUCCESS ]; then + kill_clvmd + return $OCF_ERR_GENERIC + fi + fi + + return $OCF_SUCCESS } clvmd_stop() { - clvmd_monitor; rc=$? - case $rc in - $OCF_NOT_RUNNING) return $OCF_SUCCESS;; - esac - + clvmd_validate ocf_log info "Stopping $OCF_RESOURCE_INSTANCE" - kill_daemon + status_clvmd; rc=$? + if [ $rc != $OCF_NOT_RUNNING ]; then + kill_clvmd; krc=$? + if [ $krc != $OCF_SUCCESS ]; then + ocf_log err "Failed to stop clvmd" + return $OCF_ERR_GENERIC + fi + fi + + status_cmirrord; rc=$? + if [ $rc != $OCF_NOT_RUNNING ]; then + kill_cmirrord; krc=$? + if [ $krc != $OCF_SUCCESS ]; then + ocf_log err "Failed to stop cmirrord" + return $OCF_ERR_GENERIC + fi + fi + + return $OCF_SUCCESS } clvmd_monitor() { clvmd_validate - status_daemon + status_daemons return $? } @@ -145,10 +257,10 @@ clvmd_usage() { } clvmd_validate() { - : TODO: check for gloablly_unique=true and return OCF_ERR_CONFIGURED - case ${OCF_RESKEY_CRM_meta_gloablly_unique} in + : TODO: check for globally_unique=true and return OCF_ERR_CONFIGURED + case ${OCF_RESKEY_CRM_meta_globally_unique} in yes|Yes|true|True|1) - ocf_log err "$OCF_RESOURCE_INSTANCE must be configured with the gloablly_unique=false meta attribute" + ocf_log err "$OCF_RESOURCE_INSTANCE must be configured with the globally_unique=false meta attribute" exit $OCF_ERR_CONFIGURED ;; esac @@ -163,8 +275,8 @@ meta_data() { 1.0 -This is a clvmd Resource Agent. -It starts clvmd as anonymous clones. +This is a Resource Agent for both clvmd and cmirrord. +It starts clvmd and cmirrord as anonymous clones. clvmd resource agent @@ -182,7 +294,7 @@ Number of seconds to allow the control daemon to come up and down Options to clvmd. Refer to clvmd.8 for detailed descriptions. Daemon Options - + diff --git a/cmirrord.ocf b/cmirrord.ocf new file mode 100644 index 0000000..1c1e0b2 --- /dev/null +++ b/cmirrord.ocf @@ -0,0 +1,222 @@ +#!/bin/bash +# Copyright (c) 2008 Xinwei Hu +# All Rights Reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# Further, this software is distributed without any warranty that it is +# free of the rightful claim of any third person regarding infringement +# or the like. Any license provided herein, whether implied or +# otherwise, applies only to this software file. Patent licenses, if +# any, provided herein do not apply to combinations of this program with +# other software, or any other product whatsoever. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. +# +####################################################################### + +# OCF initialization +. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs + +# Parameter defaults +: ${OCF_RESKEY_CRM_meta_globally_unique:="false"} +: ${OCF_RESKEY_daemon_timeout:="80"} +: ${OCF_RESKEY_daemon_options:="-d0"} + +# Common variables +DAEMON="/usr/sbin/cmirrord" + +status_daemon() +{ + PID=`pidofproc "$DAEMON"` + if [ -n "$PID" ]; then + return $OCF_SUCCESS + fi + return $OCF_NOT_RUNNING +} + +bringup_daemon() +{ + if [ ! -e "$DAEMON" ]; then + ocf_log err "Required binary not found: $DAEMON" + return $OCF_ERR_INSTALLED + fi + + start_daemon "$DAEMON" "$OCF_RESKEY_daemon_options"; rc=$? + if [ $rc != 0 ]; then + ocf_log err "Could not start $DAEMON" + return $OCF_ERR_GENERIC + fi + + sleep 1 + COUNT=0 + rc=$OCF_NOT_RUNNING + + while [ $rc = $OCF_NOT_RUNNING ]; do + COUNT=`expr $COUNT + 1` + if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then + ocf_log err "`basename $DAEMON` did not come up" + return $OCF_ERR_GENERIC + fi + status_daemon; rc=$? + sleep 1 + done + + return $rc +} + +kill_daemon() +{ + status_daemon; rc=$? + if [ $rc != $OCF_SUCCESS ]; then + return rc + fi + + ocf_log info "Stopping `basename "$DAEMON"`" + killproc -INT "$DAEMON" + + sleep 1 + status_daemon; rc=$? + + COUNT=0 + while [ $rc = $OCF_SUCCESS ]; do + COUNT=`expr $COUNT + 1` + if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then + ocf_log err "`basename $DAEMON` shutdown emergency" + killproc -9 "$DAEMON" + status_daemon; rc=$? + if [ $rc = $OCF_NOT_RUNNING ]; then + return $OCF_SUCCESS + else + return $OCF_ERR_GENERIC + fi + fi + killproc -INT "$DAEMON" + sleep 1 + status_daemon; rc=$? + done + + return $OCF_SUCCESS +} + +cmirrord_start() { + + cmirrord_monitor; rc=$? + if [ $rc != $OCF_NOT_RUNNING ]; then + return $rc + fi + + ocf_log info "Starting $OCF_RESOURCE_INSTANCE" + + bringup_daemon + return $? +} + +cmirrord_stop() { + cmirrord_monitor; rc=$? + case $rc in + $OCF_NOT_RUNNING) return $OCF_SUCCESS;; + esac + + ocf_log info "Stopping $OCF_RESOURCE_INSTANCE" + + kill_daemon +} + +cmirrord_monitor() { + cmirrord_validate + + status_daemon + return $? +} + +cmirrord_usage() { + echo "usage: $0 {start|stop|monitor|validate-all|meta-data}" + echo " Expects to have a fully populated OCF RA-compliant environment set." + echo " In particualr, a value for OCF_ROOT" +} + +cmirrord_validate() { + : TODO: check for globally_unique=true and return OCF_ERR_CONFIGURED + case ${OCF_RESKEY_CRM_meta_globally_unique} in + yes|Yes|true|True|1) + ocf_log err "$OCF_RESOURCE_INSTANCE must be configured with the globally_unique=false meta attribute" + exit $OCF_ERR_CONFIGURED + ;; + esac + + return $OCF_SUCCESS +} + +meta_data() { + cat < + + + 1.0 + +This is a cmirrord Resource Agent. +It starts cmirrord as anonymous clones. + + cmirrord resource agent + + + + +Number of seconds to allow the control daemon to come up and down + + Daemon Timeout + + + + + +Options to cmirrord. Cmirrord actually doesn't accept any options +for now. + + Daemon Options + + + + + + + + + + + + + +END +} + +case $__OCF_ACTION in +meta-data) meta_data + exit $OCF_SUCCESS + ;; +start) cmirrord_start + ;; +stop) cmirrord_stop + ;; +monitor) cmirrord_monitor + ;; +validate-all) cmirrord_validate + ;; +usage|help) cmirrord_usage + exit $OCF_SUCCESS + ;; +*) cmirrord_usage + exit $OCF_ERR_UNIMPLEMENTED + ;; +esac + +exit $? diff --git a/collect_lvm b/collect_lvm deleted file mode 100644 index 6b353da..0000000 --- a/collect_lvm +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -PVNAME=$1 - -source /etc/sysconfig/lvm - -/sbin/lvm pvs --config "devices {filter = [ \"a|$PVNAME|\", \"r/.*/\" ]}" --partial -o vg_name,vg_attr,pv_uuid,vg_uuid --ignorelockingfailure --noheadings $PVNAME 2>/dev/null | while read vgname vgattr pvuuid vguuid; do - if [[ $vgattr =~ mode. ]]; then - continue - fi - if [[ $vgattr =~ .....c ]]; then - exit 1 - fi - - lvlist=$(/sbin/lvm lvs --config "devices {filter = [ \"a|$PVNAME|\", \"r/.*/\" ]}" --partial -o lv_name,lv_attr --ignorelockingfailure --noheadings $vgname 2>/dev/null | while read lvname lvattr; do - if [[ $lvattr =~ mode. ]] ; then - continue - fi - if [[ $lvattr =~ ....-. ]]; then - echo -n $lvname - fi - done) - - if [ -z "$lvlist" ] ; then - exit 1 - fi - - pvlist=$(/sbin/lvm vgdisplay --config "devices {filter = [ \"a|$PVNAME|\", \"r/.*/\" ]}" --partial -v $vgname 2>/dev/null | while read str1 str2 val; do - if [[ $str1 =~ PV && $str2 =~ UUID ]]; then - echo $val - fi - done) - - echo PVUUID=$pvuuid - echo VGUUID=$vguuid - echo VGNAME=$vgname - - if [[ -n $LVM_VGS_ACTIVATED_ON_BOOT ]]; then - found=0 - for autovg in $LVM_VGS_ACTIVATED_ON_BOOT; do - if [[ $vgname == $autovg ]]; then - found=1 - break - fi - done - if [[ $found == 0 ]]; then - echo COLLECT=1 - exit 0 - fi - fi - - collected=0 - for pv in $pvlist; do - if [[ x$pv = x$pvuuid ]]; then - continue - fi - if [[ ! -h /dev/disk/by-id/lvm2-pvuuid-$pv ]]; then - echo COLLECT=1 - collected=1 - break - fi - done - if [[ $collected = 0 ]]; then - echo COLLECT=0 - fi - -# /lib/udev/collect $vguuid $pvuuid $pvlist -# echo COLLECT=$? -done - diff --git a/device-mapper-dmsetup-deps-export.patch b/device-mapper-dmsetup-deps-export.patch deleted file mode 100644 index 37cae82..0000000 --- a/device-mapper-dmsetup-deps-export.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- - tools/dmsetup.c | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) - -Index: LVM2.2.02.98/tools/dmsetup.c -=================================================================== ---- LVM2.2.02.98.orig/tools/dmsetup.c -+++ LVM2.2.02.98/tools/dmsetup.c -@@ -1717,10 +1717,11 @@ static int _export(CMD_ARGS) - char *target_type = NULL; - char *params; - const char *name = NULL; - const char *uuid = NULL; - struct dm_info info; -+ struct dm_deps *deps; - - if (names) - name = names->name; - else if (argc == 2) - name = argv[1]; -@@ -1786,10 +1787,32 @@ static int _export(CMD_ARGS) - printf(",%s", target_type); - } - printf("\n"); - } - -+ dm_task_destroy(dmt); -+ -+ if (!(dmt = dm_task_create(DM_DEVICE_DEPS))) -+ goto out; -+ -+ name = NULL; -+ if (names) -+ name = names->name; -+ else if (argc == 2) -+ name = argv[1]; -+ -+ if (!_set_task_device(dmt, name, 0)) -+ goto out; -+ -+ if (!dm_task_run(dmt)) -+ goto out; -+ -+ if (!(deps = dm_task_get_deps(dmt))) -+ goto out; -+ -+ printf("DM_DEPS=%d\n", deps->count); -+ - r = 1; - out: - if (dmt) - dm_task_destroy(dmt); - return r; diff --git a/device-mapper-dmsetup-export.patch b/device-mapper-dmsetup-export.patch deleted file mode 100644 index ef5d314..0000000 --- a/device-mapper-dmsetup-export.patch +++ /dev/null @@ -1,152 +0,0 @@ ---- - man/dmsetup.8.in | 7 ++++ - tools/dmsetup.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 95 insertions(+) - -Index: LVM2.2.02.98/man/dmsetup.8.in -=================================================================== ---- LVM2.2.02.98.orig/man/dmsetup.8.in -+++ LVM2.2.02.98/man/dmsetup.8.in -@@ -17,10 +17,13 @@ dmsetup \- low level logical volume mana - .RB [{ \-\-addnodeoncreate | \-\-addnodeonresume }] - .RB [ \-\-readahead - .RI [ \+ ]< sectors >| auto | none ] - .RE - .br -+.B dmsetup export -+.I [device_name] -+.br - .B dmsetup deps - .RB [ \-o - .IR options ] - .RI [ device_name ] - .br -@@ -283,10 +286,14 @@ Otherwise a table is read from standard - The optional uuid can be used in place of - device_name in subsequent dmsetup commands. - If successful a device will appear as - /dev/mapper/. - See below for information on the table format. -+.IP \fBexport -+.I [device_name] -+.br -+Outputs information in key/value format to be imported by other programs. - .br - .TP - .B deps - .RB [ \-o - .IR options ] -Index: LVM2.2.02.98/tools/dmsetup.c -=================================================================== ---- LVM2.2.02.98.orig/tools/dmsetup.c -+++ LVM2.2.02.98/tools/dmsetup.c -@@ -1706,10 +1706,97 @@ static int _status(CMD_ARGS) - out: - dm_task_destroy(dmt); - return r; - } - -+static int _export(CMD_ARGS) -+{ -+ int r = 0; -+ struct dm_task *dmt = NULL; -+ void *next = NULL; -+ uint64_t start, length; -+ char *target_type = NULL; -+ char *params; -+ const char *name = NULL; -+ const char *uuid = NULL; -+ struct dm_info info; -+ -+ if (names) -+ name = names->name; -+ else if (argc == 2) -+ name = argv[1]; -+ -+ if (!(dmt = dm_task_create(DM_DEVICE_STATUS))) -+ goto out; -+ -+ if (!_set_task_device(dmt, name, 0)) -+ goto out; -+ -+ if (!dm_task_run(dmt)) -+ goto out; -+ -+ if (!dm_task_get_info(dmt, &info) || !info.exists) -+ goto out; -+ -+ if (!name) -+ name = dm_task_get_name(dmt); -+ -+ uuid = dm_task_get_uuid(dmt); -+ printf("DM_NAME=%s\n", name); -+ -+ if ((uuid = dm_task_get_uuid(dmt)) && *uuid) -+ printf("DM_UUID=%s\n", uuid); -+ -+ if (!info.exists) { -+ printf("DM_STATE=NOTPRESENT\n"); -+ goto out; -+ } -+ -+ printf("DM_STATE=%s\n", -+ info.suspended ? "SUSPENDED" : -+ (info.read_only ? "READONLY" : "ACTIVE")); -+ -+ if (!info.live_table && !info.inactive_table) -+ printf("DM_TABLE_STATE=NONE\n"); -+ else -+ printf("DM_TABLE_STATE=%s%s%s\n", -+ info.live_table ? "LIVE" : "", -+ info.live_table && info.inactive_table ? "/" : "", -+ info.inactive_table ? "INACTIVE" : ""); -+ -+ if (info.open_count != -1) -+ printf("DM_OPENCOUNT=%d\n", info.open_count); -+ -+ printf("DM_LAST_EVENT_NR=%" PRIu32 "\n", info.event_nr); -+ -+ printf("DM_MAJOR=%d\n", info.major); -+ printf("DM_MINOR=%d\n", info.minor); -+ -+ if (info.target_count != -1) -+ printf("DM_TARGET_COUNT=%d\n", info.target_count); -+ -+ /* export all table types */ -+ next = dm_get_next_target(dmt, next, &start, &length, -+ &target_type, ¶ms); -+ if (target_type) { -+ printf("DM_TARGET_TYPES=%s", target_type); -+ while (next) { -+ next = dm_get_next_target(dmt, next, &start, &length, -+ &target_type, ¶ms); -+ if (target_type) -+ printf(",%s", target_type); -+ } -+ printf("\n"); -+ } -+ -+ r = 1; -+ out: -+ if (dmt) -+ dm_task_destroy(dmt); -+ return r; -+} -+ - /* Show target names and their version numbers */ - static int _targets(CMD_ARGS) - { - int r = 0; - struct dm_task *dmt; -@@ -3056,10 +3143,11 @@ static struct command _commands[] = { - {"message", " ", 2, -1, 0, _message}, - {"ls", "[--target ] [--exec ] [-o options] [--tree]", 0, 0, 0, _ls}, - {"info", "[]", 0, -1, 1, _info}, - {"deps", "[-o options] []", 0, -1, 1, _deps}, - {"status", "[] [--noflush] [--target ]", 0, -1, 1, _status}, -+ {"export", "[]", 0, 1, 1, _export}, - {"table", "[] [--target ] [--showkeys]", 0, -1, 1, _status}, - {"wait", " [] [--noflush]", 0, 2, 0, _wait}, - {"mknodes", "[]", 0, -1, 1, _mknodes}, - {"mangle", "[]", 0, -1, 1, _mangle}, - {"udevcreatecookie", "", 0, 0, 0, _udevcreatecookie}, diff --git a/lvm.conf b/lvm.conf index e3804f9..04550e0 100644 --- a/lvm.conf +++ b/lvm.conf @@ -6,7 +6,24 @@ # # To put this file in a different directory and override /etc/lvm set # the environment variable LVM_SYSTEM_DIR before running the tools. +# +# N.B. Take care that each setting only appears once if uncommenting +# example settings in this file. +# This section allows you to set the way the configuration settings are handled. +config { + + # If enabled, any LVM2 configuration mismatch is reported. + # This implies checking that the configuration key is understood + # by LVM2 and that the value of the key is of a proper type. + # If disabled, any configuration mismatch is ignored and default + # value is used instead without any warning (a message about the + # configuration key not being found is issued in verbose mode only). + checks = 1 + + # If enabled, any configuration mismatch aborts the LVM2 process. + abort_on_errors = 0 +} # This section allows you to configure which block devices should # be used by the LVM system. @@ -19,6 +36,25 @@ devices { # to use with LVM2. scan = [ "/dev" ] + # If set, the cache of block device nodes with all associated symlinks + # will be constructed out of the existing udev database content. + # This avoids using and opening any inapplicable non-block devices or + # subdirectories found in the device directory. This setting is applied + # to udev-managed device directory only, other directories will be scanned + # fully. LVM2 needs to be compiled with udev support for this setting to + # take effect. N.B. Any device node or symlink not managed by udev in + # udev directory will be ignored with this setting on. + obtain_device_list_from_udev = 1 + + # If several entries in the scanned directories correspond to the + # same block device and the tools need to display a name for device, + # all the pathnames are matched against each item in the following + # list of regular expressions in turn and the first match is used. + preferred_names = [ ] + + # Try to avoid using undescriptive /dev/dm-N names, if present. + # preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ] + # A filter that tells LVM2 to only use a restricted set of devices. # The filter consists of an array of regular expressions. These # expressions can be delimited by a character of your choice, and @@ -27,8 +63,13 @@ devices { # the device will be accepted or rejected (ignored). Devices that # don't match any patterns are accepted. - # Remember to run vgscan after you change this parameter to ensure - # that the cache file gets regenerated (see below). + # Be careful if there there are symbolic links or multiple filesystem + # entries for the same device as each name is checked separately against + # the list of patterns. The effect is that if the first pattern in the + # list to match a name is an 'a' pattern for any of the names, the device + # is accepted; otherwise if the first pattern in the list to match a name + # is an 'r' pattern for any of the names it is rejected; otherwise it is + # accepted. # By default we accept every block device except udev names: filter = [ "r|/dev/.*/by-path/.*|", "r|/dev/.*/by-id/.*|", "a/.*/" ] @@ -45,11 +86,26 @@ devices { # Use anchors if you want to be really specific # filter = [ "a|^/dev/hda8$|", "r/.*/" ] + # Since "filter" is often overriden from command line, it is not suitable + # for system-wide device filtering (udev rules, lvmetad). To hide devices + # from LVM-specific udev processing and/or from lvmetad, you need to set + # global_filter. The syntax is the same as for normal "filter" + # above. Devices that fail the global_filter are not even opened by LVM. + + # global_filter = [] + # The results of the filtering are cached on disk to avoid - # rescanning dud devices (which can take a very long time). By - # default this cache file is hidden in the /etc/lvm directory. - # It is safe to delete this file: the tools regenerate it. - cache = "/etc/lvm/.cache" + # rescanning dud devices (which can take a very long time). + # By default this cache is stored in the /etc/lvm/cache directory + # in a file called '.cache'. + # It is safe to delete the contents: the tools regenerate it. + # (The old setting 'cache' is still respected if neither of + # these new ones is present.) + # N.B. If obtain_device_list_from_udev is set to 1 the list of + # devices is instead obtained from udev and any existing .cache + # file is removed. + cache_dir = "/etc/lvm/cache" + cache_file_prefix = "" # You can turn off writing this cache file by setting this to 0. write_cache_state = 1 @@ -65,10 +121,141 @@ devices { # 1 enables; 0 disables. sysfs_scan = 1 + # By default, LVM2 will ignore devices used as component paths + # of device-mapper multipath devices. + # 1 enables; 0 disables. + multipath_component_detection = 0 + # By default, LVM2 will ignore devices used as components of # software RAID (md) devices by looking for md superblocks. # 1 enables; 0 disables. md_component_detection = 1 + + # By default, if a PV is placed directly upon an md device, LVM2 + # will align its data blocks with the md device's stripe-width. + # 1 enables; 0 disables. + md_chunk_alignment = 1 + + # Default alignment of the start of a data area in MB. If set to 0, + # a value of 64KB will be used. Set to 1 for 1MiB, 2 for 2MiB, etc. + # default_data_alignment = 1 + + # By default, the start of a PV's data area will be a multiple of + # the 'minimum_io_size' or 'optimal_io_size' exposed in sysfs. + # - minimum_io_size - the smallest request the device can perform + # w/o incurring a read-modify-write penalty (e.g. MD's chunk size) + # - optimal_io_size - the device's preferred unit of receiving I/O + # (e.g. MD's stripe width) + # minimum_io_size is used if optimal_io_size is undefined (0). + # If md_chunk_alignment is enabled, that detects the optimal_io_size. + # This setting takes precedence over md_chunk_alignment. + # 1 enables; 0 disables. + data_alignment_detection = 1 + + # Alignment (in KB) of start of data area when creating a new PV. + # md_chunk_alignment and data_alignment_detection are disabled if set. + # Set to 0 for the default alignment (see: data_alignment_default) + # or page size, if larger. + data_alignment = 0 + + # By default, the start of the PV's aligned data area will be shifted by + # the 'alignment_offset' exposed in sysfs. This offset is often 0 but + # may be non-zero; e.g.: certain 4KB sector drives that compensate for + # windows partitioning will have an alignment_offset of 3584 bytes + # (sector 7 is the lowest aligned logical block, the 4KB sectors start + # at LBA -1, and consequently sector 63 is aligned on a 4KB boundary). + # But note that pvcreate --dataalignmentoffset will skip this detection. + # 1 enables; 0 disables. + data_alignment_offset_detection = 1 + + # If, while scanning the system for PVs, LVM2 encounters a device-mapper + # device that has its I/O suspended, it waits for it to become accessible. + # Set this to 1 to skip such devices. This should only be needed + # in recovery situations. + ignore_suspended_devices = 0 + + # During each LVM operation errors received from each device are counted. + # If the counter of a particular device exceeds the limit set here, no + # further I/O is sent to that device for the remainder of the respective + # operation. Setting the parameter to 0 disables the counters altogether. + disable_after_error_count = 0 + + # Allow use of pvcreate --uuid without requiring --restorefile. + require_restorefile_with_uuid = 1 + + # Minimum size (in KB) of block devices which can be used as PVs. + # In a clustered environment all nodes must use the same value. + # Any value smaller than 512KB is ignored. + + # Ignore devices smaller than 2MB such as floppy drives. + pv_min_size = 2048 + + # The original built-in setting was 512 up to and including version 2.02.84. + # pv_min_size = 512 + + # Issue discards to a logical volumes's underlying physical volume(s) when + # the logical volume is no longer using the physical volumes' space (e.g. + # lvremove, lvreduce, etc). Discards inform the storage that a region is + # no longer in use. Storage that supports discards advertise the protocol + # specific way discards should be issued by the kernel (TRIM, UNMAP, or + # WRITE SAME with UNMAP bit set). Not all storage will support or benefit + # from discards but SSDs and thinly provisioned LUNs generally do. If set + # to 1, discards will only be issued if both the storage and kernel provide + # support. + # 1 enables; 0 disables. + issue_discards = 0 +} + +# This section allows you to configure the way in which LVM selects +# free space for its Logical Volumes. +allocation { + + # When searching for free space to extend an LV, the "cling" + # allocation policy will choose space on the same PVs as the last + # segment of the existing LV. If there is insufficient space and a + # list of tags is defined here, it will check whether any of them are + # attached to the PVs concerned and then seek to match those PV tags + # between existing extents and new extents. + # Use the special tag "@*" as a wildcard to match any PV tag. + + # Example: LVs are mirrored between two sites within a single VG. + # PVs are tagged with either @site1 or @site2 to indicate where + # they are situated. + + # cling_tag_list = [ "@site1", "@site2" ] + # cling_tag_list = [ "@*" ] + + # Changes made in version 2.02.85 extended the reach of the 'cling' + # policies to detect more situations where data can be grouped + # onto the same disks. Set this to 0 to revert to the previous + # algorithm. + maximise_cling = 1 + + # Set to 1 to guarantee that mirror logs will always be placed on + # different PVs from the mirror images. This was the default + # until version 2.02.85. + mirror_logs_require_separate_pvs = 0 + + # Set to 1 to guarantee that thin pool metadata will always + # be placed on different PVs from the pool data. + thin_pool_metadata_require_separate_pvs = 0 + + # Specify the minimal chunk size (in KB) for thin pool volumes. + # Use of the larger chunk size may improve perfomance for plain + # thin volumes, however using them for snapshot volumes is less efficient, + # as it consumes more space and takes extra time for copying. + # When unset, lvm tries to estimate chunk size starting from 64KB + # Supported values are in range from 64 to 1048576. + # thin_pool_chunk_size = 64 + + # Specify discards behavior of the thin pool volume. + # Select one of "ignore", "nopassdown", "passdown" + # thin_pool_discards = "passdown" + + # Set to 0, to disable zeroing of thin pool data chunks before their + # first use. + # N.B. zeroing larger thin pool chunk size degrades performance. + # thin_pool_zero = 1 } # This section that allows you to configure the nature of the @@ -79,6 +266,17 @@ log { # There are three levels of verbosity, 3 being the most verbose. verbose = 0 + # Set to 1 to suppress all non-essential messages from stdout. + # This has the same effect as -qq. + # When this is set, the following commands still produce output: + # dumpconfig, lvdisplay, lvmdiskscan, lvs, pvck, pvdisplay, + # pvs, version, vgcfgrestore -l, vgdisplay, vgs. + # Non-essential messages are shifted from log level 4 to log level 5 + # for syslog and lvm2_log_fn purposes. + # Any 'yes' or 'no' questions not overridden by other arguments + # are suppressed and default to 'no'. + silent = 1 + # Should we send log messages through syslog? # 1 is yes; 0 is no. syslog = 1 @@ -116,6 +314,15 @@ log { # Set this if you want log messages during activation. # Don't use this in low memory situations (can deadlock). # activation = 0 + + # Some debugging messages are assigned to a class and only appear + # in debug output if the class is listed here. + # Classes currently available: + # memory, devices, activation, allocation, lvmetad, metadata, cache, + # locking + # Use "all" to see everything. + debug_classes = [ "memory", "devices", "activation", "allocation", + "lvmetad", "metadata", "cache", "locking" ] } # Configuration of metadata backups and archiving. In LVM2 when we @@ -141,7 +348,7 @@ backup { # Where should archived files go ? # Remember to back up this directory regularly! archive_dir = "/etc/lvm/archive" - + # What is the minimum number of archive files you wish to keep ? retain_min = 10 @@ -172,6 +379,16 @@ global { # command. Defaults to off. test = 0 + # Default value for --units argument + units = "h" + + # Since version 2.02.54, the tools distinguish between powers of + # 1024 bytes (e.g. KiB, MiB, GiB) and powers of 1000 bytes (e.g. + # KB, MB, GB). + # If you have scripts that depend on the old behaviour, set this to 0 + # temporarily until you update them. + si_unit_consistency = 1 + # Whether or not to communicate with the kernel device-mapper. # Set to 0 if you want to use the tools to manipulate LVM metadata # without activating any logical volumes. @@ -191,21 +408,50 @@ global { # The default metadata format that commands should use - "lvm1" or "lvm2". # The command line override is -M1 or -M2. - # Defaults to "lvm1" if compiled in, else "lvm2". - # format = "lvm1" + # Defaults to "lvm2". + # format = "lvm2" # Location of proc filesystem proc = "/proc" - # Type of locking to use. Defaults to file-based locking (1). + # Type of locking to use. Defaults to local file-based locking (1). # Turn locking off by setting to 0 (dangerous: risks metadata corruption # if LVM2 commands get run concurrently). + # Type 2 uses the external shared library locking_library. + # Type 3 uses built-in clustered locking. + # Type 4 uses read-only locking which forbids any operations that might + # change metadata. locking_type = 1 + # Set to 0 to fail when a lock request cannot be satisfied immediately. + wait_for_locks = 1 + + # If using external locking (type 2) and initialisation fails, + # with this set to 1 an attempt will be made to use the built-in + # clustered locking. + # If you are using a customised locking_library you should set this to 0. + fallback_to_clustered_locking = 1 + + # If an attempt to initialise type 2 or type 3 locking failed, perhaps + # because cluster components such as clvmd are not running, with this set + # to 1 an attempt will be made to use local file-based locking (type 1). + # If this succeeds, only commands against local volume groups will proceed. + # Volume Groups marked as clustered will be ignored. + fallback_to_local_locking = 1 + # Local non-LV directory that holds file-based locks while commands are # in progress. A directory like /tmp that may get wiped on reboot is OK. locking_dir = "/run/lock/lvm" + # Whenever there are competing read-only and read-write access requests for + # a volume group's metadata, instead of always granting the read-only + # requests immediately, delay them to allow the read-write requests to be + # serviced. Without this setting, write access may be stalled by a high + # volume of read-only requests. + # NB. This option only affects locking_type = 1 viz. local file-based + # locking. + prioritise_write_locks = 1 + # Other entries can go here to allow you to load shared libraries # e.g. if support for LVM1 metadata was compiled as a shared library use # format_libraries = "liblvm2format1.so" @@ -213,20 +459,167 @@ global { # Search this directory first for shared libraries. # library_dir = "/lib" + + # The external locking library to load if locking_type is set to 2. + # locking_library = "liblvm2clusterlock.so" + + # Treat any internal errors as fatal errors, aborting the process that + # encountered the internal error. Please only enable for debugging. + abort_on_internal_errors = 0 + + # Check whether CRC is matching when parsed VG is used multiple times. + # This is useful to catch unexpected internal cached volume group + # structure modification. Please only enable for debugging. + detect_internal_vg_cache_corruption = 0 + + # If set to 1, no operations that change on-disk metadata will be permitted. + # Additionally, read-only commands that encounter metadata in need of repair + # will still be allowed to proceed exactly as if the repair had been + # performed (except for the unchanged vg_seqno). + # Inappropriate use could mess up your system, so seek advice first! + metadata_read_only = 0 + + # 'mirror_segtype_default' defines which segtype will be used when the + # shorthand '-m' option is used for mirroring. The possible options are: + # + # "mirror" - The original RAID1 implementation provided by LVM2/DM. It is + # characterized by a flexible log solution (core, disk, mirrored) + # and by the necessity to block I/O while reconfiguring in the + # event of a failure. + # + # There is an inherent race in the dmeventd failure handling + # logic with snapshots of devices using this type of RAID1 that + # in the worst case could cause a deadlock. + # Ref: https://bugzilla.redhat.com/show_bug.cgi?id=817130#c10 + # + # "raid1" - This implementation leverages MD's RAID1 personality through + # device-mapper. It is characterized by a lack of log options. + # (A log is always allocated for every device and they are placed + # on the same device as the image - no separate devices are + # required.) This mirror implementation does not require I/O + # to be blocked in the kernel in the event of a failure. + # This mirror implementation is not cluster-aware and cannot be + # used in a shared (active/active) fashion in a cluster. + # + # Specify the '--type ' option to override this default + # setting. + mirror_segtype_default = "mirror" + + # 'raid10_segtype_default' determines the segment types used by default + # when the '--stripes/-i' and '--mirrors/-m' arguments are both specified + # during the creation of a logical volume. + # Possible settings include: + # + # "raid10" - This implementation leverages MD's RAID10 personality through + # device-mapper. + # + # "mirror" - LVM will layer the 'mirror' and 'stripe' segment types. It + # will do this by creating a mirror on top of striped sub-LVs; + # effectively creating a RAID 0+1 array. This is suboptimal + # in terms of providing redunancy and performance. Changing to + # this setting is not advised. + # Specify the '--type ' option to override this default + # setting. + raid10_segtype_default = "mirror" + + # The default format for displaying LV names in lvdisplay was changed + # in version 2.02.89 to show the LV name and path separately. + # Previously this was always shown as /dev/vgname/lvname even when that + # was never a valid path in the /dev filesystem. + # Set to 1 to reinstate the previous format. + # + # lvdisplay_shows_full_device_path = 0 + + # Whether to use (trust) a running instance of lvmetad. If this is set to + # 0, all commands fall back to the usual scanning mechanisms. When set to 1 + # *and* when lvmetad is running (it is not auto-started), the volume group + # metadata and PV state flags are obtained from the lvmetad instance and no + # scanning is done by the individual commands. In a setup with lvmetad, + # lvmetad udev rules *must* be set up for LVM to work correctly. Without + # proper udev rules, all changes in block device configuration will be + # *ignored* until a manual 'pvscan --cache' is performed. + # + # If lvmetad has been running while use_lvmetad was 0, it MUST be stopped + # before changing use_lvmetad to 1 and started again afterwards. + use_lvmetad = 0 + + # Full path of the utility called to check that a thin metadata device + # is in a state that allows it to be used. + # Each time a thin pool needs to be activated or after it is deactivated + # this utility is executed. The activation will only proceed if the utility + # has an exit status of 0. + # Set to "" to skip this check. (Not recommended.) + # The thin tools are available as part of the device-mapper-persistent-data + # package from https://github.com/jthornber/thin-provisioning-tools. + # + thin_check_executable = "" + + # String with options passed with thin_check command. By default, + # option '-q' is for quiet output. + thin_check_options = [ "-q" ] + + # If set, given features are not used by thin driver. + # This can be helpful not just for testing, but i.e. allows to avoid + # using problematic implementation of some thin feature. + # Features: + # block_size + # discards + # discards_non_power_2 + # + # thin_disabled_features = [ "discards", "block_size" ] } activation { - # Device used in place of missing stripes if activating incomplete volume. - # For now, you need to set this up yourself first (e.g. with 'dmsetup') - # For example, you could make it return I/O errors using the 'error' - # target or make it return zeros. - missing_stripe_filler = "/dev/ioerror" + # Set to 1 to perform internal checks on the operations issued to + # libdevmapper. Useful for debugging problems with activation. + # Some of the checks may be expensive, so it's best to use this + # only when there seems to be a problem. + checks = 0 - # Size (in KB) of each copy operation when mirroring - mirror_region_size = 512 + # Set to 0 to disable udev synchronisation (if compiled into the binaries). + # Processes will not wait for notification from udev. + # They will continue irrespective of any possible udev processing + # in the background. You should only use this if udev is not running + # or has rules that ignore the devices LVM2 creates. + # The command line argument --nodevsync takes precedence over this setting. + # If set to 1 when udev is not running, and there are LVM2 processes + # waiting for udev, run 'dmsetup udevcomplete_all' manually to wake them up. + udev_sync = 1 + + # Set to 0 to disable the udev rules installed by LVM2 (if built with + # --enable-udev_rules). LVM2 will then manage the /dev nodes and symlinks + # for active logical volumes directly itself. + # N.B. Manual intervention may be required if this setting is changed + # while any logical volumes are active. + udev_rules = 1 + + # Set to 1 for LVM2 to verify operations performed by udev. This turns on + # additional checks (and if necessary, repairs) on entries in the device + # directory after udev has completed processing its events. + # Useful for diagnosing problems with LVM2/udev interactions. + verify_udev_operations = 0 + + # If set to 1 and if deactivation of an LV fails, perhaps because + # a process run from a quick udev rule temporarily opened the device, + # retry the operation for a few seconds before failing. + retry_deactivation = 1 + + # How to fill in missing stripes if activating an incomplete volume. + # Using "error" will make inaccessible parts of the device return + # I/O errors on access. You can instead use a device path, in which + # case, that device will be used to in place of missing stripes. + # But note that using anything other than "error" with mirrored + # or snapshotted volumes is likely to result in data corruption. + missing_stripe_filler = "error" + + # The linear target is an optimised version of the striped target + # that only handles a single stripe. Set this to 0 to disable this + # optimisation and always use the striped target. + use_linear_target = 1 # How much stack (in KB) to reserve for use while devices suspended - reserved_stack = 256 + # Prior to version 2.02.89 this used to be set to 256KB + reserved_stack = 64 # How much memory (in KB) to reserve for use while devices suspended reserved_memory = 8192 @@ -236,13 +629,177 @@ activation { # If volume_list is defined, each LV is only activated if there is a # match against the list. + # # "vgname" and "vgname/lvname" are matched exactly. # "@tag" matches any tag set in the LV or VG. # "@*" matches if any tag defined on the host is also set in the LV or VG # + # If any host tags exist but volume_list is not defined, a default + # single-entry list containing "@*" is assumed. + # # volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ] - udev_rules = 1 - udev_sync = 1 + + # If auto_activation_volume_list is defined, each LV that is to be + # activated with the autoactivation option (--activate ay/-a ay) + # is first checked against the list. If it does not match, the LV + # is not activated. This list is checked as well as volume_list. + # + # "vgname" and "vgname/lvname" are matched exactly. + # "@tag" matches any tag set in the LV or VG. + # "@*" matches if any tag defined on the host is also set in the LV or VG + # + # auto_activation_volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ] + + # If read_only_volume_list is defined, each LV that is to be activated + # is checked against the list, and if it matches, it as activated + # in read-only mode. (This overrides '--permission rw' stored in the + # metadata.) + # + # "vgname" and "vgname/lvname" are matched exactly. + # "@tag" matches any tag set in the LV or VG. + # "@*" matches if any tag defined on the host is also set in the LV or VG + # + # read_only_volume_list = [ "vg1", "vg2/lvol1", "@tag1", "@*" ] + + # For RAID or 'mirror' segment types, 'raid_region_size' is the + # size (in kiB) of each: + # - synchronization operation when initializing + # - each copy operation when performing a 'pvmove' (using 'mirror' segtype) + # This setting has replaced 'mirror_region_size' since version 2.02.99 + raid_region_size = 512 + + # Setting to use when there is no readahead value stored in the metadata. + # + # "none" - Disable readahead. + # "auto" - Use default value chosen by kernel. + readahead = "auto" + + # 'raid_fault_policy' defines how a device failure in a RAID logical + # volume is handled. This includes logical volumes that have the following + # segment types: raid1, raid4, raid5*, and raid6*. + # + # In the event of a failure, the following policies will determine what + # actions are performed during the automated response to failures (when + # dmeventd is monitoring the RAID logical volume) and when 'lvconvert' is + # called manually with the options '--repair' and '--use-policies'. + # + # "warn" - Use the system log to warn the user that a device in the RAID + # logical volume has failed. It is left to the user to run + # 'lvconvert --repair' manually to remove or replace the failed + # device. As long as the number of failed devices does not + # exceed the redundancy of the logical volume (1 device for + # raid4/5, 2 for raid6, etc) the logical volume will remain + # usable. + # + # "allocate" - Attempt to use any extra physical volumes in the volume + # group as spares and replace faulty devices. + # + raid_fault_policy = "warn" + + # 'mirror_image_fault_policy' and 'mirror_log_fault_policy' define + # how a device failure affecting a mirror (of "mirror" segment type) is + # handled. A mirror is composed of mirror images (copies) and a log. + # A disk log ensures that a mirror does not need to be re-synced + # (all copies made the same) every time a machine reboots or crashes. + # + # In the event of a failure, the specified policy will be used to determine + # what happens. This applies to automatic repairs (when the mirror is being + # monitored by dmeventd) and to manual lvconvert --repair when + # --use-policies is given. + # + # "remove" - Simply remove the faulty device and run without it. If + # the log device fails, the mirror would convert to using + # an in-memory log. This means the mirror will not + # remember its sync status across crashes/reboots and + # the entire mirror will be re-synced. If a + # mirror image fails, the mirror will convert to a + # non-mirrored device if there is only one remaining good + # copy. + # + # "allocate" - Remove the faulty device and try to allocate space on + # a new device to be a replacement for the failed device. + # Using this policy for the log is fast and maintains the + # ability to remember sync state through crashes/reboots. + # Using this policy for a mirror device is slow, as it + # requires the mirror to resynchronize the devices, but it + # will preserve the mirror characteristic of the device. + # This policy acts like "remove" if no suitable device and + # space can be allocated for the replacement. + # + # "allocate_anywhere" - Not yet implemented. Useful to place the log device + # temporarily on same physical volume as one of the mirror + # images. This policy is not recommended for mirror devices + # since it would break the redundant nature of the mirror. This + # policy acts like "remove" if no suitable device and space can + # be allocated for the replacement. + + mirror_log_fault_policy = "allocate" + mirror_image_fault_policy = "remove" + + # 'snapshot_autoextend_threshold' and 'snapshot_autoextend_percent' define + # how to handle automatic snapshot extension. The former defines when the + # snapshot should be extended: when its space usage exceeds this many + # percent. The latter defines how much extra space should be allocated for + # the snapshot, in percent of its current size. + # + # For example, if you set snapshot_autoextend_threshold to 70 and + # snapshot_autoextend_percent to 20, whenever a snapshot exceeds 70% usage, + # it will be extended by another 20%. For a 1G snapshot, using up 700M will + # trigger a resize to 1.2G. When the usage exceeds 840M, the snapshot will + # be extended to 1.44G, and so on. + # + # Setting snapshot_autoextend_threshold to 100 disables automatic + # extensions. The minimum value is 50 (A setting below 50 will be treated + # as 50). + + snapshot_autoextend_threshold = 100 + snapshot_autoextend_percent = 20 + + # 'thin_pool_autoextend_threshold' and 'thin_pool_autoextend_percent' define + # how to handle automatic pool extension. The former defines when the + # pool should be extended: when its space usage exceeds this many + # percent. The latter defines how much extra space should be allocated for + # the pool, in percent of its current size. + # + # For example, if you set thin_pool_autoextend_threshold to 70 and + # thin_pool_autoextend_percent to 20, whenever a pool exceeds 70% usage, + # it will be extended by another 20%. For a 1G pool, using up 700M will + # trigger a resize to 1.2G. When the usage exceeds 840M, the pool will + # be extended to 1.44G, and so on. + # + # Setting thin_pool_autoextend_threshold to 100 disables automatic + # extensions. The minimum value is 50 (A setting below 50 will be treated + # as 50). + + thin_pool_autoextend_threshold = 100 + thin_pool_autoextend_percent = 20 + + # While activating devices, I/O to devices being (re)configured is + # suspended, and as a precaution against deadlocks, LVM2 needs to pin + # any memory it is using so it is not paged out. Groups of pages that + # are known not to be accessed during activation need not be pinned + # into memory. Each string listed in this setting is compared against + # each line in /proc/self/maps, and the pages corresponding to any + # lines that match are not pinned. On some systems locale-archive was + # found to make up over 80% of the memory used by the process. + # mlock_filter = [ "locale/locale-archive", "gconv/gconv-modules.cache" ] + + # Set to 1 to revert to the default behaviour prior to version 2.02.62 + # which used mlockall() to pin the whole process's memory while activating + # devices. + use_mlockall = 0 + + # Monitoring is enabled by default when activating logical volumes. + # Set to 0 to disable monitoring or use the --ignoremonitoring option. + monitoring = 1 + + # When pvmove or lvconvert must wait for the kernel to finish + # synchronising or merging data, they check and report progress + # at intervals of this number of seconds. The default is 15 seconds. + # If this is set to 0 and there is only one thing to wait for, there + # are no progress reports, but the process is awoken immediately the + # operation is complete. + polling_interval = 15 } @@ -282,23 +839,37 @@ activation { # dirs = [ "/etc/lvm/metadata", "/mnt/disk2/lvm/metadata2" ] #} +# Event daemon +# dmeventd { - # mirror_library is the library used when monitoring a mirror device. - # - # "libdevmapper-event-lvm2mirror.so" attempts to recover from - # failures. It removes failed devices from a volume group and - # reconfigures a mirror as necessary. If no mirror library is - # provided, mirrors are not monitored through dmeventd. + # mirror_library is the library used when monitoring a mirror device. + # + # "libdevmapper-event-lvm2mirror.so" attempts to recover from + # failures. It removes failed devices from a volume group and + # reconfigures a mirror as necessary. If no mirror library is + # provided, mirrors are not monitored through dmeventd. - mirror_library = "libdevmapper-event-lvm2mirror.so.2.02" + mirror_library = "libdevmapper-event-lvm2mirror.so" - # snapshot_library is the library used when monitoring a snapshot device. - # - # "libdevmapper-event-lvm2snapshot.so" monitors the filling of - # snapshots and emits a warning through syslog, when the use of - # snapshot exceedes 80%. The warning is repeated when 85%, 90% and - # 95% of the snapshot are filled. + # snapshot_library is the library used when monitoring a snapshot device. + # + # "libdevmapper-event-lvm2snapshot.so" monitors the filling of + # snapshots and emits a warning through syslog when the use of + # the snapshot exceeds 80%. The warning is repeated when 85%, 90% and + # 95% of the snapshot is filled. - snapshot_library = "libdevmapper-event-lvm2snapshot.so.2.02" + snapshot_library = "libdevmapper-event-lvm2snapshot.so" + + # thin_library is the library used when monitoring a thin device. + # + # "libdevmapper-event-lvm2thin.so" monitors the filling of + # pool and emits a warning through syslog when the use of + # the pool exceeds 80%. The warning is repeated when 85%, 90% and + # 95% of the pool is filled. + + thin_library = "libdevmapper-event-lvm2thin.so" + + # Full path of the dmeventd binary. + # + # executable = "" } - diff --git a/lvm2.changes b/lvm2.changes index 2313b6d..75a15a5 100644 --- a/lvm2.changes +++ b/lvm2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Aug 20 07:59:06 UTC 2013 - dmzhang@suse.com + +- add systemd support to lvm2 package + split device-mapper to another package. + ------------------------------------------------------------------- Tue Jul 16 14:55:10 CEST 2013 - ohering@suse.de diff --git a/lvm2.spec b/lvm2.spec index 8188384..4c9b94b 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -16,36 +16,38 @@ # -Url: http://sources.redhat.com/cluster/clvm/ +Url: http://www.sourceware.org/lvm2/ Name: lvm2 BuildRequires: libcorosync-devel BuildRequires: libdlm-devel -BuildRequires: libopenais-devel BuildRequires: libselinux-devel BuildRequires: readline-devel -BuildRequires: pkgconfig(udev) +BuildRequires: libudev-devel +BuildRequires: device-mapper-devel +BuildRequires: systemd Requires: device-mapper >= 1.02.25 Provides: lvm PreReq: %fillup_prereq %insserv_prereq /sbin/mkinitrd Version: 2.02.98 -Release: 0 +Release: 0. Summary: Logical Volume Manager Tools License: GPL-2.0 and LGPL-2.1 Group: System/Base Source: ftp://sources.redhat.com/pub/%{name}/LVM2.%{version}.tgz Source1: lvm.conf -Source2: boot.lvm +#Source2: boot.lvm Source3: sysconfig.lvm Source4: mkinitrd-lvm2-setup.sh Source5: mkinitrd-lvm2-boot.sh -Source6: 64-lvm2.rules -Source7: collect_lvm +#Source6: 64-lvm2.rules +#Source7: collect_lvm Source8: clvmd.ocf -Source11: boot.device-mapper -Source12: mkinitrd-devmapper-setup.sh -Source13: mkinitrd-devmapper-boot.sh +Source10: cmirrord.ocf +#Source12: mkinitrd-devmapper-setup.sh +#Source13: mkinitrd-devmapper-boot.sh Source14: baselibs.conf +#Source15: lvm2-activation.service Patch: improve_probing.diff Patch2: no-inc-audit.diff @@ -57,12 +59,7 @@ Patch13: pipe_buff-definition.diff Patch19: dont_ignore_tmp_device_file.diff Patch20: support-drbd-filter.diff Patch22: handle_extended_devt.diff -Patch61: device-mapper-dmsetup-export.patch -Patch65: device-mapper-dmsetup-deps-export.patch Patch66: device-mapper-type_punning.diff -Patch70: sleep-try-open-count.diff -Patch81: udev-rules_update.diff -Patch82: udev_sync-cookie_set-1-on-each-dm_task_set_cookie-ca.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build # Not a real replacement but we drop evms @@ -76,6 +73,8 @@ Obsoletes: evms-gui <= 2.5.5 Obsoletes: evms-ha <= 2.5.5 %define _udevdir %(pkg-config --variable=udevdir udev) +%{systemd_requires} + %description Programs and man pages for configuring and using the LVM2 Logical Volume Manager. @@ -93,88 +92,99 @@ Volume Manager. %patch19 -p1 %patch20 -p1 %patch22 -p1 -%patch61 -p1 -%patch65 -p1 %patch66 -p1 -%patch70 -p1 -%patch81 -p1 -%patch82 -p1 %build -export MODPROBE_CMD=/sbin/modprobe +# set path so that thin_check can be found +CFLAGS="$RPM_OPT_FLAGS" MODPROBE_CMD=/sbin/modprobe \ +PATH=$PATH:/sbin:/usr/sbin \ %configure --prefix=/ \ --bindir=/bin --libdir=/%_lib --with-usrlibdir=%_libdir \ --sbindir=/sbin --enable-dmeventd \ - --with-udevdir=%{_udevdir}/rules.d \ - --with-dmeventd_path=/sbin/dmeventd \ - --with-device-uid=0 --with-device-gid=6 --with-device-mode=0640 \ --enable-udev_sync --enable-udev_rules \ - --enable-cmdlib --enable-dmeventd \ + --enable-cmdlib --enable-applib --enable-dmeventd \ --enable-realtime --enable-pkgconfig \ --enable-selinux \ - --with-clvmd=corosync --datarootdir=/usr/share --with-default-locking-dir=/run/lock/lvm + --with-clvmd=corosync --with-cluster=internal --with-cluster=internal \ + --datarootdir=/usr/share --with-default-locking-dir=/run/lock/lvm \ + --enable-cmirrord \ + --with-thin=internal \ + --enable-lvmetad export SUSE_ASNEEDED=0 make -j1 # symlinks are generated in parallel! %{?_smp_mflags} %install -make install DESTDIR=$RPM_BUILD_ROOT +make install_lvm2 DESTDIR=$RPM_BUILD_ROOT +make install_system_dirs DESTDIR=$RPM_BUILD_ROOT +make install_systemd_units DESTDIR=$RPM_BUILD_ROOT +make install_systemd_generators DESTDIR=$RPM_BUILD_ROOT +make -C liblvm install DESTDIR=$RPM_BUILD_ROOT install -d -m 755 $RPM_BUILD_ROOT/etc/lvm install -d -m 755 $RPM_BUILD_ROOT/etc/lvm/backup install -d -m 755 $RPM_BUILD_ROOT/etc/lvm/archive install -d -m 755 $RPM_BUILD_ROOT/etc/lvm/metadata install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/etc/lvm mkdir -p $RPM_BUILD_ROOT/etc/init.d -install -m 755 %{SOURCE2} $RPM_BUILD_ROOT/etc/init.d -install -m 744 %{SOURCE11} $RPM_BUILD_ROOT/etc/init.d +#install -m 755 %{SOURCE2} $RPM_BUILD_ROOT/etc/init.d install -d $RPM_BUILD_ROOT/lib/mkinitrd/scripts install -m 755 %{SOURCE4} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/setup-lvm2.sh install -m 755 %{SOURCE5} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-lvm2.sh -install -m 755 %{SOURCE12} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/setup-dm.sh -install -m 755 %{SOURCE13} $RPM_BUILD_ROOT/lib/mkinitrd/scripts/boot-dm.sh mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates install -m 644 %{SOURCE3} $RPM_BUILD_ROOT/var/adm/fillup-templates install -m755 -D %{S:8} $RPM_BUILD_ROOT/usr/lib/ocf/resource.d/lvm2/clvmd -rm -f $RPM_BUILD_ROOT/%_libdir/liblvm2cmd.so -ln -sf liblvm2cmd.so.2.02 $RPM_BUILD_ROOT/%_lib/liblvm2cmd.so +install -m755 -D %{S:10} $RPM_BUILD_ROOT/usr/lib/ocf/resource.d/lvm2/cmirrord + rm -f $RPM_BUILD_ROOT/%_libdir/libdevmapper-event-lvm2.so ln -sf libdevmapper-event-lvm2.so.2.02 $RPM_BUILD_ROOT/%_lib/libdevmapper-event-lvm2.so pushd $RPM_BUILD_ROOT/%_lib +rm -f $RPM_BUILD_ROOT/%_libdir/liblvm2app.so +rm -f $RPM_BUILD_ROOT/%_libdir/liblvm2cmd.so +ln -sf liblvm2cmd.so.2.02 liblvm2cmd.so +ln -sf liblvm2app.so.2.2 liblvm2app.so ln -sf device-mapper/libdevmapper-event-lvm2mirror.so libdevmapper-event-lvm2mirror.so.2.02 ln -sf device-mapper/libdevmapper-event-lvm2snapshot.so libdevmapper-event-lvm2snapshot.so.2.02 ln -sf device-mapper/libdevmapper-event-lvm2raid.so libdevmapper-event-lvm2raid.so.2.02 +ln -sf device-mapper/libdevmapper-event-lvm2thin.so libdevmapper-event-lvm2thin.so.2.02 popd install -d $RPM_BUILD_ROOT/usr/sbin +pushd daemons/clvmd +make install DESTDIR=$RPM_BUILD_ROOT +popd +pushd daemons/cmirrord +make install DESTDIR=$RPM_BUILD_ROOT +popd +pushd man +make install DESTDIR=$RPM_BUILD_ROOT +popd mv $RPM_BUILD_ROOT/sbin/clvmd $RPM_BUILD_ROOT/usr/sbin/clvmd +mv $RPM_BUILD_ROOT/sbin/cmirrord $RPM_BUILD_ROOT/usr/sbin/cmirrord mkdir -p $RPM_BUILD_ROOT/usr/share -rm $RPM_BUILD_ROOT/usr/include/lvm2cmd.h +rm $RPM_BUILD_ROOT/etc/lvm/cache/.cache + +#remove lvm-devel parts +rm -f $RPM_BUILD_ROOT/usr/include/lvm2cmd.h +rm -f $RPM_BUILD_ROOT/usr/include/lvm2app.h +rm -f $RPM_BUILD_ROOT%{_libdir}/pkgconfig/lvm2app.pc +#remove device-mapper man page +rm -f $RPM_BUILD_ROOT/%{_mandir}/man8/dm* +#remove device-mapper systemd events +rm -f $RPM_BUILD_ROOT/%{_unitdir}/dm-event.socket +rm -f $RPM_BUILD_ROOT/%{_unitdir}/dm-event.service + # install and collect_lvm -install -m755 -D %{S:7} $RPM_BUILD_ROOT%{_udevdir}/collect_lvm +#install -m755 -D %{S:7} $RPM_BUILD_ROOT%{_udevdir}/collect_lvm %post -%{fillup_and_insserv -n lvm boot.lvm} -[ -x /sbin/mkinitrd_setup ] && /sbin/mkinitrd_setup -if [ -e /var/lib/no_initrd_recreation_by_suspend ]; then - echo "Skipping recreation of existing initial ramdisks, due" - echo "to presence of /var/lib/no_initrd_recreation_by_suspend" -elif [ -x /sbin/mkinitrd ]; then - /sbin/mkinitrd -fi - +%service_add_post blk-availability.service lvm2-monitor.service lvm2-lvmetad.socket +[ -x /sbin/mkinitrd ] && /sbin/mkinitrd /sbin/ldconfig %preun -%{stop_on_removal boot.lvm} +#%{stop_on_removal boot.lvm} +%service_del_preun blk-availability.service lvm2-monitor.service lvm2-lvmetad.service lvm2-lvmetad.socket %postun -%{insserv_cleanup} -[ -x /sbin/mkinitrd_setup ] && /sbin/mkinitrd_setup -if [ -e /var/lib/no_initrd_recreation_by_suspend ]; then - echo "Skipping recreation of existing initial ramdisks, due" - echo "to presence of /var/lib/no_initrd_recreation_by_suspend" -elif [ -x /sbin/mkinitrd ]; then - /sbin/mkinitrd -fi - +[ -x /sbin/mkinitrd ] && /sbin/mkinitrd /sbin/ldconfig %files @@ -185,13 +195,19 @@ fi %dir /etc/lvm/archive %dir /etc/lvm/metadata %config /etc/lvm/lvm.conf -%config /etc/init.d/boot.lvm +#%config /etc/init.d/boot.lvm %dir /lib/mkinitrd %dir /lib/mkinitrd/scripts %{_udevdir}/rules.d/11-dm-lvm.rules -%{_udevdir}/collect_lvm +%{_udevdir}/rules.d/69-dm-lvm-metad.rules +%{_unitdir}/blk-availability.service +%{_unitdir}/lvm2-monitor.service +%{_unitdir}/lvm2-lvmetad.socket +%{_unitdir}/lvm2-lvmetad.service +#%{_udevdir}/collect_lvm /lib/mkinitrd/scripts/setup-lvm2.sh /lib/mkinitrd/scripts/boot-lvm2.sh +/usr/lib/systemd/system-generators/lvm2-activation-generator /var/adm/fillup-templates/sysconfig.lvm /sbin/blkdeactivate /sbin/fsadm @@ -241,18 +257,24 @@ fi /sbin/vgscan /sbin/vgsplit /sbin/lvmconf +/sbin/lvmetad %dir /%_lib/device-mapper /%_lib/device-mapper/libdevmapper-event-lvm2mirror.so /%_lib/device-mapper/libdevmapper-event-lvm2snapshot.so /%_lib/device-mapper/libdevmapper-event-lvm2raid.so +/%_lib/device-mapper/libdevmapper-event-lvm2thin.so /%_lib/libdevmapper-event-lvm2mirror.so /%_lib/libdevmapper-event-lvm2snapshot.so /%_lib/libdevmapper-event-lvm2raid.so +/%_lib/libdevmapper-event-lvm2thin.so /%_lib/liblvm2cmd.so +/%_lib/liblvm2cmd.so.2.02 +/%_lib/liblvm2app.so +/%_lib/liblvm2app.so.2.2 /%_lib/libdevmapper-event-lvm2mirror.so.2.02 /%_lib/libdevmapper-event-lvm2snapshot.so.2.02 /%_lib/libdevmapper-event-lvm2raid.so.2.02 -/%_lib/liblvm2cmd.so.2.02 +/%_lib/libdevmapper-event-lvm2thin.so.2.02 /%_lib/libdevmapper-event-lvm2.so /%_lib/libdevmapper-event-lvm2.so.2.02 %{_mandir}/man5/lvm.conf.5.gz @@ -304,69 +326,7 @@ fi %{_mandir}/man8/lvmconf.8.gz %{_mandir}/man8/lvmsadc.8.gz %{_mandir}/man8/lvmsar.8.gz - -%package -n device-mapper -# bug437293 -%ifarch ppc64 -Obsoletes: device-mapper-64bit -%endif -# -Version: 1.02.77 -Release: 0 -Url: ftp://sources.redhat.com/pub/lvm2/ -Summary: Device Mapper Tools -Group: System/Base - -%description -n device-mapper -Programs, libraries, and man pages for configuring and using the device -mapper. - -%post -n device-mapper -%{run_ldconfig} -[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup -%{insserv_cleanup} - -%postun -n device-mapper -%{run_ldconfig} -[ -x /sbin/mkinitrd_setup ] && mkinitrd_setup -%{insserv_cleanup} - -%files -n device-mapper -%defattr(-,root,root) -%doc COPYING COPYING.LIB README VERSION_DM WHATS_NEW_DM -%config /etc/init.d/boot.device-mapper -/%_lib/libdevmapper.so.1.02 -/%_lib/libdevmapper-event.so.1.02 -%{_udevdir}/rules.d/10-dm.rules -#%{_udevdir}/rules.d/12-dm-permissions.rules -%{_udevdir}/rules.d/13-dm-disk.rules -%{_udevdir}/rules.d/95-dm-notify.rules -/sbin/dmsetup -/sbin/dmeventd -%{_mandir}/man8/dmsetup.8.gz -%{_mandir}/man8/dmeventd.8.gz -%dir /lib/mkinitrd -%dir /lib/mkinitrd/scripts -/lib/mkinitrd/scripts/setup-dm.sh -/lib/mkinitrd/scripts/boot-dm.sh - -%package -n device-mapper-devel -Version: 1.02.77 -Release: 0 -Summary: Development package for the device mapper -Group: System/Base -Requires: device-mapper = 1.02.77 - -%description -n device-mapper-devel -Files needed for software development using the device mapper - -%files -n device-mapper-devel -%defattr(-,root,root) -/%_libdir/libdevmapper.so -/%_libdir/libdevmapper-event.so -/%_libdir/pkgconfig/*.pc -/usr/include/libdevmapper.h -/usr/include/libdevmapper-event.h +%{_mandir}/man8/lvmetad.8.gz %package clvm Url: http://sources.redhat.com/cluster/clvm/ @@ -374,10 +334,9 @@ Version: 2.02.98 Release: 0 Requires: device-mapper >= 1.02.25 Requires: lvm2 = %{version} -Requires: openais -Provides: clvm +Requires: corosync lvm2-cmirrord Summary: Clustered LVM2 -Group: System/Base +Group: Productivity/Clustering/HA %description clvm A daemon for using LVM2 Logival Volumes in a clustered environment. @@ -393,4 +352,25 @@ A daemon for using LVM2 Logival Volumes in a clustered environment. /usr/lib/ocf/resource.d/lvm2/clvmd %{_mandir}/man8/clvmd.8.gz +%package cmirrord +Url: http://www.sourceware.org/lvm2/ +Version: 2.02.98 +Release: 0 +Requires: device-mapper >= 1.02.25 +Requires: lvm2 = %{version} +Requires: corosync lvm2-clvm +Summary: Clustered RAID 1 support using device-mapper and corosync +Group: Productivity/Clustering/HA + +%description cmirrord +A daemon for using LVM2 Logival Volumes in a clustered environment. + + + +%files cmirrord +%defattr(-,root,root) +/usr/sbin/cmirrord +/usr/lib/ocf/resource.d/lvm2/cmirrord +%{_mandir}/man8/cmirrord.8.gz + %changelog diff --git a/mkinitrd-devmapper-boot.sh b/mkinitrd-devmapper-boot.sh deleted file mode 100644 index 06e4bae..0000000 --- a/mkinitrd-devmapper-boot.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -#%stage: boot -#%depends: start -#%udevmodules: dm-mod dm-snapshot $dm_modules -#%programs: dmsetup blockdev -# dm-crypt dm-zero dm-mirror -#%if: -n "$root_dm" -# -##### Device Mapper -## -## If the root device uses device mapper, this initializes and waits for the control file -## -## Command line parameters -## ----------------------- -## -## root_dm=1 use device mapper -## - -load_modules - -# because we run before udev we need to create the device node manually -mkdir -p /dev/mapper -if [ ! -c /dev/mapper/control ] ; then - mknod /dev/mapper/control c 10 63 -fi diff --git a/mkinitrd-devmapper-setup.sh b/mkinitrd-devmapper-setup.sh deleted file mode 100644 index 79e9690..0000000 --- a/mkinitrd-devmapper-setup.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -# -#%stage: devicemapper -#%depends: dmroot -# - -# no dmsetup -> no dm -if [ -x "$(type -p dmsetup)" ]; then - dm_blockdev= - - # if any device before was on dm we have to activate it - [ "$tmp_root_dm" ] && root_dm=1 - - blockdev="$(dm_resolvedeps_recursive $blockdev)" - [ "$?" = 0 ] && root_dm=1 - # include dm when using dm based block devs - [ "$DM_BLOCK" ] && root_dm=1 - - # include modules - if [ -n "$root_dm" ] ; then - # Add all dm modules - dm_modules= - for table in $(dmsetup table | cut -f 4 -d ' ' | sort | uniq); do - if [ "$table" ] && [ "$table" != "linear" ] && - [ "$table" != "striped" ] && [ "$table" != "snapshot-origin" ] ; then - dm_modules="$dm_modules dm-$table" - fi - done - fi - - # include dm block var from sysconfig - mkdir -p $tmp_mnt/etc/sysconfig - grep DM_BLOCK /etc/sysconfig/kernel > $tmp_mnt/etc/sysconfig/kernel - mkdir -p $tmp_mnt/usr/lib/udev/rules.d - cp /usr/lib/udev/rules.d/10-dm.rules $tmp_mnt/usr/lib/udev/rules.d/ - cp /usr/lib/udev/rules.d/13-dm-disk.rules $tmp_mnt/usr/lib/udev/rules.d - cp /usr/lib/udev/rules.d/95-dm-notify.rules $tmp_mnt/usr/lib/udev/rules.d - save_var root_dm - save_var dm_modules -fi diff --git a/sleep-try-open-count.diff b/sleep-try-open-count.diff deleted file mode 100644 index 7082ccd..0000000 --- a/sleep-try-open-count.diff +++ /dev/null @@ -1,34 +0,0 @@ ---- - libdm/libdm-deptree.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - ---- LVM2.2.02.98.orig/libdm/libdm-deptree.c -+++ LVM2.2.02.98/libdm/libdm-deptree.c -@@ -20,6 +20,7 @@ - #include - #include - #include -+#include - - #define MAX_TARGET_PARAMSIZE 500000 - -@@ -1570,6 +1571,19 @@ static int _dm_tree_deactivate_children( - if ((child->presuspend_node && - !_node_has_closed_parents(child->presuspend_node, - uuid_prefix, uuid_prefix_len))) { -+ -+ int idx = 10; -+ while (info.open_count && idx--) { -+ struct timespec ts = {0, 500000000}; -+ nanosleep(&ts, NULL); -+ _info_by_dev(dinfo->major, dinfo->minor, 1, &info, NULL, NULL, NULL); -+ } -+ -+ if (info.open_count) { -+ log_error("give up on open_count"); -+ continue; -+ } -+ - /* Only report error from (likely non-internal) dependency at top level */ - if (!level) { - log_error("Unable to deactivate open %s (%" PRIu32 diff --git a/udev-rules_update.diff b/udev-rules_update.diff deleted file mode 100644 index 1baa4f5..0000000 --- a/udev-rules_update.diff +++ /dev/null @@ -1,52 +0,0 @@ ---- - udev/10-dm.rules.in | 4 ++++ - udev/13-dm-disk.rules.in | 9 ++++++--- - 2 files changed, 10 insertions(+), 3 deletions(-) - -Index: LVM2.2.02.98/udev/10-dm.rules.in -=================================================================== ---- LVM2.2.02.98.orig/udev/10-dm.rules.in -+++ LVM2.2.02.98/udev/10-dm.rules.in -@@ -88,10 +88,14 @@ ACTION=="add", ENV{DM_UDEV_RULES_VSN}!=" - # is in between these releases. - TEST=="dm", ENV{DM_NAME}="$attr{dm/name}", ENV{DM_UUID}="$attr{dm/uuid}", ENV{DM_SUSPENDED}="$attr{dm/suspended}" - TEST!="dm", IMPORT{program}="(DM_EXEC)/dmsetup info -j %M -m %m -c --nameprefixes --noheadings --rows -o name,uuid,suspended" - ENV{DM_SUSPENDED}!="?*", IMPORT{program}="(DM_EXEC)/dmsetup info -j %M -m %m -c --nameprefixes --noheadings --rows -o suspended" - -+# dmsetup export is a SUSE extension to dmsetup -+# it is required by some other udev rules in SUSE distro. -+IMPORT{program}="(DM_EXEC)/dmsetup export -j %M -m %m" -+ - # dmsetup tool provides suspended state information in textual - # form with values "Suspended"/"Active". We translate it to - # 0/1 respectively to be consistent with sysfs values. - ENV{DM_SUSPENDED}=="Active", ENV{DM_SUSPENDED}="0" - ENV{DM_SUSPENDED}=="Suspended", ENV{DM_SUSPENDED}="1" -Index: LVM2.2.02.98/udev/13-dm-disk.rules.in -=================================================================== ---- LVM2.2.02.98.orig/udev/13-dm-disk.rules.in -+++ LVM2.2.02.98/udev/13-dm-disk.rules.in -@@ -12,17 +12,20 @@ - # "add" event is processed on coldplug only! - ACTION!="add|change", GOTO="dm_end" - ENV{DM_UDEV_RULES_VSN}!="?*", GOTO="dm_end" - ENV{DM_UDEV_DISABLE_DISK_RULES_FLAG}=="1", GOTO="dm_end" - --SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" --ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" -+SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}", OPTIONS+="string_escape=replace" -+ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}", OPTIONS+="string_escape=replace" - - ENV{DM_SUSPENDED}=="1", GOTO="dm_end" -+ENV{DM_TARGET_TYPES}=="|*error*", GOTO="dm_end" - - (BLKID_RULE) --ENV{DM_UDEV_LOW_PRIORITY_FLAG}=="1", OPTIONS="link_priority=-100" -+ENV{DM_UDEV_LOW_PRIORITY_FLAG}=="1", OPTIONS+="link_priority=-100" -+OPTIONS+="watch" -+ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS+="link_priority=-90" - ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" - ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - - # Add inotify watch to track changes on this device. - # Using the watch rule is not optimal - it generates a lot of spurious diff --git a/udev_sync-cookie_set-1-on-each-dm_task_set_cookie-ca.patch b/udev_sync-cookie_set-1-on-each-dm_task_set_cookie-ca.patch deleted file mode 100644 index e2e5df0..0000000 --- a/udev_sync-cookie_set-1-on-each-dm_task_set_cookie-ca.patch +++ /dev/null @@ -1,66 +0,0 @@ -From a820a68619c10108666f8093545837233c954046 Mon Sep 17 00:00:00 2001 -From: Peter Rajnoha -Date: Tue, 23 Oct 2012 11:40:53 +0200 -Subject: [PATCH] udev_sync: cookie_set=1 on each dm_task_set_cookie call - -cookie_set variable found in the struct dm_task should be always -set to 1 after dm_task_set_cookie_call, even if udev_sync is disabled -as the cookie itself carries synchronization informations *as well as* -extra flags to control other aspects of udev support. - -For example, one could disable the synchronization itself, but still -direct the libdm code to disable library fallback via -DM_UDEV_DISABLE_LIBRARY_FALLBACK flag. These extra flags still need -to be carried out! - -A concrete example: - $ dmsetup create test --table "0 1 zero" --noudevsync - -This disables synchronization with udev. As the --verifyudev option is -not used, we don't want to do any corrections. In other words, we -need DM_UDEV_DISABLE_LIBRARY_FALLBACK flag to be used. However, -with --noudevsync this was not the case - the flag was ignored! - -This patch fixes the case when noudevsync is used but there are still -some extra flags passed within the cookie flag part. The synchronization -part of the cookie stays zero (which is ok as dm_udev_wait call on such a -cookie is simply a NOOP). ---- - WHATS_NEW_DM | 1 + - libdm/libdm-common.c | 2 ++ - 2 files changed, 3 insertions(+) - -diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM -index 2d0b05c..7c636f0 100644 ---- a/WHATS_NEW_DM -+++ b/WHATS_NEW_DM -@@ -1,5 +1,6 @@ - Version 1.02.77 - 15th October 2012 - =================================== -+ Fix dm_task_set_cookie to properly process udev flags if udev_sync disabled. - Support unmount of thin volumes from pool above thin pool threshold. - Update man page to reflect that dm UUIDs are being mangled as well. - Apply 'dmsetup mangle' for dm UUIDs besides dm names. -diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c -index b8533ed..afdac89 100644 ---- a/libdm/libdm-common.c -+++ b/libdm/libdm-common.c -@@ -1838,6 +1838,7 @@ int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie, uint16_t flags) - if (dm_cookie_supported()) - dmt->event_nr = flags << DM_UDEV_FLAGS_SHIFT; - *cookie = 0; -+ dmt->cookie_set = 1; - - return 1; - } -@@ -2207,6 +2208,7 @@ int dm_task_set_cookie(struct dm_task *dmt, uint32_t *cookie, uint16_t flags) - - if (!dm_udev_get_sync_support()) { - *cookie = 0; -+ dmt->cookie_set = 1; - return 1; - } - --- -1.7.10.4 - From 12cb8d4b488a55447ec1296bf71e0a6928468370f7f4726c5f9d5a00d5c04021 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Mon, 26 Aug 2013 11:29:43 +0000 Subject: [PATCH 2/3] OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=65 --- LVM2.2.02.98.tgz | 4 ++-- LVM2.2.02.98.tgz.asc | 7 +++++++ lvm2.spec | 11 +++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 LVM2.2.02.98.tgz.asc diff --git a/LVM2.2.02.98.tgz b/LVM2.2.02.98.tgz index 6898723..70a61c8 100644 --- a/LVM2.2.02.98.tgz +++ b/LVM2.2.02.98.tgz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:621961bddbcb232281c127802f6bfb1758d8d219f346cb2bd38eefae3f077353 -size 970745 +oid sha256:71030a58fef7e00d82ca4144334548e46aad24551a3cfbe7c3059b1bd137d864 +size 1227919 diff --git a/LVM2.2.02.98.tgz.asc b/LVM2.2.02.98.tgz.asc new file mode 100644 index 0000000..6833858 --- /dev/null +++ b/LVM2.2.02.98.tgz.asc @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.11 (GNU/Linux) + +iEYEABECAAYFAlB8HicACgkQIoGRwVZ+LBd+mwCg2X9MFz3iFlnARwxVgNBCWgYY +KHYAn1fgrjMIeoQaKUEDjMrhvapj9wOK +=/QEd +-----END PGP SIGNATURE----- diff --git a/lvm2.spec b/lvm2.spec index 4c9b94b..aa697b0 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -19,12 +19,12 @@ Url: http://www.sourceware.org/lvm2/ Name: lvm2 +BuildRequires: device-mapper-devel BuildRequires: libcorosync-devel BuildRequires: libdlm-devel BuildRequires: libselinux-devel -BuildRequires: readline-devel BuildRequires: libudev-devel -BuildRequires: device-mapper-devel +BuildRequires: readline-devel BuildRequires: systemd Requires: device-mapper >= 1.02.25 Provides: lvm @@ -35,6 +35,7 @@ Summary: Logical Volume Manager Tools License: GPL-2.0 and LGPL-2.1 Group: System/Base Source: ftp://sources.redhat.com/pub/%{name}/LVM2.%{version}.tgz +Source42: ftp://sources.redhat.com/pub/%{name}/LVM2.%{version}.tgz.asc Source1: lvm.conf #Source2: boot.lvm Source3: sysconfig.lvm @@ -332,9 +333,10 @@ rm -f $RPM_BUILD_ROOT/%{_unitdir}/dm-event.service Url: http://sources.redhat.com/cluster/clvm/ Version: 2.02.98 Release: 0 +Requires: corosync Requires: device-mapper >= 1.02.25 Requires: lvm2 = %{version} -Requires: corosync lvm2-cmirrord +Requires: lvm2-cmirrord Summary: Clustered LVM2 Group: Productivity/Clustering/HA @@ -356,9 +358,10 @@ A daemon for using LVM2 Logival Volumes in a clustered environment. Url: http://www.sourceware.org/lvm2/ Version: 2.02.98 Release: 0 +Requires: corosync Requires: device-mapper >= 1.02.25 Requires: lvm2 = %{version} -Requires: corosync lvm2-clvm +Requires: lvm2-clvm Summary: Clustered RAID 1 support using device-mapper and corosync Group: Productivity/Clustering/HA From 0a7be8e2a6081c85f7eba1fc2a7bb04dd16c95cab0dfe516908bd6356efa57c2 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Wed, 28 Aug 2013 11:16:38 +0000 Subject: [PATCH 3/3] - replace BuildRequires: systemd by pkgconfig(udev) again to avoid cycles. OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=66 --- lvm2.changes | 6 ++++++ lvm2.spec | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lvm2.changes b/lvm2.changes index 75a15a5..29c5e50 100644 --- a/lvm2.changes +++ b/lvm2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Aug 28 11:15:54 UTC 2013 - meissner@suse.com + +- replace BuildRequires: systemd by pkgconfig(udev) again + to avoid cycles. + ------------------------------------------------------------------- Tue Aug 20 07:59:06 UTC 2013 - dmzhang@suse.com diff --git a/lvm2.spec b/lvm2.spec index aa697b0..901449d 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -25,7 +25,7 @@ BuildRequires: libdlm-devel BuildRequires: libselinux-devel BuildRequires: libudev-devel BuildRequires: readline-devel -BuildRequires: systemd +BuildRequires: pkgconfig(udev) Requires: device-mapper >= 1.02.25 Provides: lvm PreReq: %fillup_prereq %insserv_prereq /sbin/mkinitrd