Note: This procedure cannot be implemented on a CLUSTER edition of SERVERware. This setup is further complicated with the implementation of GR features, so please bear this in mind.
NOTE NOTE: This is not supported!!! Customers use it at their own risk. Possibility of D state processes.
The purpose is to mount iSCSI targets to mount the monitor directories of individual VPSs so that the call recordings can be stored directly to the NAS server on the local network. The setup is that the connections to the targets will be made from the serverware host, and then the directories mounted through lxc.
On the iSCSI server, a target needs to be created with a whitelisted initiator name (cat /etc/iscsi/initiatorname.iscsi on both hosts) and the IP addresses of the two storage servers. The target on the iSCSI server needs to have a label (ex: iSCSI48) and to be formatted into ext4.
Before the implementation, you first need to discover the target from the iSCSI server to gather the needed information.
For example:
iscsiadm -m discovery -t st -p recordings.teliqo.com
After this, you need login to the target to see confirm the disk label assigned to the newly added target. You can do this by checking the folder /dev/disk/by-label/ . If everything is done properly, you should be able to see the new disk along with its label. The label will be used to mount the new partition as explained below.
First, you need to edit /etc/sysmonit/sw-primary.py which is a script that executes every time a failover between the two servers is triggered. You need to add an entry at the bottom that runs a script located in NETSTOR. The script is located in NETSTOR to ensure it duplicates between the two servers every time it's changed. The addition to the python script is as follows
#Login to iSCSI targets and mount the directories locally.
subprocess.call(['sh', '/NETSTOR/iscsiconnect.sh'])
Next , create a folder called 'iSCI_Mount' within the VPS folder (not VPS chroot) with absolute path: /NETSTOR/lxc/iSCSI_Test/iSCI_Mount/. Again this syncs across the servers.
The script iscsiconnect.sh should contain the following:
iscsiadm -m discovery -t st -p recordings.teliqo.com
iscsiadm -m node --targetname "name_of_target_in_double_quotes" -p "address_or_DNS_of_iSCSI_server:port" --login
sleep 2
mount /dev/disk/by-label/iSCSI48 /NETSTOR/lxc/iSCSI_Test/iSCI_Mount/
For example:
iscsiadm -m node --targetname "iqn.2020-09.com.teliqo.recordings:share48" -p "recordings.teliqo.com:3260" --login
sleep 2
mount /dev/disk/by-label/iSCSI48 /NETSTOR/lxc/iSCSI_Test/iSCI_Mount/
As you can see it mounts to a local folder on the host and not inside the VPS, which will allow us to later mount it to the monitor folder.
Next, you need to instruct lxc to bind mount the local host folder with the monitor folder within the VPS. This is done in the VPS lxc config file: '/NETSTOR/lxc/iSCSI_Test/config'
and adding
lxc.mount.entry = /home/lxc/iSCSI_Test/iSCI_Mount opt/pbxware/pw/var/spool/asterisk/monitor none bind 0 0
Please note the missing leading slash in the mount destination, as the path needs to be relative to the / inside the VPS.
Restarting the VPS will mount the monitor folder to the previously mounted folder which is connected to the iSCSI target.