Sun N1 Service Provisioning System User's Guide for Solaris Plug-In 4.0

Creating and Managing Solaris Zones

The Common Tasks page of the software enables you to create and manage Solaris 10 zones.

ProcedureHow to Define a Host as a Global Zone

A global zone is a host on which individual zones are defined. Before you can create any local zones, you must have at least one host defined to be in the host set com.sun.solaris#global_zones. This task explains how to define a host as a global zone.

Steps
  1. In the left control panel, under the Hosts Setup section, click Hosts.

  2. Designate the host system by choosing one of the following options:

    • User provided Solaris 10 host.

      1. Type a Solaris 10 host name in the Host field.

      2. Click Create.

    • Solaris 10 host from the host table.

      1. Select a Solaris 10 host from the host table.

      2. Click Edit.

  3. Choose com.sun.solaris#global_zone from the host type menu.

  4. Modify values for any attributes as needed.

    For example, you might want to change the connection type from RAW (the default) to SSH or SSL.


    Note –

    To use SSH for the local zone connection, you must set the port to 70000.


  5. Click the appropriate checkbox to include a Remote Agent or a Local Distributor on the physical host.

  6. Click Save.

ProcedureHow to Create a Solaris Local Zone

Before You Begin

If there is no Name Server, you must update the /etc/hosts file on the Master Server with the hostname:ip_address of the local zone on the Remote Agent.

Steps
  1. In the left control panel, under Common Tasks, click the Solaris link.

  2. Click the Solaris Container: Create and Manage link.

  3. Click the Run action next to Install: Create.

  4. Select the target host on which to create the local zone.


    Note –

    The target host must be a member of the com.sun.solaris#global_zones host set.


  5. Select the local zone host name from the Plan Variables settings.

    If desired local zone names are not present, you can create new zone names. To create new zone names, follow these steps:

    1. Click Select From List in the plan parameters table.

    2. In the Variable Setting window, click Create Set

    3. Type the new zone set name in the New Set Name field.

    4. Click the box next to Zone Name prompt and type a new variable set name.


      Note –

      Zone names become network Zone Host Names during local zone creation. Local Zone Host Names should resolve to local network IP address.


    5. Determine if you want the local zone file system to be sparse or full.

      A sparse local zone file system shares the /lib, /sbin, /platform, and /usr directories with the global zone. If the local zone will run applications that must install files into one of these directories, then install the local zone with a full file system. The full local zone file system does not share directories with the global zone.


      Note –

      The provisioning system installs the local zone file system as sparse by default. Install a full local zone file system by overriding the default.


    6. (Optional) If you need to add the logical network interfaces into the local zone, type values into the zoneIfaceDetails component variable.

      Each entry consists of three fields in the following format: network interface,IPAddress/netmask. Each entry is separated by a semicolon. For example: hme0,123.123.123.123/24;eri0,124.124.124.124/8

    7. (Optional) If you need to mount global zone file systems in the local zone, type values into the zoneFsLayout component variable.

      Each file system must be separated by a semicolon. For example, dir=/usr/local special=/opt/local raw=/dev/rdsk/c0t0d0s7 type=lofs [ro,nodevices];dir=/opt/mystuff special=/empty type=lofs ro

      For more information, see the zonecfg(1M) man page.

  6. Click Save and Select.

  7. Click Select From List for the target host.

  8. Select one of Current Found Hosts.

  9. Click Add Hosts To Main Window.

  10. Click Run Plan (includes preflight).

Using the CLI to Work With Solaris Zones

By default, the Sun N1 Service Provisioning System command-line interface is located in the following directory: /opt/SUNWn1sps/N1_Service_Provisioning_System_5.2/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 Sun N1 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_default_filesystem=FULL; 
     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