r694 - in lvm2/trunk/debian/contrib: . dmsetup dmsetup/lib dmsetup/lib/udev dmsetup/lib/udev/rules.d lvm2 lvm2/lib lvm2/lib/udev lvm2/lib/udev/rules.d

Bastian Blank waldi at alioth.debian.org
Mon Aug 17 15:05:47 UTC 2009


Author: waldi
Date: Mon Aug 17 15:05:46 2009
New Revision: 694

Log:
debian/contrib: Add extensions.

Added:
   lvm2/trunk/debian/contrib/
   lvm2/trunk/debian/contrib/dmsetup/
   lvm2/trunk/debian/contrib/dmsetup/lib/
   lvm2/trunk/debian/contrib/dmsetup/lib/udev/
   lvm2/trunk/debian/contrib/dmsetup/lib/udev/rules.d/
   lvm2/trunk/debian/contrib/dmsetup/lib/udev/rules.d/55-dm.rules
   lvm2/trunk/debian/contrib/dmsetup/lib/udev/rules.d/60-persistent-storage-dm.rules
   lvm2/trunk/debian/contrib/dmsetup/lib/udev/rules.d/95-dm-notify.rules
   lvm2/trunk/debian/contrib/lvm2/
   lvm2/trunk/debian/contrib/lvm2/lib/
   lvm2/trunk/debian/contrib/lvm2/lib/udev/
   lvm2/trunk/debian/contrib/lvm2/lib/udev/rules.d/
   lvm2/trunk/debian/contrib/lvm2/lib/udev/rules.d/60-persistent-storage-lvm.rules

Added: lvm2/trunk/debian/contrib/dmsetup/lib/udev/rules.d/55-dm.rules
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ lvm2/trunk/debian/contrib/dmsetup/lib/udev/rules.d/55-dm.rules	Mon Aug 17 15:05:46 2009	(r694)
@@ -0,0 +1,44 @@
+# Udev rules for device-mapper devices.
+#
+# These rules create a DM control node in /dev/(DM_DIR) directory.
+# The rules also create nodes named dm-x (x is a number) in /dev
+# directory and symlinks to these nodes with names given by
+# the actual DM names. Some udev environment variables are set
+# for use in later rules:
+#   DM_NAME - actual DM device's name
+#   DM_UUID - UUID set for DM device (blank if not specified)
+#   DM_SUSPENDED - suspended state of DM device (0 or 1)
+
+KERNEL=="device-mapper", NAME="mapper/control"
+
+SUBSYSTEM!="block", GOTO="dm_end"
+KERNEL!="dm-[0-9]*", GOTO="dm_end"
+ACTION!="add|change", GOTO="dm_end"
+
+# Normally, we operate on "change" events only. But when
+# coldplugging, there's an "add" event present. We have to
+# recognize this and do our actions in this particular
+# situation, too. Also, we don't want the nodes to be
+# created prematurely on "add" events while not coldplugging.
+ACTION=="add", ENV{STARTUP}!="1", NAME="", GOTO="dm_end"
+
+# "dm" sysfs subdirectory is available in newer versions of DM
+# only (kernels >= 2.6.29). We have to check for its existence
+# and use dmsetup tool instead to get the DM name, uuid and 
+# suspended state if the "dm" subdirectory is not present.
+# The "suspended" item was added even later (kernels >= 2.6.31),
+# so we also have to call dmsetup if the kernel version used
+# 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}="/sbin/dmsetup info -j %M -m %m -c --nameprefixes --noheadings --rows -o name,uuid,suspended"
+ENV{DM_SUSPENDED}!="?*", IMPORT{program}="/sbin/dmsetup info -j %M -m %m -c --nameprefixes --noheadings --rows -o suspended"
+
+# 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"
+
+ENV{DM_NAME}=="?*", SYMLINK+="mapper/$env{DM_NAME}"
+
+LABEL="dm_end"

