13.5 Creating a Virtual Server Object for an LVM Volume Group Cluster Resource

You can create an NCP virtual server for an existing clustered LVM volume group cluster resource by using the /opt/novell/ncs/bin/ncs_ncpserv.py script to create an NCS:NCP Server object. Having a virtual server object allows the resource to be viewed in the Browse panel in Novell iManager. You can also bind the virtual server name to the IP address to allow users to access the resource via an assigned name in addition to its IP address.

The NCS:NCP Server object does not give users NCP file access to the data on the Linux LVM logical volume. You can add commands to the load script to create an NCP volume on the Linux file system for NCP users. See NCP Enabling a clustered LVM volume.

The virtual server name is stored in eDirectory in an NCS:NCP Server object under the Cluster object where you created the resource. You must add a line to the load and unload scripts that identifies the name of this virtual server and a line that binds or unbinds the name to the IP address of the Linux POSIX cluster resource.

13.5.1 Creating an NCP Virtual Server for the LVM Resource

You use the /opt/novell/ncs/bin/ncs_ncpserv.py script to create a virtual server object (NCS:NCP Server) in eDirectory for the LVM volume group cluster resource. If the resource does not have NCP volumes on it, you do not use the -v option. For information about the ncs_ncpser.py script, see Section A.9, ncs_ncpserv.py Script (Creating an NCP Virtual Server Object for a Clustered LVM Volume Group).

  1. On the master cluster node, open a terminal console, then log in as the root user.

  2. In the console, use the cd command to go to the /opt/novell/ncs/bin directory.

  3. At the command prompt, enter

    ./ncs_ncpserv.py -c vg_name -i resource_ip_address
    

    Replace the vg_name and resource_ip_address with the information for your particular solution.

    Do not use periods in cluster resource names. Novell clients interpret periods as delimiters. If you use a space in a cluster resource name, that space is converted to an underscore.

    For example, to create the NCS:NCP Server object for the clustervg01 cluster resource where the IP address is 10.10.10.44 and the cluster context is ou=clusters,ou=city,o=mycompany, enter

    ./ncs_ncpserv.py -c clustervg01 -i 10.10.10.44
    

    The confirmation message is displayed:

    NCP Server 'cn=cluster1-clustervg01-server,ou=clusters,ou=city,o=mycompany' created.
    
  4. Continue with Section 13.5.2, Adding NCP Virtual Server Commands to the Resource Scripts.

13.5.2 Adding NCP Virtual Server Commands to the Resource Scripts

After you have created an NCS:NCP Server object, you must modify the resource’s load, unload, and monitor scripts to bind and unbind the NCS:NCP Server object with the resource IP address.

  1. In iManager, select Clusters > My Clusters, then select the cluster.

  2. Click the name link of the LVM volume group cluster resource to open its Cluster Resource Properties page, then click the Scripts tab.

  3. Modify the LVM resource’s load script:

    1. On the Scripts tab, click Load Script.

    2. At the end of the definition area, add the following lines to define the virtual NCP server name:

      # define NCP server name
      NCP_SERVER=cluster1-clustervg01-server
      

      Replace the NCP server name with the name for your virtual NCP server.

    3. Under the add_secondary_ipaddress command line, add a line to bind the NCP server name to the resource IP address:

      # bind the NCP server name
      exit_on_error ncpcon bind --ncpservername=$NCP_SERVER --ipaddress=$RESOURCE_IP
      
    4. Verify the order of the commands against the Sample LVM Resource Load Script with an NCP Virtual Server.

    5. Click Apply to save your changes.

      The script changes are not active until the next time the cluster resource is taken offline, and then brought online. Do not active the script changes at this time.

  4. Modify the LVM resource’s unload script:

    1. On the Scripts tab, click Unload Script.

    2. At the end of the definition area, add the following lines to define the virtual NCP server name:

      # define NCP server name
      NCP_SERVER=cluster1-clustervg01-server
      

      Specify the same NCP virtual server name that you used in the load script.

    3. Under the definition, add a line to unbind the NCP server name from the resource IP address:

      # unbind the NCP server name
      ignore_error ncpcon unbind --ncpservername=$NCP_SERVER --ipaddress=$RESOURCE_IP
      
    4. Verify the order of the commands against the Sample LVM Resource Unload Script with an NCP Virtual Server.

    5. Click Apply to save your changes.

      The script changes are not active until the next time the cluster resource is taken offline, and then brought online.

  5. Modify the LVM resource’s monitor script:

    1. On the Scripts tab, click Monitor Script.

    2. At the end of the definition area, add the following lines to define the virtual NCP server name:

      # define NCP server name
      NCP_SERVER=cluster1-clustervg01-server
      

      Specify the same NCP virtual server name that you used in the load script.

    3. Verify the order of the commands against the Sample LVM Resource Monitor Script with an NCP Virtual Server.

    4. Click Apply to save your changes.

      The script changes are not active until the next time the cluster resource is taken offline, and then brought online.

  6. At the bottom of the Properties dialog box, click OK to save your changes.

  7. Activate the modified scripts by taking the resource offline and bringing it online.

    1. Click the Cluster Manager tab.

    2. Select the check box next to the LVM volume group cluster resource, then click Offline.

      Wait until the resource is reports an Offline status before continuing.

    3. Select the check box next to the LVM volume group cluster resource, then click Online.

      Wait until the resource is reports an Online status before continuing.

  8. Verify that an NCS:NCP Server object appears in the Browse panel in iManager.

    1. In the iManager toolbar, click the View Objects icon.

    2. In the left panel, click Browse.

    3. Browse to the Cluster container to see the virtual server object for the cluster resource, such as cluster1-clustervg01-server.

  9. (Optional) To add NCP file access for the Linux volume, continue with Section 13.6, Enabling NCP File Access for a Clustered LVM Volume

