Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for sending OS command to LPAR/partition #938

Closed
andy-maier opened this issue Mar 17, 2024 · 1 comment · Fixed by #1033
Closed

Support for sending OS command to LPAR/partition #938

andy-maier opened this issue Mar 17, 2024 · 1 comment · Fixed by #1033

Comments

@andy-maier
Copy link
Member

andy-maier commented Mar 17, 2024

Add support for sending an OS command to the OS running in an LPAR or partition, using the existing zhmcclient Lpar.send_os_command() and Partition.send_os_command() methods.

That support will not be idempotent.

This had been requested earlier in issue #565.

Here is a way to do that today, using the Ansible uri module to issue the HMC operation directly, and a session ID from the ibm_zhmc.zhmc_session module.

- name: Create an HMC session
  zhmc_session:
    hmc_host: "{{ my_hmc_host }}"
    hmc_auth:
      userid: "{{ my_hmc_userid }}"
      password: "{{ my_hmc_password }}"
      verify: false
    action: create
  register: session
  no_log: true

- name: "Send OS command {{ my_cmd }}"
  ansible.builtin.uri:
    url: "{{ session.hmc_host }}:6794{{ lpar_uri }}/operations/send-os-cmd"
    method: POST
    body:
      is-priority: false
      operating-system-command-text: "{{ my_cmd }}"
    headers:
      x-api-session: "{{ session.hmc_auth.session_id }}"
    validate_certs: no
    status_code: 204

- name: Delete the HMC session
  zhmc_session:
    hmc_host: "{{ session.hmc_host }}"  
    hmc_auth: "{{ session.hmc_auth }}"
    action: delete
@andy-maier andy-maier self-assigned this Mar 17, 2024
@andy-maier andy-maier added this to the 1.9.0 milestone Mar 17, 2024
andy-maier added a commit that referenced this issue Jul 12, 2024
Details:

* Added new modules 'zhmc_lpar_command' and 'zhmc_partition_command' for
  sending a command to the OS running in an LPAR or partition. (issue #938)

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
andy-maier added a commit that referenced this issue Jul 12, 2024
Details:

* Added new modules 'zhmc_lpar_command' and 'zhmc_partition_command' for
  sending a command to the OS running in an LPAR or partition. (issue #938)

* In support of the above, added a new class 'NotificationThread' for
  running the message receiver thread.

* Enabled notification logging via the 'zhmcclient.jms' Python logger.
  (related to issue #938)

* Fixed typos in the documentation of the 'zhmc_lpar_messages' and
  'zhmc_partition_messages' modules.

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
@andy-maier andy-maier linked a pull request Jul 12, 2024 that will close this issue
andy-maier added a commit that referenced this issue Jul 13, 2024
Details:

* Added new modules 'zhmc_lpar_command' and 'zhmc_partition_command' for
  sending a command to the OS running in an LPAR or partition. (issue #938)

* In support of the above, added a new class 'NotificationThread' for
  running the message receiver thread.

* Enabled notification logging via the 'zhmcclient.jms' Python logger.
  (related to issue #938)

* Fixed typos in the documentation of the 'zhmc_lpar_messages' and
  'zhmc_partition_messages' modules.

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
andy-maier added a commit that referenced this issue Jul 13, 2024
Details:

* Added new modules 'zhmc_lpar_command' and 'zhmc_partition_command' for
  sending a command to the OS running in an LPAR or partition. (issue #938)

* In support of the above, added a new class 'NotificationThread' for
  running the message receiver thread.

* Enabled notification logging via the 'zhmcclient.jms' Python logger.
  (related to issue #938)

* Fixed typos in the documentation of the 'zhmc_lpar_messages' and
  'zhmc_partition_messages' modules.

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
andy-maier added a commit that referenced this issue Jul 13, 2024
Details:

* Added new modules 'zhmc_lpar_command' and 'zhmc_partition_command' for
  sending a command to the OS running in an LPAR or partition. (issue #938)

* In support of the above, added a new class 'NotificationThread' for
  running the message receiver thread.

* Enabled notification logging via the 'zhmcclient.jms' Python logger.
  (related to issue #938)

* Fixed typos in the documentation of the 'zhmc_lpar_messages' and
  'zhmc_partition_messages' modules.

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
andy-maier added a commit that referenced this issue Jul 13, 2024
Details:

* Added new modules 'zhmc_lpar_command' and 'zhmc_partition_command' for
  sending a command to the OS running in an LPAR or partition. (issue #938)

* In support of the above, added a new class 'NotificationThread' for
  running the message receiver thread.

* Enabled notification logging via the 'zhmcclient.jms' Python logger.
  (related to issue #938)

* Fixed typos in the documentation of the 'zhmc_lpar_messages' and
  'zhmc_partition_messages' modules.

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
andy-maier added a commit that referenced this issue Jul 13, 2024
Details:

* Added new modules 'zhmc_lpar_command' and 'zhmc_partition_command' for
  executing an OS consosle command in the OS running in an LPAR or
  partition. (issue #938)

* In support of the above, added a new class 'NotificationThread' for
  running the message receiver thread.

* Enabled notification logging via the 'zhmcclient.jms' Python logger.
  (related to issue #938)

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
@andy-maier
Copy link
Member Author

ScYang1991: PR #1033 is adding support for executing OS consosle commands in LPARs and partitions. The new modules return the command output, so you do not have to get and compare the messages in the playbook.

andy-maier added a commit that referenced this issue Jul 18, 2024
Details:

* Added new modules 'zhmc_lpar_command' and 'zhmc_partition_command' for
  executing an OS consosle command in the OS running in an LPAR or
  partition. (issue #938)

* In support of the above, added a new class 'NotificationThread' for
  running the message receiver thread.

* Enabled notification logging via the 'zhmcclient.jms' Python logger.
  (related to issue #938)

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
andy-maier added a commit that referenced this issue Jul 18, 2024
* Added new modules for executing OS console commands

Details:

* Added new modules 'zhmc_lpar_command' and 'zhmc_partition_command' for
  executing an OS consosle command in the OS running in an LPAR or
  partition. (issue #938)

* In support of the above, added a new class 'NotificationThread' for
  running the message receiver thread.

* Enabled notification logging via the 'zhmcclient.jms' Python logger.
  (related to issue #938)

Signed-off-by: Andreas Maier <maiera@de.ibm.com>

* Squash: Added disclaimer notes

Signed-off-by: Andreas Maier <maiera@de.ibm.com>

---------

Signed-off-by: Andreas Maier <maiera@de.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant