gstanden / orabuntu-lxc

Developer and User Guide
https://gstanden.github.io/
GNU General Public License v3.0
46 stars 15 forks source link

UDEV Rules for "NAME" #72

Closed gstanden closed 5 years ago

gstanden commented 7 years ago

Need to be able to created device nodes (not symlinks) in /dev i.e. /dev/containername/asm_lun_1 . This functionality was available in UDEV in RHEL6 but is not available in RHEL7. I need to investigate how this could be done in any RHEL version and any Ubuntu version. The current method of presenting all of /dev and all of /dev/mapper to the container is not really viable for a number of reasons including security and overwrite of certain things in /dev when presented to container.

gstanden commented 5 years ago

This has been done. The SCST deployer scripts now create two rules, one for the standard /dev/mapper link-type deployment of LUNs, and another rule that puts actual device nodes (not symlinks) in /dev/lxc_luns. The "/dev/lxc_luns" is a user-settable location, and the SCST deployer can be configured to put the device nodes in, for example, "/dev/ContainerName" or any other naming scheme user prefers.

Below are examples of the UDEV rules that Orabuntu-LXC SCST Linux SAN deployer is now building dynamically during SCST deployment:

Conventional Current Multipath Naming

ENV{DM_UUID}=="mpath-23466306330343361", SYMLINK+="asm/asm_sysd_2_00", OWNER:="grid", GROUP:="asmadmin", MODE:="0660"

Container-Friendly Multipath Naming

KERNEL=="dm-*", SUBSYSTEM=="block", PROGRAM=="/lib/udev/scsi_id --page=0x83 --whitelisted --device=/dev/%k", RESULT=="23466306330343361", RUN+="/bin/sh -c '/bin/mkdir -p /dev/lxc_luns; /bin/mknod /dev/lxc_luns/asm_sysd_2_00 b $major $minor; chown grid:asmadmin /dev/lxc_luns/asm_sysd_2_00; chmod 0660 /dev/lxc_luns/asm_sysd_2_00'"