diff --git a/networking_aci/extensions/acioperations.py b/networking_aci/extensions/acioperations.py index b2152b8..74845fe 100644 --- a/networking_aci/extensions/acioperations.py +++ b/networking_aci/extensions/acioperations.py @@ -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)