Abstract: This paper presents best practices for qualifying applications so that they will support non-global zones. The discussion in the paper will focus on the Solaris Zones feature of Solaris Containers.
Contents
1. Introduction
Solaris Containers technology offers a virtualized runtime environment that has established limits for an application's consumption of system resources, such as CPUs. Solaris Containers has two components: Resource Management and Solaris Zones. The resource management part of Solaris Containers addresses how much of the system resources will go to each application. For example, it is possible to dedicate certain CPUs to one particular application, or allow different applications to share CPUs while retaining a minimum guaranteed amount of CPUs. The technologies that allow the dedication of CPUs to an application, and the sharing with a minimum guarantee, are called Dynamic Resource Pools and the Fair Share Scheduler, respectively. Solaris Zones partitioning technology is used to virtualize operating system services and to provide an isolated and secure environment for hosting and running applications. There are two different types of zones: global and non-global. Solaris Containers delivers a virtualized environment for lowering total cost of ownership (TCO) via server consolidation. The administrator can use both the resource management tools as well as the zones to create environments -- called containers -- that isolate applications and share system resources. It's the sharing of resources that enables the higher utilization rates and helps lower the overall cost. With a fresh installation of the Solaris 10 Operating System (OS), no additional containers are installed; just the full OS is present, and this called the global zone. The administrator of this global zone is the one who creates any additional containers by installing non-global zones and assigning resource management rules to these zones. Processes in a container are isolated from processes in other containers. This is done by preventing the process from seeing from one non-global zone into the other non-global zone. Certain constraints are applied to the non-global zone processes to achieve container isolation. Section 4 presents the details of these constraints. Because of these constraints, the process in a non-global zone may not work due to:
Therefore, it is advisable to perform application qualification in order for the application to support the non-global zone. This paper presents best practices for qualifying applications for non-global zone. The discussion in the paper will focus on the Solaris Zones part of Solaris Containers because:
Depending on application type, zone configuration, and engineering resource availability, several qualification processes are proposed so that ISVs can choose the process that best suits their needs. This document provides technical background for the restrictions, qualification process, and step-by-step procedures for qualifying an application for a zone. This paper refers to the Solaris Ready Test Suite 1.1 (or higher); this Suite is designed to help you confirm that your applications will successfully run on the Solaris 10 OS. The Suite includes Solaris Application Scanner, a fast scanning tool for both application ELF binaries and source. The scanner is primarily intended to check for near-certain failures caused by interfaces or libraries going away in a Solaris release. Also included are DTrace scripts to check for system calls, application crashes due to signals, and system resource usage, as well as listing all the files and ports opened. 2. Qualification Process
A qualification process for non-global zone may involve up to three separate operations:
Operation 1 is recommended for ISVs that want to add support for non-global zones to their applications. An ISV may choose to perform all three operations, any one of them, or a combination of them. Operation 2 and 3 only detect runtime errors. If an ISV decides to only perform Operation 2 or Operation 3, an additional installation test in a non-global zone needs to be performed separately. An ISV decides which qualification process to use based on the following factors:
A brief discussion of each operation and its pros and cons is given below. This discussion assumes a typical application testing process does the following:
Operation 1: Perform application qualification in a non-global zone. Since a non-global zone has more constraints than the global zone has, a successful test in a non-global zone will automatically qualify the application for the global zone. This operation requires an ISV to decide on a zone configuration or a set of zone configurations first and to perform application installation, functional, and performance tests in the non-global zone. A sample zone configuration setup is shown in Section 3.1. The test plan has to be updated to reflect additional procedures for zone configuration and setup. This operation also requires the ISV to install and to bring up all test suites and tools and other layers of software stack that are required by the functional and performance tests, in the non-global zone. A modification to the testing tools might be required if the tools cannot run in the non-global zone. This operation gives the most complete testing and highest confidence level among all operations. However, it requires more engineering resources than other operations. Operation 2: Perform application qualification in the global zone or a non-global zone along with a monitoring script. The Suite mentioned above provides a utility for monitoring an application's use of device nodes and privileges that are not available in a non-global zone. The suite is launched in the global zone before starting the qualification testing. The qualification tests can be performed in either the global zone or a non-global zone. If no warning is flagged by the suite, the application is very likely to run successfully in a non-global zone. This operation is used if:
Operation 2 can be performed along with Operation 1. In this case, the monitoring script monitors the process running in a non-global zone and would be useful to identify the cause of errors found in Operation 1. The change to the existing testing procedures is minimal. The installation qualification will be performed through separate testing. The functional and performance tests are performed in the global zone. Operation 3: Scan application source code for any use of APIs that are non-compliant with non-global zones. The suite includes a utility for scanning the source code of the ISV application for the use of non-supported APIs and device nodes in a non-global zone. In addition, the suite will also scan the ELF binaries of third-party libraries for the use of zone-non-compliant APIs in third-party binaries. The output of the suite helps the development team to identify potential issues of an application regarding the support of non-global zones. This operation performs a static scanning of application source and binaries and, therefore, does not require the test engineer to run the application.
This tool will also scan the third-party libraries for the use of zone-non-compliant APIs in third-party binaries. This tool is intended for the development team to identify potential issues of an application to support non-global zones. The tool may report some false positive issues for functions like
This operation may result in no impact or minimal impact on existing testing procedures. With this operation, the development team carries most of the burden of qualifying the application in a non-global zone. This may not be a bad thing as the development team needs to be involved anyway if there is an issue found during the testing. A separate installation testing or a well-documented installation guide may be needed to address the potential installation issues. 3. Step-by-Step Qualification Procedures
This section presents step-by-step procedures for qualifying an application in a non-global zone. 3.1 Perform Application Qualification in a Non-Global ZoneStep 1: Decide on a zone configuration for the qualification testing. A zone configuration may affect the operation of an application. The following resource types can be configured for a non-global zone:
The
The default zone configuration uses the loopback file system
This example creates a default zone configuration and allows Step 2: Create a non-global zone.
Here is a quick sample zone configuration where the zone name is
At this point, a zone configuration file,
Once a zone configuration file is established, the global zone administrator uses the
When a zone is booted for the first time after installation, it will have no internal configuration for naming schemes, no locale or timezone, no root password, and so on. It will be necessary to access the zone's console in order to answer the prompts and to set these up. This should be done using the
Step 3: Install application in the non-global zone. At this point, the ISV test engineer should be able to install the ISV application into the non-global zone.
In a typical software installation, a software installation CD/DVD should be exported to the non-global zone. Since Step 4: Perform qualification testing. Once the application is successfully installed into the non-global zone, the test engineer can perform the qualification tests as if the application were installed on a regular Solaris system. A non-global zone has more restrictions on an application than the global zone in terms of privileges for accessing system resources and kernel services, device availability, networking capability. Thus a successful qualification test in a non-global zone assures the application will work in the global zone. Step 5: Handle qualification failures. In the case of a failure in the non-global zone qualification test, the test engineer should examine the failure before reporting it to the development team. For a failure caused by the zone configuration such as unavailability of a particular device, writing to a read-only file system, or resource constraints, the failure can be corrected with a different zone configuration. However, if the failure is caused by insufficient privileges, this failure can only be fixed by code changes. In such a case, the failure has to be reported to the development team for evaluation. The article "Bringing Your Application Into the Zone" [6] in References provides a workaround for the API privilege failure. Step 6: Perform Operations 2 and 3 (optional).
This operation may not catch the silent errors that might result in degraded performance or missing feature of the application. To ensure maximum application quality in a non-global zone, it is recommended to run Step 1: Install Solaris Ready Test Suite.
After installing Solaris Ready Test Suite, run abiscan
Step 2: Install application in the global zone. The test engineer installs the application in the normal way.
Step 3: Run
The test engineer must run
In an example of running
Ten minutes later,
If any one of the commands
This will be recorded in Step 4: Perform qualification testing.
The test engineer performs the qualification tests in the global zone. ( Step 5: Handle the issues reported by the script.
Step 6: Install application in the non-global zone. Solaris Ready Test Suite is not capable of detecting installation issues. It is, therefore, recommended to perform Step 3 of Section 3.1 to ensure that the application can be installed in a non-global zone. Step 7: Perform Operation 3 (optional).
This operation catches the zone errors in the code path exercised in the QA test. To ensure maximum code coverage, it is recommended to run
Step 1: Run
A typical use of the tool is:
Step 2: Evaluate the
The development team should evaluate the Step 3: Install application in the global zone. The test engineer installs the application in the normal way. Step 4: Perform qualification testing in the global zone. The test engineer performs the qualification tests in the normal way. Step 5: Install application in the non-global zone. Solaris Ready Test Suite is not capable of detecting installation issues. It is, therefore, recommended to perform Step 3 of Section 3.1 to ensure that the application can be installed in a non-global zone. Step 6: Perform Operation 2 (optional).
This operation reports many false positives for the system calls 4. Background Information
Each non-global zone has a security boundary around it. The security boundary is maintained by:
The Solaris 10 OS introduces Process Rights Management, which extends the Solaris process model with privilege sets and uses these privileges sets to control the process access of system resources and kernel services. A process can be either of the following:
If a process is PA, the kernel only checks the process privileges for system operations. If a process is NPA, the kernel checks both UID and process privileges. A process can attempt to become NPA using Each privilege set contains zero or more privileges. Each process has four sets of privileges. One of the privilege sets, the Effective (E) privilege set, determines whether a process can use a particular privilege. These four privilege sets are:
Currently, 48 privileges are defined for a privilege set.
All processes running in a non-global zone have reduced privileges. That means all processes in a non-global zone are constrained by the privilege sets that are assigned to them when the process is created. Table 1 lists the privileges that processes in a non-global zone have. Because of the reduced privileges of a process in a non-global zone, certain system calls may return errors. In most cases, It should be noted that only privileged applications in a non-global zone are affected by reduced process privileges. A traditional non-privileged application possesses only five basic privileges as highlighted in bold font in the following table. These five basic privileges are available to the non-global zones. Table: 1 Solaris Privileges
4.2 Solaris Zones Resources and Service Virtualization The Solaris Zones feature virtualizes the following resources and services that a process requires to run in an operating environment while its activities are isolated from the processes in other zones:
The following networking restrictions apply to a non-global zone:
Each zone has its own file system name space, although a global zone file system can be shared among other zones. The default zone configuration uses the loopback virtual file system, It is the basic design principle of Solaris Zones that a process in a zone is only able to use IPC to communicate with other processes in the same zone. For file system-based IPC such as pipes (via fifofs), STREAMS (via namefs), UNIX domain sockets (via sockfs), and POSIX IPC, the unique file system name space of a zone ensures that IPC communication is within a zone. Other IPCs, such as Solaris doors and System V IPC, have attached a zone ID to the communication objects so processes running in a zone will only be able to access or control objects associated with the same zone. Devices
Devices, in general, are shared resources in a system. To make devices available in a zone, therefore, requires some restrictions so the principle of zone isolation will not be compromised. The
A basic principle of the Solaris Zones design is that processes within a non-global zone must not be able to affect or to see the activity of processes running in other zones. Each process is associated with a zone. Restricting process visibility can be enforced by limiting the process ID exposed through
In a zone, the
Attempts to signal or to control processes in other zones -- for example, via Each zone maintains its own package and patch database. A package or a patch can be installed individually in a non-global zone or in all non-global zones from the global zone.
It is recommended to use 5. References
6. Acknowledgments
Many thanks to Joseph Balenzano, Prashant Srinivasan, Joost Pronk Van Hoogenveen, and Frederick Rehhausser for their help reviewing the document.
7. About the Author
Chien-Hua Yen is a Senior Staff Engineer in Market Development Engineering at Sun Microsystems.
| ||||||||||||||||||||||||||||||||||||||
Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.
|
| ||||||||||||