First commit-mw

This commit is contained in:
Bilal Baqar 2016-03-24 05:33:25 -07:00
parent d8f1c4b409
commit 2ba52039fa
6 changed files with 33 additions and 2 deletions

View File

@ -25,7 +25,7 @@ options:
type: string
description: |
Interfaces that will provide fabric connectivity on the director nodes.
Provided in form of json in a string. These interfaces have to be connected
Provided in form of json in a string. These interfaces have to be connected
to the os-data-network specified in the config. Default value is MANAGEMENT which
will configure the management interface as the fabric interface on each
director.
@ -55,3 +55,7 @@ options:
default: null
type: string
description: Provide the PLUMgrid ONS License key.
opsvm-ip:
default: 127.0.0.1
type: string
description: IP address of the PLUMgrid Operations VM Management interface.

View File

@ -95,5 +95,6 @@ class PGDirContext(context.NeutronContext):
pg_ctxt['fabric_mode'] = 'host'
virtual_ip_array = re.split('\.', conf['plumgrid-virtual-ip'])
pg_ctxt['virtual_router_id'] = virtual_ip_array[3]
pg_ctxt['opsvm_ip'] = conf['opsvm-ip']
return pg_ctxt

View File

@ -7,6 +7,7 @@
import sys
import time
from charmhelpers.contrib.network.ip import is_ip
from charmhelpers.core.hookenv import (
Hooks,
@ -63,6 +64,23 @@ def dir_joined():
restart_pg()
@hooks.hook('plumgrid-relation-joined')
def plumgrid_joined(relation_id=None):
'''
This hook is run when relation with edge or gateway is created.
'''
opsvm_ip = onfig('opsvm-ip')
if opsvm_ip == '127.0.0.1':
return 1
elif not is_ip(opsvm-ip):
raise ValueError('Incorrect IP specified')
else:
relation_set(relation_id=relation_id, opsvm_ip=opsvm_ip})
#rel_data = {
# 'opsvm-ip': opsvm-ip,
#}
@hooks.hook('config-changed')
def config_changed():
'''
@ -92,6 +110,8 @@ def config_changed():
apt_install(pkg, options=['--force-yes'], fatal=True)
remove_iovisor()
load_iovisor()
for rid in relation_ids('plumgrid'):
neutron_plugin_joined(rid)
ensure_mtu()
add_lcm_key()
CONFIGS.write_all()

View File

@ -49,6 +49,7 @@ PG_DEF_CONF = '%s/conf/pg/nginx.conf' % PG_LXC_DATA_PATH
PG_HN_CONF = '%s/conf/etc/hostname' % PG_LXC_DATA_PATH
PG_HS_CONF = '%s/conf/etc/hosts' % PG_LXC_DATA_PATH
PG_IFCS_CONF = '%s/conf/pg/ifcs.conf' % PG_LXC_DATA_PATH
OPS_CONF = '%s/conf/etc/00-pg.conf' % PG_LXC_DATA_PATH
AUTH_KEY_PATH = '%s/root/.ssh/authorized_keys' % PG_LXC_DATA_PATH
TEMP_LICENSE_FILE = '/tmp/license'
@ -73,6 +74,10 @@ BASE_RESOURCE_MAP = OrderedDict([
'services': ['plumgrid'],
'contexts': [pg_dir_context.PGDirContext()],
}),
(OPS_CONF, {
'services': ['plumgrid'],
'contexts': [pg_dir_context.PGDirContext()],
}),
(PG_IFCS_CONF, {
'services': [],
'contexts': [pg_dir_context.PGDirContext()],

View File

@ -0,0 +1 @@
$template ls_json,"{{'{'}}{{'%'}}timestamp:::date-rfc3339,jsonf:@timestamp%,%source:::jsonf:@source_host%,%msg:::json%}":syslogtag,isequal,"pg:" @{{ opsvm_ip }}:6000;ls_json

View File

@ -13,7 +13,7 @@ upstream pgCli {
}
upstream pgMW {
server 127.0.0.1:4000;
server {{ opsvm_ip }}:4000;
}
map $http_upgrade $connection_upgrade {