Merge lp:~junaidali/charms/trusty/plumgrid-edge/docker-oil into lp:charms/trusty/plumgrid-edge
- Trusty Tahr (14.04)
- docker-oil
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Review Queue (community) | automated testing | Needs Fixing | |
David Ames | Pending | ||
Review via email: mp+304249@code.launchpad.net |
Commit message
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 : | # |
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://
review:
Needs Fixing
(automated testing)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'config.yaml' | |||
2 | --- config.yaml 2015-11-22 03:25:51 +0000 | |||
3 | +++ config.yaml 2016-08-29 12:04:58 +0000 | |||
4 | @@ -5,24 +5,13 @@ | |||
5 | 5 | description: Public SSH key of PLUMgrid LCM which is running PG-Tools | 5 | description: Public SSH key of PLUMgrid LCM which is running PG-Tools |
6 | 6 | mgmt-interface: | 6 | mgmt-interface: |
7 | 7 | type: string | 7 | type: string |
8 | 8 | default: 'juju-br0' | ||
9 | 9 | description: The interface connected to PLUMgrid Managment network. | 8 | description: The interface connected to PLUMgrid Managment network. |
10 | 10 | os-data-network: | ||
11 | 11 | type: string | ||
12 | 12 | default: | ||
13 | 13 | description: | | ||
14 | 14 | The IP address and netmask of the OpenStack Data network (e.g., | ||
15 | 15 | 192.168.0.0/24) | ||
16 | 16 | . | ||
17 | 17 | This network will be used for tenant network traffic in overlay | ||
18 | 18 | networks. | ||
19 | 19 | fabric-interfaces: | 9 | fabric-interfaces: |
20 | 20 | default: 'MANAGEMENT' | 10 | default: 'MANAGEMENT' |
21 | 21 | type: string | 11 | type: string |
22 | 22 | description: | | 12 | description: | |
23 | 23 | Interfaces that will provide fabric connectivity on the director nodes. | 13 | Interfaces that will provide fabric connectivity on the director nodes. |
26 | 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 | 25 | to the os-data-network specified in the config. Default value is MANAGEMENT which | ||
27 | 26 | will configure the management interface as the fabric interface on each | 15 | will configure the management interface as the fabric interface on each |
28 | 27 | director. | 16 | director. |
29 | 28 | network-device-mtu: | 17 | network-device-mtu: |
30 | 29 | 18 | ||
31 | === modified file 'hooks/charmhelpers/contrib/openstack/neutron.py' | |||
32 | --- hooks/charmhelpers/contrib/openstack/neutron.py 2016-04-21 08:28:10 +0000 | |||
33 | +++ hooks/charmhelpers/contrib/openstack/neutron.py 2016-08-29 12:04:58 +0000 | |||
34 | @@ -204,7 +204,7 @@ | |||
35 | 204 | database=config('database'), | 204 | database=config('database'), |
36 | 205 | ssl_dir=NEUTRON_CONF_DIR)], | 205 | ssl_dir=NEUTRON_CONF_DIR)], |
37 | 206 | 'services': [], | 206 | 'services': [], |
39 | 207 | 'packages': ['plumgrid-lxc', | 207 | 'packages': ['plumgrid-edge-docker', |
40 | 208 | 'iovisor-dkms'], | 208 | 'iovisor-dkms'], |
41 | 209 | 'server_packages': ['neutron-server', | 209 | 'server_packages': ['neutron-server', |
42 | 210 | 'neutron-plugin-plumgrid'], | 210 | 'neutron-plugin-plumgrid'], |
43 | 211 | 211 | ||
44 | === modified file 'hooks/pg_edge_hooks.py' | |||
45 | --- hooks/pg_edge_hooks.py 2016-04-06 16:43:20 +0000 | |||
46 | +++ hooks/pg_edge_hooks.py 2016-08-29 12:04:58 +0000 | |||
47 | @@ -37,7 +37,9 @@ | |||
48 | 37 | fabric_interface_changed, | 37 | fabric_interface_changed, |
49 | 38 | load_iptables, | 38 | load_iptables, |
50 | 39 | restart_on_change, | 39 | restart_on_change, |
52 | 40 | director_cluster_ready | 40 | director_cluster_ready, |
53 | 41 | configure_pg_sources, | ||
54 | 42 | docker_configure_sources | ||
55 | 41 | ) | 43 | ) |
56 | 42 | 44 | ||
57 | 43 | hooks = Hooks() | 45 | hooks = Hooks() |
58 | @@ -51,6 +53,7 @@ | |||
59 | 51 | ''' | 53 | ''' |
60 | 52 | status_set('maintenance', 'Executing pre-install') | 54 | status_set('maintenance', 'Executing pre-install') |
61 | 53 | load_iptables() | 55 | load_iptables() |
62 | 56 | docker_configure_sources() | ||
63 | 54 | configure_sources(update=True) | 57 | configure_sources(update=True) |
64 | 55 | status_set('maintenance', 'Installing apt packages') | 58 | status_set('maintenance', 'Installing apt packages') |
65 | 56 | pkgs = determine_packages() | 59 | pkgs = determine_packages() |
66 | @@ -108,6 +111,8 @@ | |||
67 | 108 | charm_config.changed('iovisor-build')): | 111 | charm_config.changed('iovisor-build')): |
68 | 109 | stop_pg() | 112 | stop_pg() |
69 | 110 | status_set('maintenance', 'Upgrading apt packages') | 113 | status_set('maintenance', 'Upgrading apt packages') |
70 | 114 | if charm_config.changed('install_sources'): | ||
71 | 115 | configure_pg_sources() | ||
72 | 111 | configure_sources(update=True) | 116 | configure_sources(update=True) |
73 | 112 | pkgs = determine_packages() | 117 | pkgs = determine_packages() |
74 | 113 | for pkg in pkgs: | 118 | for pkg in pkgs: |
75 | 114 | 119 | ||
76 | === modified file 'hooks/pg_edge_utils.py' | |||
77 | --- hooks/pg_edge_utils.py 2016-05-25 16:33:18 +0000 | |||
78 | +++ hooks/pg_edge_utils.py 2016-08-29 12:04:58 +0000 | |||
79 | @@ -23,8 +23,6 @@ | |||
80 | 23 | get_iface_from_addr, | 23 | get_iface_from_addr, |
81 | 24 | get_bridges, | 24 | get_bridges, |
82 | 25 | get_bridge_nics, | 25 | get_bridge_nics, |
83 | 26 | is_address_in_network, | ||
84 | 27 | get_iface_addr | ||
85 | 28 | ) | 26 | ) |
86 | 29 | from charmhelpers.core.host import ( | 27 | from charmhelpers.core.host import ( |
87 | 30 | write_file, | 28 | write_file, |
88 | @@ -33,7 +31,8 @@ | |||
89 | 33 | service_stop, | 31 | service_stop, |
90 | 34 | service_running, | 32 | service_running, |
91 | 35 | path_hash, | 33 | path_hash, |
93 | 36 | set_nic_mtu | 34 | set_nic_mtu, |
94 | 35 | lsb_release | ||
95 | 37 | ) | 36 | ) |
96 | 38 | from charmhelpers.fetch import ( | 37 | from charmhelpers.fetch import ( |
97 | 39 | apt_cache, | 38 | apt_cache, |
98 | @@ -43,10 +42,11 @@ | |||
99 | 43 | os_release, | 42 | os_release, |
100 | 44 | ) | 43 | ) |
101 | 45 | 44 | ||
102 | 45 | SOURCES_LIST = '/etc/apt/sources.list' | ||
103 | 46 | SHARED_SECRET = "/etc/nova/secret.txt" | 46 | SHARED_SECRET = "/etc/nova/secret.txt" |
104 | 47 | LXC_CONF = '/etc/libvirt/lxc.conf' | 47 | LXC_CONF = '/etc/libvirt/lxc.conf' |
105 | 48 | TEMPLATES = 'templates/' | 48 | TEMPLATES = 'templates/' |
107 | 49 | PG_LXC_DATA_PATH = '/var/lib/libvirt/filesystems/plumgrid-data' | 49 | PG_LXC_DATA_PATH = '/var/lib/plumgrid/plumgrid-data' |
108 | 50 | PG_CONF = '%s/conf/pg/plumgrid.conf' % PG_LXC_DATA_PATH | 50 | PG_CONF = '%s/conf/pg/plumgrid.conf' % PG_LXC_DATA_PATH |
109 | 51 | PG_HN_CONF = '%s/conf/etc/hostname' % PG_LXC_DATA_PATH | 51 | PG_HN_CONF = '%s/conf/etc/hostname' % PG_LXC_DATA_PATH |
110 | 52 | PG_HS_CONF = '%s/conf/etc/hosts' % PG_LXC_DATA_PATH | 52 | PG_HS_CONF = '%s/conf/etc/hosts' % PG_LXC_DATA_PATH |
111 | @@ -85,12 +85,56 @@ | |||
112 | 85 | ]) | 85 | ]) |
113 | 86 | 86 | ||
114 | 87 | 87 | ||
115 | 88 | def configure_pg_sources(): | ||
116 | 89 | ''' | ||
117 | 90 | Returns true if install sources is updated in sources.list file | ||
118 | 91 | ''' | ||
119 | 92 | try: | ||
120 | 93 | with open(SOURCES_LIST, 'r+') as sources: | ||
121 | 94 | all_lines = sources.readlines() | ||
122 | 95 | sources.seek(0) | ||
123 | 96 | for i in (line for line in all_lines if "plumgrid" not in line): | ||
124 | 97 | sources.write(i) | ||
125 | 98 | sources.truncate() | ||
126 | 99 | sources.close() | ||
127 | 100 | except IOError: | ||
128 | 101 | log('Unable to update /etc/apt/sources.list') | ||
129 | 102 | |||
130 | 103 | |||
131 | 104 | def configure_analyst_opsvm(): | ||
132 | 105 | ''' | ||
133 | 106 | Configures Anaylyst for OPSVM | ||
134 | 107 | ''' | ||
135 | 108 | if not service_running('plumgrid'): | ||
136 | 109 | restart_pg() | ||
137 | 110 | opsvm_ip = pg_edge_context._pg_dir_context()['opsvm_ip'] | ||
138 | 111 | NS_ENTER = ('/opt/local/bin/nsenter -t $(ps ho pid --ppid $(cat ' | ||
139 | 112 | '/var/run/libvirt/lxc/plumgrid.pid)) -m -n -u -i -p ') | ||
140 | 113 | sigmund_stop = NS_ENTER + '/usr/bin/service plumgrid-sigmund stop' | ||
141 | 114 | sigmund_status = NS_ENTER \ | ||
142 | 115 | + '/usr/bin/service plumgrid-sigmund status' | ||
143 | 116 | sigmund_autoboot = NS_ENTER \ | ||
144 | 117 | + '/usr/bin/sigmund-configure --ip {0} --start --autoboot' \ | ||
145 | 118 | .format(opsvm_ip) | ||
146 | 119 | try: | ||
147 | 120 | status = subprocess.check_output(sigmund_status, shell=True) | ||
148 | 121 | if 'start/running' in status: | ||
149 | 122 | if subprocess.call(sigmund_stop, shell=True): | ||
150 | 123 | log('plumgrid-sigmund couldn\'t be stopped!') | ||
151 | 124 | return | ||
152 | 125 | subprocess.check_call(sigmund_autoboot, shell=True) | ||
153 | 126 | except: | ||
154 | 127 | log('plumgrid-sigmund couldn\'t be started!') | ||
155 | 128 | |||
156 | 129 | |||
157 | 88 | def determine_packages(): | 130 | def determine_packages(): |
158 | 89 | ''' | 131 | ''' |
159 | 90 | Returns list of packages required by PLUMgrid Edge as specified | 132 | Returns list of packages required by PLUMgrid Edge as specified |
160 | 91 | in the neutron_plugins dictionary in charmhelpers. | 133 | in the neutron_plugins dictionary in charmhelpers. |
161 | 92 | ''' | 134 | ''' |
162 | 93 | pkgs = [] | 135 | pkgs = [] |
163 | 136 | pkgs.extend(docker_dependencies()) | ||
164 | 137 | pkgs.append('docker-engine') | ||
165 | 94 | tag = 'latest' | 138 | tag = 'latest' |
166 | 95 | for pkg in neutron_plugin_attribute('plumgrid', 'packages', 'neutron'): | 139 | for pkg in neutron_plugin_attribute('plumgrid', 'packages', 'neutron'): |
167 | 96 | if 'plumgrid' in pkg: | 140 | if 'plumgrid' in pkg: |
168 | @@ -111,6 +155,35 @@ | |||
169 | 111 | return pkgs | 155 | return pkgs |
170 | 112 | 156 | ||
171 | 113 | 157 | ||
172 | 158 | def docker_dependencies(): | ||
173 | 159 | ''' | ||
174 | 160 | Returns a list of packages to be installed for docker engine | ||
175 | 161 | ''' | ||
176 | 162 | kver = subprocess.check_output(['uname', '-r']).replace('\n', '') | ||
177 | 163 | return ['apt-transport-https', 'ca-certificates', 'apparmor', | ||
178 | 164 | 'linux-image-extra-{}'.format(kver)] | ||
179 | 165 | |||
180 | 166 | |||
181 | 167 | def docker_configure_sources(): | ||
182 | 168 | ''' | ||
183 | 169 | Imports GPG key and updates apt source for docker engine | ||
184 | 170 | ''' | ||
185 | 171 | ubuntu_rel = lsb_release()['DISTRIB_CODENAME'] | ||
186 | 172 | DOCKER_SOURCE = ('deb https://apt.dockerproject.org/repo ubuntu-%s' | ||
187 | 173 | ' main') | ||
188 | 174 | log('Importing GPG Key for docker engine') | ||
189 | 175 | _exec_cmd(['apt-key', 'adv', '--keyserver', | ||
190 | 176 | 'hkp://p80.pool.sks-keyservers.net:80', | ||
191 | 177 | '--recv-keys', '58118E89F3A912897C070ADBF76221572C52609D']) | ||
192 | 178 | try: | ||
193 | 179 | with open('/etc/apt/sources.list.d/docker.list', 'w') as f: | ||
194 | 180 | f.write(DOCKER_SOURCE % ubuntu_rel) | ||
195 | 181 | f.close() | ||
196 | 182 | except: | ||
197 | 183 | raise ValueError('Unable to update /etc/apt/sources.list.d/' | ||
198 | 184 | 'docker.list') | ||
199 | 185 | |||
200 | 186 | |||
201 | 114 | def register_configs(release=None): | 187 | def register_configs(release=None): |
202 | 115 | ''' | 188 | ''' |
203 | 116 | Returns an object of the Openstack Tempating Class which contains the | 189 | Returns an object of the Openstack Tempating Class which contains the |
204 | @@ -221,7 +294,9 @@ | |||
205 | 221 | Returns the managment interface. | 294 | Returns the managment interface. |
206 | 222 | ''' | 295 | ''' |
207 | 223 | mgmt_interface = config('mgmt-interface') | 296 | mgmt_interface = config('mgmt-interface') |
209 | 224 | if interface_exists(mgmt_interface): | 297 | if not mgmt_interface: |
210 | 298 | return get_iface_from_addr(unit_get('private-address')) | ||
211 | 299 | elif interface_exists(mgmt_interface): | ||
212 | 225 | return mgmt_interface | 300 | return mgmt_interface |
213 | 226 | else: | 301 | else: |
214 | 227 | log('Provided managment interface %s does not exist' | 302 | log('Provided managment interface %s does not exist' |
215 | @@ -265,11 +340,7 @@ | |||
216 | 265 | else: | 340 | else: |
217 | 266 | raise ValueError('No fabric interface provided for node') | 341 | raise ValueError('No fabric interface provided for node') |
218 | 267 | if interface_exists(node_fabric_interface): | 342 | if interface_exists(node_fabric_interface): |
224 | 268 | if is_address_in_network(config('os-data-network'), | 343 | return node_fabric_interface |
220 | 269 | get_iface_addr(node_fabric_interface)[0]): | ||
221 | 270 | return node_fabric_interface | ||
222 | 271 | else: | ||
223 | 272 | raise ValueError('Fabric interface not in fabric network') | ||
225 | 273 | else: | 344 | else: |
226 | 274 | log('Provided fabric interface %s does not exist' | 345 | log('Provided fabric interface %s does not exist' |
227 | 275 | % node_fabric_interface) | 346 | % node_fabric_interface) |
228 | 276 | 347 | ||
229 | === modified file 'templates/kilo/00-pg.conf' | |||
230 | --- templates/kilo/00-pg.conf 2016-04-06 16:43:20 +0000 | |||
231 | +++ templates/kilo/00-pg.conf 2016-08-29 12:04:58 +0000 | |||
232 | @@ -1,2 +1,3 @@ | |||
233 | 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%}" |
235 | 2 | :syslogtag,isequal,"pg:" @{{ opsvm_ip }}:6000;ls_json | 2 | if $syslogtag == 'pg:' and not ($msg contains 'dht_cli_') then @{{ opsvm_ip }}:6000;ls_json |
236 | 3 | :msg, contains, "VM Interface Stats" ~ | ||
237 | 3 | 4 | ||
238 | === modified file 'templates/kilo/plumgrid.conf' | |||
239 | --- templates/kilo/plumgrid.conf 2016-03-26 22:31:19 +0000 | |||
240 | +++ templates/kilo/plumgrid.conf 2016-08-29 12:04:58 +0000 | |||
241 | @@ -5,6 +5,9 @@ | |||
242 | 5 | plumgrid_rsync_port=2222 | 5 | plumgrid_rsync_port=2222 |
243 | 6 | plumgrid_rest_addr=0.0.0.0:9180 | 6 | plumgrid_rest_addr=0.0.0.0:9180 |
244 | 7 | fabric_mode={{ fabric_mode }} | 7 | fabric_mode={{ fabric_mode }} |
245 | 8 | plumgrid_syslog_ng_ip={{ plumgrid_syslog_ng_ip }} | ||
246 | 9 | plumgrid_syslog_ng_port={{ plumgrid_syslog_ng_port }} | ||
247 | 10 | plumgrid_monitor_interval={{ plumgrid_monitor_interval }} | ||
248 | 8 | start_plumgrid_iovisor=yes | 11 | start_plumgrid_iovisor=yes |
249 | 9 | start_plumgrid=`/opt/pg/scripts/pg_is_director.sh $plumgrid_ip` | 12 | start_plumgrid=`/opt/pg/scripts/pg_is_director.sh $plumgrid_ip` |
250 | 10 | location= | 13 | location= |
251 | 11 | 14 | ||
252 | === modified file 'unit_tests/test_pg_edge_hooks.py' | |||
253 | --- unit_tests/test_pg_edge_hooks.py 2016-05-01 02:20:12 +0000 | |||
254 | +++ unit_tests/test_pg_edge_hooks.py 2016-08-29 12:04:58 +0000 | |||
255 | @@ -33,7 +33,8 @@ | |||
256 | 33 | 'relation_ids', | 33 | 'relation_ids', |
257 | 34 | 'load_iptables', | 34 | 'load_iptables', |
258 | 35 | 'director_cluster_ready', | 35 | 'director_cluster_ready', |
260 | 36 | 'status_set' | 36 | 'status_set', |
261 | 37 | 'docker_configure_sources' | ||
262 | 37 | ] | 38 | ] |
263 | 38 | NEUTRON_CONF_DIR = "/etc/neutron" | 39 | NEUTRON_CONF_DIR = "/etc/neutron" |
264 | 39 | 40 |
This item has failed automated testing! Results available here http:// juju-ci. vapour. ws/job/ charm-bundle- test-lxc/ 5468/