# TODO - the call above should add security groups. The return object shows they exist but the association
# had never been made by OpenStack. This call is here to ensure they have been added
for sec_grp_name in self.instance_settings.security_group_names:
- nova_utils.add_security_group(self.__nova, self.__vm, sec_grp_name)
+ if self.vm_active(block=True):
+ nova_utils.add_security_group(self.__nova, self.__vm, sec_grp_name)
+ else:
+ raise Exception('Cannot applying security group with name ' + sec_grp_name +
+ ' to VM that did not activate with name - ' + self.instance_settings.name)
self.__apply_floating_ips()