Showing posts with label WPAR. Show all posts
Showing posts with label WPAR. Show all posts

Thursday, 13 February 2014

AIX 6.1 WPAR Commands

 AIX 6.1 WPAR Commands

Most of these commands are only runnable by root user for the Global LPAR (Global Environment).

chwpar Modifies dynamically the configuration options of the WPAR even when it is running.

clogin Provides a mechanism for the root user to log in or run a command within a workload partition. The “clogin” command uses a pseudo-terminal allocated on the Global Environment (see in the mobility part the impact of this) and creates a login shell running which belongs to the workload partition.

lswpar Prints information about WPARs

mkwpar Specific for System WPAR - Builds the infrastructure and the configuration file. Then it creates and populates the WPARs file systems. Allocate the specified resources as well as the WLM information (if any) and eventually starts it. Specifying whether the workload partitions should be automatically started on system boot or when /etc/rc.wpars is executed.

startwpar Activates the System WPAR defined with mkwpar

wparexec Specific for Application WPAR – Builds, create specification file and eventually starts the Application WPAR

rebootwpar Stops and resumes a System Workload Partition. It cannot be run within a WPAR

rmwpar Deletes the specified Workload Partition from the system as well as its configuration and its WLM profile

stopwpar Kills the WPAR and deallocate all resources belonging to it. It removes the Application WPAR

syncwpar Specific to System WPAR - Synchronizes the software installed in the global shared parts (usually /usr and /opt) with the workload partition's root part.

Note: The mkwpar and chwpar can update the global file /etc/wpars
Note: /etc/rc.wpars: Specific to System WPAR - this script is run at main system boot it invokes the startwpar command on all workload partitions with the autostart option.

Some commands have different or enhanced behavior in a WPAR environment. The list includes acctcom, acctctl, df, domainname, hosted, hostname, ifconfig, ioo, ipcrm, ipcs, mkclass, mount, netstat, nfso, no, projctl, ps , schedo, uname, vmo, wlmstat, wlmtune, wlmcntrl. This change is described in the AIX 6 documentation.

The simplest way to administrate WPARs using command lines (CLI) is to issue the command smitty wpar which will provide the interface to these commands.

Monday, 15 April 2013

WPAR

WPAR

WPARs are a new term introduced within AIX 6.1. Prior to WPAR, we used logical partitions to isolate the operating environment. This is no longer necessary as we can have multiple WPARs running in a single LPAR. If you are Solaris or HP-UX admin, you would have seen zones in solaris and virtual machines in HP-UX. WPAR is more or less similar to them.

There are 2 types of wpars

a. Application WPAR

Application workload partitions (WPARs) provide an environment for the isolation of applications and their resources to enable checkpoint, restart, and relocation at the application level. These WPARs share the global environment's file system namespace. When an application WPAR is created, it has access to all mounts available to the global environment's file system.

b. System WPAR 

System WPARs are autonomous virtual system environments with their own private file systems, users and groups, login, network space and administrative domain.

For system WPARs, local file system spaces, such as /home and /usr, are constructed from isolated sections of the file system space for the global environment. By default, these spaces are located in the /wpars directory of the global environment. All processes run within the WPAR appear in the base directory for the WPAR. For example, users in the WPAR “part1” would see the /wpars/part1/usr directory as the /usr directory.

Creating an application wpar:

You can create an application WPAR using the wparexec command.

You must supply the path to the application or command that you want to create an application WPAR for, and you must supply any command line arguments when you run the wparexec command. The application can either come from a specification file, or be specified on the command line. Unlike system WPARs, it is not necessary to assign an explicit name to an application WPAR. Although both WPAR types require a name, the names for application WPARs are generated based on the name of the application running in the WPAR.

Complete the following steps to create an application WPAR:

1. Log in as the root user to the system where you want to create and configure the workload partition.
This login places you into the global environment.

2. To create and configure the workload partition, run the following command:
wparexec -n wparname -- /usr/bin/ps -ef > /ps.out
The output should look similar to the following:
wparexec: Verifying filesystems...
wparexec: Workload partition wparname created successfully.
startwpar: COMMAND START, ARGS: wparname
startwpar: Starting workload partition 'wparname'
startwpar: Mounting all workload partition file systems
startwpar: Loading workload partition
startwpar: Shutting down all workload partition processes
rmwpar: Removing workload partition firstapp
rmwpar: Return Status = SUCCESS
startwpar: Return Status = SUCCESS
You have now successfully created an application WPAR.

Application WPARs start as soon as the wparexec command is issued, and stop as soon as the application completes its operation. When the operation is complete, the configuration for the application WPAR is destroyed.

System WPAR:

To create a system WPAR:

Here is an example for the system WPAR creation,
# mkwpar -n system1
mkwpar: Creating file systems...
/
/home
/opt
/proc
/tmp
/usr
/var
<<>>
FILESET STATISTICS
------------------
241 Selected to be installed, of which:
241 Passed pre-installation verification
----
241 Total to be installed
+-----------------------------------------------------------------------------+
Installing Software...
+-----------------------------------------------------------------------------+

