CLI Options for Configuring and Modifying LPARs
Rob McNelly highlights resources you can use to learn how to create an LPAR without using the HMC GUI, and use the CLI for dynamic LPAR operations
By Rob McNelly08/23/2021
“Here is a suite of files to create an LPAR on an IBM [Power Systems server].... There are shell scripts and configuration files.
You need to make changes to suit your particular environment. I'd say that the chance of them working on your systems without such modifications is nil.
A tar file is available for download in the "Attachment" section at the bottom of this page.
My original motivation for developing the suite was when I was working on a particular project. To access the HMCs from my desktop, network packets had to go through several firewalls using a complicated WAN. There were many LPARs on numerous Enterprise Class systems and many users of the HMCs' GUIs. The HMCs were busy and paging was happening. The result was a slow network connection; both low bandwidth and more importantly, high latency! It could easily take over 5 minutes to fill in the HMC pages and create the LPAR, even when all of the properties were already defined and I just had to complete the forms. Then, I had to use DLPAR to add virtual adapters to the VIO [servers] and edit the VIOS profiles.
Using "malt," I could achieve all of the steps in under 30 seconds. Sometimes, I was tasked with creating several (maybe 10) LPARs with similar configurations but with different LPARid numbers, you can imagine the time which the scripting saved.
I found that improvements to the HMC and new powerful products like PowerVC and the "LPAR Provisioning Toolkit" took over from malt, so I did not post my utility. Recently, several customers have asked for access to it, so here it is.
I understand that it has some limitations, but it is what it is. I am not doing any more development on it. If people extend it, for example to use SSP storage, and let me have the code, I'll consider posting it here ...”
Be sure to read the entire support doc for complete instructions.
Getting the Most From Dynamic LPARAlong those lines, my coworker Eric Hopkins recently helped a client better understand how to use the command line interface (CLI) for dynamic LPAR (DLPAR) operations:
“The full capabilities to dynamically add or delete devices or edit the contents of a profile using CLI of the HMC still exists and has become the most direct method for implementing those changes. While confusing at first glance, the CLI offers a logical repeatable method of DLPAR actions.
The following examples will define the needed information for each task and utilizes a defined variable within the command structure. A real-world example will also be shown for clarity and syntax.
Two commands are needed to completely add an operational device. One command to add it to the LPAR that points to the managing VIOS, and one command to add it to the VIOS that points to the LPAR.
The syntax of the action being taken must be understood with reference to where the intention of the command is directed to add or remove a device. If a virtual fibre device is being added to an IBM i or AIX LPAR the $VIRTUAL_SLOT is the Adapter ID of the virtual device on that LPAR, while $REMOTE_SLOT refers to the managing VIOS for that device. Similarly, if this virtual fibre device is being added to the VIOS, $VIRTUAL_SLOT refers to the Adapter ID of the virtual device on that VIOS while $REMOTE_SLOT refers to the Adapter ID of the virtual device on the corresponding LPAR.
Best practice is that this number matches. However, if it doesn't match, it's important to know the distinction between the two variables.
Once the command has been accurately issued, the device will appear in the running operating system. At this time it is imperative to save the running config to the profile of the LPAR or VIOS. Without this step, when the LPAR is halted and started from its profile, the device will no longer exist.
Variable Information needed: $MACHINE_NAME Server-9009-22A-SN8675309 $VIOS_NAME VIOS1 $LPAR_NAME nim01 $VIRTUAL_SLOT 315 $REMOTE_SLOT 315 $DEVICE TYPE fc (fibre), eth (ethernet), scsi (SCSI) $ADD_OR_REMOVE a (add), r (remove) $SERVER_OR_CLIENT server (Adding on VIOS), client (Adding on LPAR)
Adding a virtual fibre channel device to an LPAR:
chhwres -r virtualio -m $MACHINE_NAME -o $ADD_OR_REMOVE -p $VIOS_NAME --rsubtype $DEVICE TYPE -s $VIRTUAL_SLOT -a "adapter_type=$SERVER_OR_CLIENT,remote_lpar_name=$LPAR_NAME,remote_slot_num=$REMOTE_SLOT" chhwres -r virtualio -m Server-9009-22A-SN8675309 -o a -p VIOS1 --rsubtype fc -s 315 -a "adapter_type=client,remote_lpar_name=nim01,remote_slot_num=315"
Adding a virtual fibre channel device to a VIO:
chhwres -r virtualio -m $MACHINE_NAME -o $ADD_OR_REMOVE -p $VIOS_NAME --rsubtype $DEVICE TYPE -s $VIRTUAL_SLOT -a "adapter_type=$SERVER_OR_CLIENT,remote_lpar_name=$LPAR_NAME,remote_slot_num=$REMOTE_SLOT" chhwres -r virtualio -m Server-9009-22A-SN8675309 -o a -p VIOS1 --rsubtype fc -s 315 -a "adapter_type=server,remote_lpar_name=nim01,remote_slot_num=315"
Removing a virtual adapter in slot 315 from an LPAR or VIOS:
chhwres -r virtualio -m $MACHINE_NAME -o $ADD_OR_REMOVE -p $LPAR_NAME -s $VIRTUAL_SLOT chhwres -r virtualio -m Server-9009-22A-SN8675309 -o r -p nim01 -s 315
* Don't forget to save running config!
1. On the HMC GUI check the box by the LPAR name.
2. From the ACTIONS pulldown menu choose Profiles, then Save Current Configuration.
3. A window will pop up to allow overwrite of the existing profile or the option to save to a new profile.”
Everyone should be aware of these handy options. Even in smaller, static environments where the GUI is typically sufficient, these alternatives can be handy when installing systems or applying changes.
Rob McNelly is a senior AIX solutions architect doing pre-sales and post-sales support for IBM Premier Business Partner Meridian IT Inc.
See more by Rob McNelly