summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilal Baqar <bbaqar@plumgrid.com>2016-05-29 00:31:25 +0200
committerBilal Baqar <bbaqar@plumgrid.com>2016-05-29 00:31:25 +0200
commit03c379164be1f8ab10512fccd734e63cda3a3de7 (patch)
treec01bdaade6783580efa8764d39899986e7f88573
parent174d5da3e8141cb50c2d5fb4b6f1942ff592b51a (diff)
parent1c19fadbc4b8bdad7d66666c629d11728d43c741 (diff)
5.1 changes
- configure-pg-sources added - updated templates
-rwxr-xr-xhooks/pg_gw_hooks.py5
-rw-r--r--hooks/pg_gw_utils.py17
-rw-r--r--templates/kilo/00-pg.conf3
-rw-r--r--templates/kilo/ifcs.conf4
-rw-r--r--templates/kilo/plumgrid.conf3
5 files changed, 28 insertions, 4 deletions
diff --git a/hooks/pg_gw_hooks.py b/hooks/pg_gw_hooks.py
index 4ccb4b6..5818cea 100755
--- a/hooks/pg_gw_hooks.py
+++ b/hooks/pg_gw_hooks.py
@@ -34,7 +34,8 @@ from pg_gw_utils import (
34 load_iptables, 34 load_iptables,
35 restart_on_change, 35 restart_on_change,
36 restart_on_stop, 36 restart_on_stop,
37 director_cluster_ready 37 director_cluster_ready,
38 configure_pg_sources
38) 39)
39 40
40hooks = Hooks() 41hooks = Hooks()
@@ -92,6 +93,8 @@ def config_changed():
92 charm_config.changed('iovisor-build')): 93 charm_config.changed('iovisor-build')):
93 stop_pg() 94 stop_pg()
94 status_set('maintenance', 'Upgrading apt packages') 95 status_set('maintenance', 'Upgrading apt packages')
96 if charm_config.changed('install_sources'):
97 configure_pg_sources()
95 configure_sources(update=True) 98 configure_sources(update=True)
96 pkgs = determine_packages() 99 pkgs = determine_packages()
97 for pkg in pkgs: 100 for pkg in pkgs:
diff --git a/hooks/pg_gw_utils.py b/hooks/pg_gw_utils.py
index c628cf9..cb9250e 100644
--- a/hooks/pg_gw_utils.py
+++ b/hooks/pg_gw_utils.py
@@ -42,6 +42,7 @@ from charmhelpers.contrib.openstack.utils import (
42 os_release, 42 os_release,
43) 43)
44 44
45SOURCES_LIST = '/etc/apt/sources.list'
45LXC_CONF = "/etc/libvirt/lxc.conf" 46LXC_CONF = "/etc/libvirt/lxc.conf"
46TEMPLATES = 'templates/' 47TEMPLATES = 'templates/'
47PG_LXC_DATA_PATH = '/var/lib/libvirt/filesystems/plumgrid-data' 48PG_LXC_DATA_PATH = '/var/lib/libvirt/filesystems/plumgrid-data'
@@ -78,6 +79,22 @@ BASE_RESOURCE_MAP = OrderedDict([
78]) 79])
79 80
80 81
82def configure_pg_sources():
83 '''
84 Returns true if install sources is updated in sources.list file
85 '''
86 try:
87 with open(SOURCES_LIST, 'r+') as sources:
88 all_lines = sources.readlines()
89 sources.seek(0)
90 for i in (line for line in all_lines if "plumgrid" not in line):
91 sources.write(i)
92 sources.truncate()
93 sources.close()
94 except IOError:
95 log('Unable to update /etc/apt/sources.list')
96
97
81def determine_packages(): 98def determine_packages():
82 ''' 99 '''
83 Returns list of packages required by PLUMgrid Gateway as specified 100 Returns list of packages required by PLUMgrid Gateway as specified
diff --git a/templates/kilo/00-pg.conf b/templates/kilo/00-pg.conf
index e744a27..ac09811 100644
--- a/templates/kilo/00-pg.conf
+++ b/templates/kilo/00-pg.conf
@@ -1,2 +1,3 @@
1$template ls_json,"{{'{'}}{{'%'}}timestamp:::date-rfc3339,jsonf:@timestamp%,%source:::jsonf:@source_host%,%msg:::json%}" 1$template ls_json,"{{'{'}}{{'%'}}timestamp:::date-rfc3339,jsonf:@timestamp%,%source:::jsonf:@source_host%,%msg:::json%}"
2:syslogtag,isequal,"pg:" @{{ opsvm_ip }}:6000;ls_json 2if $syslogtag == 'pg:' and not ($msg contains 'dht_cli_') then @{{ opsvm_ip }}:6000;ls_json
3:msg, contains, "VM Interface Stats" ~
diff --git a/templates/kilo/ifcs.conf b/templates/kilo/ifcs.conf
index 657fbd5..e7535cb 100644
--- a/templates/kilo/ifcs.conf
+++ b/templates/kilo/ifcs.conf
@@ -1,7 +1,7 @@
1{{ fabric_interface }} = fabric_core host 1{{ fabric_interface }} = fabric_core host
2{% if ext_interfaces -%} 2{% if ext_interfaces -%}
3{% for ip in ext_interfaces -%} 3{% for dev in ext_interfaces -%}
4{{ ip }} = access_phys 4{{ dev }} = access_phys
5{% endfor -%} 5{% endfor -%}
6{% endif -%} 6{% endif -%}
7 7
diff --git a/templates/kilo/plumgrid.conf b/templates/kilo/plumgrid.conf
index acb8e9b..f56f11f 100644
--- a/templates/kilo/plumgrid.conf
+++ b/templates/kilo/plumgrid.conf
@@ -5,6 +5,9 @@ label={{ label}}
5plumgrid_rsync_port=2222 5plumgrid_rsync_port=2222
6plumgrid_rest_addr=0.0.0.0:9180 6plumgrid_rest_addr=0.0.0.0:9180
7fabric_mode={{ fabric_mode }} 7fabric_mode={{ fabric_mode }}
8plumgrid_syslog_ng_ip={{ plumgrid_syslog_ng_ip }}
9plumgrid_syslog_ng_port={{ plumgrid_syslog_ng_port }}
10plumgrid_monitor_interval={{ plumgrid_monitor_interval }}
8start_plumgrid_iovisor=yes 11start_plumgrid_iovisor=yes
9start_plumgrid=`/opt/pg/scripts/pg_is_director.sh $plumgrid_ip` 12start_plumgrid=`/opt/pg/scripts/pg_is_director.sh $plumgrid_ip`
10location= 13location=