Filesets processed: 6 of 241 (Total time: 2 secs).
installp: APPLYING software for:
X11.base.smt 6.1.0.1
Filesets processed: 7 of 241 (Total time: 3 secs).
installp: APPLYING software for:
X11.help.EN_US.Dt.helpinfo 6.1.0.0
Filesets processed: 8 of 241 (Total time: 3 secs).
installp: APPLYING software for:
bos.acct 6.1.0.1
Filesets processed: 9 of 241 (Total time: 3 secs).
installp: APPLYING software for:
bos.acct 6.1.0.2
Filesets processed: 10 of 241 (Total time: 4 secs).
installp: APPLYING software for:
bos.adt.base 6.1.0.0
bos.adt.insttools 6.1.0.0
Filesets processed: 12 of 241 (Total time: 4 secs).
installp: APPLYING software for:
bos.compat.links 6.1.0.0
bos.compat.net 6.1.0.0
bos.compat.termcap 6.1.0.0
Workload partition devpayrollWPAR01 created successfully.
mkwpar: 0960-390 To start the workload partition, execute the
following as root: startwpar [-v] system1
It normally takes 2 to 4 minutes for the creation of a system WPAR.

By default, the file systems for a new system WPAR are located in the /wpars/wpar_name directory.

You can override the default location using the following command:
mkwpar -n wpar_name -d /newfs/wpar_name

To change the name of a system WPAR:

chwpar -n wpar_name

Configure networks for system WPARs:

You can configure the network for a system WPAR using the -h flag or the -N flag for the mkwpar command or the chwpar command.

If you do not specify any network information when you create a system WPAR, the name of the WPAR resolves to an OP address on the same network as any active global interface.

Here is an example to create a system WPAR and configure a IP address on it,
# mkwpar -n wpar_name -N interface=en0 address=224.128.9.3 \
netmask=255.255.255.0 broadcast=224.128.9.255
This creates a alias ip on the network interface 'en0' in the base Operating system.
Using the below command you can change the ip address later on
# chwpar -N address=224.128.9.3 netmask=255.255.255.128 \
broadcast=224.128.9.127 wpar_name
Changing the hostname in a system WPAR:
By default, the name for a system WPAR is used as its host name. You can use the -h flag with the mkwpar command or the chwpar command to change the host name for a system WPAR.
Example: # chwpar -h new_hostname wpar_name

Removing a network from a system WPAR:

You can remove a network from a system WPAR using the chwpar command with the -K flag.
Example: # chwpar -K -N address=124.128.9.3 wpar_name

Configuring domain resolution for system WPARs:

You can configure the domain resolution for system WPARs using the -r flag for the mkwpar command.
Below command copies the global environment’s domain resolution configuration into the system wpars,
# mkwpar -n wpar_name -r

Configuring system WPAR-specific routing:

You can configure a WPAR to use its own routing table using the -i flag and the -I flag for the mkwpar command, the wparexec command, or the chwpar command.

Configuring resource controls for system WPARs:

You can configure the resource controls to limit the physical resources a system WPAR has access to using the -R flag for the mkwpar command and chwpar command.

To initialize resource control settings, run the following mkwpar command:

mkwpar -n wpar_name -R active=yes CPU=10%-20%,50% totalProcesses=1024
In this example, the WPAR is entitled to the following system resources:
· A minimum of 10% of the global environment’s processors upon request
· A maximum of 20% of the global environment’s processors when there is contention
· A maximum of 50% of the global environment’s processors when there is no contention
· A maximum of 1024 processes at a time
To change resource control settings dynamically for an existing active or inactive application WPAR run the following chwpar command:
chwpar -R totalThreads=2048 shares_memory=100 wpar_name

Note: You can also use the -K flag for the chwpar command to remove individual attributes from the profile and restore those controls to their default, as follows:
chwpar -K -R totalProcesses shares_CPU wpar_name
Starting a System WPAR:
After logging into the global environment, run the below command to start a system WPAR # startwpar wpar_name To start in a maintenance mode,
# startwpar –m wpar_name
Note: You cannot start WPARs that rely on NFS-mounted file systems in maintenance mode.

Stopping a System WPAR:

You can stop a WPAR from the global environment using the stopwpar command.

Stopping a system WPAR follows a similar paradigm to the shutdown command and the halt command for AIX®. For application WPARs, running the stopwpar command is equivalent to removing the WPAR with the rmwpar command.
To stop a system WPAR in the same way that the shutdown command stops a system, run the following command:
# stopwpar wpar_name
To stop a system WPAR quickly in the same way that the halt command stops a system, run the following command:
# stopwpar -F wpar_name

Software update in system WPARs:

When you install software in the global environment, it is not always automatically available for use within your system WPAR. You can use the syncwpar command or the syncroot command to make software available.

Application workload partitions share their file systems with the global environment and do not create new file systems. Therefore, the syncwpar command and the syncroot command are applicable only to system WPARs.

To make software available in one or more WPARs, run the following command in the global environment:
# syncwpar wpar_name1 wpar_name 2
The syncroot command performs the same function as the syncwpar command, but the syncroot command operates only within the WPAR where it is issued.

Listing WPARs:

You can list summary data for system WPARs and application WPARs using the lswpar command.
For example, to list the WPARs on a system with names that start with "mypar_", run the following command:
# lswpar 'mypar_*'

Listing WPAR identifiers:

You can list the identifiers for a WPAR using the lparstat command or the uname command using the ‘-W’ flag.

Logging into a WPAR:

After you configure and activate a system WPAR, you can log in to it locally using the clogin command.

To log in to a system WPAR and create a shell as the root user, run the following command:
# clogin wpar_name
To log in to a system WPAR and create a shell as a different user, run the following command:
# clogin -l username wpar_name
Note: You can also log into a system WPAR remotely using the a network-based login command, such as the rlogin command, the telnet command, or the rsh command.

Backing up WPARs:

