Code Monkey home page Code Monkey logo

zhmccli's Introduction

zhmccli - A CLI for the IBM Z HMC, written in pure Python

Version on Pypi Test status (master) Docs status (master) Test coverage (master) Code Climate

Overview

The zhmccli package is a CLI written in pure Python that interacts with the Hardware Management Console (HMC) of IBM Z or LinuxONE machines. The goal of this package is to provide an easy-to-use command line interface for operators.

The zhmccli package uses the API provided by the zhmcclient package, which interacts with the Web Services API of the HMC. It supports management of the lifecycle and configuration of various platform resources, such as partitions, CPU, memory, virtual switches, I/O adapters, and more.

Installation

The quick way:

$ pip install zhmccli

For more details, see the Installation section in the documentation.

Quickstart

The following example lists the names of the machines (CPCs) managed by an HMC:

$ hmc_host="<IP address or hostname of the HMC>"
$ hmc_userid="<userid on that HMC>"
$ zhmc -h $hmc_host -u $hmc_userid cpc list --names-only
Enter password (for user ... at HMC ...): .......
+----------+
| name     |
|----------+
| P000S67B |
+----------+

Documentation

Contributing

For information on how to contribute to this project, see the Development section in the documentation.

License

The zhmccli package is licensed under the Apache 2.0 License.

zhmccli's People

Contributors

andy-maier avatar dependabot[bot] avatar edgue42 avatar leopoldjuergen avatar mhartmay avatar samirgorai avatar simon-spinner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

zhmccli's Issues

Improve resource properties shown by list commands

Right now, the list commands often show the properties that are returned by the corresponding List HMC operations. This is not always helpful, for example the URIs are not helpful and other important properties are missing.

This issue is about adjusting the set of properties shown. This includes adjusting some of the options that control the properties shown.

Support for changing the adapter type for FICON adapters (DPM mode)

Overview

Add support for changing the adapter type for FICON adapters (DPM mode). (This is supported by zhmcclient 0.28)

Proposal

Update the functionality of the existing adapter update CPC ADAPTER command to change the 'type' property by calling zhmcclient.Adapter.change_adapter_type().

Support for HMC/console-level command group

Overview

Add support for an HMC/console-level command group and commands.

Proposal

New console command group and commands:

  • console show - Show details of the HMC
  • console get-audit-log - Get the audit log entries of the HMC as a log file
  • console get-security-log - Get the security log entries of the HMC as a log file
  • console list-unmanaged-cpcs - List the unmanaged CPCs of the HMC - DONE in PR #374
  • console make-primary - Change the role of the HMC to become the primary HMC
  • console restart - Restart the HMC
  • console shutdown - Shut down and power off the HMC

Command groups for storage management feature

Overview

The zhmc CLI needs to add command groups to support the storage management feature.

This issue proposes an initial set of functionality, which covers most of what is supported by zhmcclient 0.28. See issue #54 for the overall roadmap to add functionality, which also lists the remaining functionality.

Proposal

New command group and commands for storage groups:

  • storagegroup create - Create a storage group
  • storagegroup list - List the storage groups
  • storagegroup show SG - Show the details of a storage group
  • storagegroup delete SG - Delete a storage group
  • storagegroup update SG - Update properties of a storage group
  • storagegroup list-partitions SG - List the partitions to which a storage group is attached
  • storagegroup list-ports SG - List the candidate adapter ports of a storage group
  • storagegroup add-ports SG- Add storage adapter ports to the candidate adapter ports of a storage group
  • storagegroup remove-ports SG - Remove storage adapter ports from the candidate adapter ports of a storage group
  • storagegroup discover-fcp SG - Perform LUN discovery for an FCP storage group

New commands for partitions:

  • partition list-storagegroups CPC PARTITION - List the storage groups attached to a partition
  • partition attach-storagegroup CPC PARTITION - Attach a storage group to a partition
  • partition detach-storagegroup CPC PARTITION - Detach a storage group from a partition

New command group and commands for storage volumes:

  • storagevolume create SG - Create a storage volume in a storage group
  • storagevolume list SG - List the storage volumes in a storage group
  • storagevolume show SG SV - Show the details of a storage volume
  • storagevolume delete SG SV - Delete a storage volume
  • storagevolume update SG SV - Update properties of a storage volume
  • storagevolume fulfill-fcp SG SV - Indicate fulfillment for a FCP boot volume

