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

CRAYSAT-1866, CRAYSAT-1871: Backport sat status fixes to release/3.25 for CSM 1.5 and SAT 2.6 #232

Merged
merged 2 commits into from
Jul 3, 2024

Conversation

haasken-hpe
Copy link
Contributor

Summary and Scope

Backport the following changes to release/3.25 for inclusion in CSM 1.5 and SAT 2.6.

Issues and Related PRs

Testing

See linked PRs above.

Risks and Mitigations

See linked PRs above.

Pull Request Checklist

  • Version number(s) incremented, if applicable
  • Copyrights updated
  • License file intact
  • Target branch correct
  • CHANGELOG.md updated
  • Testing is appropriate and complete, if applicable
  • HPC Product Announcement prepared, if applicable

Fix the `sat status` command to only make the necessary API requests to
CSM services. Specifically, the `BOSStatusModule`, `SLSStatusModule`,
and the `CFSStatusModule`, only apply to components of type `Node`, and
so they should not be used when getting status of components of other
types, e.g. `NodeBMC`. Using those modules in that case results in many
unneccessary API requests to BOS, SLS, and CFS.

Simplify code a little by making `component_types` a required argument
for the `get_relevant_modules` and `get_poopulated_rows` methods. It was
confusing to have a lot of code that handled `None` when it really would
never be `None` because the corresponding argparse argument had a
default value of `["Node"]`.

Test Description:
Unit tests pass. Tested by running `sat status` against drax with
debug logging enabled and different values for `--types`. E.g. tested with `--types
NodeBMC RouterBMC` and verified that no requests were made to BOS, CFS,
or SLS. Then tested with `--types Node` (the default) and `--types Node
NodeBMC` to verify that requests were made to BOS, CFS, and SLS.

(cherry picked from commit 0d692fe)
The `SLSStatusModule` used by `sat status` has only `Node` as its
`component_types`, meaning information from SLS is only added for nodes.
The query, however, obtains SLS data for all components known to SLS.
Modify this query to use the `/search/hardware` endpoint of SLS with
`type=comptype_node` as a query parameter to limit the results to only
the node components.

Test Description:
Ran `sat status` from my macbook against drax with debug logging enabled
to verify API requests made. Executed with multiple option combinations,
including:

* `--types Node`
* `--types NodeBMC`
* `--types Node NodeBMC`
* `--types all`
* Same as above but with addition of `--sls-fields` option

(cherry picked from commit 67cd146)
@haasken-hpe haasken-hpe changed the title Craysat 1866 craysat 1871 3.25 backport CRAYSAT-1866, CRAYSAT-1871: Backport sat status fixes to release/3.25 for CSM 1.5 and SAT 2.6 #231 Jul 3, 2024
@haasken-hpe haasken-hpe changed the title CRAYSAT-1866, CRAYSAT-1871: Backport sat status fixes to release/3.25 for CSM 1.5 and SAT 2.6 #231 CRAYSAT-1866, CRAYSAT-1871: Backport sat status fixes to release/3.25 for CSM 1.5 and SAT 2.6 Jul 3, 2024
@haasken-hpe haasken-hpe merged commit 68c3fdd into release/3.25 Jul 3, 2024
3 checks passed
@haasken-hpe haasken-hpe deleted the CRAYSAT-1866-CRAYSAT-1871-3.25-backport branch July 3, 2024 18:44
@haasken-hpe
Copy link
Contributor Author

The resulting build was sanity tested on drax as follows:

