summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorviswesn <viswesn@gmail.com>2016-10-25 12:18:53 +0530
committerviswesn <viswesn@gmail.com>2016-10-25 12:18:53 +0530
commit97f1c6c4abde2e97f984e7ffba5aaf80dc67d492 (patch)
tree0c83c76e7f6c065e3d76ec9a586ac650d3f6afdb
parent913569bc624ed807687b559940647eab3a9a5df6 (diff)
downloadcharm-murano-97f1c6c4abde2e97f984e7ffba5aaf80dc67d492.zip
charm-murano-97f1c6c4abde2e97f984e7ffba5aaf80dc67d492.tar.gz
charm-murano-97f1c6c4abde2e97f984e7ffba5aaf80dc67d492.tar.bz2
io-murano package installation during charm bringup done
-rw-r--r--src/lib/charm/openstack/murano.py59
-rw-r--r--src/reactive/murano_handlers.py20
-rw-r--r--src/templates/mitaka/novarc17
3 files changed, 90 insertions, 6 deletions
diff --git a/src/lib/charm/openstack/murano.py b/src/lib/charm/openstack/murano.py
index 60a5360..ab3a834 100644
--- a/src/lib/charm/openstack/murano.py
+++ b/src/lib/charm/openstack/murano.py
@@ -1,3 +1,4 @@
+import os
import socket
import subprocess
@@ -9,6 +10,20 @@ import charms_openstack.ip as os_ip
# import charms_openstack.sdn.odl as odl
# import charms_openstack.sdn.ovs as ovs
+RC_FILE = '/root/novarc'
+
+def get_environment(env):
+ with open("/root/novarc", "r") as ins:
+ for line in ins:
+ k, v = line.replace('export', '').replace(" ", "").split('=')
+ env[k] = v.strip()
+ return env
+
+def run_command(cmd):
+ os_env = get_environment(os.environ.copy())
+ subprocess.check_call(cmd, env=os_env)
+
+
def register_endpoints(keystone):
"""When the keystone interface connects, register this unit in the keystone
catalogue.
@@ -66,6 +81,22 @@ def assess_status():
"""
MuranoCharm.singleton.assess_status()
+def render_novarc_config(interfaces_list):
+ """Use the singleton from the MuranoCharm to run render_novarc_config
+
+ @param interfaces_list: List of instances of interface classes.
+ @returns: None
+ """
+ MuranoCharm.singleton.render_novarc_config(interfaces_list)
+
+def import_io_murano():
+ """Use the singleton from the MuranoCharm to run import io-murano
+ package
+
+ @returns: None
+ """
+ MuranoCharm.singleton.import_io_murano()
+
class MuranoCharm(charms_openstack.charm.HAOpenStackCharm):
@@ -92,10 +123,12 @@ class MuranoCharm(charms_openstack.charm.HAOpenStackCharm):
}
service_type = 'murano'
- # Note that the hsm interface is optional - defined in config.yaml
required_relations = ['shared-db', 'amqp', 'identity-service']
- restart_map = {'/etc/murano/murano.conf': services}
+ restart_map = {
+ '/etc/murano/murano.conf': services,
+ RC_FILE: [''],
+ }
ha_resources = ['vips', 'haproxy']
@@ -117,7 +150,29 @@ class MuranoCharm(charms_openstack.charm.HAOpenStackCharm):
"""
self.configure_source()
super(MuranoCharm, self).install()
+
+ def render_novarc_config(self, interfaces_list):
+ """Render novarc config to bootstrap Murano service
+
+ @returns None
+ """
+ configs = [RC_FILE]
+ self.render_with_interfaces(
+ interfaces_list,
+ configs=configs)
+
+
+ def import_io_murano(self):
+ """Install Core libary io-murano
+
+ @returns None
+ """
+ io_murano_lib = "/usr/share/murano-common/io.murano.zip"
+ if os.path.isfile(io_murano_lib):
+ cmd = ['murano', 'package-import', io_murano_lib]
+ run_command(cmd)
+
def get_amqp_credentials(self):
"""Provide the default amqp username and vhost as a tuple.
diff --git a/src/reactive/murano_handlers.py b/src/reactive/murano_handlers.py
index 192018e..919002d 100644
--- a/src/reactive/murano_handlers.py
+++ b/src/reactive/murano_handlers.py
@@ -14,6 +14,7 @@
import charms_openstack.charm as charm
import charms.reactive as reactive
+import charmhelpers.core.hookenv as hookenv
# This charm's library contains all of the handler code associated with
# sdn_charm
@@ -28,9 +29,13 @@ charm.use_defaults(
'config.changed',
'update-status')
-@reactive.when('shared-db.available')
-@reactive.when('identity-service.available')
-@reactive.when('amqp.available')
+COMPLETE_INTERFACE_STATES = [
+ 'shared-db.available',
+ 'identity-service.available',
+ 'amqp.available',
+]
+
+@reactive.when(*COMPLETE_INTERFACE_STATES)
def render_config(*args):
"""Render the configuration for charm when all the interfaces are
available.
@@ -38,10 +43,17 @@ def render_config(*args):
with charm.provide_charm_instance() as charm_class:
charm_class.render_with_interfaces(args)
charm_class.assess_status()
+ murano.render_novarc_config(args)
reactive.set_state('config.rendered')
# db_sync checks if sync has been done so rerunning is a noop
@reactive.when('config.rendered')
-def init_db():
+def init_db(*args):
with charm.provide_charm_instance() as charm_class:
charm_class.db_sync()
+
+@reactive.when_not('io-murano.imported')
+@reactive.when(*COMPLETE_INTERFACE_STATES)
+def import_io_murano(*args):
+ murano.import_io_murano()
+ reactive.set_state('io-murano.imported')
diff --git a/src/templates/mitaka/novarc b/src/templates/mitaka/novarc
new file mode 100644
index 0000000..e138759
--- /dev/null
+++ b/src/templates/mitaka/novarc
@@ -0,0 +1,17 @@
+{% if identity_service.api_version == '3' -%}
+export OS_AUTH_URL={{ identity_service.auth_protocol }}://{{ identity_service.auth_host }}:{{ identity_service.auth_port }}/v3
+export OS_USERNAME={{ identity_service.service_username }}
+export OS_PASSWORD={{ identity_service.service_password }}
+export OS_USER_DOMAIN_NAME=default
+export OS_PROJECT_DOMAIN_NAME=default
+export OS_PROJECT_NAME={{ identity_service.service_tenant }}
+export OS_REGION_NAME={{ options.region }}
+export OS_IDENTITY_API_VERSION=3
+export OS_AUTH_VERSION=3
+{% else -%}
+export OS_AUTH_URL={{ identity_service.auth_protocol }}://{{ identity_service.auth_host }}:{{ identity_service.auth_port }}/v2.0
+export OS_TENANT_NAME={{ identity_service.service_tenant }}
+export OS_USERNAME={{ identity_service.service_username }}
+export OS_PASSWORD={{ identity_service.service_password }}
+export OS_REGION_NAME={{ options.region }}
+{% endif -%}

This mirror site include all the OpenStack related repositories under: openstack, openstack-dev and openstack-infra.

NOTE: All repositories are updated every one hour.

Usage

For Git Clone
 git clone http://git.trystack.cn/openstack/nova.git 
For DevStack

Add GIT_BASE, NOVNC_REPO and SPICE_REPO variables to local.conf file.

[[local|localrc]]

# use TryStack git mirror
GIT_BASE=http://git.trystack.cn
NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git
SPICE_REPO=http://git.trystack.cn/git/spice/spice-html5.git