Merge "Added for support for generating overcloud clouds.yaml"

This commit is contained in:
Zuul 2019-07-15 14:00:45 +00:00 committed by Gerrit Code Review
commit b2e8787c2d
5 changed files with 57 additions and 0 deletions

View File

@ -0,0 +1,8 @@
---
features:
- |
OpenStack overcloud services cli and api is currently accessed through
overcloudrc and clouds.yaml.
This adds support for overcloud clouds.yaml file generation after
deployment. The file can be found at ~/.config/openstack/clouds.yaml
and /etc/openstack/clouds.yaml.

View File

@ -123,3 +123,7 @@ DEPRECATED_SERVICES = {"OS::TripleO::Services::OpenDaylightApi":
"OpenDaylight to another networking backend. We "
"recommend you understand other networking "
"alternatives such as OVS or OVN. "}
# clouds_yaml related constants
CLOUD_HOME_DIR = os.path.expanduser("~")
CLOUDS_YAML_DIR = os.path.join('.config', 'openstack')

View File

@ -0,0 +1,3 @@
def create_clouds_yaml(cloud=None, cloud_yaml_dir=None,
user_id=None, group_id=None):
pass

View File

@ -33,6 +33,14 @@ from osc_lib.i18n import _
from swiftclient.exceptions import ClientException
from tripleo_common import update
# FIXME(chkumar246): Once https://review.opendev.org/664568 gets merged
# and new version of tripleo-common gots released, It requires a version
# bump in requirements.txt.
try:
from tripleo_common.utils import clouds_yaml
except ImportError:
from tripleoclient.v1 import mock_clouds_yaml as clouds_yaml
from tripleoclient import command
from tripleoclient import constants
from tripleoclient import exceptions
@ -1000,6 +1008,18 @@ class DeployOvercloud(command.Command):
self.clients, container=stack.stack_name,
no_proxy=parsed_args.no_proxy)
# Create overcloud clouds.yaml
cloud_data = deployment.create_cloudsyaml(
self.clients, container=stack.stack_name)
cloud_yaml_dir = os.path.join(constants.CLOUD_HOME_DIR,
constants.CLOUDS_YAML_DIR)
cloud_user_id = os.stat(constants.CLOUD_HOME_DIR).st_uid
cloud_group_id = os.stat(constants.CLOUD_HOME_DIR).st_gid
clouds_yaml.create_clouds_yaml(
cloud=cloud_data,
cloud_yaml_dir=cloud_yaml_dir,
user_id=cloud_user_id,
group_id=cloud_group_id)
rcpath = utils.write_overcloudrc(stack.stack_name, overcloudrcs)
utils.create_tempest_deployer_input()

View File

@ -132,6 +132,28 @@ def create_overcloudrc(clients, **workflow_input):
payload.get('message')))
def create_cloudsyaml(clients, **workflow_input):
workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient
with tripleoclients.messaging_websocket() as ws:
execution = base.start_workflow(
workflow_client,
'tripleo.deployment.v1.createcloudsyaml',
workflow_input=workflow_input
)
for payload in base.wait_for_messages(workflow_client, ws, execution):
# the workflow will return the overcloud cloud yaml data, an error
# message or blank.
if payload.get('status') == 'SUCCESS':
return payload.get('message')
else:
raise exceptions.WorkflowServiceError(
'Exception creating overcloud clouds.yaml file: {}'.format(
payload.get('message')))
def get_overcloud_hosts(stack, ssh_network):
ips = []
role_net_ip_map = utils.get_role_net_ip_map(stack)