Merge "NSX: fix error when creating VM ports on subnets without dhcp"
This commit is contained in:
commit
c28906c9e8
@ -296,12 +296,11 @@ class LsnManager(object):
|
|||||||
self.lsn_port_dispose(context, network_id, const.METADATA_MAC)
|
self.lsn_port_dispose(context, network_id, const.METADATA_MAC)
|
||||||
|
|
||||||
def _lsn_port_host_conf(self, context, network_id, subnet_id, data, hdlr):
|
def _lsn_port_host_conf(self, context, network_id, subnet_id, data, hdlr):
|
||||||
lsn_id = None
|
lsn_id, lsn_port_id = self.lsn_port_get(
|
||||||
lsn_port_id = None
|
context, network_id, subnet_id, raise_on_err=False)
|
||||||
try:
|
try:
|
||||||
lsn_id, lsn_port_id = self.lsn_port_get(
|
if lsn_id and lsn_port_id:
|
||||||
context, network_id, subnet_id)
|
hdlr(self.cluster, lsn_id, lsn_port_id, data)
|
||||||
hdlr(self.cluster, lsn_id, lsn_port_id, data)
|
|
||||||
except (n_exc.NotFound, api_exc.NsxApiException):
|
except (n_exc.NotFound, api_exc.NsxApiException):
|
||||||
LOG.error(_('Error while configuring LSN '
|
LOG.error(_('Error while configuring LSN '
|
||||||
'port %s'), lsn_port_id)
|
'port %s'), lsn_port_id)
|
||||||
|
@ -666,14 +666,10 @@ class LsnManagerTestCase(base.BaseTestCase):
|
|||||||
|
|
||||||
def test_lsn_port_host_conf_lsn_port_not_found(self):
|
def test_lsn_port_host_conf_lsn_port_not_found(self):
|
||||||
with mock.patch.object(
|
with mock.patch.object(
|
||||||
self.manager,
|
self.manager, 'lsn_port_get', return_value=(None, None)) as f:
|
||||||
'lsn_port_get',
|
self.manager._lsn_port_host_conf(
|
||||||
side_effect=p_exc.LsnPortNotFound(lsn_id=self.lsn_id,
|
mock.ANY, self.net_id, self.sub_id, mock.ANY, mock.Mock())
|
||||||
entity='subnet',
|
self.assertEqual(1, f.call_count)
|
||||||
entity_id=self.sub_id)):
|
|
||||||
self.assertRaises(p_exc.PortConfigurationError,
|
|
||||||
self.manager._lsn_port_host_conf, mock.ANY,
|
|
||||||
self.net_id, self.sub_id, mock.ANY, mock.Mock())
|
|
||||||
|
|
||||||
def _test_lsn_port_update(self, dhcp=None, meta=None):
|
def _test_lsn_port_update(self, dhcp=None, meta=None):
|
||||||
self.manager.lsn_port_update(
|
self.manager.lsn_port_update(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user