Installing and Administering Solaris Container Manager 3.6.1

Creating Projects

You can create custom projects in addition to the default containers that are available after the software has been installed and set up. The combined use of both types of containers aids you in the implementation of your server consolidation plan.

Use the New Project wizard to create custom projects. You have the option to create and save just the container to the Containers view. Or, you can complete all wizard steps to create a project. The same wizard is used for both situations.

If you choose to create just the container, the name is saved in the Containers view. You can use the container to create one or more projects at a later time. For more information about how to activate a project, see Activating or Deactivating Projects.

If you choose to create a project, you also make a container as part of the process. After you finish creating the project, the container is saved to the navigation window of the Containers view. You can use this same definition to create additional projects that are associated with multiple hosts. The definition for all these projects, including the name and project type, will be the same for each of the hosts. You can vary the resource reservations of the project per host, or you can make them all the same. This flexibility is provided so that you can meet resource needs as conditions vary. For more information, see About Container Properties.

The New Project wizard guides you through the project creation process. You should have the following information available when creating a project to move readily through the wizard:

This wizard is accessible from three different places in the GUI, but always from the New Project button. Depending on where in the GUI you access the wizard, you might not need to provide all this information. Again, certain information might be completed for you depending on the entry point.

ProcedureTo Start the New Project Wizard

The New Project wizard can be accessed from three places in the GUI. Depending on the access point to the wizard, you might not be required to complete all its panels because certain information is completed automatically.

For more samples of the New Project wizard, see Creating an Application-Based Project.

Steps
  1. If the Container Manager GUI is not already open, access it as described in To Start the Container Manager GUI.

  2. In the navigation window, determine the relationship of the container you want to create.

    • To associate a specific host with the container automatically, do the following:

      1. Select the host name in the navigation window from the Hosts view.

        If needed, click the host group name to expand the list.

      2. Select the Projects tab that is located in the right pane.

        The Projects table appears.

      You are required to select a host during the container creation process when using this method.

      Screen capture of Hosts view showing the New Project button.
Surrounding text describes the context.
    • To automatically bind a project to a specific resource pool:

      1. Select the resource pool name from the navigation window in the Hosts view.

        If needed, click the key symbol next to the host name to expand the list. The resource pools that are assigned to the host are displayed.

      2. Select the Projects tab located in the right pane.

        The Projects table appears.

      You are not required to assign a resource pool as part of the container creation process.

    Screen capture of Hosts view (resource pool) showing the New
Project button. Surrounding text describes the context.
  3. Click the New Project button from the host project table or the host resource pool table.


    Note –

    The New Project button is always available from a table that appears in the right pane, regardless of which of the methods you selected.


    The New Project wizard is displayed. The Overview panel is the first panel to appear.

    Screen capture of the New Project wizard Overview panel. Surrounding
text describes the context.

Creating a User-Based or Group-Based Project


Note –

Only the user-based container type is available if you are running the Solaris 8 release.


If you want the container to manage processes that are identified by either a UNIX user name or UNIX group name, you should create a user-based or group-based container. The project type that is selected during the creation process determines whether the finished container is user-based or group-based.

ProcedureTo Create a User-Based or Group-Based Project

