Tips using HMC for VMWare Users

 Creating a Virtual Machine is a necessary step of most of software development process. The reason is that we want to optimalise our hardware use, to isolate one application instance from another application  instance running in the same hardware. For that purpose I recently tried to create a VM instance in an IBM machine, a PowerVM. Creating such VM is quite different than creating such VM in VMWare, and this post will show some tips when facing challenges creating a PowerVM.

HMC Console

First, we need to access HMC (Hardware Management Console), which is the interface from where we configure our hardware and logical partitions. One HMC could manage more than one system (which stands for a single box of server hardware).  Choose Resource >> All Systems to get an overview of which systems are available to manage.





From the HMC we could create a new Logical Partition.
The menu path is : Resource >> All Systems >> [ choose system ], then by clicking on Create Partition we could provide the amount of CPU core and memory to be allocated for the new Logical Partition.





The resource that could be allocated are limited by resources that are not yet allocated to other partition in the system.  Setting minimum and maximum to the same value will disable dynamic resource reallocation, it is better to set two different number here to allow reallocation.

(Almost) Everything is thru VIO

HMC doesn't stand alone, there is a quite separation between HMC console and VIO console, which we would not find when using VMWare.  Most access from outside world to the VM or Logical Partition is thru the VIO. Disk access are provided through VIO, and Network access are also going thru VIO. When attaching a disk, we need to have a client-server pair of virtual scsi adapter, the first is server virtual scsi adapter in VIOS, and the second is the client virtual scsi adapter in the client partition. The creation of such pair is normally automatic and became part of operations in the HMC such as optical drive creation or attaching new disk, be aware that mismatch between the pair resulted in strange bugs. For example, when creation of server part of the pair success but the creation of client part failed because the client scsi slot numbers were exhausted.

Configuring Disks

When the disk are already configured and available for use (which requires access to storage controller  and managing the disks there), we could add the storage from the Virtual Storage view inside the  Partition view.  The menu path is : Resource >> All Partitions >> [ choose partition ] >> Virtual Storage.


Tips : be sure to click the  Edit connection and choose the existing adapter, otherwise each operation will add a new virtual Scsi adapter and the slots for the adapters will be full in no time. The first time we add storage or optical drive, a new adapter should be created by not configuring the connection, but for other times we should configure the connection to minimize adapter creation. 






I should warn that while I were using  HMC, errors when creating adapter result in mismatch between HMC's adapters and VIO's adapter connection, which in my case I could only resolve by going into command-line-interface level.

Creating Virtual Optical Device

From the tab 'Virtual Optical Device', we could create a new one (virtually). Choose Add Virtual Optical Device button.



Please ensure the checkbox 'Use existing adapters' is being checked, and choose the server adapter IP in the left of such textbox.

Accessing the VIO from the HMC

From the HMC, some settings (the ISO to virtual optical device mapping)  could be found only when we access virtual storage from the System view, not the Logical Partition view.  This could be a bug in our system tough. The menu path is : Resources >> All Systems >> [ choose system ] >> Virtual Storage. 



From there,  choose the VIO server radio button, click on the Action button, and then click on the Manage Virtual Storage menu.
This place is where for assigning the ISO to virtual optical devices in each partition.



Put a check box to mount the ISO image into a specific virtual optical device inside a logical partition. Be aware that checking along the lines of 'New Virtual Optical Device' will create a new Virtual Optical Device attached to the LPAR's existing virtual SCSI adapter.


The Profile

The UI for the Logical Partition's Profile is  also quite hidden, and it is frankly very important. In the profile is the only place I was able to configure the virtual ethernet adapter being deployed in the VM. The IBM documentation for configuring virtual ethernet adapter seems to require the dynamic partition capability to be active, which it were not in my system. So in my case what I do is :

  1. Save current configuration into a new profile
  2. Add the virtual ethernet adapter from the profile's edit menu
  3. Activate the new profile
The menu path is : Resources >> All Partitions >> [ choose partition ] >> Partition Actions >> Profiles.


Choose the profile to be edited ( the profile should be different with the one currently active).
Afterwards use the Actions menu for further configuration..


Then we could create new ethernet adapters. The profile stores all adapters that will exist when the partition is running. Be mindful that the VLAN id is configured here.



To activate the new profile,  the partition needs to be shutdown first.

Accessing the Partition's Console

A newly created partition, usually are not yet accessible from the network.  First we need to install the OS and configure IP address for the partition. To do this, access to the console's screen (monitor) is required. In VMWare, we configure VGA adapter for the VMs, and the virtualized adapter display is accessible from the VMWare console / vSphere. For HMC, the similar thing exists, but instead of virtualized display we get a virtualized terminal. Accessing the terminal sooner is better, because text that were printed before we connect were lost and would not be visible.

Method 1 - Access from vtmenu

  1. Connect HMC using ssh Terminal. The ssh password should be the same as HMC Web Console password.
  2. In the ssh prompt, type 
    vtmenu
  3. From vtmenu, we could choose which partition to connect the virtual terminal to.


  4. To exit the connection, type ~~. (tilde-tilde-dot).

Method 2 - Access from JNLP Java App Launched from HMC Console

This method requires installation of Java JDK 8 on local system. If you are using Windows, just install Oracle JDK 8 from https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html. In my case, I was using a MacBook, with Open JDK 8 Temurin (https://adoptium.net/temurin/releases/?version=8), which doesn't have JNLP capabilities. The reason is that Oracle changed the license for Oracle JDK to be non-free, so it is better to use Temurin. In order to run JNLP,  I downloaded IcedTea Portable zip from https://adoptopenjdk.net/icedtea-web.html , move it to a path that not contain any spaces, then extracted the zip. 

From the HMC Console, access the partition console menu using Resources >> All partitions >> [choose partition] >> Partition Actions >> Console .

By Clicking Open Terminal Window, we launch the JNLP App to Connect the virtual console. In my system, clicking this will result a jnlp file being downloaded (not run). So open up mac's Terminal, note the location of Temurin's java Home and set it in the environment variable (please check your local system's Java PATH, and change accordingly) :

export JAVA_HOME=/Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/

cd (location of IcedTea extract)/icedtea-web-image/bin

./javaws.sh ~/Downloads/vterm_application_tmp\(4\).jnlp 

 Note: replace jnlp file name, location of icedtea extract, and temurin home path according to the condition in your system.

 

Closing Remarks and Rants

Using the HMC, the capabilities is adequate but far from user-friendly. The separation of HMC and VIO is somewhat unnatural when comparing HMC with VMWare, but it was an unavoidable design consequence. I had spent some time in pitfalls such as when not choosing existing adapter during storage attach process, and in the result got error when the adapter slot were full, resulting somewhat corrupted partition that I try to resolve first by going command-line (and having quite adventure not captured by this post). But even by going to command-line the partition still have some quirks that I don't understand, and finally get resolved by recreating another partition from scratch. The console is quite difficult to access from a MacBook, and thats before I found out the vtmenu method. But the GRUB boot menu got corrupted in vtmenu, so I wasn't be able to choose the 'Install' menu in GRUB before switching back to JNLP-connected console. Another pitfall is I got stuck in Virtual Network section to add virtual ethernet adapter, whereas the correct location to add the adapter is in the partition profile.

Command line notes

  1. List system in hmc
    lssyscfg -r sys
  2. List lpar in hmc
    lssyscfg -r lpar -m [system-name]
  3. List virtual scsi adapter and connections
    lshwres -m [system-name] -r virtualio --rsubtype scsi
  4. Remove virtual scsi adapter 
    chhwres -m [system-name] -r virtualio -o r -p [partition-name] --rsubtype scsi -s [slot-num]
  5. To access VIOS CLI from HMC cli
    vtmenu
    choose VIOS partition
    login as VIOS prime administrator user (padmin) & password
  6. List virtual devices in VIOS cli
    lsdev -virtual
  7. List adapter in VIOS cli
    lsdev -type adapter
  8. List virtual adapter and connected virtual device mapping
    lsmap -all
  9. Detach virtual disk (required as prerequisite to be able to remove the virtual scsi adapter)
    rmvdev -vdev (disk-name)
  10. Attach virtual disk
    mkvdev -vdev (disk-name) -vadapter (server-virtual-scsi-adapter-name)

References

  1. Partitioning for Linux with an HMC https://www.ibm.com/docs/en/POWER5/iphbi_p5/iphbibook.pdf
  2. Virtualizing an infrastructure with System p and Linux https://www.redbooks.ibm.com/redbooks/pdfs/sg247499.pdf

  3. https://www.ibm.com/docs/en/power9?topic=commands-chhwres
  4. https://www.ibm.com/docs/en/power5?topic=POWER5/iphcx_p5/lshwres.html
  5. https://www.ibm.com/docs/en/power7/9109-RMD?topic=commands-lsdev-command
  6. https://www.ibm.com/docs/en/power8/8335-GTA?topic=HW4M4/p8hat/p8hat_changeprofilep6.html
  7. https://www.ibm.com/docs/en/power9/9080-M9S?topic=networks-managing-virtual-network-connections-in-adapter-view 
  8. https://www.ibm.com/docs/en/power8/9080-MME?topic=libraries-adding-removing-media-files-from-media-library
  9. https://www.ibm.com/support/pages/creating-virtual-optical-drive-hmc-managed-vios-partition
  10. https://www.ibm.com/support/pages/how-assign-vios-hosted-virtual-optical-device-using-new-hmc-v8-gui
  11. https://apple.stackexchange.com/questions/342943/in-macos-how-to-run-a-jnlp-file-with-openjdk-8

 


Comments

Popular posts from this blog

Long running process in Linux using PHP

Reverse Engineering Reptile Kernel module to Extract Authentication code

SAP System Copy Lessons Learned