diff --git a/IM/connectors/EC2.py b/IM/connectors/EC2.py index 7f287da7f..572c3c39e 100644 --- a/IM/connectors/EC2.py +++ b/IM/connectors/EC2.py @@ -1318,9 +1318,12 @@ def _get_security_groups(self, conn, vm): """ Get all the SGs where the VM is included """ + sg_names = ["im-%s" % str(vm.inf.id)] + for net in vm.inf.radl.networks: + sg_names.append("im-%s-%s" % (str(vm.inf.id), net.id)) + sgs = [] - for net in vm.info.networks: - sg_name = "im-%s-%s" % (str(vm.inf.id), net.id) + for sg_name in sg_names: try: sgs.extend(conn.get_all_security_groups(filters={'group-name': sg_name})) except Exception: diff --git a/IM/connectors/OpenStack.py b/IM/connectors/OpenStack.py index 601493e38..c0f4f87c7 100644 --- a/IM/connectors/OpenStack.py +++ b/IM/connectors/OpenStack.py @@ -984,9 +984,11 @@ def delete_security_groups(self, driver, inf, timeout=180, delay=10): """ Delete the SG of this inf """ + sg_names = ["im-%s" % str(inf.id)] for net in inf.radl.networks: - sg_name = "im-%s-%s" % (str(inf.id), net.id) + sg_names.append("im-%s-%s" % (str(inf.id), net.id)) + for sg_name in sg_names: # wait it to terminate and then remove the SG cont = 0 deleted = False