Merge lp:~james-page/charms/trusty/percona-cluster/vivid into lp:~openstack-charmers-archive/charms/trusty/percona-cluster/next
- Trusty Tahr (14.04)
- vivid
- Merge into next
Status: | Merged |
---|---|
Merged at revision: | 84 |
Proposed branch: | lp:~james-page/charms/trusty/percona-cluster/vivid |
Merge into: | lp:~openstack-charmers-archive/charms/trusty/percona-cluster/next |
Diff against target: |
241 lines (+145/-11) 3 files modified
hooks/percona_hooks.py (+8/-7) hooks/percona_utils.py (+21/-4) templates/mysqld.cnf (+116/-0) |
To merge this branch: | bzr merge lp:~james-page/charms/trusty/percona-cluster/vivid |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
David Ames (community) | Approve | ||
James Page | Needs Resubmitting | ||
Review via email: mp+271659@code.launchpad.net |
Commit message
Description of the change
uosci-testing-bot (uosci-testing-bot) wrote : | # |
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #10250 percona-
LINT OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #6490 percona-
AMULET OK: passed
Build: http://
James Page (james-page) : | # |
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #11094 percona-
LINT OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #10302 percona-
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #6899 percona-
AMULET FAIL: amulet-test failed
AMULET Results (max last 2 lines):
make: *** [functional_test] Error 1
ERROR:root:Make target returned non-zero.
Full amulet test output: http://
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #6930 percona-
AMULET OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_lint_check #12204 percona-
LINT OK: passed
Build: http://
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #11325 percona-
UNIT OK: passed
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #7446 percona-
AMULET OK: passed
Build: http://
David Ames (thedac) wrote : | # |
Approval after the fact. Tested and merged.
Preview Diff
1 | === modified file 'hooks/percona_hooks.py' | |||
2 | --- hooks/percona_hooks.py 2015-09-22 13:54:27 +0000 | |||
3 | +++ hooks/percona_hooks.py 2015-09-29 11:04:01 +0000 | |||
4 | @@ -45,7 +45,6 @@ | |||
5 | 45 | ) | 45 | ) |
6 | 46 | from percona_utils import ( | 46 | from percona_utils import ( |
7 | 47 | determine_packages, | 47 | determine_packages, |
8 | 48 | MY_CNF, | ||
9 | 49 | setup_percona_repo, | 48 | setup_percona_repo, |
10 | 50 | get_host_ip, | 49 | get_host_ip, |
11 | 51 | get_cluster_hosts, | 50 | get_cluster_hosts, |
12 | @@ -61,6 +60,7 @@ | |||
13 | 61 | notify_bootstrapped, | 60 | notify_bootstrapped, |
14 | 62 | is_bootstrapped, | 61 | is_bootstrapped, |
15 | 63 | get_wsrep_value, | 62 | get_wsrep_value, |
16 | 63 | resolve_cnf_file, | ||
17 | 64 | ) | 64 | ) |
18 | 65 | from charmhelpers.contrib.database.mysql import ( | 65 | from charmhelpers.contrib.database.mysql import ( |
19 | 66 | PerconaClusterHelper, | 66 | PerconaClusterHelper, |
20 | @@ -111,8 +111,8 @@ | |||
21 | 111 | 111 | ||
22 | 112 | 112 | ||
23 | 113 | def render_config(clustered=False, hosts=[]): | 113 | def render_config(clustered=False, hosts=[]): |
26 | 114 | if not os.path.exists(os.path.dirname(MY_CNF)): | 114 | if not os.path.exists(os.path.dirname(resolve_cnf_file())): |
27 | 115 | os.makedirs(os.path.dirname(MY_CNF)) | 115 | os.makedirs(os.path.dirname(resolve_cnf_file())) |
28 | 116 | 116 | ||
29 | 117 | context = { | 117 | context = { |
30 | 118 | 'cluster_name': 'juju_cluster', | 118 | 'cluster_name': 'juju_cluster', |
31 | @@ -123,7 +123,7 @@ | |||
32 | 123 | 'sst_password': config('sst-password'), | 123 | 'sst_password': config('sst-password'), |
33 | 124 | 'innodb_file_per_table': config('innodb-file-per-table'), | 124 | 'innodb_file_per_table': config('innodb-file-per-table'), |
34 | 125 | 'table_open_cache': config('table-open-cache'), | 125 | 'table_open_cache': config('table-open-cache'), |
36 | 126 | 'lp1366997_workaround': config('lp1366997-workaround') | 126 | 'lp1366997_workaround': config('lp1366997-workaround'), |
37 | 127 | } | 127 | } |
38 | 128 | 128 | ||
39 | 129 | if config('prefer-ipv6'): | 129 | if config('prefer-ipv6'): |
40 | @@ -137,7 +137,8 @@ | |||
41 | 137 | context['ipv6'] = False | 137 | context['ipv6'] = False |
42 | 138 | 138 | ||
43 | 139 | context.update(PerconaClusterHelper().parse_config()) | 139 | context.update(PerconaClusterHelper().parse_config()) |
45 | 140 | render(os.path.basename(MY_CNF), MY_CNF, context, perms=0o444) | 140 | render(os.path.basename(resolve_cnf_file()), |
46 | 141 | resolve_cnf_file(), context, perms=0o444) | ||
47 | 141 | 142 | ||
48 | 142 | 143 | ||
49 | 143 | def render_config_restart_on_changed(clustered, hosts, bootstrap=False): | 144 | def render_config_restart_on_changed(clustered, hosts, bootstrap=False): |
50 | @@ -152,10 +153,10 @@ | |||
51 | 152 | it is started so long as the new node to be added is guaranteed to have | 153 | it is started so long as the new node to be added is guaranteed to have |
52 | 153 | been restarted so as to apply the new config. | 154 | been restarted so as to apply the new config. |
53 | 154 | """ | 155 | """ |
55 | 155 | pre_hash = file_hash(MY_CNF) | 156 | pre_hash = file_hash(resolve_cnf_file()) |
56 | 156 | render_config(clustered, hosts) | 157 | render_config(clustered, hosts) |
57 | 157 | update_db_rels = False | 158 | update_db_rels = False |
59 | 158 | if file_hash(MY_CNF) != pre_hash or bootstrap: | 159 | if file_hash(resolve_cnf_file()) != pre_hash or bootstrap: |
60 | 159 | if bootstrap: | 160 | if bootstrap: |
61 | 160 | service('bootstrap-pxc', 'mysql') | 161 | service('bootstrap-pxc', 'mysql') |
62 | 161 | # NOTE(dosaboy): this will not actually do anything if no cluster | 162 | # NOTE(dosaboy): this will not actually do anything if no cluster |
63 | 162 | 163 | ||
64 | === modified file 'hooks/percona_utils.py' | |||
65 | --- hooks/percona_utils.py 2015-07-30 09:59:33 +0000 | |||
66 | +++ hooks/percona_utils.py 2015-09-29 11:04:01 +0000 | |||
67 | @@ -25,6 +25,7 @@ | |||
68 | 25 | INFO, | 25 | INFO, |
69 | 26 | WARNING, | 26 | WARNING, |
70 | 27 | ERROR, | 27 | ERROR, |
71 | 28 | cached, | ||
72 | 28 | ) | 29 | ) |
73 | 29 | from charmhelpers.fetch import ( | 30 | from charmhelpers.fetch import ( |
74 | 30 | apt_install, | 31 | apt_install, |
75 | @@ -46,8 +47,7 @@ | |||
76 | 46 | KEY = "keys/repo.percona.com" | 47 | KEY = "keys/repo.percona.com" |
77 | 47 | REPO = """deb http://repo.percona.com/apt {release} main | 48 | REPO = """deb http://repo.percona.com/apt {release} main |
78 | 48 | deb-src http://repo.percona.com/apt {release} main""" | 49 | deb-src http://repo.percona.com/apt {release} main""" |
81 | 49 | MY_CNF = "/etc/mysql/my.cnf" | 50 | SEEDED_MARKER = "{data_dir}/seeded" |
80 | 50 | SEEDED_MARKER = "/var/lib/mysql/seeded" | ||
82 | 51 | HOSTS_FILE = '/etc/hosts' | 51 | HOSTS_FILE = '/etc/hosts' |
83 | 52 | 52 | ||
84 | 53 | 53 | ||
85 | @@ -69,12 +69,13 @@ | |||
86 | 69 | 69 | ||
87 | 70 | def seeded(): | 70 | def seeded(): |
88 | 71 | ''' Check whether service unit is already seeded ''' | 71 | ''' Check whether service unit is already seeded ''' |
90 | 72 | return os.path.exists(SEEDED_MARKER) | 72 | return os.path.exists(SEEDED_MARKER.format(data_dir=resolve_data_dir())) |
91 | 73 | 73 | ||
92 | 74 | 74 | ||
93 | 75 | def mark_seeded(): | 75 | def mark_seeded(): |
94 | 76 | ''' Mark service unit as seeded ''' | 76 | ''' Mark service unit as seeded ''' |
96 | 77 | with open(SEEDED_MARKER, 'w') as seeded: | 77 | with open(SEEDED_MARKER.format(data_dir=resolve_data_dir()), |
97 | 78 | 'w') as seeded: | ||
98 | 78 | seeded.write('done') | 79 | seeded.write('done') |
99 | 79 | 80 | ||
100 | 80 | 81 | ||
101 | @@ -360,3 +361,19 @@ | |||
102 | 360 | (cluster_uuid), DEBUG) | 361 | (cluster_uuid), DEBUG) |
103 | 361 | for rid in rids: | 362 | for rid in rids: |
104 | 362 | relation_set(relation_id=rid, **{'bootstrap-uuid': cluster_uuid}) | 363 | relation_set(relation_id=rid, **{'bootstrap-uuid': cluster_uuid}) |
105 | 364 | |||
106 | 365 | |||
107 | 366 | @cached | ||
108 | 367 | def resolve_data_dir(): | ||
109 | 368 | if lsb_release()['DISTRIB_CODENAME'] < 'vivid': | ||
110 | 369 | return '/var/lib/mysql' | ||
111 | 370 | else: | ||
112 | 371 | return '/var/lib/percona-xtradb-cluster' | ||
113 | 372 | |||
114 | 373 | |||
115 | 374 | @cached | ||
116 | 375 | def resolve_cnf_file(): | ||
117 | 376 | if lsb_release()['DISTRIB_CODENAME'] < 'vivid': | ||
118 | 377 | return '/etc/mysql/my.cnf' | ||
119 | 378 | else: | ||
120 | 379 | return '/etc/mysql/percona-xtradb-cluster.conf.d/mysqld.cnf' | ||
121 | 363 | 380 | ||
122 | === added file 'templates/mysqld.cnf' | |||
123 | --- templates/mysqld.cnf 1970-01-01 00:00:00 +0000 | |||
124 | +++ templates/mysqld.cnf 2015-09-29 11:04:01 +0000 | |||
125 | @@ -0,0 +1,116 @@ | |||
126 | 1 | [mysqld] | ||
127 | 2 | # | ||
128 | 3 | # * Basic Settings | ||
129 | 4 | # | ||
130 | 5 | user = mysql | ||
131 | 6 | pid-file = /var/run/mysqld/mysqld.pid | ||
132 | 7 | socket = /var/run/mysqld/mysqld.sock | ||
133 | 8 | port = 3306 | ||
134 | 9 | basedir = /usr | ||
135 | 10 | datadir = /var/lib/percona-xtradb-cluster | ||
136 | 11 | tmpdir = /tmp | ||
137 | 12 | lc-messages-dir = /usr/share/mysql | ||
138 | 13 | skip-external-locking | ||
139 | 14 | |||
140 | 15 | # | ||
141 | 16 | # * Networking | ||
142 | 17 | # | ||
143 | 18 | {% if bind_address -%} | ||
144 | 19 | bind-address = {{ bind_address }} | ||
145 | 20 | {% else -%} | ||
146 | 21 | bind-address = 0.0.0.0 | ||
147 | 22 | {% endif %} | ||
148 | 23 | |||
149 | 24 | # | ||
150 | 25 | # * Fine Tuning | ||
151 | 26 | # | ||
152 | 27 | key_buffer = {{ key_buffer }} | ||
153 | 28 | table_open_cache = {{ table_open_cache }} | ||
154 | 29 | max_allowed_packet = 16M | ||
155 | 30 | thread_stack = 192K | ||
156 | 31 | thread_cache_size = 8 | ||
157 | 32 | |||
158 | 33 | # This replaces the startup script and checks MyISAM tables if needed | ||
159 | 34 | # the first time they are touched | ||
160 | 35 | myisam-recover = BACKUP | ||
161 | 36 | |||
162 | 37 | {% if max_connections != -1 -%} | ||
163 | 38 | max_connections = {{ max_connections }} | ||
164 | 39 | {% endif %} | ||
165 | 40 | |||
166 | 41 | {% if wait_timeout != -1 -%} | ||
167 | 42 | # Seconds before clearing idle connections | ||
168 | 43 | wait_timeout = {{ wait_timeout }} | ||
169 | 44 | {% endif %} | ||
170 | 45 | |||
171 | 46 | # | ||
172 | 47 | # * Query Cache Configuration | ||
173 | 48 | # | ||
174 | 49 | query_cache_limit = 1M | ||
175 | 50 | query_cache_size = 16M | ||
176 | 51 | |||
177 | 52 | # | ||
178 | 53 | # * Logging and Replication | ||
179 | 54 | # | ||
180 | 55 | # | ||
181 | 56 | # Error log - should be very few entries. | ||
182 | 57 | # | ||
183 | 58 | log_error = /var/log/mysql/error.log | ||
184 | 59 | # | ||
185 | 60 | # The following can be used as easy to replay backup logs or for replication. | ||
186 | 61 | # note: if you are setting up a replication slave, see README.Debian about | ||
187 | 62 | # other settings you may need to change. | ||
188 | 63 | expire_logs_days = 10 | ||
189 | 64 | max_binlog_size = 100M | ||
190 | 65 | |||
191 | 66 | # | ||
192 | 67 | # * InnoDB | ||
193 | 68 | # | ||
194 | 69 | {% if innodb_file_per_table -%} | ||
195 | 70 | # This enables storing InnoDB tables in separate .ibd files. Note that, however | ||
196 | 71 | # existing InnoDB tables will remain in ibdata file(s) unles OPTIMIZE is run | ||
197 | 72 | # on them. Still, the ibdata1 file will NOT shrink - a full dump/import of the | ||
198 | 73 | # data is needed in order to get rid of large ibdata file. | ||
199 | 74 | innodb_file_per_table = 1 | ||
200 | 75 | {% else -%} | ||
201 | 76 | innodb_file_per_table = 0 | ||
202 | 77 | {% endif %} | ||
203 | 78 | |||
204 | 79 | innodb_buffer_pool_size = {{ innodb_buffer_pool_size }} | ||
205 | 80 | |||
206 | 81 | # | ||
207 | 82 | # * Galera | ||
208 | 83 | # | ||
209 | 84 | # Add address of other cluster nodes here | ||
210 | 85 | {% if not clustered -%} | ||
211 | 86 | # Empty gcomm address is being used when cluster is getting bootstrapped | ||
212 | 87 | wsrep_cluster_address=gcomm:// | ||
213 | 88 | {% else -%} | ||
214 | 89 | # Cluster connection URL contains the IPs of node#1, node#2 and node#3 | ||
215 | 90 | wsrep_cluster_address=gcomm://{{ cluster_hosts }} | ||
216 | 91 | {% endif %} | ||
217 | 92 | |||
218 | 93 | # | ||
219 | 94 | # Node address | ||
220 | 95 | wsrep_node_address={{ private_address }} | ||
221 | 96 | # | ||
222 | 97 | # SST method | ||
223 | 98 | wsrep_sst_method={{ sst_method }} | ||
224 | 99 | # | ||
225 | 100 | # Cluster name | ||
226 | 101 | wsrep_cluster_name={{ cluster_name }} | ||
227 | 102 | # | ||
228 | 103 | # Authentication for SST method | ||
229 | 104 | wsrep_sst_auth="sstuser:{{ sst_password }}" | ||
230 | 105 | |||
231 | 106 | {% if wsrep_provider_options -%} | ||
232 | 107 | wsrep_provider_options = {{ wsrep_provider_options }} | ||
233 | 108 | {% endif %} | ||
234 | 109 | |||
235 | 110 | # | ||
236 | 111 | # * IPv6 SST configuration | ||
237 | 112 | # | ||
238 | 113 | {% if ipv6 -%} | ||
239 | 114 | [sst] | ||
240 | 115 | sockopt=,pf=ip6 | ||
241 | 116 | {% endif %} |
charm_unit_test #9404 percona- cluster- next for james-page mp271659
UNIT OK: passed
Build: http:// 10.245. 162.77: 8080/job/ charm_unit_ test/9404/