ncn-m001:~/haasken # sat --version
sat 3.25.13
ncn-m001:~/haasken # sat --loglevel debug status --type NodeBMC
...
DEBUG: Issuing GET request to URL 'https://api-gw-service-nmn.local/apis/smd/hsm/v2/State/Components'
DEBUG: Received response to GET request to URL 'https://api-gw-service-nmn.local/apis/smd/hsm/v2/State/Components?type=NodeBMC' with status code: '200': OK
+--------------+---------+-------+------+---------+------+-------+----------+
| xname        | Type    | State | Flag | Enabled | Arch | Class | Net Type |
+--------------+---------+-------+------+---------+------+-------+----------+
| x3000c0s3b0  | NodeBMC | Ready | OK   | True    | X86  | River | Sling    |
...
+--------------+---------+-------+------+---------+------+-------+----------+
ncn-m001:~/haasken # sat --loglevel debug status --type Node
...
DEBUG: Issuing GET request to URL 'https://api-gw-service-nmn.local/apis/smd/hsm/v2/State/Components'
DEBUG: Received response to GET request to URL 'https://api-gw-service-nmn.local/apis/smd/hsm/v2/State/Components?type=Node' with status code: '200': OK
DEBUG: Issuing GET request to URL 'https://api-gw-service-nmn.local/apis/sls/v1/search/hardware'
DEBUG: Received response to GET request to URL 'https://api-gw-service-nmn.local/apis/sls/v1/search/hardware?type=comptype_node' with status code: '200': OK
DEBUG: Issuing GET request to URL 'https://api-gw-service-nmn.local/apis/cfs/v2/components'
DEBUG: Received response to GET request to URL 'https://api-gw-service-nmn.local/apis/cfs/v2/components' with status code: '200': OK
DEBUG: Issuing GET request to URL 'https://api-gw-service-nmn.local/apis/bos/v2/components'
DEBUG: Received response to GET request to URL 'https://api-gw-service-nmn.local/apis/bos/v2/components' with status code: '200': OK
DEBUG: Issuing GET request to URL 'https://api-gw-service-nmn.local/apis/bos/v2/sessions/a39946a0-79ae-48be-a4f6-1a75a25f92d2'
DEBUG: Received response to GET request to URL 'https://api-gw-service-nmn.local/apis/bos/v2/sessions/a39946a0-79ae-48be-a4f6-1a75a25f92d2' with status code: '200': OK
DEBUG: Issuing GET request to URL 'https://api-gw-service-nmn.local/apis/bos/v2/sessions/a758428c-34f8-46e2-b817-c47e182e686c'
DEBUG: Received response to GET request to URL 'https://api-gw-service-nmn.local/apis/bos/v2/sessions/a758428c-34f8-46e2-b817-c47e182e686c' with status code: '404': Not Found
DEBUG: Could not retrieve BOS session a758428c-34f8-46e2-b817-c47e182e686c: Failed to get BOS session a758428c-34f8-46e2-b817-c47e182e686c: GET request to URL 'https://api-gw-service-nmn.local/apis/bos/v2/sessions/a758428c-34f8-46e2-b817-c47e182e686c' failed with status code 404: Not Found. Session could not found. Detail: Session a758428c-34f8-46e2-b817-c47e182e686c could not be found
DEBUG: Issuing GET request to URL 'https://api-gw-service-nmn.local/apis/bos/v2/sessions/38ec90cc-a970-4411-9e4f-e12046205f53'
DEBUG: Received response to GET request to URL 'https://api-gw-service-nmn.local/apis/bos/v2/sessions/38ec90cc-a970-4411-9e4f-e12046205f53' with status code: '404': Not Found
DEBUG: Could not retrieve BOS session 38ec90cc-a970-4411-9e4f-e12046205f53: Failed to get BOS session 38ec90cc-a970-4411-9e4f-e12046205f53: GET request to URL 'https://api-gw-service-nmn.local/apis/bos/v2/sessions/38ec90cc-a970-4411-9e4f-e12046205f53' failed with status code 404: Not Found. Session could not found. Detail: Session 38ec90cc-a970-4411-9e4f-e12046205f53 could not be found
DEBUG: Issuing GET request to URL 'https://api-gw-service-nmn.local/apis/bos/v2/sessions/16f8b34e-6ad6-4ed2-bf34-050e44a434fe'
DEBUG: Received response to GET request to URL 'https://api-gw-service-nmn.local/apis/bos/v2/sessions/16f8b34e-6ad6-4ed2-bf34-050e44a434fe' with status code: '404': Not Found
DEBUG: Could not retrieve BOS session 16f8b34e-6ad6-4ed2-bf34-050e44a434fe: Failed to get BOS session 16f8b34e-6ad6-4ed2-bf34-050e44a434fe: GET request to URL 'https://api-gw-service-nmn.local/apis/bos/v2/sessions/16f8b34e-6ad6-4ed2-bf34-050e44a434fe' failed with status code 404: Not Found. Session could not found. Detail: Session 16f8b34e-6ad6-4ed2-bf34-050e44a434fe could not be found
DEBUG: Issuing GET request to URL 'https://api-gw-service-nmn.local/apis/bos/v2/sessions/a6bb5902-c902-4ea0-8516-37c529c07216'
DEBUG: Received response to GET request to URL 'https://api-gw-service-nmn.local/apis/bos/v2/sessions/a6bb5902-c902-4ea0-8516-37c529c07216' with status code: '200': OK
DEBUG: Session id a758428c-34f8-46e2-b817-c47e182e686c which applies to 1 nodes is missing
DEBUG: Session id 38ec90cc-a970-4411-9e4f-e12046205f53 which applies to 1 nodes is missing
DEBUG: Session id 16f8b34e-6ad6-4ed2-bf34-050e44a434fe which applies to 1 nodes is missing
+----------------+-----------+------+----------+-----------+------+---------+------+-------+-------------+---------+----------+------------------------------------------+----------------------+-------------+-------------+--------------------------------------+------------------------------+--------------------------------------+
| xname          | Aliases   | Type | NID      | State     | Flag | Enabled | Arch | Class | Role        | SubRole | Net Type | Desired Config                           | Configuration Status | Error Count | Boot Status | Most Recent BOS Session              | Most Recent Session Template | Most Recent Image                    |
+----------------+-----------+------+----------+-----------+------+---------+------+-------+-------------+---------+----------+------------------------------------------+----------------------+-------------+-------------+--------------------------------------+------------------------------+--------------------------------------+
| x3000c0s1b0n0  | ncn-m001  | Node | 100001   | Populated | OK   | True    | X86  | River | Management  | Master  | Sling    | management-24.3.1-csm-1.5.1-rc.1         | configured           | 0           | stable      | MISSING                              | MISSING                      | MISSING                              |
...
+----------------+-----------+------+----------+-----------+------+---------+------+-------+-------------+---------+----------+------------------------------------------+----------------------+-------------+-------------+--------------------------------------+------------------------------+--------------------------------------+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant