Remove Tuskar support
This change removes Tuskar support from the following commands: - openstack overcloud deploy - openstack overcloud node delete - openstack overcloud update stack This removal is due to the limiting nature of Tuskar, we can achieve everything we need and more without it. The change also removes python-tuskarclient from the requirements and if the Tuskar CLI (openstack management commands) is required it will need to be installed independently. This change is dependant on the Tuskar examples being removed from the documentation. These are removed in the dependant change ID below. Depends-On: I2d4aa114156c5bafb003e6a67862ed6d1449fd98 Change-Id: Ic6fd4568054fe91b8fc898728022a7d7ed8cf3cf
This commit is contained in:
parent
08807350a2
commit
6abf557aa1
@ -13,7 +13,7 @@ Deploy an overcloud stack
|
||||
.. code:: bash
|
||||
|
||||
openstack overcloud deploy stack
|
||||
(--plan PLAN | --templates [TEMPLATES])
|
||||
--templates [TEMPLATES]
|
||||
[-t <TIMEOUT>]
|
||||
[--control-scale CONTROL_SCALE]
|
||||
[--compute-scale COMPUTE_SCALE]
|
||||
@ -46,10 +46,6 @@ Deploy an overcloud stack
|
||||
[--reg-sat-url REG_SAT_URL]
|
||||
[--reg-activation-key REG_ACTIVATION_KEY]
|
||||
|
||||
.. option:: --plan <name or UUID>
|
||||
|
||||
The Name or UUID of the Tuskar plan to deploy.
|
||||
|
||||
.. option:: --templates <directory>
|
||||
|
||||
The directory containing the Heat templates to deploy.
|
||||
@ -168,11 +164,6 @@ Deploy an overcloud stack
|
||||
|
||||
A comma separated list of hosts that should not be proxied.
|
||||
|
||||
.. option:: -O <directory>, --output-dir <directory>
|
||||
|
||||
Directory to write Tuskar template files into. It will be created if it
|
||||
does not exist. If not provided a temporary directory will be used.
|
||||
|
||||
.. option:: -e <file>, --environment-file <file>
|
||||
|
||||
Environment files to be passed to the heat stack-create or heat
|
||||
|
@ -11,7 +11,6 @@ os-cloud-config
|
||||
python-heatclient>=0.3.0
|
||||
python-ironicclient>=0.4.1
|
||||
python-openstackclient>=1.0.0
|
||||
python-tuskarclient>=0.1.17
|
||||
six>=1.9.0
|
||||
|
||||
# tripleo-common lib is not yet on PyPi
|
||||
|
@ -19,7 +19,6 @@ import logging
|
||||
|
||||
from ironicclient import client as ironic_client
|
||||
from openstackclient.common import utils
|
||||
from tuskarclient import client as tuskar_client
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -67,7 +66,6 @@ class ClientWrapper(object):
|
||||
self._instance = instance
|
||||
self._baremetal = None
|
||||
self._orchestration = None
|
||||
self._management = None
|
||||
|
||||
def baremetal(self):
|
||||
"""Returns an baremetal service client"""
|
||||
@ -129,18 +127,3 @@ class ClientWrapper(object):
|
||||
|
||||
self._orchestration = client
|
||||
return self._orchestration
|
||||
|
||||
def management(self):
|
||||
"""Returns an management service client"""
|
||||
|
||||
endpoint = self._instance.get_endpoint_for_service_type(
|
||||
"management",
|
||||
region_name=self._instance._region_name,
|
||||
)
|
||||
|
||||
token = self._instance.auth.get_token(self._instance.session)
|
||||
|
||||
self._management = tuskar_client.get_client(
|
||||
2, os_auth_token=token, tuskar_url=endpoint)
|
||||
|
||||
return self._management
|
||||
|
@ -18,10 +18,10 @@ from openstackclient.tests import utils
|
||||
|
||||
|
||||
def create_to_dict_mock(**kwargs):
|
||||
mock_plan = mock.Mock()
|
||||
mock_plan.configure_mock(**kwargs)
|
||||
mock_plan.to_dict.return_value = kwargs
|
||||
return mock_plan
|
||||
mock_with_to_dict = mock.Mock()
|
||||
mock_with_to_dict.configure_mock(**kwargs)
|
||||
mock_with_to_dict.to_dict.return_value = kwargs
|
||||
return mock_with_to_dict
|
||||
|
||||
|
||||
def create_tht_stack(**kwargs):
|
||||
@ -49,7 +49,6 @@ class FakeClientWrapper(object):
|
||||
self._instance = mock.Mock()
|
||||
self._orchestration = mock.Mock()
|
||||
self._baremetal = mock.Mock()
|
||||
self._management = mock.Mock()
|
||||
|
||||
def orchestration(self):
|
||||
return self._orchestration
|
||||
@ -57,9 +56,6 @@ class FakeClientWrapper(object):
|
||||
def baremetal(self):
|
||||
return self._baremetal
|
||||
|
||||
def management(self):
|
||||
return self._management
|
||||
|
||||
|
||||
class TestDeployOvercloud(utils.TestCommand):
|
||||
|
||||
|
@ -15,15 +15,12 @@
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import six
|
||||
import tempfile
|
||||
|
||||
import mock
|
||||
import six
|
||||
|
||||
from openstackclient.common import exceptions as oscexc
|
||||
from openstackclient.tests import utils as oscutils
|
||||
from tuskarclient.v2.plans import Plan
|
||||
|
||||
from tripleoclient import exceptions
|
||||
from tripleoclient.tests.v1.overcloud_deploy import fakes
|
||||
@ -455,406 +452,11 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
mock_process_multiple_env.assert_called_with(
|
||||
[self.parameter_defaults_env_file])
|
||||
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_deploy_postconfig')
|
||||
@mock.patch('tripleoclient.utils.get_config_value', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_create_tempest_deployer_input', autospec=True)
|
||||
@mock.patch('tripleoclient.utils.generate_overcloud_passwords')
|
||||
@mock.patch('heatclient.common.template_utils.'
|
||||
'process_multiple_environments_and_files')
|
||||
@mock.patch('heatclient.common.template_utils.get_template_contents')
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_get_stack')
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_pre_heat_deploy')
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_create_overcloudrc')
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_heat_deploy')
|
||||
def test_tuskar_deploy(self, mock_heat_deploy, mock_create_overcloudrc,
|
||||
most_pre_deploy, mock_get_stack,
|
||||
mock_get_templte_contents,
|
||||
mock_process_multiple_env,
|
||||
mock_generate_overcloud_passwords,
|
||||
mock_create_tempest_deployer_input,
|
||||
mock_get_key,
|
||||
mock_deploy_postconfig):
|
||||
|
||||
arglist = ['--plan', 'undercloud', '--output-dir', 'fake',
|
||||
'--compute-flavor', 'baremetal',
|
||||
'--neutron-bridge-mappings', 'datacentre:br-test',
|
||||
'--neutron-disable-tunneling',
|
||||
'--control-scale', '3',
|
||||
'--neutron-mechanism-drivers', 'linuxbridge',
|
||||
'--ntp-server', 'ntp.local']
|
||||
|
||||
verifylist = [
|
||||
('templates', None),
|
||||
('plan', 'undercloud'),
|
||||
('output_dir', 'fake'),
|
||||
('ntp_server', 'ntp.local')
|
||||
]
|
||||
|
||||
clients = self.app.client_manager
|
||||
management = clients.tripleoclient.management()
|
||||
|
||||
management.plans.templates.return_value = {}
|
||||
management.plans.resource_class = Plan
|
||||
|
||||
mock_plan = mock.Mock()
|
||||
mock_plan.configure_mock(name="undercloud")
|
||||
management.plans.list.return_value = [mock_plan, ]
|
||||
|
||||
mock_get_templte_contents.return_value = ({}, "template")
|
||||
mock_process_multiple_env.return_value = ({}, "envs")
|
||||
clients.network.api.find_attr.return_value = {
|
||||
"id": "network id"
|
||||
}
|
||||
|
||||
mock_get_key.return_value = "PASSWORD"
|
||||
|
||||
mock_generate_overcloud_passwords.return_value = self._get_passwords()
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
baremetal = clients.tripleoclient.baremetal()
|
||||
baremetal.node.list.return_value = range(10)
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.assertTrue(result)
|
||||
|
||||
parameters = {
|
||||
'Cinder-Storage-1::SnmpdReadonlyUserPassword': "PASSWORD",
|
||||
'Compute-1::AdminPassword': 'password',
|
||||
'Compute-1::CeilometerMeteringSecret': 'password',
|
||||
'Compute-1::CeilometerPassword': 'password',
|
||||
'Compute-1::Flavor': 'baremetal',
|
||||
'Compute-1::NeutronAllowL3AgentFailover': False,
|
||||
'Compute-1::NeutronBridgeMappings': 'datacentre:br-test',
|
||||
'Compute-1::NeutronL3HA': True,
|
||||
'Compute-1::NeutronMechanismDrivers': 'linuxbridge',
|
||||
'Compute-1::NeutronPassword': 'password',
|
||||
'Compute-1::NovaPassword': 'password',
|
||||
'Compute-1::NtpServer': 'ntp.local',
|
||||
'Compute-1::SnmpdReadonlyUserPassword': "PASSWORD",
|
||||
'Controller-1::AdminPassword': 'password',
|
||||
'Controller-1::AdminToken': 'password',
|
||||
'Controller-1::CeilometerMeteringSecret': 'password',
|
||||
'Controller-1::CeilometerPassword': 'password',
|
||||
'Controller-1::CinderPassword': 'password',
|
||||
'Controller-1::count': 3,
|
||||
'Controller-1::GlancePassword': 'password',
|
||||
'Controller-1::HeatPassword': 'password',
|
||||
'Controller-1::HeatStackDomainAdminPassword': 'password',
|
||||
'Controller-1::NeutronAllowL3AgentFailover': False,
|
||||
'Controller-1::NeutronBridgeMappings': 'datacentre:br-test',
|
||||
'Controller-1::NeutronDhcpAgentsPerNetwork': 3,
|
||||
'Controller-1::NeutronL3HA': True,
|
||||
'Controller-1::NeutronMechanismDrivers': 'linuxbridge',
|
||||
'Controller-1::NeutronPassword': 'password',
|
||||
'Controller-1::NovaPassword': 'password',
|
||||
'Controller-1::NtpServer': 'ntp.local',
|
||||
'Controller-1::SnmpdReadonlyUserPassword': "PASSWORD",
|
||||
'Controller-1::SwiftHashSuffix': 'password',
|
||||
'Controller-1::SwiftPassword': 'password',
|
||||
'NeutronControlPlaneID': 'network id',
|
||||
'Swift-Storage-1::SnmpdReadonlyUserPassword': "PASSWORD",
|
||||
}
|
||||
|
||||
mock_heat_deploy.assert_called_with(
|
||||
mock_get_stack(),
|
||||
'overcloud',
|
||||
'fake/plan.yaml',
|
||||
parameters,
|
||||
['fake/environment.yaml'],
|
||||
240
|
||||
)
|
||||
|
||||
mock_create_tempest_deployer_input.assert_called_with(self.cmd)
|
||||
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_deploy_postconfig')
|
||||
@mock.patch('tripleoclient.utils.get_config_value', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_create_tempest_deployer_input', autospec=True)
|
||||
@mock.patch('tripleoclient.utils.generate_overcloud_passwords')
|
||||
@mock.patch('heatclient.common.template_utils.'
|
||||
'process_multiple_environments_and_files')
|
||||
@mock.patch('heatclient.common.template_utils.get_template_contents')
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_get_stack')
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_pre_heat_deploy')
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_create_overcloudrc')
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_heat_deploy')
|
||||
def test_tuskar_scale(self, mock_heat_deploy, mock_create_overcloudrc,
|
||||
most_pre_deploy, mock_get_stack,
|
||||
mock_get_templte_contents,
|
||||
mock_process_multiple_env,
|
||||
mock_generate_overcloud_passwords,
|
||||
mock_create_tempest_deployer_input,
|
||||
mock_get_key,
|
||||
mock_deploy_postconfig):
|
||||
|
||||
arglist = ['--plan', 'undercloud', '--output-dir', 'fake',
|
||||
'--compute-flavor', 'baremetal',
|
||||
'--neutron-bridge-mappings', 'datacentre:br-test',
|
||||
'--neutron-disable-tunneling',
|
||||
'--control-scale', '3',
|
||||
'--ntp-server', 'ntp.local',
|
||||
'--neutron-mechanism-drivers', 'linuxbridge']
|
||||
|
||||
verifylist = [
|
||||
('templates', None),
|
||||
('plan', 'undercloud'),
|
||||
('output_dir', 'fake'),
|
||||
]
|
||||
|
||||
clients = self.app.client_manager
|
||||
management = clients.tripleoclient.management()
|
||||
|
||||
management.plans.templates.return_value = {}
|
||||
management.plans.resource_class = Plan
|
||||
|
||||
mock_plan = mock.Mock()
|
||||
mock_plan.configure_mock(name="undercloud")
|
||||
management.plans.list.return_value = [mock_plan, ]
|
||||
|
||||
mock_get_templte_contents.return_value = ({}, "template")
|
||||
mock_process_multiple_env.return_value = ({}, "envs")
|
||||
clients.network.api.find_attr.return_value = {
|
||||
"id": "network id"
|
||||
}
|
||||
|
||||
mock_get_key.return_value = "PASSWORD"
|
||||
|
||||
mock_generate_overcloud_passwords.return_value = self._get_passwords()
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
baremetal = clients.tripleoclient.baremetal()
|
||||
baremetal.node.list.return_value = range(10)
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.assertTrue(result)
|
||||
|
||||
parameters = {
|
||||
'Cinder-Storage-1::SnmpdReadonlyUserPassword': "PASSWORD",
|
||||
'Compute-1::AdminPassword': 'password',
|
||||
'Compute-1::CeilometerMeteringSecret': 'password',
|
||||
'Compute-1::CeilometerPassword': 'password',
|
||||
'Compute-1::Flavor': 'baremetal',
|
||||
'Compute-1::NeutronAllowL3AgentFailover': False,
|
||||
'Compute-1::NeutronBridgeMappings': 'datacentre:br-test',
|
||||
'Compute-1::NeutronL3HA': True,
|
||||
'Compute-1::NeutronMechanismDrivers': 'linuxbridge',
|
||||
'Compute-1::NeutronPassword': 'password',
|
||||
'Compute-1::NovaPassword': 'password',
|
||||
'Compute-1::NtpServer': 'ntp.local',
|
||||
'Compute-1::SnmpdReadonlyUserPassword': "PASSWORD",
|
||||
'Controller-1::AdminPassword': 'password',
|
||||
'Controller-1::AdminToken': 'password',
|
||||
'Controller-1::CeilometerMeteringSecret': 'password',
|
||||
'Controller-1::CeilometerPassword': 'password',
|
||||
'Controller-1::CinderPassword': 'password',
|
||||
'Controller-1::count': 3,
|
||||
'Controller-1::GlancePassword': 'password',
|
||||
'Controller-1::HeatPassword': 'password',
|
||||
'Controller-1::HeatStackDomainAdminPassword': 'password',
|
||||
'Controller-1::NeutronAllowL3AgentFailover': False,
|
||||
'Controller-1::NeutronBridgeMappings': 'datacentre:br-test',
|
||||
'Controller-1::NeutronDhcpAgentsPerNetwork': 3,
|
||||
'Controller-1::NeutronL3HA': True,
|
||||
'Controller-1::NeutronMechanismDrivers': 'linuxbridge',
|
||||
'Controller-1::NeutronPassword': 'password',
|
||||
'Controller-1::NovaPassword': 'password',
|
||||
'Controller-1::NtpServer': 'ntp.local',
|
||||
'Controller-1::SnmpdReadonlyUserPassword': "PASSWORD",
|
||||
'Controller-1::SwiftHashSuffix': 'password',
|
||||
'Controller-1::SwiftPassword': 'password',
|
||||
'NeutronControlPlaneID': 'network id',
|
||||
'Swift-Storage-1::SnmpdReadonlyUserPassword': "PASSWORD",
|
||||
}
|
||||
|
||||
mock_heat_deploy.assert_called_with(
|
||||
mock_get_stack(),
|
||||
'overcloud',
|
||||
'fake/plan.yaml',
|
||||
parameters,
|
||||
['fake/environment.yaml'],
|
||||
240
|
||||
)
|
||||
|
||||
mock_create_tempest_deployer_input.assert_called_with(self.cmd)
|
||||
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_deploy_postconfig')
|
||||
@mock.patch('tripleoclient.utils.get_config_value', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_create_tempest_deployer_input', autospec=True)
|
||||
@mock.patch('tripleoclient.utils.generate_overcloud_passwords')
|
||||
@mock.patch('heatclient.common.template_utils.'
|
||||
'process_multiple_environments_and_files')
|
||||
@mock.patch('heatclient.common.template_utils.get_template_contents')
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_get_stack')
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_pre_heat_deploy')
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_create_overcloudrc')
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_heat_deploy')
|
||||
def test_tuskar_deploy_extra_config(self, mock_heat_deploy,
|
||||
mock_create_overcloudrc,
|
||||
most_pre_deploy, mock_get_stack,
|
||||
mock_get_templte_contents,
|
||||
mock_process_multiple_env,
|
||||
mock_generate_overcloud_passwords,
|
||||
mock_create_tempest_deployer_input,
|
||||
mock_get_key,
|
||||
mock_deploy_postconfig):
|
||||
|
||||
arglist = ['--plan', 'undercloud', '--output-dir', 'fake',
|
||||
'--compute-flavor', 'baremetal',
|
||||
'--neutron-bridge-mappings', 'datacentre:br-test',
|
||||
'--neutron-disable-tunneling',
|
||||
'--control-scale', '3',
|
||||
'--ntp-server', 'ntp.local',
|
||||
'-e', 'extra_registry.yaml',
|
||||
'-e', 'extra_environment.yaml',
|
||||
'-t', '120', ]
|
||||
|
||||
verifylist = [
|
||||
('templates', None),
|
||||
('plan', 'undercloud'),
|
||||
('output_dir', 'fake'),
|
||||
('environment_files', ['extra_registry.yaml',
|
||||
'extra_environment.yaml'])
|
||||
]
|
||||
|
||||
clients = self.app.client_manager
|
||||
management = clients.tripleoclient.management()
|
||||
|
||||
management.plans.templates.return_value = {}
|
||||
management.plans.resource_class = Plan
|
||||
|
||||
mock_plan = mock.Mock()
|
||||
mock_plan.configure_mock(name="undercloud")
|
||||
management.plans.list.return_value = [mock_plan, ]
|
||||
|
||||
mock_get_templte_contents.return_value = ({}, "template")
|
||||
mock_process_multiple_env.return_value = ({}, "envs")
|
||||
clients.network.api.find_attr.return_value = {
|
||||
"id": "network id"
|
||||
}
|
||||
|
||||
mock_get_key.return_value = "PASSWORD"
|
||||
|
||||
mock_generate_overcloud_passwords.return_value = self._get_passwords()
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
baremetal = clients.tripleoclient.baremetal()
|
||||
baremetal.node.list.return_value = range(10)
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.assertTrue(result)
|
||||
|
||||
parameters = {
|
||||
'Cinder-Storage-1::SnmpdReadonlyUserPassword': "PASSWORD",
|
||||
'Compute-1::AdminPassword': 'password',
|
||||
'Compute-1::CeilometerMeteringSecret': 'password',
|
||||
'Compute-1::CeilometerPassword': 'password',
|
||||
'Compute-1::Flavor': 'baremetal',
|
||||
'Compute-1::NeutronAllowL3AgentFailover': False,
|
||||
'Compute-1::NeutronBridgeMappings': 'datacentre:br-test',
|
||||
'Compute-1::NeutronL3HA': True,
|
||||
'Compute-1::NeutronPassword': 'password',
|
||||
'Compute-1::NovaPassword': 'password',
|
||||
'Compute-1::NtpServer': 'ntp.local',
|
||||
'Compute-1::SnmpdReadonlyUserPassword': "PASSWORD",
|
||||
'Controller-1::AdminPassword': 'password',
|
||||
'Controller-1::AdminToken': 'password',
|
||||
'Controller-1::CeilometerMeteringSecret': 'password',
|
||||
'Controller-1::CeilometerPassword': 'password',
|
||||
'Controller-1::CinderPassword': 'password',
|
||||
'Controller-1::count': 3,
|
||||
'Controller-1::GlancePassword': 'password',
|
||||
'Controller-1::HeatPassword': 'password',
|
||||
'Controller-1::HeatStackDomainAdminPassword': 'password',
|
||||
'Controller-1::NeutronAllowL3AgentFailover': False,
|
||||
'Controller-1::NeutronBridgeMappings': 'datacentre:br-test',
|
||||
'Controller-1::NeutronDhcpAgentsPerNetwork': 3,
|
||||
'Controller-1::NeutronL3HA': True,
|
||||
'Controller-1::NeutronPassword': 'password',
|
||||
'Controller-1::NovaPassword': 'password',
|
||||
'Controller-1::NtpServer': 'ntp.local',
|
||||
'Controller-1::SnmpdReadonlyUserPassword': "PASSWORD",
|
||||
'Controller-1::SwiftHashSuffix': 'password',
|
||||
'Controller-1::SwiftPassword': 'password',
|
||||
'NeutronControlPlaneID': 'network id',
|
||||
'Swift-Storage-1::SnmpdReadonlyUserPassword': "PASSWORD",
|
||||
}
|
||||
|
||||
mock_heat_deploy.assert_called_with(
|
||||
mock_get_stack(),
|
||||
'overcloud',
|
||||
'fake/plan.yaml',
|
||||
parameters,
|
||||
['fake/environment.yaml',
|
||||
'extra_registry.yaml',
|
||||
'extra_environment.yaml'],
|
||||
120
|
||||
)
|
||||
|
||||
# We can't use assert_called_with() here, as we need to compare
|
||||
# two lists that may have different ordering, although the ordering
|
||||
# does not matter:
|
||||
call_args = dict([(x['name'], x['value']) for x in
|
||||
management.plans.patch.call_args_list[0][0][1]])
|
||||
target = dict([(k, six.text_type(v)) for k, v in parameters.items()])
|
||||
self.assertEqual(call_args, target)
|
||||
self.assertEqual(management.plans.patch.call_count, 1)
|
||||
|
||||
mock_create_tempest_deployer_input.assert_called_with(self.cmd)
|
||||
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_deploy_tuskar', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_deploy_tripleo_heat_templates', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_pre_heat_deploy', autospec=True)
|
||||
def test_invalid_deploy_call(self, mock_pre_deploy, mock_deploy_tht,
|
||||
mock_deploy_tuskar):
|
||||
|
||||
arglist = ['--plan', 'undercloud', '--templates']
|
||||
verifylist = [
|
||||
('templates', '/usr/share/openstack-tripleo-heat-templates/'),
|
||||
('plan', 'undercloud'),
|
||||
]
|
||||
|
||||
try:
|
||||
oldstderr = sys.stderr
|
||||
sys.stderr = self.fake_stdout
|
||||
self.assertRaises(oscutils.ParserException, self.check_parser,
|
||||
self.cmd, arglist, verifylist)
|
||||
finally:
|
||||
sys.stderr = oldstderr
|
||||
|
||||
self.assertFalse(mock_deploy_tht.called)
|
||||
self.assertFalse(mock_deploy_tuskar.called)
|
||||
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_deploy_tuskar', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_deploy_tripleo_heat_templates', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_pre_heat_deploy', autospec=True)
|
||||
def test_missing_sat_url(self, mock_pre_deploy, mock_deploy_tht,
|
||||
mock_deploy_tuskar):
|
||||
def test_missing_sat_url(self, mock_pre_deploy, mock_deploy_tht):
|
||||
|
||||
arglist = ['--templates', '--rhel-reg',
|
||||
'--reg-method', 'satellite', '--reg-org', '123456789',
|
||||
@ -871,7 +473,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.assertFalse(result)
|
||||
self.assertFalse(mock_deploy_tht.called)
|
||||
self.assertFalse(mock_deploy_tuskar.called)
|
||||
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_create_tempest_deployer_input', autospec=True)
|
||||
@ -879,14 +480,12 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
'_create_overcloudrc', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_get_overcloud_endpoint', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_deploy_tuskar', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_deploy_tripleo_heat_templates', autospec=True)
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_pre_heat_deploy', autospec=True)
|
||||
def test_rhel_reg_params_provided(self, mock_pre_deploy, mock_deploy_tht,
|
||||
mock_deploy_tuskar, mock_oc_endpoint,
|
||||
mock_oc_endpoint,
|
||||
mock_create_ocrc,
|
||||
mock_create_tempest_deployer_input):
|
||||
|
||||
@ -909,7 +508,6 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
||||
self.assertTrue(mock_deploy_tht.called)
|
||||
self.assertTrue(mock_oc_endpoint.called)
|
||||
self.assertTrue(mock_create_ocrc.called)
|
||||
self.assertFalse(mock_deploy_tuskar.called)
|
||||
|
||||
mock_create_tempest_deployer_input.assert_called_with(self.cmd)
|
||||
|
||||
|
@ -22,7 +22,6 @@ class FakeClientWrapper(object):
|
||||
def __init__(self):
|
||||
self._instance = mock.Mock()
|
||||
self._orchestration = None
|
||||
self._management = None
|
||||
|
||||
def orchestration(self):
|
||||
|
||||
@ -31,13 +30,6 @@ class FakeClientWrapper(object):
|
||||
|
||||
return self._orchestration
|
||||
|
||||
def management(self):
|
||||
|
||||
if self._management is None:
|
||||
self._management = mock.Mock()
|
||||
|
||||
return self._management
|
||||
|
||||
|
||||
class TestDeleteNode(utils.TestCommand):
|
||||
|
||||
|
@ -31,10 +31,9 @@ class TestDeleteNode(fakes.TestDeleteNode):
|
||||
# probably be fixed so that it can pass with that.
|
||||
@mock.patch('tripleo_common.scale.ScaleManager')
|
||||
def test_node_delete(self, scale_manager):
|
||||
argslist = ['instance1', 'instance2', '--plan', 'overcloud',
|
||||
argslist = ['instance1', 'instance2', '--templates',
|
||||
'--stack', 'overcloud']
|
||||
verifylist = [
|
||||
('plan', 'overcloud'),
|
||||
('stack', 'overcloud'),
|
||||
('nodes', ['instance1', 'instance2'])
|
||||
]
|
||||
|
@ -22,7 +22,6 @@ class FakeClientWrapper(object):
|
||||
def __init__(self):
|
||||
self._instance = mock.Mock()
|
||||
self._orchestration = None
|
||||
self._management = None
|
||||
|
||||
def orchestration(self):
|
||||
|
||||
@ -31,13 +30,6 @@ class FakeClientWrapper(object):
|
||||
|
||||
return self._orchestration
|
||||
|
||||
def management(self):
|
||||
|
||||
if self._management is None:
|
||||
self._management = mock.Mock()
|
||||
|
||||
return self._management
|
||||
|
||||
|
||||
class TestOvercloudUpdate(utils.TestCommand):
|
||||
|
||||
|
@ -31,10 +31,9 @@ class TestOvercloudUpdate(fakes.TestOvercloudUpdate):
|
||||
def test_update_out(self, update_manager):
|
||||
update_manager.return_value.get_status.return_value = (
|
||||
'UPDATE_COMPLETE', {})
|
||||
argslist = ['-i', '--plan', 'overcloud', 'overcloud']
|
||||
argslist = ['overcloud', '-i', '--templates']
|
||||
verifylist = [
|
||||
('stack', 'overcloud'),
|
||||
('plan', 'overcloud'),
|
||||
('interactive', True),
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, argslist, verifylist)
|
||||
|
@ -35,7 +35,6 @@ from os_cloud_config import keystone
|
||||
from os_cloud_config import keystone_pki
|
||||
from os_cloud_config.utils import clients
|
||||
from six.moves import configparser
|
||||
from tuskarclient.common import utils as tuskarutils
|
||||
|
||||
from tripleoclient import exceptions
|
||||
from tripleoclient import utils
|
||||
@ -114,66 +113,24 @@ class DeployOvercloud(command.Command):
|
||||
self.passwords = passwords = utils.generate_overcloud_passwords()
|
||||
ceilometer_pass = passwords['OVERCLOUD_CEILOMETER_PASSWORD']
|
||||
ceilometer_secret = passwords['OVERCLOUD_CEILOMETER_SECRET']
|
||||
if parsed_args.templates:
|
||||
parameters['AdminPassword'] = passwords['OVERCLOUD_ADMIN_PASSWORD']
|
||||
parameters['AdminToken'] = passwords['OVERCLOUD_ADMIN_TOKEN']
|
||||
parameters['CeilometerPassword'] = ceilometer_pass
|
||||
parameters['CeilometerMeteringSecret'] = ceilometer_secret
|
||||
parameters['CinderPassword'] = passwords[
|
||||
'OVERCLOUD_CINDER_PASSWORD']
|
||||
parameters['GlancePassword'] = passwords[
|
||||
'OVERCLOUD_GLANCE_PASSWORD']
|
||||
parameters['HeatPassword'] = passwords['OVERCLOUD_HEAT_PASSWORD']
|
||||
parameters['HeatStackDomainAdminPassword'] = passwords[
|
||||
'OVERCLOUD_HEAT_STACK_DOMAIN_PASSWORD']
|
||||
parameters['NeutronPassword'] = passwords[
|
||||
'OVERCLOUD_NEUTRON_PASSWORD']
|
||||
parameters['NovaPassword'] = passwords['OVERCLOUD_NOVA_PASSWORD']
|
||||
parameters['SwiftHashSuffix'] = passwords['OVERCLOUD_SWIFT_HASH']
|
||||
parameters['SwiftPassword'] = passwords['OVERCLOUD_SWIFT_PASSWORD']
|
||||
parameters['SnmpdReadonlyUserPassword'] = (
|
||||
undercloud_ceilometer_snmpd_password)
|
||||
else:
|
||||
parameters['Controller-1::AdminPassword'] = passwords[
|
||||
'OVERCLOUD_ADMIN_PASSWORD']
|
||||
parameters['Controller-1::AdminToken'] = passwords[
|
||||
'OVERCLOUD_ADMIN_TOKEN']
|
||||
parameters['Compute-1::AdminPassword'] = passwords[
|
||||
'OVERCLOUD_ADMIN_PASSWORD']
|
||||
parameters['Controller-1::SnmpdReadonlyUserPassword'] = (
|
||||
undercloud_ceilometer_snmpd_password)
|
||||
parameters['Cinder-Storage-1::SnmpdReadonlyUserPassword'] = (
|
||||
undercloud_ceilometer_snmpd_password)
|
||||
parameters['Swift-Storage-1::SnmpdReadonlyUserPassword'] = (
|
||||
undercloud_ceilometer_snmpd_password)
|
||||
parameters['Compute-1::SnmpdReadonlyUserPassword'] = (
|
||||
undercloud_ceilometer_snmpd_password)
|
||||
parameters['Controller-1::CeilometerPassword'] = ceilometer_pass
|
||||
parameters[
|
||||
'Controller-1::CeilometerMeteringSecret'] = ceilometer_secret
|
||||
parameters['Compute-1::CeilometerPassword'] = ceilometer_pass
|
||||
parameters[
|
||||
'Compute-1::CeilometerMeteringSecret'] = ceilometer_secret
|
||||
parameters['Controller-1::CinderPassword'] = (
|
||||
passwords['OVERCLOUD_CINDER_PASSWORD'])
|
||||
parameters['Controller-1::GlancePassword'] = (
|
||||
passwords['OVERCLOUD_GLANCE_PASSWORD'])
|
||||
parameters['Controller-1::HeatPassword'] = (
|
||||
passwords['OVERCLOUD_HEAT_PASSWORD'])
|
||||
parameters['Controller-1::HeatStackDomainAdminPassword'] = (
|
||||
passwords['OVERCLOUD_HEAT_STACK_DOMAIN_PASSWORD'])
|
||||
parameters['Controller-1::NeutronPassword'] = (
|
||||
passwords['OVERCLOUD_NEUTRON_PASSWORD'])
|
||||
parameters['Compute-1::NeutronPassword'] = (
|
||||
passwords['OVERCLOUD_NEUTRON_PASSWORD'])
|
||||
parameters['Controller-1::NovaPassword'] = (
|
||||
passwords['OVERCLOUD_NOVA_PASSWORD'])
|
||||
parameters['Compute-1::NovaPassword'] = (
|
||||
passwords['OVERCLOUD_NOVA_PASSWORD'])
|
||||
parameters['Controller-1::SwiftHashSuffix'] = (
|
||||
passwords['OVERCLOUD_SWIFT_HASH'])
|
||||
parameters['Controller-1::SwiftPassword'] = (
|
||||
passwords['OVERCLOUD_SWIFT_PASSWORD'])
|
||||
parameters['AdminPassword'] = passwords['OVERCLOUD_ADMIN_PASSWORD']
|
||||
parameters['AdminToken'] = passwords['OVERCLOUD_ADMIN_TOKEN']
|
||||
parameters['CeilometerPassword'] = ceilometer_pass
|
||||
parameters['CeilometerMeteringSecret'] = ceilometer_secret
|
||||
parameters['CinderPassword'] = passwords[
|
||||
'OVERCLOUD_CINDER_PASSWORD']
|
||||
parameters['GlancePassword'] = passwords[
|
||||
'OVERCLOUD_GLANCE_PASSWORD']
|
||||
parameters['HeatPassword'] = passwords['OVERCLOUD_HEAT_PASSWORD']
|
||||
parameters['HeatStackDomainAdminPassword'] = passwords[
|
||||
'OVERCLOUD_HEAT_STACK_DOMAIN_PASSWORD']
|
||||
parameters['NeutronPassword'] = passwords[
|
||||
'OVERCLOUD_NEUTRON_PASSWORD']
|
||||
parameters['NovaPassword'] = passwords['OVERCLOUD_NOVA_PASSWORD']
|
||||
parameters['SwiftHashSuffix'] = passwords['OVERCLOUD_SWIFT_HASH']
|
||||
parameters['SwiftPassword'] = passwords['OVERCLOUD_SWIFT_PASSWORD']
|
||||
parameters['SnmpdReadonlyUserPassword'] = (
|
||||
undercloud_ceilometer_snmpd_password)
|
||||
|
||||
def _get_stack(self, orchestration_client, stack_name):
|
||||
"""Get the ID for the current deployed overcloud stack if it exists."""
|
||||
@ -185,12 +142,9 @@ class DeployOvercloud(command.Command):
|
||||
return None
|
||||
|
||||
def _update_paramaters(self, args, network_client, stack):
|
||||
if args.templates:
|
||||
parameters = PARAMETERS.copy()
|
||||
if stack is None:
|
||||
parameters.update(NEW_STACK_PARAMETERS)
|
||||
else:
|
||||
parameters = {}
|
||||
parameters = PARAMETERS.copy()
|
||||
if stack is None:
|
||||
parameters.update(NEW_STACK_PARAMETERS)
|
||||
|
||||
self.log.debug("Generating overcloud passwords")
|
||||
self.set_overcloud_passwords(parameters, args)
|
||||
@ -199,107 +153,42 @@ class DeployOvercloud(command.Command):
|
||||
net = network_client.api.find_attr('networks', 'ctlplane')
|
||||
parameters['NeutronControlPlaneID'] = net['id']
|
||||
|
||||
if args.templates:
|
||||
param_args = (
|
||||
('NeutronPublicInterface', 'neutron_public_interface'),
|
||||
('NeutronBridgeMappings', 'neutron_bridge_mappings'),
|
||||
('NeutronFlatNetworks', 'neutron_flat_networks'),
|
||||
('HypervisorNeutronPhysicalBridge', 'neutron_physical_bridge'),
|
||||
('NtpServer', 'ntp_server'),
|
||||
('ControllerCount', 'control_scale'),
|
||||
('ComputeCount', 'compute_scale'),
|
||||
('ObjectStorageCount', 'swift_storage_scale'),
|
||||
('BlockStorageCount', 'block_storage_scale'),
|
||||
('CephStorageCount', 'ceph_storage_scale'),
|
||||
('OvercloudControlFlavor', 'control_flavor'),
|
||||
('OvercloudComputeFlavor', 'compute_flavor'),
|
||||
('OvercloudBlockStorageFlavor', 'block_storage_flavor'),
|
||||
('OvercloudSwiftStorageFlavor', 'swift_storage_flavor'),
|
||||
('OvercloudCephStorageFlavor', 'ceph_storage_flavor'),
|
||||
('NeutronNetworkVLANRanges', 'neutron_network_vlan_ranges'),
|
||||
('NeutronMechanismDrivers', 'neutron_mechanism_drivers')
|
||||
param_args = (
|
||||
('NeutronPublicInterface', 'neutron_public_interface'),
|
||||
('NeutronBridgeMappings', 'neutron_bridge_mappings'),
|
||||
('NeutronFlatNetworks', 'neutron_flat_networks'),
|
||||
('HypervisorNeutronPhysicalBridge', 'neutron_physical_bridge'),
|
||||
('NtpServer', 'ntp_server'),
|
||||
('ControllerCount', 'control_scale'),
|
||||
('ComputeCount', 'compute_scale'),
|
||||
('ObjectStorageCount', 'swift_storage_scale'),
|
||||
('BlockStorageCount', 'block_storage_scale'),
|
||||
('CephStorageCount', 'ceph_storage_scale'),
|
||||
('OvercloudControlFlavor', 'control_flavor'),
|
||||
('OvercloudComputeFlavor', 'compute_flavor'),
|
||||
('OvercloudBlockStorageFlavor', 'block_storage_flavor'),
|
||||
('OvercloudSwiftStorageFlavor', 'swift_storage_flavor'),
|
||||
('OvercloudCephStorageFlavor', 'ceph_storage_flavor'),
|
||||
('NeutronNetworkVLANRanges', 'neutron_network_vlan_ranges'),
|
||||
('NeutronMechanismDrivers', 'neutron_mechanism_drivers')
|
||||
)
|
||||
|
||||
if stack is None:
|
||||
new_stack_args = (
|
||||
('NeutronNetworkType', 'neutron_network_type'),
|
||||
('NeutronTunnelIdRanges', 'neutron_tunnel_id_ranges'),
|
||||
('NeutronTunnelTypes', 'neutron_tunnel_types'),
|
||||
('NeutronVniRanges', 'neutron_vni_ranges'),
|
||||
('NovaComputeLibvirtType', 'libvirt_type'),
|
||||
)
|
||||
param_args = param_args + new_stack_args
|
||||
|
||||
if stack is None:
|
||||
new_stack_args = (
|
||||
('NeutronNetworkType', 'neutron_network_type'),
|
||||
('NeutronTunnelIdRanges', 'neutron_tunnel_id_ranges'),
|
||||
('NeutronTunnelTypes', 'neutron_tunnel_types'),
|
||||
('NeutronVniRanges', 'neutron_vni_ranges'),
|
||||
('NovaComputeLibvirtType', 'libvirt_type'),
|
||||
)
|
||||
param_args = param_args + new_stack_args
|
||||
|
||||
if args.neutron_disable_tunneling is not None:
|
||||
neutron_enable_tunneling = (
|
||||
not args.neutron_disable_tunneling)
|
||||
parameters.update({
|
||||
'NeutronEnableTunnelling': neutron_enable_tunneling,
|
||||
})
|
||||
|
||||
else:
|
||||
param_args = (
|
||||
('Controller-1::NeutronPublicInterface',
|
||||
'neutron_public_interface'),
|
||||
('Compute-1::NeutronPublicInterface',
|
||||
'neutron_public_interface'),
|
||||
('Controller-1::NeutronBridgeMappings',
|
||||
'neutron_bridge_mappings'),
|
||||
('Compute-1::NeutronBridgeMappings',
|
||||
'neutron_bridge_mappings'),
|
||||
('Controller-1::NeutronFlatNetworks', 'neutron_flat_networks'),
|
||||
('Compute-1::NeutronFlatNetworks', 'neutron_flat_networks'),
|
||||
('Compute-1::NeutronPhysicalBridge',
|
||||
'neutron_physical_bridge'),
|
||||
('Controller-1::NtpServer', 'ntp_server'),
|
||||
('Compute-1::NtpServer', 'ntp_server'),
|
||||
('Controller-1::NeutronNetworkVLANRanges',
|
||||
'neutron_network_vlan_ranges'),
|
||||
('Compute-1::NeutronNetworkVLANRanges',
|
||||
'neutron_network_vlan_ranges'),
|
||||
('Controller-1::NeutronMechanismDrivers',
|
||||
'neutron_mechanism_drivers'),
|
||||
('Compute-1::NeutronMechanismDrivers',
|
||||
'neutron_mechanism_drivers'),
|
||||
('Controller-1::count', 'control_scale'),
|
||||
('Compute-1::count', 'compute_scale'),
|
||||
('Swift-Storage-1::count', 'swift_storage_scale'),
|
||||
('Cinder-Storage-1::count', 'block_storage_scale'),
|
||||
('Ceph-Storage-1::count', 'ceph_storage_scale'),
|
||||
('Cinder-Storage-1::Flavor', 'block_storage_flavor'),
|
||||
('Compute-1::Flavor', 'compute_flavor'),
|
||||
('Controller-1::Flavor', 'control_flavor'),
|
||||
('Swift-Storage-1::Flavor', 'swift_storage_flavor'),
|
||||
('Ceph-Storage-1::Flavor', 'ceph_storage_flavor'),
|
||||
)
|
||||
|
||||
if stack is None:
|
||||
new_stack_args = (
|
||||
('Controller-1::NeutronNetworkType',
|
||||
'neutron_network_type'),
|
||||
('Compute-1::NeutronNetworkType', 'neutron_network_type'),
|
||||
('Controller-1::NeutronTunnelTypes',
|
||||
'neutron_tunnel_types'),
|
||||
('Compute-1::NeutronTunnelTypes', 'neutron_tunnel_types'),
|
||||
('Compute-1::NovaComputeLibvirtType', 'libvirt_type'),
|
||||
('Controller-1::NeutronTunnelIdRanges',
|
||||
'neutron_tunnel_id_ranges'),
|
||||
('Controller-1::NeutronVniRanges', 'neutron_vni_ranges'),
|
||||
('Compute-1::NeutronTunnelIdRanges',
|
||||
'neutron_tunnel_id_ranges'),
|
||||
('Compute-1::NeutronVniRanges', 'neutron_vni_ranges'),
|
||||
)
|
||||
param_args = param_args + new_stack_args
|
||||
|
||||
if args.neutron_disable_tunneling is not None:
|
||||
neutron_enable_tunneling = (
|
||||
not args.neutron_disable_tunneling)
|
||||
parameters.update({
|
||||
'Controller-1::NeutronEnableTunnelling':
|
||||
neutron_enable_tunneling,
|
||||
'Compute-1::NeutronEnableTunnelling':
|
||||
neutron_enable_tunneling,
|
||||
})
|
||||
if args.neutron_disable_tunneling is not None:
|
||||
neutron_enable_tunneling = (
|
||||
not args.neutron_disable_tunneling)
|
||||
parameters.update({
|
||||
'NeutronEnableTunnelling': neutron_enable_tunneling,
|
||||
})
|
||||
|
||||
# Update parameters from commandline
|
||||
for param, arg in param_args:
|
||||
@ -312,57 +201,30 @@ class DeployOvercloud(command.Command):
|
||||
parameters[param] = getattr(args, arg)
|
||||
|
||||
# Scaling needs extra parameters
|
||||
number_controllers = max((
|
||||
int(parameters.get('ControllerCount', 0)),
|
||||
int(parameters.get('Controller-1::count', 0))
|
||||
))
|
||||
|
||||
number_controllers = int(parameters.get('ControllerCount', 0))
|
||||
if number_controllers > 1:
|
||||
if not args.ntp_server:
|
||||
raise Exception('Specify --ntp-server when using multiple'
|
||||
' controllers (with HA).')
|
||||
|
||||
if args.templates:
|
||||
parameters.update({
|
||||
'NeutronL3HA': True,
|
||||
'NeutronAllowL3AgentFailover': False,
|
||||
})
|
||||
else:
|
||||
parameters.update({
|
||||
'Controller-1::NeutronL3HA': True,
|
||||
'Controller-1::NeutronAllowL3AgentFailover': False,
|
||||
'Compute-1::NeutronL3HA': True,
|
||||
'Compute-1::NeutronAllowL3AgentFailover': False,
|
||||
})
|
||||
parameters.update({
|
||||
'NeutronL3HA': True,
|
||||
'NeutronAllowL3AgentFailover': False,
|
||||
})
|
||||
else:
|
||||
if args.templates:
|
||||
parameters.update({
|
||||
'NeutronL3HA': False,
|
||||
'NeutronAllowL3AgentFailover': False,
|
||||
})
|
||||
else:
|
||||
parameters.update({
|
||||
'Controller-1::NeutronL3HA': False,
|
||||
'Controller-1::NeutronAllowL3AgentFailover': False,
|
||||
'Compute-1::NeutronL3HA': False,
|
||||
'Compute-1::NeutronAllowL3AgentFailover': False,
|
||||
})
|
||||
parameters.update({
|
||||
'NeutronL3HA': False,
|
||||
'NeutronAllowL3AgentFailover': False,
|
||||
})
|
||||
|
||||
dhcp_agents_per_network = (min(number_controllers, 3) if
|
||||
number_controllers else 1)
|
||||
|
||||
if args.templates:
|
||||
parameters.update({
|
||||
'NeutronDhcpAgentsPerNetwork': dhcp_agents_per_network,
|
||||
})
|
||||
else:
|
||||
parameters.update({
|
||||
'Controller-1::NeutronDhcpAgentsPerNetwork':
|
||||
dhcp_agents_per_network,
|
||||
})
|
||||
parameters.update({
|
||||
'NeutronDhcpAgentsPerNetwork': dhcp_agents_per_network,
|
||||
})
|
||||
|
||||
if max((int(parameters.get('CephStorageCount', 0)),
|
||||
int(parameters.get('Ceph-Storage-1::count', 0)))) > 0:
|
||||
if int(parameters.get('CephStorageCount', 0)) > 0:
|
||||
|
||||
if stack is None:
|
||||
parameters.update({
|
||||
@ -375,10 +237,7 @@ class DeployOvercloud(command.Command):
|
||||
|
||||
def _create_registration_env(self, args):
|
||||
|
||||
if args.templates:
|
||||
tht_root = args.templates
|
||||
else:
|
||||
tht_root = TRIPLEO_HEAT_TEMPLATES
|
||||
tht_root = args.templates
|
||||
|
||||
environment = os.path.join(tht_root,
|
||||
RHEL_REGISTRATION_EXTRACONFIG_NAME,
|
||||
@ -538,95 +397,6 @@ class DeployOvercloud(command.Command):
|
||||
self._heat_deploy(stack, parsed_args.stack, overcloud_yaml, parameters,
|
||||
environments, parsed_args.timeout)
|
||||
|
||||
def _deploy_tuskar(self, stack, parsed_args):
|
||||
|
||||
clients = self.app.client_manager
|
||||
management = clients.tripleoclient.management()
|
||||
network_client = clients.network
|
||||
|
||||
# TODO(dmatthews): The Tuskar client has very similar code to this for
|
||||
# downloading templates. It should be refactored upstream so we can use
|
||||
# it.
|
||||
|
||||
if parsed_args.output_dir:
|
||||
output_dir = parsed_args.output_dir
|
||||
else:
|
||||
output_dir = tempfile.mkdtemp()
|
||||
|
||||
if not os.path.isdir(output_dir):
|
||||
os.mkdir(output_dir)
|
||||
|
||||
management_plan = tuskarutils.find_resource(
|
||||
management.plans, parsed_args.plan)
|
||||
|
||||
# retrieve templates
|
||||
templates = management.plans.templates(management_plan.uuid)
|
||||
|
||||
parameters = self._update_paramaters(
|
||||
parsed_args, network_client, stack)
|
||||
|
||||
utils.check_nodes_count(
|
||||
self.app.client_manager.tripleoclient.baremetal(),
|
||||
stack,
|
||||
parameters,
|
||||
{
|
||||
'Controller-1::count': 1,
|
||||
'Compute-1::count': 1,
|
||||
'Swift-Storage-1::count': 0,
|
||||
'Cinder-Storage-1::count': 0,
|
||||
'Ceph-Storage-1::count': 0,
|
||||
}
|
||||
)
|
||||
|
||||
if stack is None:
|
||||
ca_key_pem, ca_cert_pem = keystone_pki.create_ca_pair()
|
||||
signing_key_pem, signing_cert_pem = (
|
||||
keystone_pki.create_signing_pair(ca_key_pem, ca_cert_pem))
|
||||
parameters['Controller-1::KeystoneCACertificate'] = ca_cert_pem
|
||||
parameters['Controller-1::KeystoneSigningCertificate'] = (
|
||||
signing_cert_pem)
|
||||
parameters['Controller-1::KeystoneSigningKey'] = signing_key_pem
|
||||
|
||||
# Save the parameters to Tuskar so they can be used when redeploying.
|
||||
# Tuskar expects to get all values as strings. So we convert them all
|
||||
# below.
|
||||
management.plans.patch(
|
||||
management_plan.uuid,
|
||||
[{'name': x[0], 'value': six.text_type(x[1])}
|
||||
for x in parameters.items()]
|
||||
)
|
||||
|
||||
# write file for each key-value in templates
|
||||
print("The following templates will be written:")
|
||||
for template_name, template_content in templates.items():
|
||||
|
||||
# It's possible to organize the role templates and their dependent
|
||||
# files into directories, in which case the template_name will
|
||||
# carry the directory information. If that's the case, first
|
||||
# create the directory structure (if it hasn't already been
|
||||
# created by another file in the templates list).
|
||||
template_dir = os.path.dirname(template_name)
|
||||
output_template_dir = os.path.join(output_dir, template_dir)
|
||||
if template_dir and not os.path.exists(output_template_dir):
|
||||
os.makedirs(output_template_dir)
|
||||
|
||||
filename = os.path.join(output_dir, template_name)
|
||||
with open(filename, 'w+') as template_file:
|
||||
template_file.write(template_content)
|
||||
print(filename)
|
||||
|
||||
overcloud_yaml = os.path.join(output_dir, 'plan.yaml')
|
||||
environment_yaml = os.path.join(output_dir, 'environment.yaml')
|
||||
environments = [environment_yaml, ]
|
||||
if parsed_args.rhel_reg:
|
||||
reg_env = self._create_registration_env(parsed_args)
|
||||
environments.extend(reg_env)
|
||||
if parsed_args.environment_files:
|
||||
environments.extend(parsed_args.environment_files)
|
||||
|
||||
self._heat_deploy(stack, parsed_args.stack, overcloud_yaml, parameters,
|
||||
environments, parsed_args.timeout)
|
||||
|
||||
def _create_overcloudrc(self, stack, parsed_args):
|
||||
overcloud_endpoint = self._get_overcloud_endpoint(stack)
|
||||
overcloud_ip = six.moves.urllib.parse.urlparse(
|
||||
@ -1014,14 +784,11 @@ class DeployOvercloud(command.Command):
|
||||
prog=prog_name,
|
||||
add_help=False
|
||||
)
|
||||
main_group = parser.add_mutually_exclusive_group(required=True)
|
||||
main_group.add_argument(
|
||||
'--plan',
|
||||
help=_("The Name or UUID of the Tuskar plan to deploy.")
|
||||
)
|
||||
main_group.add_argument(
|
||||
parser.add_argument(
|
||||
'--templates', nargs='?', const=TRIPLEO_HEAT_TEMPLATES,
|
||||
help=_("The directory containing the Heat templates to deploy"))
|
||||
help=_("The directory containing the Heat templates to deploy"),
|
||||
required=True
|
||||
)
|
||||
parser.add_argument('--stack',
|
||||
help=_("Stack name to create or update"),
|
||||
default='overcloud')
|
||||
@ -1112,12 +879,6 @@ class DeployOvercloud(command.Command):
|
||||
help=_('A comma separated list of hosts that should not be '
|
||||
'proxied.')
|
||||
)
|
||||
parser.add_argument(
|
||||
'-O', '--output-dir', metavar='<OUTPUT DIR>',
|
||||
help=_('Directory to write Tuskar template files into. It will be '
|
||||
'created if it does not exist. If not provided a temporary '
|
||||
'directory will be used.')
|
||||
)
|
||||
parser.add_argument(
|
||||
'-e', '--environment-file', metavar='<HEAT ENVIRONMENT FILE>',
|
||||
action='append', dest='environment_files',
|
||||
@ -1230,10 +991,7 @@ class DeployOvercloud(command.Command):
|
||||
"must specify --reg-org, and "
|
||||
"--reg-activation-key.")
|
||||
|
||||
if parsed_args.templates:
|
||||
self._deploy_tripleo_heat_templates(stack, parsed_args)
|
||||
else:
|
||||
self._deploy_tuskar(stack, parsed_args)
|
||||
self._deploy_tripleo_heat_templates(stack, parsed_args)
|
||||
|
||||
# Get a new copy of the stack after stack update/create. If it was
|
||||
# a create then the previous stack object would be None.
|
||||
|
@ -35,10 +35,6 @@ class DeleteNode(command.Command):
|
||||
help='Name or ID of heat stack to scale '
|
||||
'(default=Env: OVERCLOUD_STACK_NAME)',
|
||||
default=utils.env('OVERCLOUD_STACK_NAME'))
|
||||
parser.add_argument('--plan', dest='plan',
|
||||
help='Name or ID of tuskar plan to scale '
|
||||
'(default=Env: OVERCLOUD_PLAN_NAME)',
|
||||
default=utils.env('OVERCLOUD_PLAN_NAME'))
|
||||
parser.add_argument(
|
||||
'--templates', nargs='?', const=TRIPLEO_HEAT_TEMPLATES,
|
||||
help="The directory containing the Heat templates to deploy"
|
||||
@ -56,19 +52,13 @@ class DeleteNode(command.Command):
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
osc_plugin = self.app.client_manager.tripleoclient
|
||||
if parsed_args.templates:
|
||||
management = None
|
||||
else:
|
||||
management = osc_plugin.management()
|
||||
|
||||
orchestration = osc_plugin.orchestration()
|
||||
scale_manager = scale.ScaleManager(
|
||||
tuskarclient=management,
|
||||
heatclient=orchestration,
|
||||
plan_id=parsed_args.plan,
|
||||
stack_id=parsed_args.stack,
|
||||
tht_dir=parsed_args.templates,
|
||||
environment_files=parsed_args.environment_files)
|
||||
print("deleting nodes {0} from stack {1}".format(parsed_args.nodes,
|
||||
parsed_args.plan))
|
||||
parsed_args.stack))
|
||||
scale_manager.scaledown(parsed_args.nodes)
|
||||
|
@ -17,6 +17,7 @@ import logging
|
||||
|
||||
from cliff import command
|
||||
from openstackclient.common import utils
|
||||
from openstackclient.i18n import _
|
||||
from tripleo_common import update
|
||||
|
||||
TRIPLEO_HEAT_TEMPLATES = "/usr/share/openstack-tripleo-heat-templates/"
|
||||
@ -31,17 +32,13 @@ class UpdateOvercloud(command.Command):
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(UpdateOvercloud, self).get_parser(prog_name)
|
||||
parser.add_argument('stack', nargs='?',
|
||||
help='Name or ID of heat stack to scale '
|
||||
'(default=Env: OVERCLOUD_STACK_NAME)',
|
||||
help=_('Name or ID of heat stack to scale '
|
||||
'(default=Env: OVERCLOUD_STACK_NAME)'),
|
||||
default=utils.env('OVERCLOUD_STACK_NAME'))
|
||||
main_group = parser.add_mutually_exclusive_group(required=True)
|
||||
main_group.add_argument('--plan', dest='plan',
|
||||
help='Name or ID of tuskar plan to scale '
|
||||
'(default=Env: OVERCLOUD_PLAN_NAME)',
|
||||
default=utils.env('OVERCLOUD_PLAN_NAME'))
|
||||
main_group.add_argument(
|
||||
parser.add_argument(
|
||||
'--templates', nargs='?', const=TRIPLEO_HEAT_TEMPLATES,
|
||||
help="The directory containing the Heat templates to deploy"
|
||||
help=_("The directory containing the Heat templates to deploy"),
|
||||
required=True
|
||||
)
|
||||
parser.add_argument('-i', '--interactive', dest='interactive',
|
||||
action='store_true')
|
||||
@ -50,26 +47,20 @@ class UpdateOvercloud(command.Command):
|
||||
parser.add_argument(
|
||||
'-e', '--environment-file', metavar='<HEAT ENVIRONMENT FILE>',
|
||||
action='append', dest='environment_files',
|
||||
help='Environment files to be passed to the heat stack-create '
|
||||
help=_('Environment files to be passed to the heat stack-create '
|
||||
'or heat stack-update command. (Can be specified more than '
|
||||
'once.)'
|
||||
'once.)')
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
osc_plugin = self.app.client_manager.tripleoclient
|
||||
if parsed_args.templates:
|
||||
management = None
|
||||
else:
|
||||
management = osc_plugin.management()
|
||||
|
||||
orchestration = osc_plugin.orchestration()
|
||||
update_manager = update.PackageUpdateManager(
|
||||
tuskarclient=management,
|
||||
heatclient=orchestration,
|
||||
novaclient=self.app.client_manager.compute,
|
||||
plan_id=parsed_args.plan,
|
||||
stack_id=parsed_args.stack,
|
||||
tht_dir=parsed_args.templates,
|
||||
environment_files=parsed_args.environment_files)
|
||||
|
Loading…
Reference in New Issue
Block a user