#! /bin/sh # # $Id: lcmap.sc30.sh,v 1.5.32.1 2005/12/07 22:21:13 benedv Exp $ Copyright (c) 2000-2005 EMC Corporation. # # # Copyright (c) 2000-2005 EMC Corporation. # # All rights reserved. This is an UNPUBLISHED work, and # comprises proprietary and confidential information of EMC. # Unauthorized use, disclosure, and distribution are strictly # prohibited. Use, duplication, or disclosure of the software # and documentation by the U.S. Government is subject to # restrictions set forth in a license agreement between the # Government and EMC or other written agreement specifying # the Government's rights to use the software and any applicable # FAR provisions, such as FAR 52.227-19. # PATH=/bin:/usr/bin:/usr/sbin:/usr/cluster/bin:$PATH export PATH # # Get the mapping of path ownership from the RGM. # # print header info... print_header() { PHYSICAL_HOST=`hostname` echo "type: NSR_CLU_TYPE;" echo "clu_type: NSR_LC_TYPE;" # echo "nodename: ${PHYSICAL_HOST};" echo "interface version: 1.0;\n" } local_nodes() { DEVICE_BASENAME="/global/.devices/node@" nodes=`scha_cluster_get -O all_nodenames` for node in ${nodes} ; do id=`scha_cluster_get -O nodeid_nodename ${node}` echo "type: NSR_CLU_VIRTHOST;" echo "hostname: ${node};" echo "local: FALSE;" echo "owned paths: ${DEVICE_BASENAME}${id};\n" done } # Start here... if [ $# -eq 1 ]; then mode=$1 else mode=local fi if [ ${mode} = node ] ; then print_header exit 0 fi print_header local_nodes # For each resource group print out path ownership info in RAP format... RESOURCE_GROUPS=`scha_cluster_get -O ALL_RESOURCEGROUPS` for resgrp in ${RESOURCE_GROUPS} ; do RES_NAMES=`scha_resourcegroup_get -G $resgrp -O RESOURCE_LIST` for name in ${RES_NAMES} ; do STATUS="" TYPE=`scha_resource_get -G ${resgrp} -R ${name} -O TYPE` if [ ${TYPE} = LGTO.clnt ] ; then PATHS=`scha_resource_get -G ${resgrp} -R ${name} -O EXTENSION Owned_Paths | tail +2` CLIENT=`scha_resource_get -G ${resgrp} -R ${name} -O EXTENSION Clientname | tail +2` STATE=`scha_resource_get -R ${CLIENT} -O resource_state` if [ -z "${STATE}" ] ; then # Clientname doesn't specify a valid network resource # Check the state of network resource that contains it NETWORK_RES=`scha_resource_get -G ${resgrp} -R ${name} -O EXTENSION Network_resource | tail +2` STATE=`scha_resource_get -R ${NETWORK_RES} -O resource_state` STATUS=`scha_resource_get -R ${NETWORK_RES} -O status | head -1` fi if [ -z "${STATE}" ]; then STATE=OFFLINE fi echo "type: NSR_CLU_VIRTHOST;" echo "hostname: ${CLIENT};" if [ "${STATE}" = ONLINE -o "${STATUS}" = OK ] ; then echo "local: TRUE;" else echo "local: FALSE;" fi echo "owned paths: \c" first=0 for file in ${PATHS} ; do if [ ${first} -eq 0 ] ; then echo "${file}\c" first=1 else echo ", ${file}\c" fi done echo ";\n" fi done done