ZFS selinux centos automount on restart

Selinux does not allow
to auto mount. This is shown in
dmesg or /var/log/messages
as below.
hostname kernel: type=1400 audit(1507795184.331:7): avc:  denied  { open } for  pid=4158 comm="mount.zfs" name="zfs" dev=devtmpfs ino=12977 scontext=system_u:system_r:mount_t:s0 tcontext=system_u:object_r:device_t:s0 tclass=chr_file
hostname kernel: type=1400 audit(1507795660.920:10): avc:  denied  { open } for  pid=4613 comm="mount.zfs" name="zfs" dev=devtmpfs ino=12977 scontext=unconfined_u:system_r:mount_t:s0 tcon

Before proceeding check if zfs/zpool is available but not mounted
zfs get used,compressratio,compression,logicalused
zpool status
Verify it here: In my case, audit was empty.
ls /var/log/audit/
Check for audit.
yum list audit audit-libs
Installed Packages
audit.x86_64           2.4.5-6.el6          @Centos-base
audit-libs.x86_64      2.4.5-6.el6          @Centos-base
The packages were installed OK. In case zfs is running:
service zfs-mount stop
In my case auditd was not running.
service auditd (re)start
create a local folder
su -
mkdir selinux_zfs
cd selinux_zfs
Turn SELinux enforcing mode off for now, and reload the policy so we have a clean slate of access violations
setenforce 0
Whatever it was that was getting denied, do it again! In this case the system was trying to mount the ZFS volumes during boot, but we can achieve the same thing with:
service zfs-mount start
Generate a module for this action using audit2allow, feeding it the system audit log:
audit2allow -M zfs_centos69 -l -i /var/log/audit/audit.log
You can name it anything, but try to be a bit specific so you know what it is without having to go to too much trouble. It will be saved to the local directory (hopefully you created a working space?). Turn SELinux enforcing back on and load the new module:
setenforce 1
semodule -i zfs_centos69.pp
Note. There are 2 files in this directory. I do not know what these mean but it works.
zfs_centos69.pp  zfs_centos69.te
Now, restart the machine - ZFS volumes must mount. You can test it with:
service zfs-mount start
Adapted from https://mjanja.ch/2013/03/centos-6-4-with-selinux-enforcing-denies-mount-action-to-glusterd/