Browse Source

Pass in correct port id parameter

When calling interface create on a server, the port id must be passed in
port_id as specified in [1].  Passing in the incorrect parameter was
causing nodes to go into error state during cluster update that involved
a profile whose network was changed.

[1] https://docs.openstack.org/api-ref/compute/?expanded=create-interface-detail#create-interface

Change-Id: I4627cba1064097234c765a7c97cfd1be8b3224a7
Closes-Bug: #1895759
tags/10.0.0.0rc1^0
Duc Truong 2 weeks ago
parent
commit
aca5b42d81
3 changed files with 6 additions and 6 deletions
  1. +1
    -1
      senlin/profiles/os/nova/server.py
  2. +2
    -2
      senlin/tests/unit/drivers/test_nova_v2.py
  3. +3
    -3
      senlin/tests/unit/profiles/test_nova_server_update.py

+ 1
- 1
senlin/profiles/os/nova/server.py View File

@@ -1199,7 +1199,7 @@ class ServerProfile(base.Profile):
ports = self._create_ports_from_properties(
obj, networks, 'update')
for port in ports:
params = {'port': port['id']}
params = {'port_id': port['id']}
try:
cc.server_interface_create(server, **params)
except exc.InternalError as ex:


+ 2
- 2
senlin/tests/unit/drivers/test_nova_v2.py View File

@@ -372,9 +372,9 @@ class TestNovaV2(base.SenlinTestCase):
def test_server_interface_create(self):
server = mock.Mock()
d = nova_v2.NovaClient(self.conn_params)
d.server_interface_create(server, name='foo')
d.server_interface_create(server, port_id='fake-port-id')
self.compute.create_server_interface.assert_called_once_with(
server, name='foo')
server, port_id='fake-port-id')

def test_server_interface_list(self):
d = nova_v2.NovaClient(self.conn_params)


+ 3
- 3
senlin/tests/unit/profiles/test_nova_server_update.py View File

@@ -797,9 +797,9 @@ class TestNovaServerUpdate(base.SenlinTestCase):
mock_validate.assert_has_calls(validation_calls)
mock_get_port.assert_called_with(obj, {'port': 'port4'})
create_calls = [
mock.call(server_obj, port='port1_id'),
mock.call(server_obj, port='port2_id'),
mock.call(server_obj, port='port4_id'),
mock.call(server_obj, port_id='port1_id'),
mock.call(server_obj, port_id='port2_id'),
mock.call(server_obj, port_id='port4_id'),
]
cc.server_interface_create.assert_has_calls(create_calls)



Loading…
Cancel
Save