Add device mode support
authorBryn M. Reeves <bmr@redhat.com>
Fri, 18 Jan 2013 21:59:17 +0000 (21:59 +0000)
committerBryn M. Reeves <bmr@redhat.com>
Fri, 18 Jan 2013 21:59:17 +0000 (21:59 +0000)
Add a (hidden) configuration option to control device mode.
Setting the BA_MODE configuration (default 0660) variable causes
this to be used for device modes.

99-blkdevalias.rules
blkdevalias
blkdevalias.conf

index 6b2f59d..c3a806d 100644 (file)
@@ -1,18 +1,21 @@
 KERNEL=="sd*[^0-9]" ENV{DEVTYPE}=="disk" \
     PROGRAM="/sbin/scsi_id -g -u -d$tempnode" \
     IMPORT="/sbin/blkdevalias map %c" \
+    MODE="$env{BA_MODE}" \
     SYMLINK+="$env{BA_NAME}" OWNER="$env{BA_USER}" GROUP="$env{BA_GROUP}"
 
 KERNEL=="sd*[1-9]*" ENV{DEVTYPE}=="partition" \
     PROGRAM="/sbin/scsi_id -g -u -d/dev/$parent" \
     IMPORT="/sbin/blkdevalias map %c" \
     SYMLINK+="$env{BA_NAME}" OWNER="$env{BA_USER}" GROUP="$env{BA_GROUP}" \
+    MODE="$env{BA_MODE}" \
     OPTIONS+={link_priority=5}
 
 KERNEL=="dm*" ENV{DM_UUID}=="mpath*" \
     PROGRAM="/sbin/scsi_id -g -u -d$tempnode" \
     IMPORT="/sbin/blkdevalias map %c" \
     SYMLINK+="$env{BA_NAME}" OWNER="$env{BA_USER}" GROUP="$env{BA_GROUP}" \
+    MODE="$env{BA_MODE}" \
     OPTIONS+="link_priority=10"
 
 KERNEL=="dm*" ENV{DM_UUID}=="part*" \
@@ -22,4 +25,5 @@ KERNEL=="dm*" ENV{DM_UUID}=="part*" \
     PROGRAM="/sbin/scsi_id -g -u -d/dev/mapper/$env{DM_PARENT}" \
     IMPORT="/sbin/blkdevalias map %c" \
     SYMLINK+="$env{BA_NAME}" OWNER="$env{BA_USER}" GROUP="$env{BA_GROUP}" \
+    MODE="$env{BA_MODE}" \
     OPTIONS+="link_priority=15"
index 202840f..d332fb5 100755 (executable)
@@ -332,6 +332,7 @@ ba_map () {
     echo "BA_TYPE=${TYPEMAP[$WWID]}"
     echo "BA_USER=$BA_USER"
     echo "BA_GROUP=$BA_GROUP"
+    echo "BA_MODE=$BA_MODE"
 }
 
 # no point optimizing this out for configure
index 8a0c9f2..fec6782 100644 (file)
@@ -1,3 +1,4 @@
 BA_DEV_PATH="oracleasm/disks"
 BA_USER="oracle"
 BA_GROUP="oracle"
+BA_MODE="0660"