Skip to content

Commit

Permalink
added support for lpar start command
Browse files Browse the repository at this point in the history
added missing support for lpar start group command

Signed-off-by: Saiprasanna Boyina <[email protected]>
  • Loading branch information
Saiprasanna Boyina authored and andy-maier committed Jan 28, 2024
1 parent b857389 commit 1d05c04
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ Released: not yet
* Test: Added Python 3.8 with latest package levels to normal tests because
that is now the minimum version to run Sphinx. (related to issue #547)

* Added support for Lpar start command (issue #500)

**Cleanup:**

* Increased versions of GitHub Actions plugins to increase node.js runtime
Expand Down
33 changes: 33 additions & 0 deletions zhmccli/_cmd_lpar.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,24 @@ def lpar_console(cmd_ctx, cpc, lpar, **options):
cmd_ctx.execute_cmd(lambda: cmd_lpar_console(cmd_ctx, cpc, lpar, options))


@lpar_group.command('start', options_metavar=COMMAND_OPTIONS_METAVAR)
@click.argument('CPC', type=str, metavar='CPC')
@click.argument('LPAR', type=str, metavar='LPAR')
@click.option('--allow-status-exceptions', is_flag=True, required=False,
help='Allow status "exceptions" as a valid end status.')
@add_options(ASYNC_TIMEOUT_OPTIONS)
@click.pass_obj
def lpar_start(cmd_ctx, cpc, lpar, **options):
"""
Start the processors for processing instructions of an LPAR.
In addition to the command-specific options shown in this help text, the
general options (see 'zhmc --help') can also be specified right after the
'zhmc' command name.
"""
cmd_ctx.execute_cmd(lambda: cmd_lpar_start(cmd_ctx, cpc, lpar, options))


@lpar_group.command('stop', options_metavar=COMMAND_OPTIONS_METAVAR)
@click.argument('CPC', type=str, metavar='CPC')
@click.argument('LPAR', type=str, metavar='LPAR')
Expand Down Expand Up @@ -1125,6 +1143,21 @@ def cmd_lpar_console(cmd_ctx, cpc_name, lpar_name, options):
"{exc}: {msg}".format(exc=exc.__class__.__name__, msg=exc))


def cmd_lpar_start(cmd_ctx, cpc_name, lpar_name, options):
# pylint: disable=missing-function-docstring

client = zhmcclient.Client(cmd_ctx.session)
lpar = find_lpar(cmd_ctx, client, cpc_name, lpar_name)

try:
lpar.start(wait_for_completion=True, **options)
except zhmcclient.Error as exc:
raise click_exception(exc, cmd_ctx.error_format)

cmd_ctx.spinner.stop()
click.echo("Starting of LPAR '{p}' is complete.".format(p=lpar_name))


def cmd_lpar_stop(cmd_ctx, cpc_name, lpar_name, options):
# pylint: disable=missing-function-docstring

Expand Down

0 comments on commit 1d05c04

Please sign in to comment.