summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunaid Ali <junaidali@plumgrid.com>2016-05-21 16:54:18 +0500
committerJunaid Ali <junaidali@plumgrid.com>2016-05-21 16:54:18 +0500
commit561ee23925dfd96adc015802a121466361f928c8 (patch)
tree83fdfc10854897b94d9b257c8604eb46f7252b84
parent174d5da3e8141cb50c2d5fb4b6f1942ff592b51a (diff)
Changes:
Updated template files Configured plumgrid install sources
-rwxr-xr-xhooks/pg_gw_hooks.py6
-rw-r--r--hooks/pg_gw_utils.py18
-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, 30 insertions, 4 deletions
diff --git a/hooks/pg_gw_hooks.py b/hooks/pg_gw_hooks.py
index 4ccb4b6..10b5791 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,9 @@ 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 if not configure_pg_sources():
98 log('IOError: /etc/apt/sources.list couldn\'t be updated')
95 configure_sources(update=True) 99 configure_sources(update=True)
96 pkgs = determine_packages() 100 pkgs = determine_packages()
97 for pkg in pkgs: 101 for pkg in pkgs:
diff --git a/hooks/pg_gw_utils.py b/hooks/pg_gw_utils.py
index c628cf9..7e77a06 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,23 @@ 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 return True
95 except IOError:
96 return False
97
98
81def determine_packages(): 99def determine_packages():
82 ''' 100 '''
83 Returns list of packages required by PLUMgrid Gateway as specified 101 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=