N1 Grid Service Provisioning System User's Guide and Release Notes for the Solaris Plug-In 2.0

Using the CLI to Work With Solaris Zones

By default, the N1 Grid Service Provisioning System command-line interface is located in the following directory: /opt/SUNWn1sps/N1_Grid_Service_Provisioning_system_5.0/cli/bin/cr_cli

Solaris zone plug-in plans that run Container procedures are located in the folder /com/sun/solaris/zones.


Example 6–1 Creating a Solaris Zone by Using the CLI

This example illustrates how you can use the N1 Grid Service Provisioning System command-line interface to create a Solaris zone. The example contains three command segments. All commands use an example user name of spsadmin and password of x1y2z3.

The first command creates a host for global zone on server10 and defines default values for the local_zone_default_name, local_zone_connection_type, and local_zone_port variables.


% cr_cli -cmd hdb.h.mod                     host modify
    -ID "NM:server10"                       target global host
    -tID "NM:com.sun.solaris#global_zone"   host type
    -attr "local_zone_default_name=server10_z1; 
     local_zone_connection_type=RAW; 
     local_zone_port=1131"                  local zone attributes
    -u spsadmin                             user name
    -p x1y2z3                               password

The second command creates a local zone using the default variables.


% cr_cli -cmd pe.p.run                      plan execution
    -PID "NM:/com/sun/solaris/Container-create" 	create zone plan ID
    -tar "H:NM:server10"                    target global host
    -vs "+"                                 default var set "default set"
    -comp "+"                               default component "latest build"
    -pto 6000                               plan time 1 hr max [6000 secs]
    -nto 6000                               call time 1 hr max [6000 secs]
    -u spsadmin                             user name
    -p x1y2z3                               user password

The third command activates the local zone.


% echo "server10_z1" | cr_cli -cmd pe.p.run plan execution, std input is zone name
    -PID "NM:/com/sun/solaris/Container-activate" attach zone plan ID
    -tar "H:NM:server10"                    target global host
    -f "-"                                  standard input args
    -pto 6000                               plan time 1 hr max [6000 secs]
    -nto 6000                               call time 1 hr max [6000 secs]
    -u spsadmin                             user name
    -p x1y2z3                               user password