You can back up a WPAR using the savewpar command, the mkcd command, or the mkdvd command.

The savewpar command uses the data created by the mkwpardata command to back up your WPAR. If these files are not already on your system, the savewpar command will call the mkwpardata command to create these files.

The image files contain the following information:
· A list of logical volumes and their sizes
· A list of file systems and their sizes
· A list of volume groups
· The WPAR name
To back up a WPAR to the default tape device, run the following command:
# savewpar wparname
To back up a WPAR to a file, run the following command:
# savewpar -f file wparname
You can also back up a WPAR to a CD device using the mkcd -W command or to a DVD device using the mkdvd -W command.

Restoring WPARs:

You can restore a WPAR using the restwpar command. You can restore a WPAR from a backup image created by the savewpar command, the mkcd command, or the mkdvd command.

To restore the backup image from the /dev/rmt1 device, run the following command:
estwpar -f/dev/rmt1

Removing WPARs:

You can remove a WPAR using the rmwpar command.

To remove a WPAR, it must be in the defined state, and you must provide the name of the WPAR.
To remove a WPAR, run the following command:
rmwpar wpar_name
To stop a WPAR before removing it, run the following rmwpar command with the -s flag:
rmwpar -s wpar_name

Sunday, 7 April 2013

WPARs Vs LPARs

Getting started with Workload Partitions in AIX 6.1

If you are a systems administrator who is responsible for care and feeding of IBM® System p™ servers, you are probably familiar with virtualization and server consolidation using logical partitions (LPARs). Using the Hardware Management Console (HMC) or the Integrated Virtualization Manager (IVM), you can quickly define a new LPAR, install AIX® or Linux®, configure your operating system, install applications, and then put your new virtual server to work.

AIX 6.1 introduces a new mechanism for virtualization: Workload Partitions (WPARs). In this article, you'll learn the basics of what WPARs are, how they differ from LPARs, and how you can quickly and easily try them out on your AIX 6.1 system. This article also provides some basic rules of thumb to help you decide which virtualization method is most appropriate for you and walks you through the steps to create your first WPAR. Then, you’ll examine additional life cycle management tasks that you can perform from the AIX command line or System Management Interface Tool (SMIT). Because this article is intended to be only a high-level introduction, you'll find some links to information that help you learn all the technical details about this new technology. Finally, you'll review some more advanced WPAR features, including Live Application Mobility—the ability to move a running WPAR-based application from one AIX system to another—using a new management tool, the IBM Workload Partitions Manager for AIX (WPAR Manager).

What are WPARs?

In contrast to LPARs, which are created and managed at the server's firmware level, AIX WPARs are software partitions that are created from, and share the resources of, a single instance of the AIX operating system. This means that you must have AIX 6.1 to create WPARs, but you can create WPARs on any System p hardware that supports AIX 6.1, including POWER4, POWER5, and POWER6 hardware. You don’t need an HMC or IVM to create or manage WPARs.
There are two kinds of WPARs:
   • System WPARs
   • Application WPARs

System WPARs

System WPARs are autonomous virtual system environments that have their own private file systems, users and groups, login, network space, and administrative domain. To users and applications, a system WPAR appears almost exactly like a full AIX system. Operating system services, such as telnet, are supported, so if network information has been configured, users can telnet into a system WPAR as root or any other defined user, issue commands, and run applications as they would on any other AIX system.

Here are a couple of quick examples of situations in which system WPARs might be useful:

If you happen to be an administrator for an AIX system used in a university computer science class, you can create a system WPAR for each student. Students can each be the root user of their own private virtual environment—defining users, installing applications, and programming their class assignments. If a student is persuaded to find out what happens when you type rm –r *, only their WPAR is trashed— catastrophic events in one WPAR can't harm other WPARs or the global AIX environment. At the end of     the semester, you might run a script that deletes and cleans up all the class WPARs.

• If you are setting up an application development or test environment, you can create it in a system WPAR. You don't have to acquire a dedicated server or LPAR but, if the new environment should have serious problems, any adverse effects will be confined to the WPAR.

Application WPARs

Application WPARs provide an environment for isolation of applications and their resources to enable checkpoint, restart, and relocation at the application level. An application WPAR is essentially a wrapper around a running application or process for the purposes of isolation and mobility. It lacks some of the system services provided by system WPARs—for example, it’s not possible to log in or telnet into an application WPAR. When the application running in an application WPAR terminates, the WPAR also ceases to exist. Application WPARs are most useful when you want to enable Live Application Mobility—that is, when you want to be able to move a running application from one AIX system to another. You might want to relocate applications to avoid downtime resulting from scheduled maintenance or to improve performance by moving an application to a more powerful server.

How do WPARs compare with LPARs?

As noted earlier, you do not need access to the HMC or IVM to create WPARs as you do for LPARs. WPARs are lightweight and quicker to install, because they share many of the file systems and resources of the global AIX system in which they reside. While using an LPAR requires you to install an entire operating system, creation of system WPARs only installs private copies of a few file systems, and application WPARs share even more of the global system's resources. As a result, a WPAR can be created in just a few minutes without installation media. Ongoing administration and maintenance of WPARs should be simpler—fewer AIX licenses might be required, and you don’t have to install fixes and updates on so many virtual systems. There is a command for synchronizing the filesets of a WPAR with the corresponding filesets on the global system, so you have the choice of propagating AIX fixes to WPARs or continuing to run with the current versions of system files.

