[host_maintenance] Pass des hostname in add_action solution

Currently we are passing src_node and des_node uuid when we try to run
migrate action.

In the watcher-applier log, migration fails with following exception
```
Nova client exception occurred while live migrating instance <uuid>Exception: Compute host <uuid> could not be found
```
Based on 57f55190ff/watcher/applier/actions/migration.py (L122)
and
57f55190ff/watcher/common/nova_helper.py (L322),
live_migrate_instance expects destination hostname not uuid.

This cr replaces dest_node uuid to hostname.

Closes-Bug: #2109309

Change-Id: I3911ff24ea612f69dddae5eab15fabb4891f938d
Signed-off-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
(cherry picked from commit 278cb7e98c)
This commit is contained in:
Chandan Kumar (raukadah)
2025-04-25 09:45:38 +05:30
committed by chandan kumar
parent 8a99d4c5c1
commit f4bfb10525
2 changed files with 5 additions and 5 deletions

View File

@@ -195,7 +195,7 @@ class HostMaintenance(base.HostMaintenanceBaseStrategy):
'source_node': src_node.uuid,
'resource_name': instance.name}
if des_node:
params['destination_node'] = des_node.uuid
params['destination_node'] = des_node.hostname
self.solution.add_action(action_type=self.INSTANCE_MIGRATION,
resource_id=instance.uuid,
input_parameters=params)

View File

@@ -111,7 +111,7 @@ class TestHostMaintenance(TestBaseStrategy):
self.strategy.instance_migration(instance_0, node_0, node_1)
self.assertEqual(1, len(self.strategy.solution.actions))
expected = [{'action_type': 'migrate',
'input_parameters': {'destination_node': node_1.uuid,
'input_parameters': {'destination_node': node_1.hostname,
'source_node': node_0.uuid,
'migration_type': 'live',
'resource_id': instance_0.uuid,
@@ -144,14 +144,14 @@ class TestHostMaintenance(TestBaseStrategy):
self.strategy.host_migration(node_0, node_1)
self.assertEqual(2, len(self.strategy.solution.actions))
expected = [{'action_type': 'migrate',
'input_parameters': {'destination_node': node_1.uuid,
'input_parameters': {'destination_node': node_1.hostname,
'source_node': node_0.uuid,
'migration_type': 'live',
'resource_id': instance_0.uuid,
'resource_name': instance_0.name
}},
{'action_type': 'migrate',
'input_parameters': {'destination_node': node_1.uuid,
'input_parameters': {'destination_node': node_1.hostname,
'source_node': node_0.uuid,
'migration_type': 'live',
'resource_id': instance_1.uuid,
@@ -213,7 +213,7 @@ class TestHostMaintenance(TestBaseStrategy):
'disabled_reason': 'watcher_maintaining'}},
{'action_type': 'migrate',
'input_parameters': {
'destination_node': node_3.uuid,
'destination_node': node_3.hostname,
'source_node': node_2.uuid,
'migration_type': 'live',
'resource_id': instance_4.uuid,