Running HMC commands from the System i

Background

We've just upgraded to a System i 550 with an HMC (Hardware Management Console). One of the things this lets us do is to switch the tape drive between partitions directly from the 550, without needing to schedule the resource switch in advance. This is done using globe OpenSSH (Secure SHell) running in PASE. There is a simple overview of the process as an IBM Technote - globe Sending HMC Commands from a CL Program and a much more in-depth Redpaper on using SSH on the iSeries / System i on the IBM Redbooks site - pdf Securing Communications with OpenSSH on IBM i5/OS. The tech note is pretty much all that's required to get things running, along with the pre-requisite i5/OS licensed programs:

  • 5733SC1 - IBM Portable Utilities for i5/OS
  • 5722SS1 - Option 33 - i5/OS PASE - Portable Applications Solutions Environment (a subset of the AIX runtime environment)

You'll also find the HMC command line documentation essential. See the globe Commands Available In Restricted Shell Technote and the globe Hardware Management Console resource page. The latter has a number of links, including for all command line utilities. If you get stuck you can always use the man command in an SSH session to the HMC - type man lshwres to get the manual page for lshwres, etc.

Details

The tech note includes a sample CL program to move a resource, using the chhwres Change Hardware Resource command, but doesn't go into how this resource is identified. chhwres doesn't refer to System i card slots directly. Instead it needs the DRC index of the slot. You need to use another HMC command, lshwres List Hardware Resources, to find the DRC index for the slots you are interested in, and plug them into chhwres. This is covered on page 54 of the Redpaper.

In our case I used

lshwres -r io --rsubtype slot -m Server-9406-550-SNxxxxx -F phys_loc,drc_index --header --filter units=U0588.002.6537735

where Server-9406-550-SNxxxxx is our system name, as shown by the HMC (xxxxxxx is the system serial number would be), and U0588.002.6537735 is the system/expansion unit (you can determine this from WRKHDWRSC *STG then taking option 7 against the Storage Controller resource). The output is like this:

phys_loc,drc_index
C11,21010020
C12,21020020
C13,21030020
C14,21040020
C15,21050020
C01,21010021
C02,21020021
C03,21030021
C04,21040021
C05,21010022
C06,21020022
C07,21030022
C08,21040022
C09,21050022

Our 3583 LTO2 tape library (PCI Fibre Channel Tape Controller) is on slot C04 (DRC index 21040021) and the PCI I/O processor with it on slot C03 (DRC index 21030021). Both need to be moved to the target LPAR for the tape library to work.

Example code

I wrote a couple of commands to make life easier moving the tape drive. warning Note that these should be used as example code, as the slots they work with are specific to the system they were written for. Use lshwres to find out which slot(s) you need to work with and amend (or re-write) accordingly. Another point to note is the host that the ssh command is run on. I just added a host table entry for hmc on our box - we only have the one, and the name seemed the most obvious to choose. You will (equally obviously) need to change it to match your configuration.

  • MOVETAPE - Move the tape drive

There are a few non-IBM commands used in the programs. MOVDIAGMSG and RSNESCMSG are from Tom Liotta's globe Sharea site. There are several versions of CHKIFSOBJ, including a couple by globe Scott Klement. The one I use is an early version Scott posted online, and archived at globe www.think400.dk. You could use a DSPLNK OBJ(&SSHKEY) with a MONMSG MSGID(CPFA0A9) instead of the MONMSG(CPF9897), but remember to tidy up with a DLTSPLF FILE(QSYSPRT) SPLNBR(*LAST) if the file is there.

Future plans

I hope to add examples of removing/adding memory and CPU resource at some point, which are just variations on the routines above.
Topic revision: r4 - 01 Oct 2014 - 19:37:02 - UnknownUser
 
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding DBG/400? Send feedback