While LPARs offer a significantly higher degree of workload isolation, WPARs might provide "good enough" isolation for your particular workloads, especially temporary ones such as development or test environments. Similarly, with LPARs, you can achieve a greater degree of control over the usage of resources—by allocating entire processors or precise fractions of processors to an LPAR, for example. With WPARs, you don’t have such fine control over resource allocations, but you can allocate target shares or percentages of CPU utilization to a WPAR (if have used the AIX Workload Manager, you will find the share and percentage resource allocation scheme familiar). Similar differences exist for the allocation of memory, number of processes, and other resources.

Using WPARs

Are you ready to create your first workload partition? All you need to get started is the capability to log in as the root user on an AIX 6 system—the official 6.1 product version is the most up-to-date but, if you happen to have downloaded an early copy during the Open Beta program, you can use that for basic WPAR operations.

Define a WPAR

Log in as root on your AIX 6 system, and run the following command:
mkwpar –n mywpar
That is all you need to do to create a system WPAR whose name is mywpar. After pressing the Enter key, a long series of messages display on the console that look very similar to those you see during a typical AIX installation. After a few minutes, a message displays, followed by a command prompt indicating that the WPAR creation is complete. To verify that your WPAR was created, run the following command to list all defined WPARs:

lswpar

Listing 1 displays a table showing the WPAR named mywpar that you just created. The D in the State field means the WPAR is Defined; it exists, but it has not been started. It has a type of S —that is, it’s a system WPAR, because the mkwpar command creates system WPARs by default. Also by default, the hostname is the same as the WPAR name, and the base directory for all the WPAR’s filesets is located at /wpars/<wpar name>.
Listing 1. lswpar command output
# lswpar
Name    State  Type  Hostname  Directory
---------------------------------------------
mywpar  D      S     mywpar    /wpars/mywpar
#
<
To start your new WPAR and log in, run the following command:
startwpar mywpar
Running the lswpar command again indicates that state of the WPAR changed from D to A (for Active).

You have not defined network information for this WPAR, so unless the name you picked for your WPAR already resolves to a valid network address, you probably won’t be able to do any kind of network login yet. Since you are still on the system console, do a console login to the new WPAR:
clogin mywpar
The AIX welcome message and command prompt displays. You have created, started, and logged in to your first WPAR! Run the hostname command to confirm this.

From this point, you can run most AIX commands, define other users, and do most anything you would do with a full AIX system.

Once you have logged into the WPAR, there is one important point to remember: From the WPAR, you have no access to the global system or to any other WPAR. So some familiar commands or SMIT menus will not work as they usually do, or they might be missing altogether. For example, if you enter the hostname command, it returns the name of the WPAR and not the hostname of the global AIX system. So for now, let’s leave the WPAR, and return to the global AIX environment by typing the exit command. Then to stop the WPAR, just type:
stopwpar mywpar
Using SMIT to change WPAR properties
How about using SMIT to define an IP address for the new WPAR? Of course, you can also do this using the command line, since SMIT is just a command processor. On the global AIX command line, type smit to display the initial SMIT menu. You’ll see a new menu choice, Workload Partition Administration.

After selecting Workload Partition Administration, you’ll see three choices:

List All Workload Partitions

 Administer SYSTEM Workload Partitions
 Administer APPLICATION Workload Partitions

The first choice, List All Workload Partitions, executes the lswpar command to show all defined WPARs on your system. Choose Administer SYSTEM Workload Partitions to work with the WPAR you defined earlier. This selection displays the following sub-menu:
List System Workload Partitions
Create a System Workload Partition or Specification File
Start / Stop / Reboot a System Workload Partition
System Workload Partition Software Maintenance
Change / Show System Workload Partition Characteristics
Remove a System Workload Partition
System Workload Partition Backup Manager
You do not need to create a WPAR, so select Change / Show System Workload Partition Characteristics, which results in the following submenu:
Change / Show General Characteristics
Change / Show Network Interfaces
Change / Show File Systems
The first choice, Change / Show General Characteristics, displays an input panel that lets you view or change the basic WPAR properties, such as the WPAR name, hostname, start options, and more advanced settings, including resource controls and security settings. You set out to work with network settings, so select Change / Show Network Interfaces, which results in the following data entry fields:
                                                       [Entry Fields]
*   Workload Partition Name                            []                     
+  Network INTERFACE                                                         
+
*             Internet ADDRESS (dotted decimal)        []
                Network MASK                           []
1.Type or select the WPAR name in the Workload Partition Name field.

2.In the Network INTERFACE field press F4 or Esc+4 to show the list of available network interfaces.
Select the one that you want to use, then enter a valid IP address and network mask in the remaining fields

If you plan to define a bunch of WPARs, you’ll need to secure in advance a group of available hostnames and IP addresses in your network.

After completing the panel for adding a network interface, you can start the WPAR, either by using SMIT menus, or issuing the startwpar command from the command line. After the WPAR has started, you should be able to log in remotely using telnet. Don’t forget to set a root password and any other security measures that you normally take when setting up a new AIX system. You might also want to add a line to the /etc/hosts file on the global system containing the hostname and IP address of the new WPAR.

Now that you can log in to your new system WPAR, either from the system console or remotely, you can do many of the things you would do with any new AIX system: create users, create new file systems, or install software. Regarding software installation, you might use NIM to perform network installs. Or, you can add a CD-ROM file system to the WPAR, which enables you to use a CD-ROM attached to the physical server to install software on the WPAR.

Creating and using application WPARs