Steps
  1. Start the New Project wizard, as described in To Start the New Project Wizard.

    The Overview panel appears.

  2. Select User or Group as the project type.

    A container with a user-based project type tracks processes with the same UNIX user name.

    A container with a group-based project type tracks processes with the same UNIX group name.


    Note –

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


  3. Provide project-type identifiers that meet the following requirements:

    (On Solaris 8)

    • User-Based Project - You must provide a valid UNIX user name in the first field. UNIX user names of those users that can join the project can be added in the second field. UNIX group names of those groups that can join the project can be added in the third field. Separate multiple entries with a comma.

      Do not provide a user name that is being used in another user-based project or in a Default project in the first field.

    • Group-Based Project - You must provide a valid UNIX group name in the first field. UNIX group names of those groups that can join the project can be added in the second field. UNIX user names of those users that can join the project can be added in the third field. Separate multiple entries with a comma.

      Do not provide a group name that is being used in another group-based project or Default project in the first field.


    Note –

    On Solaris 9 and Solaris 10, a valid user name and group name are not required. However, the additional user names and group names must be present on the system.


    For additional information about this project type, see Table 3–2.

  4. If you accessed the New Project wizard by selecting a host name only (without selecting a pool), assign a resource pool that supports the resource requirements of the project.

    New processes started in a project are bound to the corresponding resource pool. After the project is activated, the new processes that the project is holding are bound to its resource pool.

    • To assign a new resource pool:

      1. Select Create a New Resource Pool.

      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.

        The 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.

  5. (Solaris 10 only) Select an existing zone.

    Click the button from the available zones to associate the project to a zone.

  6. Provide the resource reservations for the project.

    The number of maximum CPUs, the number of unreserved CPU shares, and memory resources available on the host is provided.

    The CPU reservation is required and must be provided as an integer. 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 should be provided in Mbytes.

    The shared memory value is the total amount of shared memory allowed to be used by the processes that run within this project. The shared memory is also optional. The default value of the shared memory is one-quarter of the physical memory.

  7. Provide a name for the container.

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

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

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

  9. Review the information in the Summary panel.

    Project summary screen
  10. Click Finish.

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

Creating an Application-Based Project


Note –

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


Use an application-based project to manage the processes that run in a particular software application. You can create an application-based project that moves the processes automatically or one that enables 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 project. You must also provide the UNIX user ID or UNIX group ID under which the processes will run. Additional users or groups that have the right to join the project at a later time can be added as well. To automatically move processes into the project, you must provide all required project identifiers when the corresponding wizard panel appears. The software then moves all matching processes automatically for all the projects that are based on 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 project. If you want to move the processes manually, create the project with only the UNIX user ID or UNIX group ID under which the processes will run. Additional users or groups that have the right to join the project 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 Project.

ProcedureTo 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.

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

  2. To see a list of all processes that are 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 4–1 Determining a Match Expression For Mozilla

The following is an example of output from the ps - cafe command in a search 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 4–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 in a search for Tomcat server. This example has been condensed for space, leaving the irrelevant 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 4–3 Verifying a Match Expression for Tomcat Server

The following example shows how to use the pgrep command to find the PID. The PID verifies 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 number matches the PID from Example 4–2. This match confirms that the match expression tomcat corresponds to the Tomcat server process.


ProcedureTo Create an Application-Based Project

Steps
  1. start the New Project wizard, as described in To Start the New Project Wizard.

    The Overview panel appears.

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

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

  3. Provide a name for the project.

    The name must be unique and not exceed 32 characters. This name identifies the project in the navigation window, status tables, and resource utilization reports. If a duplicate name is typed, the creation of the project fails.

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

  4. 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 names are not provided, the corresponding processes will not be moved under the container until they are supplied. Separate multiple entries with a comma.

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

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

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

      You can use wildcards in the Match Expression field to identify the processes that are associated with an application. Examples of match expressions using wildcards are moz, cat that identify the processes associated with Mozilla and Tomcat respectively.

      Project Application Process Identifiers in New Project Wizard

      The match expression must be supplied 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.

  6. If you access the New Project wizard from the host name (without selecting a pool), assign a resource pool that supports the project's resource requirements.

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

    • To assign a new resource pool:

      1. Select Create a New Resource Pool.

      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 project is bound to the selected resource pool.

  7. (Solaris 10 only) Select an existing zone.

    Click the button from one of the available zones.

  8. Provide the resource reservations for the project.

    The maximum CPUs, unreserved CPU shares, and memory resources that are available on the host is provided.

    The CPU reservation (CPU shares) is required and must be provided as an integer. A project 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 should be provided in Mbytes.

    The shared memory value is the total amount of shared memory allowed to be used by the processes that run within this project. The shared memory is also optional. The default value of the shared memory is one-quarter of the physical memory.

  9. Provide a name for the container.

    The name must be unique and not exceed 32 characters. This name identifies the container in the navigation window, status tables, and resource utilization reports. If a duplicate name is entered, the creation of the container will fail. A container name cannot be changed after the creation procedure is finished.

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

  11. Review the information in the Summary panel.

    Application Project Summary screen
  12. Click Finish.

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