Merge lp:~adam-collard/charms/trusty/swift-storage/conditional-service-restart-stable into lp:~openstack-charmers-archive/charms/trusty/swift-storage/trunk

Proposed by Adam Collard
Status: Merged
Merged at revision: 70
Proposed branch: lp:~adam-collard/charms/trusty/swift-storage/conditional-service-restart-stable
Merge into: lp:~openstack-charmers-archive/charms/trusty/swift-storage/trunk
Diff against target: 194 lines (+19/-49)
7 files modified
hooks/charmhelpers/cli/__init__.py (+1/-5)
hooks/charmhelpers/cli/commands.py (+4/-4)
hooks/charmhelpers/contrib/openstack/utils.py (+7/-5)
hooks/charmhelpers/contrib/storage/linux/utils.py (+3/-2)
hooks/charmhelpers/core/hookenv.py (+1/-20)
hooks/charmhelpers/core/host.py (+2/-2)
tests/basic_deployment.py (+1/-11)
To merge this branch: bzr merge lp:~adam-collard/charms/trusty/swift-storage/conditional-service-restart-stable
Reviewer Review Type Date Requested Status
Liam Young (community) Approve
Review via email: mp+270030@code.launchpad.net

Description of the change

Backport r79 to stable.

See https://code.launchpad.net/~adam-collard/charms/trusty/swift-storage/fix-unconditional-service-restart/+merge/269744 for next MP.

"This branch prevents the swift-storage charm from thinking there was an OpenStack upgrade available at every config-changed.

I had to update the Amulet tests because they were incorrectly asserting that all of the swift services should have been restarted following a change to object-server-threads-per-disk. In fact, only the object services should be restarted, and only are (the test passed prior to this because of the bug in charm-helpers which caused the unconditional OpenStack upgrade, in turn restarting all of the services)"

This relies on stable charm-helpers branch from https://code.launchpad.net/~adam-collard/charm-helpers/openstack-upgrade-available-swift-stable/+merge/270028

To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #9318 swift-storage for adam-collard mp270030
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/9318/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #8616 swift-storage for adam-collard mp270030
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/8616/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #9322 swift-storage for adam-collard mp270030
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/9322/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #8621 swift-storage for adam-collard mp270030
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/8621/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #6232 swift-storage for adam-collard mp270030
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/6232/

Revision history for this message
Liam Young (gnuoy) wrote :

approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/charmhelpers/cli/__init__.py'
--- hooks/charmhelpers/cli/__init__.py 2015-08-10 16:39:22 +0000
+++ hooks/charmhelpers/cli/__init__.py 2015-09-03 10:26:58 +0000
@@ -152,15 +152,11 @@
152 arguments = self.argument_parser.parse_args()152 arguments = self.argument_parser.parse_args()
153 argspec = inspect.getargspec(arguments.func)153 argspec = inspect.getargspec(arguments.func)
154 vargs = []154 vargs = []
155 kwargs = {}
156 for arg in argspec.args:155 for arg in argspec.args:
157 vargs.append(getattr(arguments, arg))156 vargs.append(getattr(arguments, arg))
158 if argspec.varargs:157 if argspec.varargs:
159 vargs.extend(getattr(arguments, argspec.varargs))158 vargs.extend(getattr(arguments, argspec.varargs))
160 if argspec.keywords:159 output = arguments.func(*vargs)
161 for kwarg in argspec.keywords.items():
162 kwargs[kwarg] = getattr(arguments, kwarg)
163 output = arguments.func(*vargs, **kwargs)
164 if getattr(arguments.func, '_cli_test_command', False):160 if getattr(arguments.func, '_cli_test_command', False):
165 self.exit_code = 0 if output else 1161 self.exit_code = 0 if output else 1
166 output = ''162 output = ''
167163
=== modified file 'hooks/charmhelpers/cli/commands.py'
--- hooks/charmhelpers/cli/commands.py 2015-08-10 16:39:22 +0000
+++ hooks/charmhelpers/cli/commands.py 2015-09-03 10:26:58 +0000
@@ -26,7 +26,7 @@
26"""26"""
27Import the sub-modules which have decorated subcommands to register with chlp.27Import the sub-modules which have decorated subcommands to register with chlp.
28"""28"""
29import host # noqa29from . import host # noqa
30import benchmark # noqa30from . import benchmark # noqa
31import unitdata # noqa31from . import unitdata # noqa
32from charmhelpers.core import hookenv # noqa32from . import hookenv # noqa
3333
=== modified file 'hooks/charmhelpers/contrib/openstack/utils.py'
--- hooks/charmhelpers/contrib/openstack/utils.py 2015-08-10 16:39:22 +0000
+++ hooks/charmhelpers/contrib/openstack/utils.py 2015-09-03 10:26:58 +0000
@@ -1,5 +1,3 @@
1#!/usr/bin/python
2
3# Copyright 2014-2015 Canonical Limited.1# Copyright 2014-2015 Canonical Limited.
4#2#
5# This file is part of charm-helpers.3# This file is part of charm-helpers.
@@ -167,9 +165,9 @@
167 error_out(e)165 error_out(e)
168166
169167
170def get_os_version_codename(codename):168def get_os_version_codename(codename, version_map=OPENSTACK_CODENAMES):
171 '''Determine OpenStack version number from codename.'''169 '''Determine OpenStack version number from codename.'''
172 for k, v in six.iteritems(OPENSTACK_CODENAMES):170 for k, v in six.iteritems(version_map):
173 if v == codename:171 if v == codename:
174 return k172 return k
175 e = 'Could not derive OpenStack version for '\173 e = 'Could not derive OpenStack version for '\
@@ -392,7 +390,11 @@
392 import apt_pkg as apt390 import apt_pkg as apt
393 src = config('openstack-origin')391 src = config('openstack-origin')
394 cur_vers = get_os_version_package(package)392 cur_vers = get_os_version_package(package)
395 available_vers = get_os_version_install_source(src)393 if "swift" in package:
394 codename = get_os_codename_install_source(src)
395 available_vers = get_os_version_codename(codename, SWIFT_CODENAMES)
396 else:
397 available_vers = get_os_version_install_source(src)
396 apt.init()398 apt.init()
397 return apt.version_compare(available_vers, cur_vers) == 1399 return apt.version_compare(available_vers, cur_vers) == 1
398400
399401
=== modified file 'hooks/charmhelpers/contrib/storage/linux/utils.py'
--- hooks/charmhelpers/contrib/storage/linux/utils.py 2015-08-10 16:39:22 +0000
+++ hooks/charmhelpers/contrib/storage/linux/utils.py 2015-09-03 10:26:58 +0000
@@ -43,9 +43,10 @@
4343
44 :param block_device: str: Full path of block device to clean.44 :param block_device: str: Full path of block device to clean.
45 '''45 '''
46 # https://github.com/ceph/ceph/commit/fdd7f8d83afa25c4e09aaedd90ab93f3b64a677b
46 # sometimes sgdisk exits non-zero; this is OK, dd will clean up47 # sometimes sgdisk exits non-zero; this is OK, dd will clean up
47 call(['sgdisk', '--zap-all', '--mbrtogpt',48 call(['sgdisk', '--zap-all', '--', block_device])
48 '--clear', block_device])49 call(['sgdisk', '--clear', '--mbrtogpt', '--', block_device])
49 dev_end = check_output(['blockdev', '--getsz',50 dev_end = check_output(['blockdev', '--getsz',
50 block_device]).decode('UTF-8')51 block_device]).decode('UTF-8')
51 gpt_end = int(dev_end.split()[0]) - 10052 gpt_end = int(dev_end.split()[0]) - 100
5253
=== modified file 'hooks/charmhelpers/core/hookenv.py'
--- hooks/charmhelpers/core/hookenv.py 2015-08-10 16:39:22 +0000
+++ hooks/charmhelpers/core/hookenv.py 2015-09-03 10:26:58 +0000
@@ -34,23 +34,6 @@
34import tempfile34import tempfile
35from subprocess import CalledProcessError35from subprocess import CalledProcessError
3636
37try:
38 from charmhelpers.cli import cmdline
39except ImportError as e:
40 # due to the anti-pattern of partially synching charmhelpers directly
41 # into charms, it's possible that charmhelpers.cli is not available;
42 # if that's the case, they don't really care about using the cli anyway,
43 # so mock it out
44 if str(e) == 'No module named cli':
45 class cmdline(object):
46 @classmethod
47 def subcommand(cls, *args, **kwargs):
48 def _wrap(func):
49 return func
50 return _wrap
51 else:
52 raise
53
54import six37import six
55if not six.PY3:38if not six.PY3:
56 from UserDict import UserDict39 from UserDict import UserDict
@@ -91,6 +74,7 @@
91 res = func(*args, **kwargs)74 res = func(*args, **kwargs)
92 cache[key] = res75 cache[key] = res
93 return res76 return res
77 wrapper._wrapped = func
94 return wrapper78 return wrapper
9579
9680
@@ -190,7 +174,6 @@
190 return os.environ.get('JUJU_RELATION', None)174 return os.environ.get('JUJU_RELATION', None)
191175
192176
193@cmdline.subcommand()
194@cached177@cached
195def relation_id(relation_name=None, service_or_unit=None):178def relation_id(relation_name=None, service_or_unit=None):
196 """The relation ID for the current or a specified relation"""179 """The relation ID for the current or a specified relation"""
@@ -216,13 +199,11 @@
216 return os.environ.get('JUJU_REMOTE_UNIT', None)199 return os.environ.get('JUJU_REMOTE_UNIT', None)
217200
218201
219@cmdline.subcommand()
220def service_name():202def service_name():
221 """The name service group this unit belongs to"""203 """The name service group this unit belongs to"""
222 return local_unit().split('/')[0]204 return local_unit().split('/')[0]
223205
224206
225@cmdline.subcommand()
226@cached207@cached
227def remote_service_name(relid=None):208def remote_service_name(relid=None):
228 """The remote service name for a given relation-id (or the current relation)"""209 """The remote service name for a given relation-id (or the current relation)"""
229210
=== modified file 'hooks/charmhelpers/core/host.py'
--- hooks/charmhelpers/core/host.py 2015-08-10 16:39:22 +0000
+++ hooks/charmhelpers/core/host.py 2015-09-03 10:26:58 +0000
@@ -72,7 +72,7 @@
72 stopped = service_stop(service_name)72 stopped = service_stop(service_name)
73 # XXX: Support systemd too73 # XXX: Support systemd too
74 override_path = os.path.join(74 override_path = os.path.join(
75 init_dir, '{}.conf.override'.format(service_name))75 init_dir, '{}.override'.format(service_name))
76 with open(override_path, 'w') as fh:76 with open(override_path, 'w') as fh:
77 fh.write("manual\n")77 fh.write("manual\n")
78 return stopped78 return stopped
@@ -86,7 +86,7 @@
86 if init_dir is None:86 if init_dir is None:
87 init_dir = "/etc/init"87 init_dir = "/etc/init"
88 override_path = os.path.join(88 override_path = os.path.join(
89 init_dir, '{}.conf.override'.format(service_name))89 init_dir, '{}.override'.format(service_name))
90 if os.path.exists(override_path):90 if os.path.exists(override_path):
91 os.unlink(override_path)91 os.unlink(override_path)
92 started = service_start(service_name)92 started = service_start(service_name)
9393
=== modified file 'tests/basic_deployment.py'
--- tests/basic_deployment.py 2015-08-10 17:28:44 +0000
+++ tests/basic_deployment.py 2015-09-03 10:26:58 +0000
@@ -266,20 +266,10 @@
266 u.log.error("Skipping failing test until resolved")266 u.log.error("Skipping failing test until resolved")
267 return267 return
268268
269 services = {'swift-account-server': 'account-server.conf',269 services = {'swift-object-server': 'object-server.conf',
270 'swift-account-auditor': 'account-server.conf',
271 'swift-account-reaper': 'account-server.conf',
272 'swift-account-replicator': 'account-server.conf',
273 'swift-container-server': 'container-server.conf',
274 'swift-container-auditor': 'container-server.conf',
275 'swift-container-replicator': 'container-server.conf',
276 'swift-container-updater': 'container-server.conf',
277 'swift-object-server': 'object-server.conf',
278 'swift-object-auditor': 'object-server.conf',270 'swift-object-auditor': 'object-server.conf',
279 'swift-object-replicator': 'object-server.conf',271 'swift-object-replicator': 'object-server.conf',
280 'swift-object-updater': 'object-server.conf'}272 'swift-object-updater': 'object-server.conf'}
281 if self._get_openstack_release() >= self.precise_icehouse:
282 services['swift-container-sync'] = 'container-server.conf'
283273
284 self.d.configure('swift-storage',274 self.d.configure('swift-storage',
285 {'object-server-threads-per-disk': '2'})275 {'object-server-threads-per-disk': '2'})

Subscribers

People subscribed via source and target branches