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
1=== modified file 'hooks/charmhelpers/cli/__init__.py'
2--- hooks/charmhelpers/cli/__init__.py 2015-08-10 16:39:22 +0000
3+++ hooks/charmhelpers/cli/__init__.py 2015-09-03 10:26:58 +0000
4@@ -152,15 +152,11 @@
5 arguments = self.argument_parser.parse_args()
6 argspec = inspect.getargspec(arguments.func)
7 vargs = []
8- kwargs = {}
9 for arg in argspec.args:
10 vargs.append(getattr(arguments, arg))
11 if argspec.varargs:
12 vargs.extend(getattr(arguments, argspec.varargs))
13- if argspec.keywords:
14- for kwarg in argspec.keywords.items():
15- kwargs[kwarg] = getattr(arguments, kwarg)
16- output = arguments.func(*vargs, **kwargs)
17+ output = arguments.func(*vargs)
18 if getattr(arguments.func, '_cli_test_command', False):
19 self.exit_code = 0 if output else 1
20 output = ''
21
22=== modified file 'hooks/charmhelpers/cli/commands.py'
23--- hooks/charmhelpers/cli/commands.py 2015-08-10 16:39:22 +0000
24+++ hooks/charmhelpers/cli/commands.py 2015-09-03 10:26:58 +0000
25@@ -26,7 +26,7 @@
26 """
27 Import the sub-modules which have decorated subcommands to register with chlp.
28 """
29-import host # noqa
30-import benchmark # noqa
31-import unitdata # noqa
32-from charmhelpers.core import hookenv # noqa
33+from . import host # noqa
34+from . import benchmark # noqa
35+from . import unitdata # noqa
36+from . import hookenv # noqa
37
38=== modified file 'hooks/charmhelpers/contrib/openstack/utils.py'
39--- hooks/charmhelpers/contrib/openstack/utils.py 2015-08-10 16:39:22 +0000
40+++ hooks/charmhelpers/contrib/openstack/utils.py 2015-09-03 10:26:58 +0000
41@@ -1,5 +1,3 @@
42-#!/usr/bin/python
43-
44 # Copyright 2014-2015 Canonical Limited.
45 #
46 # This file is part of charm-helpers.
47@@ -167,9 +165,9 @@
48 error_out(e)
49
50
51-def get_os_version_codename(codename):
52+def get_os_version_codename(codename, version_map=OPENSTACK_CODENAMES):
53 '''Determine OpenStack version number from codename.'''
54- for k, v in six.iteritems(OPENSTACK_CODENAMES):
55+ for k, v in six.iteritems(version_map):
56 if v == codename:
57 return k
58 e = 'Could not derive OpenStack version for '\
59@@ -392,7 +390,11 @@
60 import apt_pkg as apt
61 src = config('openstack-origin')
62 cur_vers = get_os_version_package(package)
63- available_vers = get_os_version_install_source(src)
64+ if "swift" in package:
65+ codename = get_os_codename_install_source(src)
66+ available_vers = get_os_version_codename(codename, SWIFT_CODENAMES)
67+ else:
68+ available_vers = get_os_version_install_source(src)
69 apt.init()
70 return apt.version_compare(available_vers, cur_vers) == 1
71
72
73=== modified file 'hooks/charmhelpers/contrib/storage/linux/utils.py'
74--- hooks/charmhelpers/contrib/storage/linux/utils.py 2015-08-10 16:39:22 +0000
75+++ hooks/charmhelpers/contrib/storage/linux/utils.py 2015-09-03 10:26:58 +0000
76@@ -43,9 +43,10 @@
77
78 :param block_device: str: Full path of block device to clean.
79 '''
80+ # https://github.com/ceph/ceph/commit/fdd7f8d83afa25c4e09aaedd90ab93f3b64a677b
81 # sometimes sgdisk exits non-zero; this is OK, dd will clean up
82- call(['sgdisk', '--zap-all', '--mbrtogpt',
83- '--clear', block_device])
84+ call(['sgdisk', '--zap-all', '--', block_device])
85+ call(['sgdisk', '--clear', '--mbrtogpt', '--', block_device])
86 dev_end = check_output(['blockdev', '--getsz',
87 block_device]).decode('UTF-8')
88 gpt_end = int(dev_end.split()[0]) - 100
89
90=== modified file 'hooks/charmhelpers/core/hookenv.py'
91--- hooks/charmhelpers/core/hookenv.py 2015-08-10 16:39:22 +0000
92+++ hooks/charmhelpers/core/hookenv.py 2015-09-03 10:26:58 +0000
93@@ -34,23 +34,6 @@
94 import tempfile
95 from subprocess import CalledProcessError
96
97-try:
98- from charmhelpers.cli import cmdline
99-except ImportError as e:
100- # due to the anti-pattern of partially synching charmhelpers directly
101- # into charms, it's possible that charmhelpers.cli is not available;
102- # if that's the case, they don't really care about using the cli anyway,
103- # so mock it out
104- if str(e) == 'No module named cli':
105- class cmdline(object):
106- @classmethod
107- def subcommand(cls, *args, **kwargs):
108- def _wrap(func):
109- return func
110- return _wrap
111- else:
112- raise
113-
114 import six
115 if not six.PY3:
116 from UserDict import UserDict
117@@ -91,6 +74,7 @@
118 res = func(*args, **kwargs)
119 cache[key] = res
120 return res
121+ wrapper._wrapped = func
122 return wrapper
123
124
125@@ -190,7 +174,6 @@
126 return os.environ.get('JUJU_RELATION', None)
127
128
129-@cmdline.subcommand()
130 @cached
131 def relation_id(relation_name=None, service_or_unit=None):
132 """The relation ID for the current or a specified relation"""
133@@ -216,13 +199,11 @@
134 return os.environ.get('JUJU_REMOTE_UNIT', None)
135
136
137-@cmdline.subcommand()
138 def service_name():
139 """The name service group this unit belongs to"""
140 return local_unit().split('/')[0]
141
142
143-@cmdline.subcommand()
144 @cached
145 def remote_service_name(relid=None):
146 """The remote service name for a given relation-id (or the current relation)"""
147
148=== modified file 'hooks/charmhelpers/core/host.py'
149--- hooks/charmhelpers/core/host.py 2015-08-10 16:39:22 +0000
150+++ hooks/charmhelpers/core/host.py 2015-09-03 10:26:58 +0000
151@@ -72,7 +72,7 @@
152 stopped = service_stop(service_name)
153 # XXX: Support systemd too
154 override_path = os.path.join(
155- init_dir, '{}.conf.override'.format(service_name))
156+ init_dir, '{}.override'.format(service_name))
157 with open(override_path, 'w') as fh:
158 fh.write("manual\n")
159 return stopped
160@@ -86,7 +86,7 @@
161 if init_dir is None:
162 init_dir = "/etc/init"
163 override_path = os.path.join(
164- init_dir, '{}.conf.override'.format(service_name))
165+ init_dir, '{}.override'.format(service_name))
166 if os.path.exists(override_path):
167 os.unlink(override_path)
168 started = service_start(service_name)
169
170=== modified file 'tests/basic_deployment.py'
171--- tests/basic_deployment.py 2015-08-10 17:28:44 +0000
172+++ tests/basic_deployment.py 2015-09-03 10:26:58 +0000
173@@ -266,20 +266,10 @@
174 u.log.error("Skipping failing test until resolved")
175 return
176
177- services = {'swift-account-server': 'account-server.conf',
178- 'swift-account-auditor': 'account-server.conf',
179- 'swift-account-reaper': 'account-server.conf',
180- 'swift-account-replicator': 'account-server.conf',
181- 'swift-container-server': 'container-server.conf',
182- 'swift-container-auditor': 'container-server.conf',
183- 'swift-container-replicator': 'container-server.conf',
184- 'swift-container-updater': 'container-server.conf',
185- 'swift-object-server': 'object-server.conf',
186+ services = {'swift-object-server': 'object-server.conf',
187 'swift-object-auditor': 'object-server.conf',
188 'swift-object-replicator': 'object-server.conf',
189 'swift-object-updater': 'object-server.conf'}
190- if self._get_openstack_release() >= self.precise_icehouse:
191- services['swift-container-sync'] = 'container-server.conf'
192
193 self.d.configure('swift-storage',
194 {'object-server-threads-per-disk': '2'})

Subscribers

People subscribed via source and target branches