zhmcclient / zhmccli

A CLI for the IBM Z HMC
Apache License 2.0
10 stars 9 forks source link

Support for having sessions to multiple HMCs #544

Open andy-maier opened 10 months ago

andy-maier commented 10 months ago

When dealing with multiple HMCs, the zhmc command today can have only one session open (that is layed down in environments variables). A session to a second HMC without making the first session unavailable requires a separate terminal session.

This ticket is to somehow support multiple sessions in the same terminal session to be open, and zhmc commands can then select which one to use.

One idea is to use a new -s / --session option to specify a session name when creating a session, and to reference that session in subsequent commands. The session parameters would be stored in a hidden file in the user's home directory:

zhmc -n -h 10.11.12.13 -u user -s hmc13 session create    # logon and add session to hidden file
zhmc -n -h 10.11.12.14 -u user -s hmc14 session create    # logon and add session to hidden file

zhmc -s hmc13 cpc list    # perform command using session from hidden file
zhmc -s hmc14 cpc list    # perform command using session from hidden file

zhmc -s hmc13 session delete    # logoff and remove session from hidden file
zhmc -s hmc14 session delete    # logoff and remove session from hidden file

This also makes the logon command more convenient, compared to today's:

eval $(zhmc -n -h 10.11.12.13 -u user -s hmc13 session create)   # logon and store session vars in env

Related to PR #543.