From 3c2185aac391f05e2221f0c5b054865fcfe773ec Mon Sep 17 00:00:00 2001 From: Pratik Shah Date: Mon, 7 Aug 2017 19:33:20 +0530 Subject: [PATCH] Added a fix to delete a network. Description: Deleting network was raising an Exception "AWS Error: 'NeutronError' - 'Required parameter id not set'" Issue: When VPC and Subnet are deleted, neutron core code notifies the change. But since VPC is already deleted, "create_tags_for_vpc()" doesn't get VPC ID. Hence it raises AWS Exception when it tries to create tags. Neutron core code calls "update_network_precommit()" when notifying the change which eventually calls "create_tags_for_vpc()" Fix: Added a check for VPC ID in "create_tags_for_vpc()" Closes-Bug: #1709046 Change-Id: I6a94911e41bc194b98ddaf51cf9585ac3f4ed07e --- neutron/neutron/common/aws_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/neutron/neutron/common/aws_utils.py b/neutron/neutron/common/aws_utils.py index 196dd06..a926a4b 100644 --- a/neutron/neutron/common/aws_utils.py +++ b/neutron/neutron/common/aws_utils.py @@ -279,8 +279,9 @@ class AwsUtils(object): @aws_exception def create_tags_for_vpc(self, neutron_network_id, tags_list): vpc_id = self.get_vpc_from_neutron_network_id(neutron_network_id) - vpc_res = self._get_ec2_resource().Vpc(vpc_id) - vpc_res.create_tags(Tags=tags_list) + if vpc_id is not None: + vpc_res = self._get_ec2_resource().Vpc(vpc_id) + vpc_res.create_tags(Tags=tags_list) # Subnet Operations @aws_exception