New command group and commands for virtual storage resources:

  • vstorageresource list SG - List the virtual storage resources in a storage group
  • vstorageresource show SG VSR - Show the details of a virtual storage resource
  • vstorageresource update SG VSR - update properties of a virtual storage resource

Add stable branch

Add a stable branch for the latest stable version, and update the release documentation in development.rst to support that.

Roadmap for adding missing functionality available in zhmcclient 0.28

This issue describes what functionality is currently missing in the zhmccli project, compared to the functionality supported by zhmcclient 0.28.0.

DISCUSSION: Prioritize the items and assign to releases.

When functionality is added, update this description and add the issue / PR links.

Missing resource types:

  • Storage Mgmt feature:
    • StorageGroup (issue #56 - mostly DONE in PR #92, see below)
    • StorageVolume (issue #56 - mostly DONE in PR #92, see below)
    • VirtualStorageResource (issue #56 - DONE in PR #92)
    • StorageGroupTemplate (issue #95)
    • StorageVolumeTemplate (issue #95)
  • User related:
    • User (issue #96)
    • UserPattern (issue #96)
    • UserRole (issue #96)
    • PasswordRule (issue #96)
    • LDAPServerDefinition (issue #96)
    • Task (issue #96)
  • Other:
    • ActivationProfile (issue #97)
    • Console (issue #98)
    • UnmanagedCPC (issue #98)

Missing functionality on existing resource types:

  • CPC:
    • commands for temporary capacity (issue #99)
    • commands for features (issue #100)
    • commands for importing/exporting profiles (classic mode) (issue #97)
    • start/stop (issue #101)
    • validate LUN path (issue #102)
    • list associated storage groups (issue #103)
  • StorageGroup:
    • get_connection_report() (issue #104)
  • StorageVolume:
    • indicate_fulfillment_ficon() - DEFER until zhmcclient supports FICON storage mgmt
  • Partition:
    • storage group related commands (issue #56 - DONE in PR #92)
    • manage crypto attachments (incl. zeroize) (issue #105)
    • commands for features (issue #100)
    • "dump" command (issue #70 - DONE in PR #88)
    • "psw-restart" command (issue #106)
  • Adapter:
    • change_adapter_type() (issue #107)
    • change_crypto_type() (issue #108)
  • HBA (z13 and earlier):
    • reassign_port() (issue #109)
  • Virtual Switch:
    • get_connected_nics() (issue #110)
  • LPAR:
    • "reset-clear" command (issue #111)
    • "STOP LOGICAL" support for LPARs (allows stopping an LPAR before triggering a dump)
      • TBD: Does not show up in WS API book - clarify

Support for listing the assigned NICs of an adapter (DPM mode)

Overview

Add support for listing the assigned NICs of a virtual switch (DPM mode). (This is supported by zhmcclient 0.28 via VirtualSwitch.get_connected_nics())

Proposal

New commands for CPCs:

  • vswitch list-nics CPC VSWITCH - List the connected NICs of a virtual switch

Update: This should be generalized across all types of NICs (vswitch-based and adapter-based, which probably means one would list the NICs of an adapter.

Fix AttributeError when listing hbas on system with storage mgmt feature

Example:

$ zhmc hba list CPCA MGMT1 --names-only --uri
Traceback (most recent call last):
  File "/Users/maiera/virtualenvs/zhmc38/bin/zhmc", line 33, in <module>
    sys.exit(load_entry_point('zhmccli', 'console_scripts', 'zhmc')())
  File "/Users/maiera/virtualenvs/zhmc38/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/maiera/virtualenvs/zhmc38/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/maiera/virtualenvs/zhmc38/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/maiera/virtualenvs/zhmc38/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/maiera/virtualenvs/zhmc38/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/maiera/virtualenvs/zhmc38/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/maiera/virtualenvs/zhmc38/lib/python3.8/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/Users/maiera/Projects/zhmcclient/repos/zhmccli/zhmccli/_cmd_hba.py", line 67, in hba_list
    cmd_ctx.execute_cmd(lambda: cmd_hba_list(cmd_ctx, cpc, partition, options))
  File "/Users/maiera/Projects/zhmcclient/repos/zhmccli/zhmccli/_helper.py", line 265, in execute_cmd
    cmd()
  File "/Users/maiera/Projects/zhmcclient/repos/zhmccli/zhmccli/_cmd_hba.py", line 67, in <lambda>
    cmd_ctx.execute_cmd(lambda: cmd_hba_list(cmd_ctx, cpc, partition, options))
  File "/Users/maiera/Projects/zhmcclient/repos/zhmccli/zhmccli/_cmd_hba.py", line 167, in cmd_hba_list
    hbas = partition.hbas.list()
AttributeError: 'NoneType' object has no attribute 'list'

Show default values in option help messages using Click show_default

The current option help messages specify defaults "manually" in the help text, sometimes with duplicating the default value, sometimes with constants that are used for both the default value and the message, and sometimes the default is not a value but a specific text, such as for example "Default: auto-generated" in the help text of the "hba create" option "--device-number".

The Click package provides a means to automatically add the default value to the help message, by specifying option show_default=True (see https://click.palletsprojects.com/en/7.x/api/#click.Option). Using this approach adds the text [default: {default}] to the specified help text, consistent with adding [required] if the option is required.

If we use this Click ability, then those default values that are not showing the value specified with default (such as the hba create example shownn above) probably also should be manually adjusted to that output format, for consistency.

Version issue with readline package on MacOS

Actual behavior

Since today, the zhmc command on my MacOS fails as follows:

 (zhmc27) Andreass-MacBook-Pro-2:zhmccli maiera$ zhmc --version
Traceback (most recent call last):
  File "/Users/maiera/virtualenvs/zhmc27/bin/zhmc", line 6, in <module>
    from zhmccli.zhmccli import cli
  File "/Users/maiera/Projects/zhmcclient/repos/zhmccli/zhmccli/__init__.py", line 17, in <module>
    from ._cmd_info import *       # noqa: F401
  File "/Users/maiera/Projects/zhmcclient/repos/zhmccli/zhmccli/_cmd_info.py", line 20, in <module>
    from .zhmccli import cli
  File "/Users/maiera/Projects/zhmcclient/repos/zhmccli/zhmccli/zhmccli.py", line 29, in <module>
    from ._helper import CmdContext, GENERAL_OPTIONS_METAVAR, REPL_HISTORY_FILE, \
  File "/Users/maiera/Projects/zhmcclient/repos/zhmccli/zhmccli/_helper.py", line 32, in <module>
    import pyreadline as readline  # noqa: F401

Analysis

Looking at the code, the pyreadline package is supposed to be used only on Windows, and that part of the code was reached because the readline package failed to import.

Importing the readline package fails as follows:

ImportError: No module named pyreadline
(zhmc27) Andreass-MacBook-Pro-2:zhmccli maiera$ python -c "import readline"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: dlopen(/Users/maiera/virtualenvs/zhmc27/lib/python2.7/lib-dynload/readline.so, 2): Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
  Referenced from: /Users/maiera/virtualenvs/zhmc27/lib/python2.7/lib-dynload/readline.so
  Reason: image not found

On my system, this directory contains version 8 of the readline DLL, but not version 7 that is expected by the Python readline package:

(zhmc27) Andreass-MacBook-Pro-2:zhmccli maiera$ ls -l /usr/local/opt/readline/lib/
-r--r--r--   1 maiera  staff   40396 Feb 11 14:18 libhistory.8.0.dylib
lrwxr-xr-x   1 maiera  staff      20 Dec 19 22:07 libhistory.8.dylib -> libhistory.8.0.dylib
-r--r--r--   1 maiera  staff   45880 Dec 19 22:07 libhistory.a
lrwxr-xr-x   1 maiera  staff      20 Dec 19 22:07 libhistory.dylib -> libhistory.8.0.dylib
-rw-r--r--   1 maiera  staff  239252 Feb 11 14:18 libreadline.8.0.dylib
lrwxr-xr-x   1 maiera  staff      21 Dec 19 22:07 libreadline.8.dylib -> libreadline.8.0.dylib
-r--r--r--   1 maiera  staff  405848 Dec 19 22:07 libreadline.a
lrwxr-xr-x   1 maiera  staff      21 Dec 19 22:07 libreadline.dylib -> libreadline.8.0.dylib
drwxr-xr-x   3 maiera  staff      96 Feb 11 14:18 pkgconfig

Homebrew knows that it has a version 8 of its readline package installed, but does not know about a version 7.

It is not clear what caused this to fail, but presumably something changed in the system that caused this.

Execution environment

  • zhmccli version: master
  • zhmcclient version: 0.22.0
  • Operating system (type+version): MacOS High Sierra
  • HMC version: 2.14.0 (but it fails already with zhmc --version)
  • CPC version: 2.14.0

Properties missing in partition create & update commands

Copied from zhmcclient/python-zhmcclient#260:

There is a number of properties for DPM partitions that are supported for partition creation and for partition updating by the HMC version 2.13.1, and also at the zhmcclient API, but are not yet supported by the zhmc CLI and its "partition create" and "partition update" commands.

TODO: Determine list of properties that are still missing.

Support for StorageGroupTemplate and StorageVolumeTemplate command groups (DPM mode)

Overview

Add support for the resources StorageGroupTemplate and StorageVolumeTemplate (which are supported in zhmcclient).

Proposal

New command group and commands for storage group templates:

  • storagegrouptemplate create - Create a storage group template
  • storagegrouptemplate list - List the storage group templates
  • storagegrouptemplate show SGT - Show the details of a storage group template
  • storagegrouptemplate delete SGT - Delete a storage group template
  • storagegrouptemplate update SGT - Update properties of a storage group template

New command group and commands for storage volume templates:

  • storagevolumetemplate create SGT - Create a storage volume template in a storage group template
  • storagevolumetemplate list SGT - List the storage volume templates in a storage group template
  • storagevolumetemplate show SGT SVT - Show the details of a storage volume template
  • storagevolumetemplate delete SGT SVT - Delete a storage volume template
  • storagevolumetemplate update SGT SVT - Update properties of a storage volume template

CLI requests password for every command in REPL mode

Copied from zhmcclient/python-zhmcclient#176 (opened by leopoldjuergen):

Actual behavior

(demo) vagrant@vagrant-ubuntu-trusty-64:~$ zhmc -h ZHMC_IP -u ZHMC_USER
> cpc list
-Enter password (for user pedebug at HMC ZHMC_IP): 
|+----------+------------------+
| name     | status           |
|----------+------------------|
| P000TEST | service-required |
+----------+------------------+
> cpc list
Enter password (for user pedebug at HMC ZHMC_IP):

Expected behavior

Password should be provided once.

Execution environment

  • zhmcclient version: 0.9.0
  • Operating system (type+version): Ubuntu 14.04

docs: inconsistent naming of credential variables

Most of the time, the docs talk about ZHMC_USER and ZHMC_HOST but on few occasions about hmc_userid and hmc_host. I'm not sure if it is a bug, it only confused me a little.
The examples work if you read them carefully, but a bit more consistency might be helpful.

NOTE: This report is about the naming, and not about the upper-case/lower-case difference.

Actual behavior

.. code-block:: text

    $ hmc_host="<IP address or hostname of the HMC>"
    $ hmc_userid="<userid on that HMC>"
    $ zhmc -h $hmc_host -u $hmc_userid cpc list
    Enter password (for user <hmc_user> at HMC <hmc_host>): .......
    +----------+------------------+
    | name     | status           |
    |----------+------------------|
    | P000S67B | service-required |
    +----------+------------------+

Expected behavior

.. code-block:: text

    $ zhmc_host="<IP address or hostname of the HMC>"
    $ zhmc_user="<userid on that HMC>"
    $ zhmc -h $zhmc_host -u $zhmc_user cpc list
    Enter password (for user <zhmc_user> at HMC <zhmc_host>): .......
    +----------+------------------+
    | name     | status           |
    |----------+------------------|
    | P000S67B | service-required |
    +----------+------------------+

Execution environment

  • zhmccli version: 0.18.0
  • zhmcclient version: 0.19.0
  • Operating system (type+version): N/A
  • HMC version: /NA
  • CPC version: N/A

Add support for Python 3.7

Actual behavior

Currently zhmccli is tested and marked as supported up to Python 3.6

Expected behavior

Add Python 3.7

Execution environment

  • zhmccli version:
  • zhmcclient version:
  • Operating system (type+version):
  • HMC version:
  • CPC version:

Support Activation Profiles in zhmc CLI

Copied from zhmcclient/python-zhmcclient#115, and reduced to only the open items:

Actual behavior

The zhmc CLI does not support a number of resources that are supported by the underlying zhmcclient library:

  • Activation profiles

Expected behavior

Have support for these resources in the zhmc CLI.

Execution environment

  • zhmcclient version: 0.5.1.dev37
  • Operating system (type+version): RHEL 7.2 (issue applies to any)

CLI: No way to set properties to null

Copied from zhmcclient/python-zhmcclient#426 (opened by simon-spinner):

Actual behavior

There is no way to set properties of a resource to null (at least that I am aware of):
nic update --vlan-id '' SSPSE test-ssc nic
--> Error: Invalid value for "--vlan-id": is not a valid integer
nic update --vlan-id SSPSE test-ssc nic1
--> Error: Invalid value for "--vlan-id": SSPSE is not a valid integer
nic update --vlan-id null SSPSE test-ssc nic1
--> Error: Invalid value for "--vlan-id": null is not a valid integer

Expected behavior

Certain fields in the DPM API allow for null values (e.g., the field vlan-id of a SSC management nic). If this field contains a value, it can be cleared by explicitly sending a JSON null value (see SPEC at http://www.json.org/) in an update request. There should be a way to specify null values in zhmc for such fields.

Execution environment

  • zhmcclient version: 0.16.0
  • Operating system (type+version): Ubuntu LTS 16.04
  • HMC version:
  • CPC version:

Add resource names for resource URIs in show commands

Most resources have some URI-like properties. The current show commands simply show these properties as URI values. This is not very useful, since resources are identified by name in the zhmc universe.

This issue proposes to add artificial properties with the resource names. For example, when a partition object has an array property named nic-uris, it would get an artificial property nic-names that has the corresponding (index-corelated) names of these NICs.

Support for start/stop of CPC

Overview

Add support for start/stop of a CPC. (This is supported by zhmcclient 0.28)

Proposal

New commands for CPCs:

  • cpc start CPC - Start a CPC
  • cpc stop CPC - Stop a CPC

Bad line breaks when partition has more than one NIC

Copied from zhmcclient/python-zhmcclient#179 (opened by scheuran):

Actual behavior

Show the partition details of an Partition that has at least 2 NICs attached:

zhmc partition show

The zhmccli does not do any line breaks. This gets very ugly when the *uri fields (list of URIs).
As there's no line break, the terminal breaks the line - which does not look nice at all!

Expected behavior

Ideally the zhmccli would make a line break after each uri list item.

Execution environment

  • zhmcclient version: 0.9.0
  • Operating system (type+version): ubuntu14 (x86)

Support for export/import profiles (classic mode)

Overview

Add support for all types of Activation Profiles and CPC profile import/export functionality supported in zhmcclient 0.28.

Proposal

New command group and commands for reset activation profiles:

  • resetprofile list CPC - List the reset activation profiles in a CPC
  • resetprofile show CPC PROFILE - Show the details of a reset activation profile
  • resetprofile update CPC PROFILE - Update properties of a reset activation profile

New command group and commands for image activation profiles:

  • imageprofile list CPC - List the image activation profiles in a CPC
  • imageprofile show CPC PROFILE - Show the details of an image activation profile
  • imageprofile update CPC PROFILE - Update properties of an image activation profile

New command group and commands for load activation profiles:

  • loadprofile list CPC - List the load activation profiles in a CPC
  • loadprofile show CPC PROFILE - Show the details of a load activation profile
  • loadprofile update CPC PROFILE - Update properties of a load activation profile

New commands for CPCs:

  • cpc import-profiles CPC - Import activation and system activity profiles from SE hard drive
  • cpc export-profiles CPC - Export activation and system activity profiles to SE hard drive

Flake8 3.5.0 fails with bare except and ambiguous identifiers

Actual behavior

Flake8 3.5.0 (released on 2017-10-23) introduces new checks:

  • Start using new PyCodestyle checks for bare excepts and ambiguous identifier (See also GitLab#361)

These new checks cause zhmccli to fail in the following places:

zhmccli/_helper.py:578:9: E722 do not use bare except'
zhmccli/zhmccli.py:92:22: E741 ambiguous variable name 'l'

Expected behavior

No flake8 failures reported.

Execution environment

  • zhmccli version: 0.18.1.devX
  • zhmcclient version: 0.18.1.devX
  • Operating system (type+version): RHEL 7.3
  • HMC version: N/A
  • CPC version: N/A

test_option_logdest() fails with OSError "Bad file descriptor" on Travis CI with py3.5/3.6

Actual behavior

The test function test_option_logdest() when invoked with logdest_value='syslog' fails with the following exception when attempting to write a log message:

       Traceback (most recent call last):
         File "/opt/python/3.5.5/lib/python3.5/logging/handlers.py", line 924, in emit
           self.socket.send(msg)
       OSError: [Errno 9] Bad file descriptor

This happens only on the Travis CI (currently using Ubuntu 14.04) and only with Python 3.5 and 3.6. An example Travis build that fails with this error, is here: https://travis-ci.org/zhmcclient/zhmccli/builds/354989881

It does not happen on the Travis CI with Python 2.7 or 3.4, and it does not happen on the Appveyor CI (using CygWin) with Python 2.7 and 3.6.

On a local Ubuntu 16.04, the error does not happen with Python 3.6.

Expected behavior

Should work.

Execution environment

  • zhmccli version: 0.18.1.dev (master)
  • zhmcclient version: 0.19.0 (as released)
  • Operating system (type+version): Ubuntu 14.04 (Travis CI)
  • HMC version: N/A
  • CPC version: N/A

Support for temporary CPU capacity

Overview

Add support for managing temporary capacity of a CPC, as supported in zhmcclient 0.28.

Proposal

New command group and commands for storage groups:

  • cpc add-capacity CPC - Add temporary CPU capacity
  • cpc remove-capacity CPC - Remove temporary CPU capacity

CLI: Specifying --virtual-switch when creating NICs backed by OSA is cumbersome

Copied from zhmcclient/python-zhmcclient#402:

Actual behavior

When creating a NIC, the zhmc CLI currently requires the use of the --adapter and --port options for ROCE adapters, and the use of the --virtual-switch option for OSA and Hipersockets adapters.

Determining the name of the correct virtual switch is cumbersome because (without a naming convention that allows identifying the adapter) the CLI user has to list all virtual switches and needs to show each of them until the one with the desired backing adapter is found. An additional complexity is that the backing adapter is shown in the virtual switch properties only with its URI, so the user needs to compare URIs in this process.

Expected behavior

In the zhmc-ansible project, we have eliminated the virtual switch from the configuration input parameters, and both ROCE and OSA/HS adapters can be configured by specifying adapter name and port index.

It is suggested to implement a similar approach also for the CLI, i.e. to add support for using the --adapter and --port options also for OSA and Hipersockets adapters.

For backwards compatibility, we should continue supporting the --virtual-switch option for OSA and Hipersockets adapters. Specifying both the old and new options should be rejected.

Execution environment

  • zhmcclient version: 0.14.0
  • Operating system (type+version): any
  • HMC version: any
  • CPC version: any

Support for reset-clear command for LPARs (classic mode)

Overview

Add support for reset-clear command for LPARs (classic mode).
This is supported by zhmcclient 0.28 in Lpar.reset_clear().

Proposal

Add new commands for LPARs:

  • lpar reset-clear CPC LPAR - Reset an LPAR with clearing of pending interruptions, channel subsystem, and processors

Improve operation timeout behavior of commands that wait for completion

The zhmc command invokes several zhmcclient functions with wait_for_completion=True. Here is a source code grep:

zhmccli/_cmd_lpar.py:        lpar.activate(wait_for_completion=True, **options)
zhmccli/_cmd_lpar.py:        lpar.deactivate(wait_for_completion=True, **options)
zhmccli/_cmd_lpar.py:        lpar.load(load_address, wait_for_completion=True, **options)
zhmccli/_cmd_lpar.py:        lpar.stop(wait_for_completion=True, **options)
zhmccli/_cmd_lpar.py:        lpar.psw_restart(wait_for_completion=True, **options)
zhmccli/_cmd_lpar.py:        lpar.scsi_load(load_address, wwpn, lun, wait_for_completion=True,
zhmccli/_cmd_lpar.py:        lpar.scsi_dump(load_address, wwpn, lun, wait_for_completion=True,
zhmccli/_cmd_partition.py:        partition.start(wait_for_completion=True)
zhmccli/_cmd_partition.py:        partition.stop(wait_for_completion=True)
zhmccli/_cmd_partition.py:                parameters=op_properties, wait_for_completion=True,
zhmccli/_cmd_partition.py:                parameters=properties, wait_for_completion=True,
zhmccli/_cmd_storagegroup.py:            force_restart=force_restart, wait_for_completion=True)

In all those cases, the zhmccli code does not specify the operation_timeout parameter. Not specifying it causes the retry/timeout config of the zhmcclient.Session object to be used, which in zhmccli currently cannot be influenced by the user and uses the default retry/timeout config of the zhmcclient package which defines the operation timeout to be 3600s.

In addition, if such a command gets an operation timeout despite its long timeout, that only caues the zhmc command to no longer wait for completion; the associated asynchronous job keeps on running on the HMC and could succeed or fail.
Currently, zhmc does not provide a means to list or manage such asynchronous jobs on the HMC.

Here are possible improvements:

  • Add a global option --operation-timeout that would allow specifying a non-default operation timeout.
  • Add a command group that allows managing asynchronous jobs on the HMC, supporting listing, showing, killing, and waiting for completion.

Dump option for the DPM mode

Actual behavior

Currently it is only possible to dump a LPAR that are not in the DPM mode. You can do it with "lpar load..." For partition option is it not available. On the HMC GUI is it possible.

Expected behavior

Dump also a DPM system.

Execution environment

  • zhmccli version: current master
  • zhmcclient version: -
  • Operating system (type+version): fedora 31
  • HMC version: -
  • CPC version: all

Support for PSW restart of a partition (DPM mode)

Overview

Add support for PSW restart of a partition (DPM mode). (This is supported by zhmcclient 0.28)

Proposal

New commands for partitions:

  • partition psw-restart CPC PARTITION - PST restart of a partition

Support for changing the crypto type for crypto adapters (DPM mode)

Overview

Add support for changing the crypto type for crypto adapters (DPM mode). (This is supported by zhmcclient 0.28)

Proposal

Update the functionality of the existing adapter update CPC ADAPTER command to change the 'crypto-type' property by calling zhmcclient.Adapter.change_crypto_type().

Unit tests for zhmc CLI

Copied from zhmcclient/python-zhmcclient#114.

Actual behavior

The zhmc CLI has no automated test concept.

Expected behavior

Have an automated test environment for the zhmc CLI.

Execution environment

  • zhmcclient version: 0.5.1.dev37
  • Operating system (type+version): RHEL 7.2 (issue applies to any)

Pressing <TAB> on the CLI causes python exception

Actual behavior

Start the CLI, press TAB, get a python exception.

~$ zhmc -h $hmc_host -u $hmc_userid
Enter 'help' for help, <CTRL-D> or ':q' to exit.

Unhandled exception in event loop:
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/eventloop/posix.py", line 154, in _run_task
    t()
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/eventloop/context.py", line 115, in new_func
    return func(*a, **kw)
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/application/application.py", line 376, in redraw
    self._redraw()
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/application/application.py", line 444, in _redraw
    self.renderer.render(self, self.layout)
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/renderer.py", line 578, in render
    screen.draw_all_floats()
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/layout/screen.py", line 232, in draw_all_floats
    functions[0][1]()
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/layout/containers.py", line 700, in _draw_float
    width = fl.content.preferred_width(write_position.width).preferred
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/layout/containers.py", line 2173, in preferred_width
    return self.content.preferred_width(max_available_width)
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/layout/containers.py", line 1339, in preferred_width
    dont_extend=self.dont_extend_width())
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/layout/containers.py", line 1380, in _merge_dimensions
    preferred = get_preferred()
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/layout/containers.py", line 1328, in preferred_content_width
    max_available_width - total_margin_width)
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/layout/menus.py", line 46, in preferred_width
    menu_meta_width = self._get_menu_meta_width(500, complete_state)
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/layout/menus.py", line 110, in _get_menu_meta_width
    if self._show_meta(complete_state):
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/layout/menus.py", line 94, in _show_meta
    return any(c.display_meta_text for c in complete_state.completions)
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/layout/menus.py", line 94, in <genexpr>
    return any(c.display_meta_text for c in complete_state.completions)
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/completion/base.py", line 92, in display_meta_text
    return fragment_list_to_text(self.display_meta)
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/completion/base.py", line 86, in display_meta
    return to_formatted_text(self._display_meta)
  File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/formatted_text/base.py", line 50, in to_formatted_text
    'HTML, ANSI or a FormattedText instance. Got %r' % value)

Exception No formatted text. Expecting a unicode object, HTML, ANSI or a FormattedText instance. Got 'Hostname or IP address of the HMC (Default: ZHMC_HOST environment variable).'
Press ENTER to continue...                                                                                                                                                                                                                                                                                                                          

Expected behavior

Get a list of available commands.

Execution environment

  • zhmccli version: zhmc, version 0.19.0
  • zhmcclient version: zhmcclient, version 0.22.0
  • Operating system (type+version): Ubuntu 18.04.2 LTS
  • HMC version:
  • CPC version:

Support for managing crypto attachments of a partition (DPM mode)

Overview

Add support for managing crypto attachments (incl. zeroize) of a partition (DPM mode) (This is supported by zhmcclient 0.28)

Proposal

New commands for partitions for managing the assignment of crypto adapters:

  • partition list-crypto-adapters CPC PARTITION - List crypto adapters of a partition
  • partition add-crypto-adapters CPC PARTITION - Add crypto adapters to a partition
  • partition remove-crypto-adapters CPC PARTITION - Remove crypto adapters from a partition

New commands for partitions for managing the assignment of crypto domains:

  • partition list-crypto-domains CPC PARTITION - List crypto domains of a partition
  • partition add-crypto-domains CPC PARTITION - Assign crypto domains to a partition
  • partition remove-crypto-domains CPC PARTITION - Remove crypto domains from a partition
  • partition update-crypto-domains CPC PARTITION - Update access mode of crypto domains of a partition

Note, the following has been moved out into separate issues:

  • partition zeroize-crypto-domains CPC PARTITION - Zeroize crypto domains of a partition - issue #502

Support for user-related command groups

Overview

Add support for user-related command groups. They are all supported in zhmcclient.

Proposal

New commands for users: - DONE in PR #245

  • user create - Create a user
  • user list - List the users
  • user show USER - Show the details of a user
  • user delete USER - Delete a user
  • user update USER - Update properties of a user
  • user add-role USER - Add a user role to a user
  • user remove-role USER - Remove a user role from a user

New commands for user patterns:

  • userpattern create - Create a user pattern
  • userpattern list - List the user patterns
  • userpattern show PATTERN - Show the details of a user pattern
  • userpattern delete PATTERN - Delete a user pattern
  • userpattern update PATTERN - Update properties of a user pattern

New commands for user roles: - DONE in PR #245

  • userrole create - Create a user role
  • userrole list - List the user roles
  • userrole show ROLE - Show the details of a user role
  • userrole delete ROLE - Delete a user role
  • userrole update ROLE - Update properties of a user role
  • userrole add-permission ROLE - Add a task or object permission to a user role
  • userrole remove-permission ROLE - Remove a task or object permission from a user role

New commands for password rules:

  • passwordrule create - Create a password rule
  • passwordrule list - List the password rules
  • passwordrule show RULE - Show the details of a password rule
  • passwordrule delete RULE - Delete a password rule
  • passwordrule update RULE - Update properties of a password rule

New commands for LDAP Server Definitions:

  • ldapserver create - Create an LDAP server definition
  • ldapserver list - List the LDAP server definitions
  • ldapserver show SERVER - Show the details of an LDAP server definition
  • ldapserver delete SERVER - Delete an LDAP server definition
  • ldapserver update SERVER - Update properties of an LDAP server definition

New commands for Tasks:

  • task list - List the tasks
  • task show TASK - Show the details of a task

'zhmc partition console' asks for password again although session already created

Copied from zhmcclient/python-zhmcclient#308 (opened by leopoldjuergen):

Actual behavior

$ zhmc cpc list
+----------+------------------+
| name | status |
|----------+------------------|
| P000S67B | service-required |
+----------+------------------+
$ zhmc partition console P000S67B UbuntuDemo2
Enter password (for user pedebug at HMC 9.152.151.49):

Expected behavior

No password request

Execution environment

  • zhmcclient version: zhmc, version 0.13.1.dev40
  • Operating system (type+version): Ubuntu 14.04
  • HMC version: 2.13.1
  • CPC version:

Support for CPC & partition firmware features

Overview

Add support for firmware features at the CPC & partition levels, as supported by zhmcclient 0.28.0.

Proposal

New commands for CPCs:

  • cpc list-features CPC - List the features of a CPC

New commands for partitions:

  • partition list-features CPC PARTITION - List the features of a partition

Add support for Python 3.8

Actual behavior

Currently zhmccli is tested and marked as supported up to Python 3.6

Expected behavior

Add support for Python 3.8

Execution environment

  • zhmccli version:
  • zhmcclient version:
  • Operating system (type+version):
  • HMC version:
  • CPC version:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.