Don't migrate away from iscsi if it is the default

We hit an issue in Kayobe CI where we have the following config:

enabled_deploy_interfaces: iscsi,direct
default_deploy_interface: iscsi

In practice, direct does not work out of the box in Kayobe currently.
The online migration added recently to move nodes from iscsi to direct
caused issues in our upgrade jobs, since it migrated nodes to direct,
without the config in place to make this work.

This change avoids migrating nodes when iscsi is the default deploy
interface.

Story: 2008114
Task: 40996

Change-Id: I5cf0684dc53a2d89fac12e578b28e73e7697a97e
This commit is contained in:
Mark Goddard 2020-09-30 15:03:36 +01:00
parent 2151d660d2
commit 42d83a2bff
2 changed files with 14 additions and 0 deletions

View File

@ -1546,6 +1546,12 @@ class Connection(api.Connection):
'force=true to override.')
return 0, 0
if CONF.default_deploy_interface == 'iscsi':
LOG.warning('The iscsi deploy interface is the default, will '
'not migrate nodes away from it. Run with '
'--option force=true to override.')
return 0, 0
if CONF.agent.image_download_source == 'swift':
LOG.warning('The direct deploy interface is using swift, will '
'not migrate nodes to it. Run with --option '

View File

@ -290,6 +290,14 @@ class MigrateFromIscsiTestCase(base.DbTestCase):
self.assertEqual(
(0, 0), self.dbapi.migrate_from_iscsi_deploy(self.context, 0))
def test_migration_impossible3(self):
self.config(default_deploy_interface='iscsi')
for _i in range(3):
uuid = uuidutils.generate_uuid()
utils.create_test_node(uuid=uuid, deploy_interface='iscsi')
self.assertEqual(
(0, 0), self.dbapi.migrate_from_iscsi_deploy(self.context, 0))
def test_force_migration(self):
self.config(enabled_deploy_interfaces='iscsi')
utils.create_test_node(deploy_interface='direct')