Add binding:host_id when creating port for probe
When probe is created it needs to have correct bindings otherwise port is marked as dead. Change-Id: I64441fbe802aab068c129c9647c7144fcd4c50a1 Partial-Bug: #1262785
This commit is contained in:
parent
d586a957df
commit
941a7f74b0
@ -65,7 +65,6 @@ class NeutronDebugAgent():
|
|||||||
bridge = self.conf.external_network_bridge
|
bridge = self.conf.external_network_bridge
|
||||||
|
|
||||||
port = self._create_port(network, device_owner)
|
port = self._create_port(network, device_owner)
|
||||||
port.network = network
|
|
||||||
interface_name = self.driver.get_device_name(port)
|
interface_name = self.driver.get_device_name(port)
|
||||||
namespace = None
|
namespace = None
|
||||||
if self.conf.use_namespaces:
|
if self.conf.use_namespaces:
|
||||||
@ -186,13 +185,15 @@ class NeutronDebugAgent():
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def _create_port(self, network, device_owner):
|
def _create_port(self, network, device_owner):
|
||||||
body = dict(port=dict(
|
host = self.conf.host
|
||||||
admin_state_up=True,
|
body = {'port': {'admin_state_up': True,
|
||||||
network_id=network.id,
|
'network_id': network.id,
|
||||||
device_id='%s' % socket.gethostname(),
|
'device_id': '%s' % socket.gethostname(),
|
||||||
device_owner='%s:probe' % device_owner,
|
'device_owner': '%s:probe' % device_owner,
|
||||||
tenant_id=network.tenant_id,
|
'tenant_id': network.tenant_id,
|
||||||
fixed_ips=[dict(subnet_id=s.id) for s in network.subnets]))
|
'binding:host_id': host,
|
||||||
|
'fixed_ips': [dict(subnet_id=s.id)
|
||||||
|
for s in network.subnets]}}
|
||||||
port_dict = self.client.create_port(body)['port']
|
port_dict = self.client.create_port(body)['port']
|
||||||
port = DictModel(port_dict)
|
port = DictModel(port_dict)
|
||||||
port.network = network
|
port.network = network
|
||||||
|
@ -119,6 +119,7 @@ class TestDebugCommands(base.BaseTestCase):
|
|||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
'network_id': 'fake_net',
|
'network_id': 'fake_net',
|
||||||
'tenant_id': 'fake_tenant',
|
'tenant_id': 'fake_tenant',
|
||||||
|
'binding:host_id': cfg.CONF.host,
|
||||||
'fixed_ips': [{'subnet_id': 'fake_subnet'}],
|
'fixed_ips': [{'subnet_id': 'fake_subnet'}],
|
||||||
'device_id': socket.gethostname()}}
|
'device_id': socket.gethostname()}}
|
||||||
namespace = 'qprobe-fake_port'
|
namespace = 'qprobe-fake_port'
|
||||||
@ -138,7 +139,7 @@ class TestDebugCommands(base.BaseTestCase):
|
|||||||
namespace=namespace
|
namespace=namespace
|
||||||
)])
|
)])
|
||||||
|
|
||||||
def test_create_newwork_probe(self):
|
def test_create_network_probe(self):
|
||||||
self._test_create_probe(DEVICE_OWNER_NETWORK_PROBE)
|
self._test_create_probe(DEVICE_OWNER_NETWORK_PROBE)
|
||||||
|
|
||||||
def test_create_nova_probe(self):
|
def test_create_nova_probe(self):
|
||||||
@ -163,6 +164,7 @@ class TestDebugCommands(base.BaseTestCase):
|
|||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
'network_id': 'fake_net',
|
'network_id': 'fake_net',
|
||||||
'tenant_id': 'fake_tenant',
|
'tenant_id': 'fake_tenant',
|
||||||
|
'binding:host_id': cfg.CONF.host,
|
||||||
'fixed_ips': [{'subnet_id': 'fake_subnet'}],
|
'fixed_ips': [{'subnet_id': 'fake_subnet'}],
|
||||||
'device_id': socket.gethostname()}}
|
'device_id': socket.gethostname()}}
|
||||||
namespace = 'qprobe-fake_port'
|
namespace = 'qprobe-fake_port'
|
||||||
@ -313,6 +315,7 @@ class TestDebugCommands(base.BaseTestCase):
|
|||||||
'admin_state_up': True,
|
'admin_state_up': True,
|
||||||
'network_id': 'fake_net',
|
'network_id': 'fake_net',
|
||||||
'tenant_id': 'fake_tenant',
|
'tenant_id': 'fake_tenant',
|
||||||
|
'binding:host_id': cfg.CONF.host,
|
||||||
'fixed_ips': [{'subnet_id': 'fake_subnet'}],
|
'fixed_ips': [{'subnet_id': 'fake_subnet'}],
|
||||||
'device_id': socket.gethostname()}}
|
'device_id': socket.gethostname()}}
|
||||||
expected = [mock.call.show_network('fake_net'),
|
expected = [mock.call.show_network('fake_net'),
|
||||||
|
Loading…
Reference in New Issue
Block a user