Skip to content

Commit

Permalink
API: No HG mode switch if no selectors are present
Browse files Browse the repository at this point in the history
If a hostgroup has no port selectors, then we do not allow to switch
over between infra and baremetal mode. These hostgroups are in infra
mode by default and will stay there, as we don't have all necessary
information to do the switch.
  • Loading branch information
sebageek committed Nov 3, 2023
1 parent 20d6241 commit 6026cc4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions networking_aci/extensions/acioperations.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ def update(self, request, **kwargs):
if not hg_config:
raise web_exc.HTTPBadRequest("Hostgroup {} has no config associated with it".format(hostgroup_name))

if not hg_config.get('port_selectors'):
raise web_exc.HTTPBadRequest(f"Hostgroup {hostgroup_name} has no port selectors, "
"therefore hostgroup mode cannot be switched")

if curr_mode == aci_const.MODE_BAREMETAL:
# for baremetal switchover we need to check all baremetal segments for active portbindings
physnet_to_check = "{}%".format(ACI_CONFIG.baremetal_resource_prefix)
Expand Down

0 comments on commit 6026cc4

Please sign in to comment.