Installing and Administering N1 Grid Console - Container Manager 1.0

Creating an Application-Based Container


Note –

In the Solaris 8 OS, only the user-based container type is supported.


Use an application-based container to manage the processes that run in a particular software application. You can create an application-based container definition that moves the processes automatically, or one that allows you to move the processes manually.

If you can provide a match expression that is truly unique to the application, you can add this expression to the container definition. You must also provide the UNIX user or UNIX group ID under which the processes will run. Additional users or groups that have the right to join the container at a later time can be added as well. To automatically move processes into the container, you must provide all required project identifiers when the corresponding wizard panel appears. The software will then move all matching processes automatically for all the containers that are based upon this definition.

If the application does not create truly unique identifiers, then you will want to move the processes manually or start the application inside the container. If you want to move the processes manually, create the container definition with only the UNIX user or UNIX group ID under which the processes will run. Additional users or groups that have the right to join the container at a later time can be added as well. Then move the processes with the newtask -p command. For more information, see Moving or Starting Processes in a Container.

To Determine the Match Expression for an Application

Use this procedure to determine the correct match expression to identify the processes corresponding to the application you want to manage. This expression is required in the New Container wizard to move processes automatically into a container.

  1. From a terminal window, launch the application that the application-based container will manage.

  2. To see a list of all processes running, in a terminal window type:


    % ps -cafe
    
  3. In the CMD column, locate the corresponding executable name.

    Choose the expression that will uniquely identify the application's processes.


Example 3–1 Determining a Match Expression For Mozilla

The following is an example of output from the ps - cafe command when searching for Mozilla:


% ps -cafe
     UID   PID  PPID  CLS PRI    STIME TTY      TIME CMD
    ...
username  8044  7435   IA  50 19:47:09 pts/11   0:00 /bin/ksh -p /usr/sfw/lib/mozilla/mozilla

In this example, the unique executable name is mozilla. Likewise, a correct match expression is mozilla.



Example 3–2 Determining a Match Expression for Tomcat Server

When you know the name of the application, you can use the grep command in conjunction with ps -cafe to locate the correct match expression. The following is an example of output from the ps - cafe | grep tomcat command when searching for Tomcat server. This example has been trimmed for space, leaving the relevant information.


% ps -cafe | grep tomcat
  nobody 27307  /usr/j2se/bin/java -classpath //usr/apache/tomcat/bin/bootstrap.jar:/usr/j2se/l
 

In this example, the executable name is java. However, the correct match expression is tomcat. In this case the match expression is the argument instead of the executable name as java does not uniquely identify the Tomcat processes.



Example 3–3 Verifying a Match Expression for Tomcat Server

The following is an example of how to use the pgrep command to find the PID, in order to verify that you have identified the unique match expression for finding the desired process:


% pgrep -f tomcat
27307

The PID for Tomcat server is 27307. This matches the PID from Example 3–2. This confirms that the match expression tomcat corresponds to the Tomcat server process.


To Create an Application-Based Container Definition
  1. Launch the New Container wizard, as described in To Launch the New Container Wizard.

    The Overview panel appears. Use the Next button to move through the wizard. Use the Previous button to return to any panel in the wizard to make any changes.

  2. Provide a name for the container.

    The name must be unique and not exceed 32 characters. This name will identify the container in the navigation window, status tables, and resource utilization reports. If a duplicate name is entered, the creation of the container definition will fail.

    A container name cannot be changed after the creation procedure is finished.

  3. (Optional) Provide a description for the container.

  4. Select Application as the project type for the container.

    The application-based project container tracks processes associated with the application. For more information about this project type, see Table 3–2.

    Figure 3–10 Sample: Project Type Panel Showing Selected Type as Application

    Screen capture of New Container wizard project-type panel. Surrounding text describes the context.

  5. Provide the project name in the Project Name filed.

    A project name is required. You can choose the name of the application itself, or any other name that is suitable for your needs. A corresponding project name is added to the /etc/project file on the host when the container is activated.

    If you want to provide a project name that is already being used by another application-based container, both containers cannot be activated on the same host. For more information, see Container Types.

  6. Determine whether you want to move the application processes under the container automatically when the container is activated or to move them yourself from the command line.

    • To indicate that you want to move the application processes yourself from the command line, select the checkbox Do Not Use Match Expression.

    • To move application processes under the container automatically when the container is activated, provide an expression in the Match Expression field.

      The match expression must be supplied in order to automatically move the application's processes to the container. This expression is case sensitive. To determine the correct match expression, see To Determine the Match Expression for an Application.

      If a match expression is not provided at this time, the application's processes will not be moved automatically to this container until this expression is supplied.

  7. Provide the UNIX user names or UNIX group names under which the application's processes will run.

    The UNIX user names or UNIX group names under which the application's processes will run must be supplied. If these are not provided, the corresponding processes will not be moved under the container upon activation until they are supplied. Separate multiple entries with a comma.

    Figure 3–11 Sample: Completed Project Identifiers Panel Without a Match Expression

    Screen capture of New Container wizard project identifiers panel. Surrounding text describes the context.

    Figure 3–12 Sample: Completed Project Identifiers Panel With a Match Expression

    Screen capture of New Container wizard project identifiers panel. Surrounding text describes the context.

  8. Select Later in the Create an Active Container panel.

    All the required information to create the container definition has been supplied.

    Figure 3–13 Sample: Creating Active Container Later Panel

    Screen capture of New Container wizard panel for creating an active container later. Surrounding text describes the context.

  9. Review the information in the Summary panel.

    Use the Previous button to move backward through the wizard to make any changes.

  10. Click Finish.

    The container definition is saved in the navigation window in the Containers view. The wizard is dismissed.

