Sun Microsystems, Inc.  Oracle System Handbook - ISO 7.0 May 2018 Internal/Partner Edition
   Home | Current Systems | Former STK Products | EOL Systems | Components | General Info | Search | Feedback

Asset ID: 1-71-2041460.1
Update Date:2018-05-02
Keywords:

Solution Type  Technical Instruction Sure

Solution  2041460.1 :   Oracle SuperCluster - An Example of Creating Application Zones  


Related Items
  • Oracle SuperCluster M7 Hardware
  •  
Related Categories
  • PLA-Support>Eng Systems>Exadata/ODA/SSC>SPARC SuperCluster>DB: SuperCluster_EST
  •  
  • Tools>Primary Use>Configuration
  •  


An Example Of Creating Application Zones using SSC_EXAVM on an Oracle M7 SuperCluster

In this Document
Goal
Solution


Applies to:

Oracle SuperCluster M7 Hardware - Version All Versions and later
SPARC

Goal

Create an application zone on SuperCluster

Solution

 

This tool is driven  by a file named ZONE_INFO. The file is assumed to be in the current working directory. It contains a line for each zone. The lines have  the following blank delimited fields:
Field 1: zonename (must match either the management hostname or the hostname of the client interface)
Field 2:10_gig_name (client hostname)
Field 3: 10_gig_ip (client ip address)
Field 4: 10_gig_netmask (255.255.2 55.0 for example)
Field 5: mgmt_name (management hostname)
Field 6: mgmt_ip (if 0 no management network connection will be implemented)
Field 7:mgmt_netrmask (255.255.254.0 for example)
Field 8: storage_name (hostname of the storage IB connection)
Field 9: storage_ip (storage IB network IP address)
Field 10: storage_netmask (255.255.252.0 for example)
Field 11: size_LUN_GB (size of rpool in gigabytes)
Field 12:NUMBER_OF_CORES (if zero no cpu pool will be created)
Field 1 3: VLAN_ID (Vlan id , if zero no vlan will be created)
Field 14: DB_IB_NAME (hostname of Exa IB (0xFFFF) IB partition)
Field 15: DB_IB_IP (EXA IB ip address, if 0 no EXA IB connection will be created)
Field 16: DB_IB_NETMASK (255.255.252.0 for example)
Sample entries

rcwtest1 rcwtest1-ioclient 10.250.91.218 255.255.254.0 rcwtest1 10.250.93.68 255.255.252.0 rcwtest2-stor 192.168.33.34 255.255.252.0 200G 1 390 rcwtest1-ib 192.168.9.26 255.255.252.0

rcwtest2 rcwtest2-ioclient 10.250.91.219 255.255.254.0 rcwtest2 10.250.93.60 255.255.252.0 rcwtest2-stor 192.168.33.35 255.255.252.0 200G 1 390 rcwtest1-ib 192.168.9.27 255.255.252.0

 

The first parameter passed to the script is the zonename. The second optional parameter indicates whether batch mode will be used. If the second parameter is script, then batch mode is used.  So "./zone_creation_v12_vlan.ksh  rcwtest1" is interactive and "./zone_creation_v12_vlan.ksh  rcwtest1 script" is batch.

 

!/usr/bin/ksh

 

# updated 02/28/2018
# 20180228: Added VLAN support
# 20171117: Changed how TIMEZONE is determined. Was not working properly when
# Continent/City was used. At least for Toronto
# 20171117: Corrected test for "script" to work properly IF not included in
# command line
# 20171005: Added opportuniity to run without prompts (SWeiberle)
# arg2 must be "script" to be non-interactive
# 20171003: Added VLAN FIELD so this will work in IO Domains with VLANs (SWeiberle)
# 20171218: Added DB IB

 

ZONE_BASE=$(pwd) # The location of the control FILES

 

The following controls the interaction: 

 

function r_continue
{
response="N"
while [ "${response}" != "Y" ]
do
# If the second passed parameter is _script, then run in batch mode.
if [ "_$SCRIPT" == "_script" ]
then
print "Non-interactive mode, you have 5 seconds to enter control-c before script will proceed."
sleep 5
response="Y"
else
print " "
print "Shall WE Continue (Y to r_continue) break out(^C) to exit"
print " "
read response
fi
done
}

 

 Parameter check

 

