Skip to content

Commit

Permalink
Merge pull request #226 from Cray-HPE/release/2.10.0
Browse files Browse the repository at this point in the history
Release/2.10.0
  • Loading branch information
rbak-hpe authored Oct 18, 2023
2 parents e3dd0eb + ac9fa2c commit 55b1c95
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 8 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

## [2.10.0] - 10-18-2023
### Fixed
- Make the include_disabled option work as intended.
- Return the correct object from hsm's get_components call when there are no nodes in the session.
- Fixed session setup errors when there are no valid nodes before filtering for architecture.

## [2.9.0] - 09-29-2023
### Changed
- Update the spire-agent path
Expand Down
2 changes: 1 addition & 1 deletion src/bos/operators/power_off_forceful.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def filters(self):
BOSQuery(enabled=True, status=','.join([Status.power_off_forcefully_called,
Status.power_off_gracefully_called])),
TimeSinceLastAction(seconds=options.max_power_off_wait_time),
HSMState(enabled=True),
HSMState(),
]

def _act(self, components):
Expand Down
2 changes: 1 addition & 1 deletion src/bos/operators/power_off_graceful.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def name(self):
def filters(self):
return [
BOSQuery(enabled=True, status=Status.power_off_pending),
HSMState(enabled=True),
HSMState(),
]

def _act(self, components):
Expand Down
2 changes: 1 addition & 1 deletion src/bos/operators/power_on.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def name(self):
def filters(self):
return [
BOSQuery(enabled=True, status=Status.power_on_pending),
HSMState(enabled=True)
HSMState()
]

def _act(self, components):
Expand Down
8 changes: 6 additions & 2 deletions src/bos/operators/session_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ def _setup_components(self):
for component_id in components:
data.append(self._operate(component_id, boot_set))
all_component_ids += components
if not all_component_ids:
raise SessionSetupException("No nodes were found to act upon.")
except Exception as err:
raise SessionSetupException(err)
else:
Expand Down Expand Up @@ -160,7 +162,7 @@ def _get_boot_set_component_list(self, boot_set) -> Set[str]:
nodes = set(hsmfilter._filter(list(nodes)))
nodes = self._apply_tenant_limit(nodes)
if not nodes:
self._log(LOGGER.warning, "No nodes were found to act on.")
self._log(LOGGER.warning, "No nodes were found to act upon.")
return nodes

def _apply_arch(self, nodes, arch):
Expand All @@ -179,10 +181,12 @@ def _apply_arch(self, nodes, arch):
returns:
A set representing the subset of nodes that match arch, or the logical arch from HSM.
"""
if not nodes:
return nodes
valid_archs = set([arch])
if arch == 'X86':
valid_archs.add('UNKNOWN')
hsm_filter = HSMState(enabled=True)
hsm_filter = HSMState()
return set(hsm_filter.filter_by_arch(nodes, valid_archs))

def _apply_limit(self, nodes):
Expand Down
43 changes: 40 additions & 3 deletions src/bos/operators/utils/clients/hsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,47 @@ def read_all_node_xnames():
raise HWStateManagerException(ke) from ke


def get_components(node_list, enabled=None):
"""Get information for all list components HSM"""
def get_components(node_list, enabled=None) -> dict[str,list[dict]]:
"""
Get information for all list components HSM
:return the HSM components
:rtype Dictionary containing a 'Components' key whose value is a list
containing each component, where each component is itself represented by a
dictionary.
Here is an example of the returned values.
{
"Components": [
{
"ID": "x3000c0s19b1n0",
"Type": "Node",
"State": "Ready",
"Flag": "OK",
"Enabled": true,
"Role": "Compute",
"NID": 1,
"NetType": "Sling",
"Arch": "X86",
"Class": "River"
},
{
"ID": "x3000c0s19b2n0",
"Type": "Node",
"State": "Ready",
"Flag": "OK",
"Enabled": true,
"Role": "Compute",
"NID": 1,
"NetType": "Sling",
"Arch": "X86",
"Class": "River"
}
]
}
"""
if not node_list:
return []
return {'Components': []}
session = requests_retry_session()
try:
payload = {'ComponentIDs': node_list}
Expand Down

0 comments on commit 55b1c95

Please sign in to comment.