Merge lp:~junaidali/charms/trusty/plumgrid-edge/docker-oil into lp:charms/trusty/plumgrid-edge

Proposed by Junaid Ali
Status: Merged
Merged at revision: 17
Proposed branch: lp:~junaidali/charms/trusty/plumgrid-edge/docker-oil
Merge into: lp:charms/trusty/plumgrid-edge
Diff against target: 263 lines (+96/-26)
7 files modified
config.yaml (+1/-12)
hooks/charmhelpers/contrib/openstack/neutron.py (+1/-1)
hooks/pg_edge_hooks.py (+6/-1)
hooks/pg_edge_utils.py (+81/-10)
templates/kilo/00-pg.conf (+2/-1)
templates/kilo/plumgrid.conf (+3/-0)
unit_tests/test_pg_edge_hooks.py (+2/-1)
To merge this branch: bzr merge lp:~junaidali/charms/trusty/plumgrid-edge/docker-oil
Reviewer Review Type Date Requested Status
Review Queue (community) automated testing Needs Fixing
David Ames Pending
Review via email: mp+304249@code.launchpad.net

Description of the change

PLUMgrid docker package changes

To post a comment you must log in.
Revision history for this message
Review Queue (review-queue) wrote :

This item has failed automated testing! Results available here http://juju-ci.vapour.ws/job/charm-bundle-test-lxc/5468/

review: Needs Fixing (automated testing)
Revision history for this message
Review Queue (review-queue) wrote :

This item has failed automated testing! Results available here http://juju-ci.vapour.ws/job/charm-bundle-test-aws/5569/

