Second commit
This commit is contained in:
commit
882df68400
@ -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.
|
||||
|
1
hooks/pg_dir_context.py
Normal file → Executable file
1
hooks/pg_dir_context.py
Normal file → Executable file
@ -104,5 +104,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
|
||||
|
22
hooks/pg_dir_hooks.py
Normal file → Executable file
22
hooks/pg_dir_hooks.py
Normal file → Executable file
@ -8,12 +8,15 @@
|
||||
import sys
|
||||
import time
|
||||
from charmhelpers.core.host import service_running
|
||||
from charmhelpers.contrib.network.ip import is_ip
|
||||
|
||||
from charmhelpers.core.hookenv import (
|
||||
Hooks,
|
||||
UnregisteredHookError,
|
||||
log,
|
||||
config,
|
||||
relation_set,
|
||||
relation_ids
|
||||
)
|
||||
|
||||
from charmhelpers.fetch import (
|
||||
@ -64,6 +67,21 @@ 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 = config('opsvm-ip')
|
||||
print is_ip(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)
|
||||
|
||||
|
||||
@hooks.hook('config-changed')
|
||||
def config_changed():
|
||||
'''
|
||||
@ -96,6 +114,10 @@ def config_changed():
|
||||
apt_install(pkg, options=['--force-yes'], fatal=True)
|
||||
remove_iovisor()
|
||||
load_iovisor()
|
||||
if charm_config.changed('opsvm-ip'):
|
||||
for rid in relation_ids('plumgrid'):
|
||||
plumgrid_joined(rid)
|
||||
stop_pg()
|
||||
ensure_mtu()
|
||||
CONFIGS.write_all()
|
||||
if not service_running('plumgrid'):
|
||||
|
5
hooks/pg_dir_utils.py
Normal file → Executable file
5
hooks/pg_dir_utils.py
Normal file → Executable file
@ -50,6 +50,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'
|
||||
|
||||
@ -74,6 +75,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()],
|
||||
|
1
hooks/plumgrid-relation-joined
Symbolic link
1
hooks/plumgrid-relation-joined
Symbolic link
@ -0,0 +1 @@
|
||||
pg_dir_hooks.py
|
1
templates/kilo/00-pg.conf
Normal file
1
templates/kilo/00-pg.conf
Normal 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
|
@ -13,7 +13,7 @@ upstream pgCli {
|
||||
}
|
||||
|
||||
upstream pgMW {
|
||||
server 127.0.0.1:4000;
|
||||
server {{ opsvm_ip }}:4000;
|
||||
}
|
||||
|
||||
map $http_upgrade $connection_upgrade {
|
||||
|
Loading…
Reference in New Issue
Block a user