Creating an application WPAR is similar to creating a system WPAR. However, instead of the mkwpar command, you use the wparexec command, which not only creates the WPAR, but it also starts the application inside it. As previously noted, an application WPAR only exists so long as the application process is running. Once the process terminates, the WPAR is stopped and cleaned up.

To create an (somewhat trivial) application WPAR named mywpar that will sleep for 100 seconds, enter the command:
wparexec –n myappwpar /usr/bin/sleep 100 &
After pressing Enter, several messages display indicating that the WPAR is starting and that file systems are being mounted. If you type the lswpar command, the following displays:
# lswpar
Name       State  Type  Hostname   Directory
---------------------------------------------
myappwpar  A      A     myappwpar  /
#
This information indicates that a WPAR named myappwpar exists, that it is in an active state, and that it is an Application WPAR. After 100 seconds, a message displays that the system is shutting down all WPAR processes. Enter lswpar again to verify that the WPAR no longer exists.

WPAR Manager

IBM Workload Partitions Manager for AIX (WPAR Manager) is a platform management solution that provides a centralized point of control for managing workload partitions across a collection of managed systems running AIX 6.1. The managed systems might all be LPARs on a single physical server, or they might be located on multiple physical servers. Using WPAR Manager, you can monitor the health and status of multiple WPARs on multiple managed AIX systems. You can also perform all the basic WPAR life cycle operations—including create, view and manage properties, start, stop, and delete.

WPAR Manager also supports relocation of WPARs between systems in a collection of managed servers. 

WPAR Manager supports two kinds of relocation:
  • Manual relocation—This type of relocation is initiated by the user.
  • Policy-based relocation—This type of relocation is initiated by WPAR Manager in response to workload conditions defined in a relocation policy.

WPAR Manager is not part of AIX—it’s a separately purchased licensed program (Program number 5756-WPM). But, if you are working with an AIX 6 image that you downloaded during the Open Beta program, you might have the early version of WPAR Manager that was shipped with the beta. This article only touches on the main capabilities of WPAR Manager. A later article will present a more detailed description of how it works and how to use it.

Multi-system management

Managing WPARs on multiple AIX systems using the WPAR Manager requires two initial installation and configuration steps. First, you install and configure the management server software on an AIX system in your environment. Then, you install the WPAR Manager agent software on each AIX system that will be managed by WPAR Manager. The agent must then be configured to share WPAR data with a specific management server. After the WPAR Manager and agent components have been configured and started, the WPAR Manager automatically discovers all the managed systems, and begins to record data transmitted by the agents in an internal database.

One of WPAR Manager’s main resource views shows all managed AIX systems—that is, all AIX systems on which the WPAR Manager’s agent software has been installed and configured to communicate with the WPAR Manager server. This view provides information about the characteristics of each managed system, including its current operational state and connectivity with the WPAR Manager. From this view, you are able to drill down to see all the WPARs defined on any of your managed systems. You can also create and delete WPARs and perform any other life cycle tasks.

Figure 1. WPAR Manager systems view

Another main resource view shows all defined WPARs in your management environment. The WPARs in the list can be in one of several states:
•Active on one of the managed systems.
•Deployed on a managed system, but not currently running.
•Undeployed, that is, defined in the WPAR Manager’s database, but not yet deployed to any managed system.

There are also several other transitional and error states.

Figure 2. WPAR Manager WPARs view

In addition to the main resource views and associated task panels, the WPAR Manager contains both wizard and power user interfaces for creating WPARs and WPAR groups and for relocating WPARs from one system to another. There are also panels for viewing the status of tasks that you have initiated and for monitoring the performance of WPARs over time.

Live Application Mobility

Live Application Mobility is the capability to relocate a WPAR from one hosting system to another without having to restart any applications or processes running in the WPAR. (Live Application Mobility is the term seen in marketing materials, while the WPAR Manager’s user interface uses relocation.) It is important not to confuse Live Application Mobility with another recently announced feature of POWER6 servers: Live Partition Mobility. Partition mobility refers to the ability to move an entire running AIX LPAR from one physical server to another. Being a hardware-based function, partition mobility is only supported on POWER6 hardware; application mobility is supported on any hardware that supports AIX 6.

When a WPAR is relocated using WPAR Manager, all processes are checkpointed and then restarted on the target system, with minimal impact on the application or WPAR user. Although it is possible to use AIX commands to checkpoint a WPAR, copy critical files to another system, and then restart the WPAR on the target system, it is not easy, and the relocation might fail due to user error. Another important reason to use WPAR Manager to relocate WPARs is that it also offers an automated recovery mechanism. If, for whatever reason, the relocation process goes bad, WPAR Manager can be successful in restoring the WPAR to its original location and state. Log files and task status displays in the graphical user interface let you know if a task failed and provide stderr output to help understand what went wrong.

Policy-based relocation

WPAR Manager also has the capability to monitor performance of workloads running in WPARs and relocate those workloads to different AIX systems to improve performance. For example, if CPU or memory usage in a WPAR or group of WPARs is, on average, higher than a value that you specify, then the WPAR Manager might attempt to relocate one or more WPARs to a more powerful, or less busy, server in your datacenter. The detailed mechanics of how the policy engine works are beyond the scope of this article, but will be covered in a later article.

WPAR Manager Information Center

The WPAR Manager Information Center is available from any panel in WPAR Manager by clicking on the Help link at the top of the WPAR Manager browser window. The same material is available in the AIX Information Center—look under the "IBM Workload Partitions Manager for AIX" heading (see Resources).
You can access help for individual pages by clicking the question mark icon at the upper right of any active WPAR Manager page. The page help provides detailed information on how to interact with the page being viewed.

