Added for support for generating overcloud clouds.yaml
https://review.opendev.org/#/c/664568/ adds mistral actions for generating overcloud clouds.yaml file. This patch enables the same to call the above mistral action and reuse The clouds_yaml.py script is also moved from tht to here in order to reuse the script. Added proper constants and method for creating clouds yaml directory. Added a mock_clouds_yaml.py function to mock the tripleo-common.utils.clouds_yaml script in order to integrate with Tripleo. Depends-On: https://review.opendev.org/#/c/664568/ Change-Id: I243ec370f9de0f2a0e34163962f1a1f228c3a9a1 Signed-off-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
This commit is contained in:
parent
cd42f44769
commit
0a8fc376cd
@ -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.
|
@ -123,3 +123,7 @@ DEPRECATED_SERVICES = {"OS::TripleO::Services::OpenDaylightApi":
|
|||||||
"OpenDaylight to another networking backend. We "
|
"OpenDaylight to another networking backend. We "
|
||||||
"recommend you understand other networking "
|
"recommend you understand other networking "
|
||||||
"alternatives such as OVS or OVN. "}
|
"alternatives such as OVS or OVN. "}
|
||||||
|
|
||||||
|
# clouds_yaml related constants
|
||||||
|
CLOUD_HOME_DIR = os.path.expanduser("~")
|
||||||
|
CLOUDS_YAML_DIR = os.path.join('.config', 'openstack')
|
||||||
|
3
tripleoclient/v1/mock_clouds_yaml.py
Normal file
3
tripleoclient/v1/mock_clouds_yaml.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
def create_clouds_yaml(cloud=None, cloud_yaml_dir=None,
|
||||||
|
user_id=None, group_id=None):
|
||||||
|
pass
|
@ -33,6 +33,14 @@ from osc_lib.i18n import _
|
|||||||
from swiftclient.exceptions import ClientException
|
from swiftclient.exceptions import ClientException
|
||||||
from tripleo_common import update
|
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 command
|
||||||
from tripleoclient import constants
|
from tripleoclient import constants
|
||||||
from tripleoclient import exceptions
|
from tripleoclient import exceptions
|
||||||
@ -1000,6 +1008,18 @@ class DeployOvercloud(command.Command):
|
|||||||
self.clients, container=stack.stack_name,
|
self.clients, container=stack.stack_name,
|
||||||
no_proxy=parsed_args.no_proxy)
|
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)
|
rcpath = utils.write_overcloudrc(stack.stack_name, overcloudrcs)
|
||||||
utils.create_tempest_deployer_input()
|
utils.create_tempest_deployer_input()
|
||||||
|
|
||||||
|
@ -132,6 +132,28 @@ def create_overcloudrc(clients, **workflow_input):
|
|||||||
payload.get('message')))
|
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):
|
def get_overcloud_hosts(stack, ssh_network):
|
||||||
ips = []
|
ips = []
|
||||||
role_net_ip_map = utils.get_role_net_ip_map(stack)
|
role_net_ip_map = utils.get_role_net_ip_map(stack)
|
||||||
|
Loading…
Reference in New Issue
Block a user