To Create an Active Application-Based Container
  1. Launch the New Container wizard, as described in To Launch the New Container Wizard.

    The Overview panel appears. Use the Next button to move through the wizard. Use the Previous button to return to any panel in the wizard to make any changes.

  2. Provide a name for the container.

    The name must be unique and not exceed 32 characters. This name will identify the container in the navigation window, status tables, and resource utilization reports. If a duplicate name is entered, the creation of the container definition will fail.

    A container name cannot be changed after the creation procedure is finished.

  3. (Optional) Provide a description for the container.

  4. Select Application as the project type for the container.

    The application-based project container tracks processes associated with the application. For more information about this project type, see Table 3–2.

  5. Provide the project name.

    A project name is required. You can choose the name of the application itself, or any other name that is suitable for your needs. A corresponding project name is added to the /etc/project file on the host when the container is activated.

    If you want to provide a project name that is already being used by another application-based container, both containers cannot be activated on the same host. For more information, see Container Types.

  6. Determine whether you want to move application processes under the container automatically when the container is activated or to move them yourself from the command line.

    • To indicate that you want to move application processes yourself from the command line, select the checkbox Do Not Use Match Expression.

    • To move application processes under the container automatically when the container is activated, provide an expression in the Match Expression field.

      The match expression must be supplied in order to automatically move the application's processes to the container. This expression is case sensitive. To determine the correct match expression, see To Determine the Match Expression for an Application.

      If a match expression is not provided at this time, the application's processes will not be moved under this container until this expression is supplied.

  7. Provide either the UNIX user names or UNIX group names under which the application's processes will run.

    The UNIX user names or UNIX group names under which the application's processes will run must be supplied. If these are not provided, the corresponding processes will not be moved under the container until they are supplied. Separate multiple entries with a comma.

  8. Select Now in the Create an Active Container panel.

    Figure 3–14 Sample: Creating an Active Container Now

    Screen capture of New Container wizard. Surrounding text describes the context.

  9. Depending upon the entry point from which you launched the wizard, choose from the following actions:

    • If you accessed the wizard from a host name in the navigation window of the Hosts view, the container is automatically associated with that host. Continue with Step 13.

    • If you accessed the wizard from a location other than the host name, you must associate this container with a host. Continue with Step 10.

  10. The container must be associated with a host that supports its resource reservation. Select from the following options:

    • If the name of the desired host is already known, select Enter the Host Name. Type the host name in the text field. Continue with Step 13.

    • To initiate a search for all available hosts that meet the reservation requirements, select Search For a Host. Continue with Step 11.

  11. To begin the search for available hosts, provide the following information.

    Name

    Default is '*' for searching all hosts. If you want to specify a particular host, you can provide the name here.

    Operating System

    Select an operating system from this drop-down menu. Default is ALL.

    Platform

    Select a platform from this drop-down menu. Default is ALL.

    Total Processors

    Provide an integer that specifies the minimum number of processors required. The results returned will be hosts that have an equivalent, or more, number of CPUs.

    Total Physical Memory (MB)

    Provide an integer that specifies the minimum amount of required memory in Mbytes. The results returned will be hosts that have an equivalent, or more, amount of physical memory.

    Clock Speed

    Provide an integer that specifies the minimum required processor clock speed in MHz. The results returned will be hosts that have at least that clock speed.

    Figure 3–15 Sample: Completed Search For a Host Panel

    Screen capture of an example of the completed Search for Host panel. Surrounding text describes the context.

    A list is returned of all hosts that meet the search criteria.

  12. Make your selection from the list of the matching hosts.

    The container is now associated with this host.

  13. Assign a resource pool that supports the resource requirements of the container.

    New processes started in a project are bound to the corresponding resource pool. Once the container is activated, the new processes being held in the container are bound to its resource pool.

    • To assign a new resource pool:

      1. Select Create a New Resource Pool.

        Figure 3–16 Sample: Selecting Create a New Resource Pool

        Screen capture of selecting Create a New Resource Pool in New Container wizard. Surrounding text describes the context.

      2. Provide a name for the resource pool.

        The name must be alphanumeric and contain no spaces. The characters dash (-), underscore (_), and dot (.) are allowed.

      3. Assign the number of CPUs.

        The number of CPUs must be an integer not less than one and cannot exceed the number of CPUs available on the host. The total number of CPUs on the host and the number that are currently available are shown.

    • To assign an existing pool:

      1. Select Use an Existing Resource Pool.

        A list of available resource pools is displayed.

      2. Select the radio button next to the pool's name in the list.

        To total number of CPUs assigned to each resource pool is given, as well as the amount of unreserved CPU still available in each pool. The container is bound to the selected resource pool.

  14. Provide the resource reservations for the container.

    The amount of unreserved CPU and memory resources available on the host is provided.

    The minimum CPU reservation is required, and must be provided in integer or decimal units. Decimal units up to 100th decimal place are accepted. If you provide a value at 1000th decimal place, the value will be treated as zero. For example, a CPU reservation of 0.002 is treated as zero. A container with a CPU reservation of zero receives CPU resources only when no processes are running in any other container that is associated with the same host.

    The memory cap is optional, and must be provided in Mbytes.

    Figure 3–17 Sample: Completed Resource Reservations Panel

    Screen capture of a completed Resource Reservations panel in the New Container wizard. Surrounding text describes the context.

  15. Review the information in the Summary panel.

    Use the Previous button to move backward through the wizard in order to make any changes.

    Figure 3–18 Sample: Summary Panel

    Screen capture of New Container wizard. Surrounding text describes the context.

  16. Click Finish.

    The selections are saved, and the container is now active. The Solaris kernel begins enforcing the container's resource reservations.