review: Needs Fixing (automated testing)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'config.yaml'
--- config.yaml 2015-11-22 03:25:51 +0000
+++ config.yaml 2016-08-29 12:04:58 +0000
@@ -5,24 +5,13 @@
5 description: Public SSH key of PLUMgrid LCM which is running PG-Tools5 description: Public SSH key of PLUMgrid LCM which is running PG-Tools
6 mgmt-interface:6 mgmt-interface:
7 type: string7 type: string
8 default: 'juju-br0'
9 description: The interface connected to PLUMgrid Managment network.8 description: The interface connected to PLUMgrid Managment network.
10 os-data-network:
11 type: string
12 default:
13 description: |
14 The IP address and netmask of the OpenStack Data network (e.g.,
15 192.168.0.0/24)
16 .
17 This network will be used for tenant network traffic in overlay
18 networks.
19 fabric-interfaces:9 fabric-interfaces:
20 default: 'MANAGEMENT'10 default: 'MANAGEMENT'
21 type: string11 type: string
22 description: |12 description: |
23 Interfaces that will provide fabric connectivity on the director nodes.13 Interfaces that will provide fabric connectivity on the director nodes.
24 Provided in form of json in a string. These interfaces have to be connected 14 Provided in form of json in a string. Default value is MANAGEMENT which
25 to the os-data-network specified in the config. Default value is MANAGEMENT which
26 will configure the management interface as the fabric interface on each15 will configure the management interface as the fabric interface on each
27 director.16 director.
28 network-device-mtu:17 network-device-mtu:
2918
=== modified file 'hooks/charmhelpers/contrib/openstack/neutron.py'
--- hooks/charmhelpers/contrib/openstack/neutron.py 2016-04-21 08:28:10 +0000
+++ hooks/charmhelpers/contrib/openstack/neutron.py 2016-08-29 12:04:58 +0000
@@ -204,7 +204,7 @@
204 database=config('database'),204 database=config('database'),
205 ssl_dir=NEUTRON_CONF_DIR)],205 ssl_dir=NEUTRON_CONF_DIR)],
206 'services': [],206 'services': [],
207 'packages': ['plumgrid-lxc',207 'packages': ['plumgrid-edge-docker',
208 'iovisor-dkms'],208 'iovisor-dkms'],
209 'server_packages': ['neutron-server',209 'server_packages': ['neutron-server',
210 'neutron-plugin-plumgrid'],210 'neutron-plugin-plumgrid'],
211211
=== modified file 'hooks/pg_edge_hooks.py'
--- hooks/pg_edge_hooks.py 2016-04-06 16:43:20 +0000
+++ hooks/pg_edge_hooks.py 2016-08-29 12:04:58 +0000
@@ -37,7 +37,9 @@
37 fabric_interface_changed,37 fabric_interface_changed,
38 load_iptables,38 load_iptables,
39 restart_on_change,39 restart_on_change,
40 director_cluster_ready40 director_cluster_ready,
41 configure_pg_sources,
42 docker_configure_sources
41)43)
4244
43hooks = Hooks()45hooks = Hooks()
@@ -51,6 +53,7 @@
51 '''53 '''
52 status_set('maintenance', 'Executing pre-install')54 status_set('maintenance', 'Executing pre-install')
53 load_iptables()55 load_iptables()
56 docker_configure_sources()
54 configure_sources(update=True)57 configure_sources(update=True)
55 status_set('maintenance', 'Installing apt packages')58 status_set('maintenance', 'Installing apt packages')
56 pkgs = determine_packages()59 pkgs = determine_packages()
@@ -108,6 +111,8 @@
108 charm_config.changed('iovisor-build')):111 charm_config.changed('iovisor-build')):
109 stop_pg()112 stop_pg()
110 status_set('maintenance', 'Upgrading apt packages')113 status_set('maintenance', 'Upgrading apt packages')
114 if charm_config.changed('install_sources'):
115 configure_pg_sources()
111 configure_sources(update=True)116 configure_sources(update=True)
112 pkgs = determine_packages()117 pkgs = determine_packages()
113 for pkg in pkgs:118 for pkg in pkgs:
114119
=== modified file 'hooks/pg_edge_utils.py'
--- hooks/pg_edge_utils.py 2016-05-25 16:33:18 +0000
+++ hooks/pg_edge_utils.py 2016-08-29 12:04:58 +0000
@@ -23,8 +23,6 @@
23 get_iface_from_addr,23 get_iface_from_addr,
24 get_bridges,24 get_bridges,
25 get_bridge_nics,25 get_bridge_nics,
26 is_address_in_network,
27 get_iface_addr
28)26)
29from charmhelpers.core.host import (27from charmhelpers.core.host import (
30 write_file,28 write_file,
@@ -33,7 +31,8 @@
33 service_stop,31 service_stop,
34 service_running,32 service_running,
35 path_hash,33 path_hash,
36 set_nic_mtu34 set_nic_mtu,
35 lsb_release
37)36)
38from charmhelpers.fetch import (37from charmhelpers.fetch import (
39 apt_cache,38 apt_cache,
@@ -43,10 +42,11 @@
43 os_release,42 os_release,
44)43)
4544
45SOURCES_LIST = '/etc/apt/sources.list'
46SHARED_SECRET = "/etc/nova/secret.txt"46SHARED_SECRET = "/etc/nova/secret.txt"
47LXC_CONF = '/etc/libvirt/lxc.conf'47LXC_CONF = '/etc/libvirt/lxc.conf'
48TEMPLATES = 'templates/'48TEMPLATES = 'templates/'
49PG_LXC_DATA_PATH = '/var/lib/libvirt/filesystems/plumgrid-data'49PG_LXC_DATA_PATH = '/var/lib/plumgrid/plumgrid-data'
50PG_CONF = '%s/conf/pg/plumgrid.conf' % PG_LXC_DATA_PATH50PG_CONF = '%s/conf/pg/plumgrid.conf' % PG_LXC_DATA_PATH
51PG_HN_CONF = '%s/conf/etc/hostname' % PG_LXC_DATA_PATH51PG_HN_CONF = '%s/conf/etc/hostname' % PG_LXC_DATA_PATH
52PG_HS_CONF = '%s/conf/etc/hosts' % PG_LXC_DATA_PATH52PG_HS_CONF = '%s/conf/etc/hosts' % PG_LXC_DATA_PATH
@@ -85,12 +85,56 @@
85])85])
8686
8787
88def configure_pg_sources():
89 '''
90 Returns true if install sources is updated in sources.list file
91 '''
92 try:
93 with open(SOURCES_LIST, 'r+') as sources:
94 all_lines = sources.readlines()
95 sources.seek(0)
96 for i in (line for line in all_lines if "plumgrid" not in line):
97 sources.write(i)
98 sources.truncate()
99 sources.close()
100 except IOError:
101 log('Unable to update /etc/apt/sources.list')
102
103
104def configure_analyst_opsvm():
105 '''
106 Configures Anaylyst for OPSVM
107 '''
108 if not service_running('plumgrid'):
109 restart_pg()
110 opsvm_ip = pg_edge_context._pg_dir_context()['opsvm_ip']
111 NS_ENTER = ('/opt/local/bin/nsenter -t $(ps ho pid --ppid $(cat '
112 '/var/run/libvirt/lxc/plumgrid.pid)) -m -n -u -i -p ')
113 sigmund_stop = NS_ENTER + '/usr/bin/service plumgrid-sigmund stop'
114 sigmund_status = NS_ENTER \
115 + '/usr/bin/service plumgrid-sigmund status'
116 sigmund_autoboot = NS_ENTER \
117 + '/usr/bin/sigmund-configure --ip {0} --start --autoboot' \
118 .format(opsvm_ip)
119 try:
120 status = subprocess.check_output(sigmund_status, shell=True)
121 if 'start/running' in status:
122 if subprocess.call(sigmund_stop, shell=True):
123 log('plumgrid-sigmund couldn\'t be stopped!')
124 return
125 subprocess.check_call(sigmund_autoboot, shell=True)
126 except:
127 log('plumgrid-sigmund couldn\'t be started!')
128
129
88def determine_packages():130def determine_packages():
89 '''131 '''
90 Returns list of packages required by PLUMgrid Edge as specified132 Returns list of packages required by PLUMgrid Edge as specified
91 in the neutron_plugins dictionary in charmhelpers.133 in the neutron_plugins dictionary in charmhelpers.
92 '''134 '''
93 pkgs = []135 pkgs = []
136 pkgs.extend(docker_dependencies())
137 pkgs.append('docker-engine')
94 tag = 'latest'138 tag = 'latest'
95 for pkg in neutron_plugin_attribute('plumgrid', 'packages', 'neutron'):139 for pkg in neutron_plugin_attribute('plumgrid', 'packages', 'neutron'):
96 if 'plumgrid' in pkg:140 if 'plumgrid' in pkg:
@@ -111,6 +155,35 @@
111 return pkgs155 return pkgs
112156
113157
158def docker_dependencies():
159 '''
160 Returns a list of packages to be installed for docker engine
161 '''
162 kver = subprocess.check_output(['uname', '-r']).replace('\n', '')
163 return ['apt-transport-https', 'ca-certificates', 'apparmor',
164 'linux-image-extra-{}'.format(kver)]
165
166
167def docker_configure_sources():
168 '''
169 Imports GPG key and updates apt source for docker engine
170 '''
171 ubuntu_rel = lsb_release()['DISTRIB_CODENAME']
172 DOCKER_SOURCE = ('deb https://apt.dockerproject.org/repo ubuntu-%s'
173 ' main')
174 log('Importing GPG Key for docker engine')
175 _exec_cmd(['apt-key', 'adv', '--keyserver',
176 'hkp://p80.pool.sks-keyservers.net:80',
177 '--recv-keys', '58118E89F3A912897C070ADBF76221572C52609D'])
178 try:
179 with open('/etc/apt/sources.list.d/docker.list', 'w') as f:
180 f.write(DOCKER_SOURCE % ubuntu_rel)
181 f.close()
182 except:
183 raise ValueError('Unable to update /etc/apt/sources.list.d/'
184 'docker.list')
185
186
114def register_configs(release=None):187def register_configs(release=None):
115 '''188 '''
116 Returns an object of the Openstack Tempating Class which contains the189 Returns an object of the Openstack Tempating Class which contains the
@@ -221,7 +294,9 @@
221 Returns the managment interface.294 Returns the managment interface.
222 '''295 '''
223 mgmt_interface = config('mgmt-interface')296 mgmt_interface = config('mgmt-interface')
224 if interface_exists(mgmt_interface):297 if not mgmt_interface:
298 return get_iface_from_addr(unit_get('private-address'))
299 elif interface_exists(mgmt_interface):
225 return mgmt_interface300 return mgmt_interface
226 else:301 else:
227 log('Provided managment interface %s does not exist'302 log('Provided managment interface %s does not exist'
@@ -265,11 +340,7 @@
265 else:340 else:
266 raise ValueError('No fabric interface provided for node')341 raise ValueError('No fabric interface provided for node')
267 if interface_exists(node_fabric_interface):342 if interface_exists(node_fabric_interface):
268 if is_address_in_network(config('os-data-network'),343 return node_fabric_interface
269 get_iface_addr(node_fabric_interface)[0]):
270 return node_fabric_interface
271 else:
272 raise ValueError('Fabric interface not in fabric network')
273 else:344 else:
274 log('Provided fabric interface %s does not exist'345 log('Provided fabric interface %s does not exist'
275 % node_fabric_interface)346 % node_fabric_interface)
276347
=== modified file 'templates/kilo/00-pg.conf'
--- templates/kilo/00-pg.conf 2016-04-06 16:43:20 +0000
+++ templates/kilo/00-pg.conf 2016-08-29 12:04:58 +0000
@@ -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_json2if $syslogtag == 'pg:' and not ($msg contains 'dht_cli_') then @{{ opsvm_ip }}:6000;ls_json
3:msg, contains, "VM Interface Stats" ~
34
=== modified file 'templates/kilo/plumgrid.conf'
--- templates/kilo/plumgrid.conf 2016-03-26 22:31:19 +0000
+++ templates/kilo/plumgrid.conf 2016-08-29 12:04:58 +0000
@@ -5,6 +5,9 @@
5plumgrid_rsync_port=22225plumgrid_rsync_port=2222
6plumgrid_rest_addr=0.0.0.0:91806plumgrid_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=yes11start_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=
1114
=== modified file 'unit_tests/test_pg_edge_hooks.py'
--- unit_tests/test_pg_edge_hooks.py 2016-05-01 02:20:12 +0000
+++ unit_tests/test_pg_edge_hooks.py 2016-08-29 12:04:58 +0000
@@ -33,7 +33,8 @@
33 'relation_ids',33 'relation_ids',
34 'load_iptables',34 'load_iptables',
35 'director_cluster_ready',35 'director_cluster_ready',
36 'status_set'36 'status_set',
37 'docker_configure_sources'
37]38]
38NEUTRON_CONF_DIR = "/etc/neutron"39NEUTRON_CONF_DIR = "/etc/neutron"
3940

Subscribers

People subscribed via source and target branches

to all changes: