Under Construction

Optional: Master/Slave Connections to the HMCs

The LPAR tool uses the master/slave connection feature of SSH to communicate with the HMCs. Before the LPAR tool opens an SSH connection to an HMC, it checks whether there is already a so-called master connection to the HMC. If this is the case, a slave connection to the HMC is used. A slave connection uses an active master connection and has the following two advantages:

    • No re-authentication is necessary because the master connection is already authenticated. This means there is no password or passphrase request.
    • Establishing a slave connection takes around a tenth of a second and is therefore many times faster than establishing a normal connection.

In most environments, all managed systems are likely to be connected to two HMCs. When accessing managed systems or LPARs, the LPAR tool always checks whether a master connection to one of the two HMCs already exists. If this is the case, the LPAR tool automatically selects the HMC for which a master connection already exists. This means that HMC commands can be issued much more quickly using the LPAR tool.

A master connection can be used by any number of slave connections. How long a master connection to an HMC remains open can be determined by entering the ControlPersist attribute in ~/.lpar.cfg or /opt/pwrcmps/etc/lpar.cfg:

$ cat ~/.lpar.cfg

# How long (seconds) inactive master connection should persist. Default: 600
ControlPersist 8h

$

The example entry above ensures that the master connection remains active for 8 hours. If you do not use an SSH agent, you only need to enter the password or passphrase once every 8 hours (per HMC).

Whether and to which HMCs a master connection currently exists can be easily displayed using the command “hmc connections”. Try it out:

$ hmc connections
hmca01: not connected
hmca02: not connected
hmcg01: Master running (pid=8446)
hmcg02: Master running (pid=31725)
hmc01: Master running (pid=28399)
hmc02: not connected
$

The message “Master running”, together with a PID, means the presence of a master connection.

If you want to specifically terminate a master connection to an HMC, you can use the command “hmc disconnect“. Select one of your HMCs from the list that has an existing master connection and enter it as an argument:

$ hmc disconnect hmcg02
connection to hmcg02 terminated
$

The master connection is terminated. This has no impact on any managed system or LPAR. It just means that the LPAR tool has to open a new master connection if necessary, which can take a few seconds.

Check if the master connection has really been terminated by entering “hmc connections” again:

$ hmc connections
hmca01: not connected
hmca02: not connected
hmcg01: Master running (pid=8446)
hmcg02: not connected
hmc01: Master running (pid=28399)
hmc02: not connected
$

Of course, a connection to an HMC can also be re-established. The command “hmc connect” is used for this. Create a new master connection to the HMC from above:

$ hmc connect hmcg02
master connection created
$

However, a master connection does not have to be established manually; this happens automatically as soon as the LPAR tool needs to address an HMC but there is currently no master connection.

Most users will be able to get by without the commands shown here.

This information and commands are particularly useful in two cases:

    1. A user does not use SSH keys and therefore has to enter the password for the HMCs manually. The recommendation would then be to enter a large value for ControlPersist in the ~/.lpar.cfg file and use “hmc connect” to establish the master connection to all HMCs once (the password must be entered once for each HMC). The same applies to users with SSH keys with a passphrase who do not use an SSH agent. The passphrase must then be entered once for each HMC. We recommend using the SSH agent.
    2. As described above, the LPAR tool automatically selects one of the two HMCs for dual HMCs environments. In some cases, however, you may want an operation to be carried out via a specific HMC. In such a case, you can first check which HMCs have a master connection. If there is a master connection to the HMC that is not to be used, this connection can be terminated with “hmc disconnect“. If there is currently no master connection for the HMC to be used, one can be established using “hmc connect“. If one of the ms, lpar or vios commands is then used, they will use the desired HMC, as this is the only one that has an active master connection.