clear
if [ $# -lt 1 ] ; then
print "Usage: zone_creation.ksh 'zone name' ['script']"
exit
fi
ZONENAME=$1
SCRIPT=$2
if [ "_$2" != "_script" ]
then
SCRIPT=""
print "Running in interactive mode"
else
print "Running in non-interactive mode, make note of errors, and control-c out during 5 second sleep"
fi

 

print "======= Creating zone ," ${ZONENAME}

r_continue

print "======= Control FILES ZONE_INFO are in " ${ZONE_BASE}
r_continue

 

################### Validate CONFIGURATION ###########################3
if [ ! -e ${ZONE_BASE}/ZONE_INFO ] ; then
print "======= ${ZONE_BASE}/ZONE_INFO does not exist "
exit
fi

 

############ ZONE_INFO format
#zonename 10_gig_name 10_gig_ip 10_gig_netmask(xxx.xxx.xxx.xxx) mgmt_name mgmt_ip mgmt_netmask storage_IF storage_IF_ip storage_netmask SIZE(in GB for rpool) Number_of_cores_for_resource_pool VLAN_ID_10_gig DB_IB_NAME DB_IB_IP DB_IB_netmask
#####################################################################

# 10 gig client network

 

GIG_NAME=$(nawk -v Z=${ZONENAME} '$1 == Z {print $2 }' ${ZONE_BASE}/ZONE_INFO )
GIG=$(nawk -v Z=${ZONENAME} '$1 == Z {print $3 }' ${ZONE_BASE}/ZONE_INFO )
TENGIG_NETMASK_BITS=$(nawk -v Z=${ZONENAME} '$1 == Z {print $4 }' ${ZONE_BASE}/ZONE_INFO )

 

# Management/admin network

 

MGMT_NAME=$(nawk -v Z=${ZONENAME} '$1 == Z {print $5 }' ${ZONE_BASE}/ZONE_INFO )
MGMT=$(nawk -v Z=${ZONENAME} '$1 == Z {print $6 }' ${ZONE_BASE}/ZONE_INFO )
MGMT_NETMASK=$(nawk -v Z=${ZONENAME} '$1 == Z {print $7 }' ${ZONE_BASE}/ZONE_INFO )

 

#storage network

 

IB_NAME=$(nawk -v Z=${ZONENAME} '$1 == Z {print $8 }' ${ZONE_BASE}/ZONE_INFO )
IB=$(nawk -v Z=${ZONENAME} '$1 == Z {print $9 }' ${ZONE_BASE}/ZONE_INFO )
IB_NETMASK=$(nawk -v Z=${ZONENAME} '$1 == Z {print $10 }' ${ZONE_BASE}/ZONE_INFO )

 

 Storage and CPU Pool

 

ROOT_SIZE=$(nawk -v Z=${ZONENAME} '$1 == Z {print $11 }' ${ZONE_BASE}/ZONE_INFO )
N_CORES=$(nawk -v Z=${ZONENAME} '$1 == Z {print $12 }' ${ZONE_BASE}/ZONE_INFO )

 

 VLAN info

 

VLAN_ID=$(nawk -v Z=${ZONENAME} '$1 == Z {print $13 }' ${ZONE_BASE}/ZONE_INFO )

 

#IB DB network

 

IBDB_NAME=$(nawk -v Z=${ZONENAME} '$1 == Z {print $14 }' ${ZONE_BASE}/ZONE_INFO )
IBDB=$(nawk -v Z=${ZONENAME} '$1 == Z {print $15 }' ${ZONE_BASE}/ZONE_INFO )
IBDB_NETMASK=$(nawk -v Z=${ZONENAME} '$1 == Z {print $16 }' ${ZONE_BASE}/ZONE_INFO )

 

 Review data

 

print "======= 10 GIG = " $GIG_NAME, $GIG, $TENGIG_NETMASK_BITS
print "======= MGMT = " $MGMT_NAME, $MGMT, $MGMT_NETMASK
print "======= Storage IB = " $IB_NAME, $IB, $IB_NETMASK
print "======= DB IB = " $IBDB_NAME, $IBDB, $IBDB_NETMASK
print "======= rpool size in GB = " $ROOT_SIZE
print "======= number of cores for resource pool = " $N_CORES

print "======= VLAN ID on 10GbE network = " $VLAN_ID
print " "

 

 The zonename must match a network hostname

 

if [ "${ZONENAME}" != "${MGMT_NAME}" -a "${ZONENAME}" != "${GIG_NAME}" ]; then
print "!!!!! ERROR ZONENAME MUST MATCH either management name or 10 GIG name"
exit 1
fi
r_continue

 

#################### creating xml

 

print "======= Creating zone xml"
dum="N"
if [ -e $ZONENAME.xml ] ; then
print "Shall I use the existing $ZONENAME.xml (Y/N)"
read dum
fi
if [ "$dum" == "Y" ] ; then
print "Using existing FILE"
else
print "Creating new FILE"
print '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' > $ZONENAME.xml
print '<VIRTUALNODE>' >> $ZONENAME.xml
print ' <id>'${ZONENAME}'</id>' >> $ZONENAME.xml
print ' <HOSTINFO>' >> $ZONENAME.xml

 

 

#Here we pull the dns from SMF on the domain.

 

j=$(svcprop svc:/network/dns/client:default | nawk ' $1 == "config/nameserver" {for (i = 3; i<= NF; i=i+1)print $i}'| sed -e 's/ //g')
NAMESERVERS=$(print $j | sed -e 's/ /,/g')
print ' <DNSSERVERS>'${NAMESERVERS}'</DNSSERVERS>' >> $ZONENAME.xml

 

#Extract default router from netstat

 

ROUTE=$(netstat -rn | nawk ' $1 == "default" {print $2}')
print ' <DEFAULTGW>'${ROUTE}'</DEFAULTGW>' >> $ZONENAME.xml

 

#Extract domainname

 

DOMAIN=$(svcprop svc:/network/dns/client:default | nawk ' $1 == "config/domain" {print $3}')
print ' <DOMAINNAME>'${DOMAIN}'</DOMAINNAME>' >> $ZONENAME.xml

print ' <NODETYPE>app</NODETYPE>' >> $ZONENAME.xml

 

#Extract NTP server and timezone

 

NTP=$(nawk ' $1 == "server" {print $2}' /etc/inet/ntp.conf)
print ' <NTPSERVERS>'${NTP}'</NTPSERVERS>' >> $ZONENAME.xml
#
TIMEZONE=$(svccfg -s svc:/system/timezone:default listprop -o value timezone/localtime | awk '{print $1}' )
print ' <TIMEZONE>'${TIMEZONE}'</TIMEZONE>' >> $ZONENAME.xml


print ' <VIRTUALNODENAME>'${ZONENAME}'</VIRTUALNODENAME>' >> $ZONENAME.xml
print ' <VIRTUALOSTYPE>SolarisZone</VIRTUALOSTYPE>' >> $ZONENAME.xml
print ' </HOSTINFO> ' >> $ZONENAME.xml
print ' <NETWORKS>' >> $ZONENAME.xml

 

 

 #Management network

 

if [ "${MGMT}" != "0" ] ; then

  IPMP=$(ipadm | grep -c scm_ipmp0)
  if [ ${IPMP} -eq 0 ] ; then
    MGMTNIC="bondmgt0"
   else
    MGMTNIC="scm_ipmp0"
  fi
  print ' <NETWORK>' >> $ZONENAME.xml
  print ' <id>c0_'${ZONENAME}'_admin</id>' >> $ZONENAME.xml
  ADMIN_GW=$(netstat -rn | nawk -v NIC=${MGMTNIC} ' $6 == NIC {print $2}')
  print ' <GATEWAY>'${ADMIN_GW}'</GATEWAY>' >> $ZONENAME.xml
  print ' <INTERFACENAME>'${MGMTNIC}'</INTERFACENAME>' >> $ZONENAME.xml
  print ' <IPADDRESS>'${MGMT}'</IPADDRESS>' >> $ZONENAME.xml
  print ' <NETMASK>'${MGMT_NETMASK}'</NETMASK>' >> $ZONENAME.xml
  print ' <NETWORKHOST>'${MGMT_NAME}'</NETWORKHOST>' >> $ZONENAME.xml
  print ' <NETWORKNAME>admin</NETWORKNAME>' >> $ZONENAME.xml
  print ' <NETWORKTYPE>GigE</NETWORKTYPE>' >> $ZONENAME.xml
  print ' <NETWORKVERSION>1.0</NETWORKVERSION>' >> $ZONENAME.xml
  print ' <SLAVES> </SLAVES>' >> $ZONENAME.xml
  print ' </NETWORK> ' >> $ZONENAME.xml
fi

 

 

#Client network

 

IPMP=$(ipadm | grep -c sc_ipmp0)
if [ ${IPMP} -eq 0 ] ; then
CLIENTNIC="bondeth0"
else
CLIENTNIC="sc_ipmp0"
fi
print ' <NETWORK>' >> $ZONENAME.xml
print ' <id>c0_'${ZONENAME}'_client</id>' >> $ZONENAME.xml
CLIENT_GW=$(netstat -rn | nawk -v NIC=${CLIENTNIC} ' substr($6,1,8) == NIC {print $2}')
print ' <GATEWAY>'${CLIENT_GW}'</GATEWAY>' >> $ZONENAME.xml
if [ "${VLAN_ID}" == "0" ]
then
print ' <INTERFACENAME>'${CLIENTNIC}'</INTERFACENAME>' >> $ZONENAME.xml
else
print ' <INTERFACENAME>'${CLIENTNIC}'.'${VLAN_ID}'</INTERFACENAME>' >> $ZONENAME.xml
fi
print ' <IPADDRESS>'${GIG}'</IPADDRESS>' >> $ZONENAME.xml

print ' <NETMASK>'${TENGIG_NETMASK_BITS}'</NETMASK>' >> $ZONENAME.xml
print ' <NETWORKHOST>'${GIG_NAME}'</NETWORKHOST>' >> $ZONENAME.xml
print ' <NETWORKNAME>client</NETWORKNAME>' >> $ZONENAME.xml
print ' <NETWORKTYPE>XGigE</NETWORKTYPE>' >> $ZONENAME.xml
print ' <NETWORKVERSION>1.0</NETWORKVERSION>' >> $ZONENAME.xml
if [ "${VLAN_ID}" != "0" ]
then
print ' <VLANID>'${VLAN_ID}'</VLANID>' >> $ZONENAME.xml
fi
print ' <SLAVES> </SLAVES>' >> $ZONENAME.xml
print ' </NETWORK> ' >> $ZONENAME.xml

 

 

#Storage network

 

print ' <NETWORK>' >> $ZONENAME.xml
print ' <id>c0_'${ZONENAME}'_stor</id>' >> $ZONENAME.xml
STOR_GW=$(netstat -rn | nawk ' $6 == "stor_ipmp0" {print $2}')
print ' <GATEWAY>'${STOR_GW}'</GATEWAY>' >> $ZONENAME.xml
print ' <INTERFACENAME>stor_ipmp0</INTERFACENAME>' >> $ZONENAME.xml
print ' <NETWORKPKEY>8503</NETWORKPKEY>' >> $ZONENAME.xml
print ' <IPADDRESS>'${IB}'</IPADDRESS>' >> $ZONENAME.xml
print ' <NETMASK>'${IB_NETMASK}'</NETMASK>' >> $ZONENAME.xml
print ' <NETWORKHOST>'${IB_NAME}'</NETWORKHOST>' >> $ZONENAME.xml
print ' <NETWORKNAME>private</NETWORKNAME>' >> $ZONENAME.xml
print ' <NETWORKTYPE>IB</NETWORKTYPE>' >> $ZONENAME.xml
print ' <NETWORKVERSION>1.0</NETWORKVERSION>' >> $ZONENAME.xml
print ' <SLAVES> </SLAVES>' >> $ZONENAME.xml
print ' </NETWORK>' >> $ZONENAME.xml

 

#Private IB network

 

if [ "${IBDB}" != "0" ] ; then
  print ' <NETWORK>' >> $ZONENAME.xml
  print ' <id>c0_'${ZONENAME}'_priv</id>' >> $ZONENAME.xml
  print ' <GATEWAY></GATEWAY>' >> $ZONENAME.xml
  print ' <INTERFACENAME>bondib0</INTERFACENAME>' >> $ZONENAME.xml
  print ' <IPADDRESS>'${IBDB}'</IPADDRESS>' >> $ZONENAME.xml
  print ' <NETMASK>'${IBDB_NETMASK}'</NETMASK>' >> $ZONENAME.xml
  print ' <NETWORKHOST>'${ZONENAME}'-priv1</NETWORKHOST>' >> $ZONENAME.xml
  print ' <NETWORKNAME>private</NETWORKNAME>' >> $ZONENAME.xml
  print ' <NETWORKTYPE>IB</NETWORKTYPE>' >> $ZONENAME.xml
  print ' <NETWORKVERSION>1.0</NETWORKVERSION>' >> $ZONENAME.xml
  print ' <SLAVES> </SLAVES>' >> $ZONENAME.xml
  print ' </NETWORK>' >> $ZONENAME.xml
  print ' </NETWORKS>' >> $ZONENAME.xml
fi

 

#Size of root pool

 

print ' <SPACE>' >> $ZONENAME.xml
print ' <STORAGE>' >> $ZONENAME.xml
print ' <id>root</id>' >> $ZONENAME.xml
print ' <MOUNTPOINT>/</MOUNTPOINT>' >> $ZONENAME.xml
print ' <QUOTA>'${ROOT_SIZE}'</QUOTA>' >> $ZONENAME.xml

print ' <STORAGEBASE>'${ZONENAME}'</STORAGEBASE>' >> $ZONENAME.xml
print ' <STORAGEVERSION>1.0</STORAGEVERSION>' >> $ZONENAME.xml
print ' </STORAGE>' >> $ZONENAME.xml
print ' </SPACE>' >> $ZONENAME.xml

 

 #Configure CPU Pool

 

if [ "${N_CORES}" != "0" ] ; then
  print ' <CPU>' >> $ZONENAME.xml
  print ' <CORELOCKED>no</CORELOCKED>' >> $ZONENAME.xml
  print ' <CPUPOOLPREFIX>'${ZONENAME}'</CPUPOOLPREFIX>' >> $ZONENAME.xml
  print ' <CPUSHARED>no</CPUSHARED>' >> $ZONENAME.xml
  print ' <CPUTYPE>DevDynamic</CPUTYPE>' >> $ZONENAME.xml
  print ' <CPUVERSION>1.0</CPUVERSION>' >> $ZONENAME.xml
  print ' <MAX>'${N_CORES}'</MAX>' >> $ZONENAME.xml
  print ' <MIN>'${N_CORES}'</MIN>' >> $ZONENAME.xml
  print ' <POLICY>Static</POLICY>' >> $ZONENAME.xml
  print ' </CPU>' >> $ZONENAME.xml
  print '</VIRTUALNODE>' >> $ZONENAME.xml
fi

 

 

fi # End of Use new file conditional

 

r_continue

print "About to edit #${ZONENAME}.xml to check for correctness"
r_continue

 

###################### end of creating xml, examine with vi if not batch

 

if [ "_$SCRIPT" == "_script" ]
then
print "Contents of $ZONENAME.xml"
print " "
cat $ZONENAME.xml
print " "
print " "
else
vi $ZONENAME.xml
fi

r_continue

print "About to run ssc_exavm"
r_continue

 

###################### end of creating xml, run ssc_exavm

 

/opt/oracle.supercluster/zonetools/ssc_exavm/ssc_exavm -create -xml $(pwd)/$ZONENAME.xml

r_continue

 

#################### zone customization

 

print "======= Customizing zone "

r_continue

 

########################### install some useful utilities and enable nfs client services

 

zlogin ${ZONENAME} pkg install pkg://solaris/system/locale
zlogin ${ZONENAME} pkg install pkg://solaris/service/file-system/nfs
zlogin ${ZONENAME} pkg install less
zlogin ${ZONENAME} pkg install screen
zlogin ${ZONENAME} svcadm enable svc:/network/nfs/nlockmgr:default
zlogin ${ZONENAME} svcadm enable svc:/network/nfs/status:default
zlogin ${ZONENAME} svcadm enable svc:/network/nfs/client:default

r_continue

 

##################### end of customization

 

 

The sample script is in the attachments. For your convenience select prior versions of the tool are also attached.

 


Attachments
This solution has no attachment
  Copyright © 2018 Oracle, Inc.  All rights reserved.
 Feedback