Merge "send the good binding to neutron after live-migration"
This commit is contained in:
commit
78810135d8
@ -897,7 +897,8 @@ class API(base.Base):
|
||||
data = neutron.list_ports(**search_opts)
|
||||
ports = data['ports']
|
||||
for p in ports:
|
||||
port_req_body = {'port': {'binding:host_id': instance.get('host')}}
|
||||
port_req_body = {'port': {'binding:host_id':
|
||||
migration['dest_compute']}}
|
||||
try:
|
||||
neutron.update_port(p['id'], port_req_body)
|
||||
except Exception as ex:
|
||||
|
@ -1658,12 +1658,14 @@ class TestNeutronv2Portbinding(TestNeutronv2Base):
|
||||
'tenant_id': self.instance['project_id']}
|
||||
ports = {'ports': [{'id': 'test1'}]}
|
||||
self.moxed_client.list_ports(**search_opts).AndReturn(ports)
|
||||
migration = {'source_compute': self.instance.get('host'),
|
||||
'dest_compute': 'dest_host', }
|
||||
port_req_body = {'port':
|
||||
{'binding:host_id': self.instance.get('host')}}
|
||||
{'binding:host_id': migration['dest_compute']}}
|
||||
self.moxed_client.update_port('test1',
|
||||
port_req_body).AndReturn(None)
|
||||
self.mox.ReplayAll()
|
||||
api.migrate_instance_finish(self.context, self.instance, None)
|
||||
api.migrate_instance_finish(self.context, self.instance, migration)
|
||||
|
||||
def test_migrate_instance_finish_binding_true_exception(self):
|
||||
api = neutronapi.API()
|
||||
@ -1675,15 +1677,17 @@ class TestNeutronv2Portbinding(TestNeutronv2Base):
|
||||
'tenant_id': self.instance['project_id']}
|
||||
ports = {'ports': [{'id': 'test1'}]}
|
||||
self.moxed_client.list_ports(**search_opts).AndReturn(ports)
|
||||
migration = {'source_compute': self.instance.get('host'),
|
||||
'dest_compute': 'dest_host', }
|
||||
port_req_body = {'port':
|
||||
{'binding:host_id': self.instance.get('host')}}
|
||||
{'binding:host_id': migration['dest_compute']}}
|
||||
self.moxed_client.update_port('test1',
|
||||
port_req_body).AndRaise(
|
||||
Exception("fail to update port"))
|
||||
self.mox.ReplayAll()
|
||||
self.assertRaises(NEUTRON_CLIENT_EXCEPTION,
|
||||
api.migrate_instance_finish,
|
||||
self.context, self.instance, None)
|
||||
self.context, self.instance, migration)
|
||||
|
||||
|
||||
class TestNeutronv2ExtraDhcpOpts(TestNeutronv2Base):
|
||||
|
Loading…
Reference in New Issue
Block a user