diff --git a/ironic/db/sqlalchemy/api.py b/ironic/db/sqlalchemy/api.py index 3e859226cb..7c478b009d 100644 --- a/ironic/db/sqlalchemy/api.py +++ b/ironic/db/sqlalchemy/api.py @@ -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 ' diff --git a/ironic/tests/unit/db/test_api.py b/ironic/tests/unit/db/test_api.py index 9252e1d59b..701d1afc48 100644 --- a/ironic/tests/unit/db/test_api.py +++ b/ironic/tests/unit/db/test_api.py @@ -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')