Conclusion

In this article, you learned the following basics of workload partitions in AIX 6.1: 
• WPARs are software-based partitions that extend and complement the System p server’s hardware-based LPARs.
• There are two types of WPARs:  System and Application.  Which is best for you depends on your requirements for workload isolation, mobility, and how complete an operating environment you need.
• You can create a WPAR quickly using either AIX commands or SMIT.
• Other commands and SMIT menus let you modify, start, stop, or remove WPARs.
• The WPAR Manager, a separate licensed program, extends WPAR management to multiple systems, and supports relocation of WPARs from one system to another.
The information presented here should encourage you to try out WPARs in your AIX 6.1 environment, and see for yourself what this new virtualization capability can do for you.

Tuesday, 2 April 2013

How to create a WPAR step-by-step


 lpar in the managed system may have a different operating systems. Each workload partition runs only AIX. Lpar owns everything it uses, wpar shares lpar resources (memory, cpu, adapters). Usage of lpar resources (the amount of their processing power – so to speak) by wpar can be defined, limited not to exceed certain amount – if needed. Why I got interested in workload partitions (wpar)? I had to install application on AIX6.1. There is also a ”frequent” but not continuous requirement of testing patches and new releases of this application – not a constant need. As the time flows the operating system will evolve as well – patches, fixes, ML’s …. The test environment must have identical OS as the production environment – are you beginning to see my point?
