From 450bd3513668acdbbf831d6fa3eda98d9ce27c22 Mon Sep 17 00:00:00 2001 From: Bo Tran Date: Wed, 20 Mar 2024 18:17:08 +0700 Subject: [PATCH] Fix error can't do rebuild nova instances Currently, the python openstacksdk changed rebuild_server function's parameters. So, when the senlin-engine handle rebuild nova instance, it will raise this error like: "rebuild_server() got multiple values for argument 'image'" This patch will fix above error Change-Id: Ibc03fe6d5ca6db2b02ece5d0b3aab00dff157de1 --- senlin/drivers/os/nova_v2.py | 7 +++++-- senlin/tests/unit/drivers/test_nova_v2.py | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/senlin/drivers/os/nova_v2.py b/senlin/drivers/os/nova_v2.py index 1dc842362..8d0044cc9 100644 --- a/senlin/drivers/os/nova_v2.py +++ b/senlin/drivers/os/nova_v2.py @@ -72,8 +72,11 @@ class NovaClient(base.DriverBase): @sdk.translate_exception def server_rebuild(self, server, image, name=None, admin_password=None, **attrs): - return self.conn.compute.rebuild_server(server, name, admin_password, - image=image, **attrs) + attrs.update({ + "name": name, + "admin_password": admin_password + }) + return self.conn.compute.rebuild_server(server, image=image, **attrs) @sdk.translate_exception def server_resize(self, server, flavor): diff --git a/senlin/tests/unit/drivers/test_nova_v2.py b/senlin/tests/unit/drivers/test_nova_v2.py index d150802b9..1919be371 100644 --- a/senlin/tests/unit/drivers/test_nova_v2.py +++ b/senlin/tests/unit/drivers/test_nova_v2.py @@ -120,8 +120,12 @@ class TestNovaV2(base.SenlinTestCase): 'metadata': {'k1': 'v1'} } d.server_rebuild('sid', 'new_image', 'new_name', 'new_pass', **attrs) + attrs.update({ + "name": 'new_name', + "admin_password": 'new_pass' + }) self.compute.rebuild_server.assert_called_once_with( - 'sid', 'new_name', 'new_pass', image='new_image', **attrs) + 'sid', image='new_image', **attrs) def test_server_resize(self): d = nova_v2.NovaClient(self.conn_params)