Do not call remove_router_lport in remove_router_interface

Bug 1211149

The call will cause a failure as the router port is already removed
by _nvp_delete_router_port.
This patch also add the support on the fake nvp api client to verify
this kind of condition.

Change-Id: Ieb5ca5c239ccc993b96dd5bad0b412211b45417e
This commit is contained in:
Salvatore Orlando 2013-08-13 07:08:27 -07:00
parent 58e25937de
commit c9b62ac3e2
3 changed files with 20 additions and 3 deletions

View File

@ -1848,8 +1848,6 @@ class NvpPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
self.cluster, router_id, "NoSourceNatRule",
max_num_expected=1, min_num_expected=0,
destination_ip_addresses=subnet['cidr'])
nvplib.delete_router_lport(self.cluster,
router_id, lrouter_port_id)
except NvpApiClient.ResourceNotFound:
raise nvp_exc.NvpPluginException(
err_msg=(_("Logical router port resource %s not found "

View File

@ -7,7 +7,13 @@
"_href": "/ws.v1/lswitch/%(ls_uuid)s/lport/%(uuid)s/status",
"_schema": "/ws.v1/schema/LogicalSwitchPortStatus"},
"LogicalSwitchConfig":
{"uuid": "%(ls_uuid)s"}
{"uuid": "%(ls_uuid)s"},
"LogicalPortAttachment":
{
"type": "%(att_type)s",
%(att_info_json)s
"schema": "/ws.v1/schema/%(att_type)s"
}
},
"tags":
[{"scope": "q_port_id", "tag": "%(neutron_port_id)s"},

View File

@ -194,6 +194,8 @@ class FakeClient:
fake_lport['neutron_port_id'] = self._get_tag(fake_lport,
'q_port_id')
fake_lport['neutron_device_id'] = self._get_tag(fake_lport, 'vm_id')
fake_lport['att_type'] = "NoAttachment"
fake_lport['att_info_json'] = ''
self._fake_lswitch_lport_dict[fake_lport['uuid']] = fake_lport
fake_lswitch = self._fake_lswitch_dict[ls_uuid]
@ -543,6 +545,13 @@ class FakeClient:
relations_2 = {}
relations_2['LogicalPortAttachment'] = body_2
resource_2['_relations'] = relations_2
resource['peer_port_uuid'] = body_2['peer_port_uuid']
resource['att_info_json'] = (
"\"peer_port_uuid\": \"%s\"," %
resource_2['uuid'])
resource_2['att_info_json'] = (
"\"peer_port_uuid\": \"%s\"," %
body_2['peer_port_uuid'])
elif body_2['type'] == "L3GatewayAttachment":
resource['attachment_gwsvc_uuid'] = (
body_2['l3_gateway_service_uuid'])
@ -550,6 +559,10 @@ class FakeClient:
elif body_2['type'] == "L2GatewayAttachment":
resource['attachment_gwsvc_uuid'] = (
body_2['l2_gateway_service_uuid'])
elif body_2['type'] == "VifAttachment":
resource['vif_uuid'] = body_2['vif_uuid']
resource['att_info_json'] = (
"\"vif_uuid\": \"%s\"," % body_2['vif_uuid'])
if not is_attachment:
response = response_template % resource