13.5.3 Sample LVM Resource Scripts with an NCP Virtual Server

This section contains sample scripts for the Generic LVM resource where commands have been added to bind and unbind an NCP Virtual Server object with the resource IP address.

The sample scripts in this section use the following sample parameters. Ensure that you replace the sample values with your values.

Parameter

Sample Value

RESOURCE_IP

10.10.10.136

MOUNT_FS

ext3

VOLGROUP_NAME

clustervg01

MOUNT_DEV

/dev/$VOLGROUP_NAME/clustervol01

MOUNT_POINT

/mnt/clustervol01

NCP_SERVER

clus1-clustervg01-server

Sample LVM Resource Load Script with an NCP Virtual Server

Use the following sample load script to complete the fields for your LVM volume group cluster resource:

#!/bin/bash
. /opt/novell/ncs/lib/ncsfuncs

# define the IP address
RESOURCE_IP=10.10.10.136
# define the file system type
MOUNT_FS=ext3
# define the volume group name
VOLGROUP_NAME=clustervg01
# define the device
MOUNT_DEV=/dev/$VOLGROUP_NAME/clustervol01
# define the mount point
MOUNT_POINT=/mnt/clustervol01

# define NCP server name
NCP_SERVER=cluster1-clustervg01-server

# activate the volume group
exit_on_error vgchange -a ey $VOLGROUP_NAME

# create the mount point on the node if it does not exist
ignore_error mkdir -p $MOUNT_POINT

# mount the file system
exit_on_error mount_fs $MOUNT_DEV $MOUNT_POINT $MOUNT_FS

# add the IP address
exit_on_error add_secondary_ipaddress $RESOURCE_IP

# bind the NCP server name
exit_on_error ncpcon bind --ncpservername=$NCP_SERVER --ipaddress=$RESOURCE_IP

exit 0

Sample LVM Resource Unload Script with an NCP Virtual Server

Use the following sample unload script to complete the fields for your LVM volume group cluster resource:

#!/bin/bash
. /opt/novell/ncs/lib/ncsfuncs

# define the IP address
RESOURCE_IP=10.10.10.136
# define the file system type
MOUNT_FS=ext3
# define the volume group name
VOLGROUP_NAME=clustervg01
# define the device
MOUNT_DEV=/dev/$VOLGROUP_NAME/clustervol01
# define the mount point
MOUNT_POINT=/mnt/clustervol01

# define NCP server name
NCP_SERVER=cluster1-clustervg01-server

# unbind the NCP server name
ignore_error ncpcon unbind --ncpservername=$NCP_SERVER --ipaddress=$RESOURCE_IP

# del the IP address
ignore_error del_secondary_ipaddress $RESOURCE_IP

# unmount the volume
sleep 10 # if not using SMS for backup, please comment out this line
exit_on_error umount_fs $MOUNT_DEV $MOUNT_POINT $MOUNT_FS

#deactivate the volume group
exit_on_error vgchange -a n $VOLGROUP_NAME

exit 0

Sample LVM Resource Monitor Script with an NCP Virtual Server

Use the following sample monitor script to complete the fields for your LVM volume group cluster resource. To use the script, you must also enable monitoring for the resource. See Section 10.7, Enabling Monitoring and Configuring the Monitor Script.

#!/bin/bash
. /opt/novell/ncs/lib/ncsfuncs

# define the IP address
RESOURCE_IP=10.10.10.136
# define the file system type
MOUNT_FS=ext3
# define the volume group name
VOLGROUP_NAME=clustervg01
# define the device
MOUNT_DEV=/dev/$VOLGROUP_NAME/clustervol01
# define the mount point
MOUNT_POINT=/mnt/clustervol01

# define NCP server name
NCP_SERVER=cluster1-clustervg01-server

# check the logical volume
exit_on_error status_lv $MOUNT_DEV
 
# test the file system
exit_on_error status_fs $MOUNT_DEV $MOUNT_POINT $MOUNT_FS
 
# status the IP address
exit_on_error status_secondary_ipaddress $RESOURCE_IP

# check the status of NCP services
rcndsd status
  if test $? != 0; then
     exit_on_error rcndsd restart
  fi
sleep 5

exit 0