Added: lvm2/trunk/debian/contrib/dmsetup/lib/udev/rules.d/60-persistent-storage-dm.rules
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ lvm2/trunk/debian/contrib/dmsetup/lib/udev/rules.d/60-persistent-storage-dm.rules	Mon Aug 17 15:05:46 2009	(r694)
@@ -0,0 +1,31 @@
+# Udev rules for device-mapper devices.
+#
+# These rules create symlinks in /dev/disk directory.
+# Symlinks that depend on probing filesystem type,
+# label and uuid are created only if the device is not
+# suspended.
+
+SUBSYSTEM!="block", GOTO="persistent_storage_dm_end"
+KERNEL!="dm-[0-9]*", GOTO="persistent_storage_dm_end"
+ACTION!="add|change", GOTO="persistent_storage_dm_end"
+ENV{DM_NAME}!="?*", GOTO="persistent_storage_dm_end"
+
+# Normally, we operate on "change" events only. But when
+# coldplugging, there's an "add" event present. We have to
+# recognize this and do our actions in this particular
+# situation, too.
+ACTION=="add", ENV{STARTUP}!="1", GOTO="persistent_storage_dm_end"
+
+SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}"
+ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}"
+
+ENV{DM_SUSPENDED}=="1", GOTO="persistent_storage_dm_end"
+
+IMPORT{program}="/sbin/blkid -o udev -p $tempnode"
+OPTIONS="link_priority=-100"
+ENV{DM_UUID}=="DMRAID-*", OPTIONS="link_priority=100"
+ENV{DM_LV_LAYER}=="?*", 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}"
+
+LABEL="persistent_storage_dm_end"

Added: lvm2/trunk/debian/contrib/dmsetup/lib/udev/rules.d/95-dm-notify.rules
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ lvm2/trunk/debian/contrib/dmsetup/lib/udev/rules.d/95-dm-notify.rules	Mon Aug 17 15:05:46 2009	(r694)
@@ -0,0 +1,9 @@
+# Udev rules for device-mapper devices.
+#
+# These rules are responsible for sending a notification to a process
+# waiting for completion of udev rules. The process is identified by
+# a cookie value sent within "change" and "remove" events (the cookie
+# value is set before by that process for every action requested).
+# Also, it sets default permissions for DM devices if not set already.
+
+ENV{DM_COOKIE}=="?*", RUN+="/sbin/dmsetup udevcomplete $env{DM_COOKIE}"

Added: lvm2/trunk/debian/contrib/lvm2/lib/udev/rules.d/60-persistent-storage-lvm.rules
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ lvm2/trunk/debian/contrib/lvm2/lib/udev/rules.d/60-persistent-storage-lvm.rules	Mon Aug 17 15:05:46 2009	(r694)
@@ -0,0 +1,32 @@
+# Udev rules for LVM.
+#
+# These rules create symlinks for LVM logical volumes in
+# /dev/VG directory (VG is an actual VG name). Some udev
+# environment variables are set (they can be used in later
+# rules as well):
+#   DM_LV_NAME - logical volume name
+#   DM_VG_NAME - volume group name
+#   DM_LV_LAYER - logical volume layer (blank if not set)
+
+SUBSYSTEM!="block", GOTO="persistent_storage_lvm_end"
+KERNEL!="dm-[0-9]*", GOTO="persistent_storage_lvm_end"
+ACTION!="add|change", GOTO="persistent_storage_lvm_end"
+ENV{DM_UUID}!="LVM-?*", GOTO="persistent_storage_lvm_end"
+
+# Normally, we operate on "change" events only. But when
+# coldplugging, there's an "add" event present. We have
+# to recognize this and do our actions in this particular
+# situation, too.
+ACTION=="add", ENV{STARTUP}!="1", GOTO="persistent_storage_lvm_end"
+
+# Use DM name and split it up into its VG/LV/layer constituents.
+IMPORT{program}="/sbin/dmsetup splitname --nameprefixes --noheadings --rows $env{DM_NAME}"
+
+# Do not create symlinks for hidden subdevices.
+ENV{DM_LV_NAME}=="?*_mlog", GOTO="persistent_storage_lvm_end"
+ENV{DM_LV_NAME}=="?*_mimage_[0-9]*", GOTO="persistent_storage_lvm_end"
+
+# Create symlinks for top-level devices only.
+ENV{DM_VG_NAME}=="?*", ENV{DM_LV_NAME}=="?*", ENV{DM_LV_LAYER}!="?*", SYMLINK+="$env{DM_VG_NAME}/$env{DM_LV_NAME}"
+
+LABEL="persistent_storage_lvm_end"



More information about the pkg-lvm-commits mailing list