Handle missing dst_node parameter in zone_migration

For compute nodes, nova works fine if a destination node is not
specified, so this change makes sure we're not passing None when the
user does not set one to avoid an error.

Partial-Bug: 2108988

Change-Id: Ida1f18b97697c041819e29f935aa5e232848226a
This commit is contained in:
jgilaber
2025-05-16 13:45:03 +02:00
parent 63626d6fc3
commit c6302edeca
3 changed files with 18 additions and 6 deletions

View File

@@ -444,9 +444,12 @@ class ZoneMigration(base.ZoneMigrationBaseStrategy):
def _live_migration(self, instance, src_node, dst_node):
parameters = {"migration_type": "live",
"destination_node": dst_node,
"source_node": src_node,
"resource_name": instance.name}
if dst_node:
# if dst_node is None, do not add it to the parameters for the
# migration action, and let Nova figure out the destination node
parameters["destination_node"] = dst_node
self.solution.add_action(
action_type="migrate",
resource_id=instance.id,
@@ -455,9 +458,12 @@ class ZoneMigration(base.ZoneMigrationBaseStrategy):
def _cold_migration(self, instance, src_node, dst_node):
parameters = {"migration_type": "cold",
"destination_node": dst_node,
"source_node": src_node,
"resource_name": instance.name}
if dst_node:
# if dst_node is None, do not add it to the parameters for the
# migration action, and let Nova figure out the destination node
parameters["destination_node"] = dst_node
self.solution.add_action(
action_type="migrate",
resource_id=instance.id,