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:
@@ -0,0 +1,9 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
The zone migration strategy no longer requires a dst_node to be passed.
|
||||
When unspecified, the Nova scheduler will select an appropriate host automatically.
|
||||
This brings the implementation of the strategy in line with the the api schema
|
||||
where dest_node is optional.
|
||||
|
||||
See: https://bugs.launchpad.net/watcher/+bug/2108988 for more details.
|
||||
@@ -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,
|
||||
|
||||
@@ -259,10 +259,7 @@ class TestZoneMigration(TestBaseStrategy):
|
||||
migration_params = solution.actions[0]['input_parameters']
|
||||
# since we have not passed 'dst_node' in the input, we should not have
|
||||
# a destination_node in the generated migration action
|
||||
# self.assertNotIn('destination_node', migration_params)
|
||||
# temporarily make the test pass, delete and use the above assert in
|
||||
# followup
|
||||
self.assertIsNone(migration_params['destination_node'])
|
||||
self.assertNotIn('destination_node', migration_params)
|
||||
|
||||
def test_execute_cold_migrate_instance(self):
|
||||
instance_on_src1 = self.fake_instance(
|
||||
|
||||
Reference in New Issue
Block a user