Merge "Add checking mechanism driver during upgrade" into stable/stein

This commit is contained in:
Zuul 2019-04-12 17:26:16 +00:00 committed by Gerrit Code Review
commit 5ef79e36c3
3 changed files with 25 additions and 2 deletions

View File

@ -1399,7 +1399,9 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
@mock.patch('os.path.relpath', autospec=True)
@mock.patch('tripleo_common.update.add_breakpoints_cleanup_into_env',
autospec=True)
def test_heat_deploy_update_plan_only(self, mock_breakpoints_cleanup,
@mock.patch('tripleo_common.update.check_neutron_mechanism_drivers')
def test_heat_deploy_update_plan_only(self, check_mech,
mock_breakpoints_cleanup,
mock_relpath,
mock_get_template_contents,
mock_upload_missing_files,
@ -1407,6 +1409,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_deploy_and_wait,
mock_deprecated_params):
clients = self.app.client_manager
check_mech.return_value = None
orchestration_client = clients.orchestration
mock_stack = fakes.create_tht_stack()
orchestration_client.stacks.get.side_effect = [
@ -1428,7 +1431,7 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
mock_get_template_contents.return_value = [{}, {}]
self.cmd.clients = {}
self.cmd.object_client = object_client
self.cmd._heat_deploy(mock_stack, 'mock_stack', '/tmp', {},
{}, 1, '/tmp', {}, True, False, False, None)

View File

@ -15,6 +15,7 @@
import mock
from osc_lib import exceptions as oscexc
from osc_lib.tests.utils import ParserException
from tripleoclient import constants
from tripleoclient import exceptions
@ -127,6 +128,16 @@ class TestOvercloudUpgradePrepare(fakes.TestOvercloudUpgradePrepare):
self.assertRaises(exceptions.DeploymentError,
self.cmd.take_action, parsed_args)
@mock.patch('tripleo_common.update.check_neutron_mechanism_drivers')
def test_upgrade_failed_wrong_driver(self, check_mech):
check_mech.return_value = 'Wrong mech'
mock_stack = mock.Mock(parameters={'DeployIdentifier': ''})
argslist = (mock_stack, 'mock_stack', '/tmp', {},
{}, 1, '/tmp', {}, True, False, False, None)
self.cmd.object_client = mock.Mock()
self.assertRaises(oscexc.CommandError,
self.cmd._heat_deploy, *argslist)
class TestOvercloudUpgradeRun(fakes.TestOvercloudUpgradeRun):

View File

@ -194,6 +194,15 @@ class DeployOvercloud(command.Command):
deployment_options=None):
"""Verify the Baremetal nodes are available and do a stack update"""
if stack:
self.log.debug(
"Checking compatibilities of neutron drivers for {0}".format(
stack_name))
msg = update.check_neutron_mechanism_drivers(
env, stack, self.object_client, stack_name)
if msg:
raise oscexc.CommandError(msg)
self.log.debug("Getting template contents from plan %s" % stack_name)
# We need to reference the plan here, not the local
# tht root, as we need template_object to refer to