Let’s create one “private” workload partition which I will call wpar (today, for a change I have no imagination). Why “private”? Because it will have its own (private) /usr.
mkwpar -g wpar_vg -h wpar -l -n wpar -N interface=en0 address=159.14.245.85 nemtask=255.255.255.0 -P -r -s -o /root/wpar.config
-g wpar_vg -> will create all file systems owned by wpar using the capacity of the indicated volume group
-h wpar -> specifies the host name assigned to this wpar
-l -> create private and writable /opt and /usr
-n wpar -> workload partition name (wpar)
-N -> Network info follows
-P -> set the root password interactively
-r -> duplicate network name resolution services (/etc/resolv.conf and so forth)
-s -> start the wpar after creation
-o /root/wpar.config -> create wpar.config file that can be used to re-create the wpar
what we get as soon as we execute this command is:
.........
rsct.core.fsrm 2.5.4.0 ROOT APPLY SUCCESS
rsct.core.hostrm 2.5.4.0 ROOT APPLY SUCCESS
rsct.core.lprm 2.5.4.0 ROOT APPLY SUCCESS
rsct.core.microsensor 2.5.4.0 ROOT APPLY SUCCESS
syncroot: Error synchronizing installp software.
syncroot: Returns Status = FAILURE
Copying network name resolution configuration...
/etc/resolv.conf
/etc/hosts
/etc/netsvc.conf
Changing password for root@wpar
root@wpar's New password:
Re-enter root@wpar's new password:
mkwpar: 0960-192 They do not match, try again.
root@wpar's New password:
Re-enter root@wpar's new password:
Workload partition wpar created successfully.
Starting workload partition wpar.
Mounting all workload partition file systems.
Loading workload partition.
Exporting workload partition devices.
Starting workload partition subsystem cor_wpar.
0513-059 The cor_wpar Subsystem has been started. Subsystem PID is 323596.
Verifying workload partition startup.
entaimq1:MDC:/root>
entaimq1:MDC:/root>lsvg
rootvg
wpar_vg
entaimq1:MDC:/root>lsvg -l wpar_vg
wpar_vg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
fslv00 jfs2 3 3 1 open/syncd /wpars/wpar
fslv01 jfs2 1 1 1 open/syncd /wpars/wpar/home
fslv02 jfs2 16 16 1 open/syncd /wpars/wpar/opt
fslv03 jfs2 3 3 1 open/syncd /wpars/wpar/tmp
fslv04 jfs2 64 64 1 open/syncd /wpars/wpar/usr
fslv05 jfs2 4 4 1 open/syncd /wpars/wpar/var
As you can see this wpar has its own copy of the operating system created in the specified vg – wpar_vg. Now, let’s create some file systems in another (dedicated to it) volume group which (the file systems) we will assign to our wpar.
entaimq1:MDC:/root>lsvg
rootvg
wpar_vg
informatica_vg
Let’s make the logical volumes first:
entaimq1:MDC:/root>
mklv -t jfs2 -y inform1_lv informatica_vg 10
mklv -t jfs2 -y inform2_lv informatica_vg 10
mklv -t jfs2 -y inform3_lv informatica_vg 10
Now, let’s make file system on the top of each logical volume:/lang_en]
crfs -v jfs2 -d inform1_lv -m /wpars/wpar/inform1 -A yes -a log=INLINE
crfs -v jfs2 -d inform2_lv -m /wpars/wpar/inform2 -A yes -a log=INLINE
crfs -v jfs2 -d inform3_lv -m /wpars/wpar/inform3 -A yes -a log=INLINE
It’s too late but I forgot to include the mount type above so now, I have to execute the chfsagainst each file system.
entaimq1:MDC:/root>chfs -u wpar /wpars/wpar/inform1
and ..../inform2 and ..../inform3
Now, inside the lpar that owns the wpar execute the mount all and let’s go and see thewpar. To login from the lpar directly into its wpar, execute:
entaimq1:MDC:/root>clogin wpar -l root
Once inside, let’s do some poking aroung.
# df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
Global 0.09 0.07 29% 1880 11% /
Global 0.03 0.03 3% 7 1% /home
Global 0.50 0.29 43% 8787 12% /opt
Global - - - - - /proc
Global 0.09 0.09 2% 13 1% /tmp
Global 2.00 0.15 93% 39515 51% /usr
Global 0.12 0.06 52% 4405 24% /var
Global 1.25 1.24 1% 4 1% /inform1
Global 1.25 1.24 1% 4 1% /inform2
Global 1.25 1.24 1% 4 1% /inform3
#
Now, lets increase the size of one the last three file systems made.
# chfs -a size=2G /inform1
chfs: 0506-915 No record matching /inform1 was found in /etc/filesystems.
Guess, what? There are no stanzas for these file systems in the wpar own/etc/filesystems. Let’s do the increase operation on the “owner” side (inside the lpar). So, execute exit to logout from the wpar, and then let’s grow the file systems as required.
entaimq1:MDC:/root>chfs -a size=2G /wpars/wpar/inform1
Filesystem size changed to 4194304
entaimq1:MDC:/root>chfs -a size=3G /wpars/wpar/inform2
Filesystem size changed to 6291456
Inlinelog size changed to 12 MB.
entaimq1:MDC:/root>chfs -a size=4G /wpars/wpar/inform3
Filesystem size changed to 8388608
Inlinelog size changed to 16 MB.
Going back into the wpar and what do you see?
# df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
Global 0.09 0.07 29% 1880 11% /
Global 0.03 0.03 3% 7 1% /home
Global 0.50 0.29 43% 8787 12% /opt
Global - - - - - /proc
Global 0.09 0.09 2% 13 1% /tmp
Global 2.00 0.15 93% 39515 51% /usr
Global 0.12 0.06 52% 4405 24% /var
Global 2.00 1.99 1% 4 1% /inform1
Global 3.00 2.99 1% 4 1% /inform2
Global 4.00 3.98 1% 4 1% /inform3
Who owns these file systems?
# ls -ld /inform2
drwxr-xr-x 3 root system 256 Jun 08 13:20 /inform2
Let’s change it and assign it to a user and a group I have created earlier inside this wpar.
# chown infouser.info /inform1
# chown infouser.info /inform2
# chown infouser.info /inform3
Who owns these file systems now?[lan_pl]Kto obecnie posiada te pliki?
# ls -ld /inform1
drwxr-xr-x 3 infouser info 256 Jun 08 13:20 /inform1
# ls -ld /inform2
drwxr-xr-x 3 infouser info 256 Jun 08 13:20 /inform2
# ls -ld /inform3
drwxr-xr-x 3 infouser info 256 Jun 08 13:20 /inform3
#
In another putty session I tried to login to this wpar (using its IP address), and I failed. I could login only after I got back into the wpar via the clogin than I executed the passwd command and I set the root password in the wpar. I tried again to login via wpar IP address and this time it worked. Could it be that while executing mkwpar its-P options failed? Maybe, who knows – now, I do not have time to to worry about it.
I have to load a software that arrived on a CD media. How to use a CD to load a software into a wpar? I try to mount CD drive into a file system accessible to my wpar, but the operation fails.
entaimq1:MDC:/>mount -v cdrfs -o ro /dev/cd0 /wpars/wpar/cd0
mount: 0506-324 Cannot mount /dev/cd0 on /wpars/wpar/cd0: A file or directory in the path name does not exist.
You have mail in /usr/spool/mail/root
entaimq1:MDC:/>
It could be that I did not assign the adapter and CD to the partition (lpar) controlling my wpar… Let’s do it (HMC). Guess what? After I executed cfgmgr the CD showed up and I could mount it.
entaimq1:MDC:/>lsdev | grep -i cd
cd0 Available 02-08-00 SATA DVD-ROM Drive
entaimq1:MDC:/>
entaimq1:MDC:/>mount -v cdrfs -o ro /dev/cd0 /wpars/wpar/cd0
Study the previous line to understand how mounting from an lpar and into one of its wpars. Do I have access to CD from my wpar?
# df
Filesystem 512-blocks Free %Used Iused %Iused Mounted on
Global 196608 140480 29% 1882 11% /
Global 65536 63768 3% 7 1% /home
Global 1048576 605768 43% 8787 12% /opt
Global - - - - - /proc
Global 196608 193016 2% 13 1% /tmp
Global 4194304 318032 93% 39515 51% /usr
Global 262144 126944 52% 4405 24% /var
Global 4194304 4176624 1% 4 1% /inform1
Global 6291456 6265264 1% 4 1% /inform2
Global 8388608 8353904 1% 4 1% /inform3
Global 3759968 0 100% 939992 100% /cd0
#
Yes, indeed. I got it, I see it. Can I have a peak at it content too?
# cd /cd0
# ls
.Version README.expansion.html usr
GSKit.README installp
README.expansion ismp
#
Well, well, well. Now I can proceed with software installations – this CD contains the “Expansion Pack for AIX”. This is not the right CD!
Back to reality. I have made a dynamic change to my lpar configuration – I added the adapter controlling the CD. Few of you may yet not know (I belonged to this category too) but in case of an lpar anything called dynamic is nothing short of dynamic – in absence of any further steps the dynamic changes will disappear the next time the lpar will be rebooted. So the question is this ”how to make the dynamic change a permanent one?” What I did? On HMC, I go toConfiguration -> Save Current Configuration. This operation creates a new profile. Remember to make it the Default profile so if lpar reboots it will boot with this one and not the previous profile.
[lang-en]Let’s stop the wpar.
entaimq1:MDC:/>lswpar
Name State Type Hostname Directory RootVG WPAR
------------------------------------------------------
wpar A S wpar /wpars/wpar no
entaimq1:MDC:/>stopwpar -v wpar
Stopping workload partition wpar.
Stopping workload partition subsystem cor_wpar.
0513-044 The cor_wpar Subsystem was requested to stop.
stopwpar: 0960-261 Waiting up to 600 seconds for workload partition to halt.
Shutting down all workload partition processes.
WPAR='wpar' CID=1
ID=2097153 KEY=0x4107001c UID=0 GID=9 RT=-1
ID=4194314 KEY=0x0100b0c4 UID=0 GID=0 RT=-1
ID=4194316 KEY=0xffffffff UID=0 GID=0 RT=-1
ID=4194319 KEY=0x010283b4 UID=0 GID=0 RT=-1
ID=2097168 KEY=0xffffffff UID=0 GID=0 RT=-1
wio0 Defined
Unmounting all workload partition file systems.
Umounting /wpars/wpar/cd0.
Umounting /wpars/wpar/inform3.
Umounting /wpars/wpar/inform2.
Umounting /wpars/wpar/inform1.
Umounting /wpars/wpar/var.
Umounting /wpars/wpar/usr.
Umounting /wpars/wpar/tmp.
Umounting /wpars/wpar/proc.
Umounting /wpars/wpar/opt.
Umounting /wpars/wpar/home.
Umounting /wpars/wpar.
Return Status = SUCCESS.
entaimq1:MDC:/>
Have you noticed that I stopped the wpar from its lpar?
entaimq1:MDC:/>lswpar
Name State Type Hostname Directory RootVG WPAR
------------------------------------------------------
wpar D S wpar /wpars/wpar no
entaimq1:MDC:/>
And now, let start it up.
entaimq1:MDC:/>startwpar -v wpar
Starting workload partition wpar.
Mounting all workload partition file systems.
Mounting /wpars/wpar
Mounting /wpars/wpar/home
Mounting /wpars/wpar/inform1
Mounting /wpars/wpar/inform2
Mounting /wpars/wpar/inform3
Mounting /wpars/wpar/opt
Mounting /wpars/wpar/proc
Mounting /wpars/wpar/tmp
Mounting /wpars/wpar/usr
Mounting /wpars/wpar/var
Loading workload partition.
Exporting workload partition devices.
Starting workload partition subsystem cor_wpar.
0513-059 The cor_wpar Subsystem has been started. Subsystem PID is 585748.
Verifying workload partition startup.
Return Status = SUCCESS.
entaimq1:MDC:/>
Since I did not put the appropriate stanza in the /etc/filesystems no CD got mounted, has to go to the lpar to do this again:
entaimq1:MDC:/>mount -v cdrfs -o ro /dev/cd0 /wpars/wpar/cd0
What happens when I try to unmount cd0 being inside wpar?
# umount /cd0
umount: 0506-349 Cannot unmount Global: A system call received a parameter that is not valid.
#
This can be done from the ”owning” lpar.
entaimq1:MDC:/>umount /wpars/wpar/cd0
Since nobody know where is the install CD, I have to kill the time in some other way. With the help from ftp,I install the VNC software, and after login as me (duszyk) not root, I try to start it executing:
$ vncserver
You will require a password to access your desktops.
Password:
Verify:
$ vncserver
1356-364 xauth: creating new authority file /home/duszyk/.Xauthority
New 'X' desktop is wpar:1
Creating default startup script /home/duszyk/.vnc/xstartup
Starting applications specified in /home/duszyk/.vnc/xstartup
Log file is /home/duszyk/.vnc/wpar:1.log
$
It does not work… . VNC would not start until I made some changes to the/usr/bin/X11/vncserver. I followed the advice included in this link: ”http://www.ee.pw.edu.pl/~pileckip/aix/vnc_setup.htm” – I tried Doug Ranz’ method. Following the changes, I was able to start the vncserver and connect to this ”machine” from my laptop as this images shows:
VNC
How to get rid of a wpar? Easy, you can do it like that:
entaimq1:MDC:/root>rmwpar -Fsv wpar
Well, now I have been told that this wpar host name and its IP address has to change because of some requirement. The new hostname will be a very descriptive one indeed: infaprtu001, and its IP address will be 159.14.245.56. To execute the change I will add the appropriate entry to lpar /etc/hosts and execute:
chwpar -h infaprtu001 -N address=159.14.245.56 wpar
entaimq1:MDC:/root>lswpar
Name State Type Hostname Directory RootVG WPAR
---------------------------------------------------------
wpar A S infaprtu001 /wpars/wpar no
entaimq1:MDC:/root>
I use the new address to login (with putty) into the wpar and what do I see here?
$ ifconfig -a
en0: flags=1e080863,c0
inet 159.14.245.85 netmask 0xffffff00 broadcast 159.14.245.255
inet 159.14.245.56 netmask 0xffffff00 broadcast 159.14.245.255
tcp_sendspace 131072 tcp_recvspace 65536 rfc1323 0
lo0: flags=e08084b
inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255
inet6 ::1/0
tcp_sendspace 131072 tcp_recvspace 131072 rfc1323 1
$ uname -a
AIX wpar 1 6 00CD68344C00
$ hostname
infaprtu001
$
Do you understand the difference between the host and wpar name? They do not need to be the same.