Merge "Allow ports to be created on networks that do not exist in NVP"
This commit is contained in:
commit
391108a014
@ -1188,6 +1188,10 @@ class NvpPluginV2(db_base_plugin_v2.QuantumDbPluginV2,
|
||||
self._port_drivers['create']['default'])
|
||||
|
||||
port_create_func(context, port_data)
|
||||
except q_exc.NotFound:
|
||||
LOG.warning(_("Network %s was not found in NVP."),
|
||||
port_data['network_id'])
|
||||
port_data['status'] = constants.PORT_STATUS_ERROR
|
||||
except Exception as e:
|
||||
# FIXME (arosen) or the plugin_interface call failed in which
|
||||
# case we need to garbage collect the left over port in nvp.
|
||||
|
@ -838,6 +838,26 @@ class NiciraQuantumNVPOutOfSync(test_l3_plugin.L3NatTestCaseBase,
|
||||
self.assertEqual(net['port']['status'],
|
||||
constants.PORT_STATUS_ERROR)
|
||||
|
||||
def test_create_port_on_network_not_in_nvp(self):
|
||||
res = self._create_network('json', 'net1', True)
|
||||
net1 = self.deserialize('json', res)
|
||||
self.fc._fake_lswitch_dict.clear()
|
||||
res = self._create_port('json', net1['network']['id'])
|
||||
port = self.deserialize('json', res)
|
||||
self.assertEqual(port['port']['status'], constants.PORT_STATUS_ERROR)
|
||||
|
||||
def test_update_port_not_in_nvp(self):
|
||||
res = self._create_network('json', 'net1', True)
|
||||
net1 = self.deserialize('json', res)
|
||||
res = self._create_port('json', net1['network']['id'])
|
||||
port = self.deserialize('json', res)
|
||||
self.fc._fake_lswitch_lport_dict.clear()
|
||||
data = {'port': {'name': 'error_port'}}
|
||||
req = self.new_update_request('ports', data, port['port']['id'])
|
||||
port = self.deserialize('json', req.get_response(self.api))
|
||||
self.assertEqual(port['port']['status'], constants.PORT_STATUS_ERROR)
|
||||
self.assertEqual(port['port']['name'], 'error_port')
|
||||
|
||||
def test_delete_port_and_network_not_in_nvp(self):
|
||||
res = self._create_network('json', 'net1', True)
|
||||
net1 = self.deserialize('json', res)
|
||||
|
Loading…
Reference in New Issue
Block a user