diff --git a/IM/connectors/EC2.py b/IM/connectors/EC2.py index be21a700b..fe32bea9d 100644 --- a/IM/connectors/EC2.py +++ b/IM/connectors/EC2.py @@ -1311,7 +1311,7 @@ def cancel_spot_requests(self, conn, vm): self.log_info("Spot instance request " + str(sir.id) + " deleted") break - def delete_networks(self, conn, vm, timeout=120): + def delete_networks(self, conn, vm, timeout=240): """ Delete the created networks """ @@ -1331,22 +1331,23 @@ def delete_networks(self, conn, vm, timeout=120): time.sleep(5) if not deleted: - self.log_error("Timeout (%s) removing the volume %s" % (timeout, subnet.id)) + self.log_error("Timeout (%s) deleting the subnet %s" % (timeout, subnet.id)) vpc_id = None for vpc in conn.get_all_vpcs(filters={"tag:IM-INFRA-ID": vm.inf.id}): - self.log_info("Deleting vpc: %s" % vpc.id) vpc_id = vpc.id ig_id = None for ig in conn.get_all_internet_gateways(filters={"tag:IM-INFRA-ID": vm.inf.id}): - self.log_info("Deleting Internet Gateway: %s" % ig.id) ig_id = ig.id if ig_id and vpc_id: + self.log_info("Detacching Internet Gateway: %s from VPC: %s" % (ig_id, vpc_id)) conn.detach_internet_gateway(ig_id, vpc_id) if ig_id: + self.log_info("Deleting Internet Gateway: %s" % ig.id) conn.delete_internet_gateway(ig_id) if vpc_id: + self.log_info("Deleting vpc: %s" % vpc.id) conn.delete_vpc(vpc_id) def finalize(self, vm, last, auth_data):