Series Upgrade
Implement the series-upgrade feature allowing to move between Ubuntu series. Change-Id: Ib76854ed5ad5c23b4e709a41139b1436196ff446
This commit is contained in:
parent
418def1b31
commit
ec1414a8ee
|
@ -0,0 +1 @@
|
|||
swift_hooks.py
|
|
@ -0,0 +1 @@
|
|||
swift_hooks.py
|
|
@ -790,6 +790,30 @@ def certs_changed():
|
|||
configure_https()
|
||||
|
||||
|
||||
@hooks.hook('pre-series-upgrade')
|
||||
def pre_series_upgrade():
|
||||
log("Running prepare series upgrade hook", "INFO")
|
||||
if not openstack.is_unit_paused_set():
|
||||
for service in services():
|
||||
stopped = service_stop(service)
|
||||
if not stopped:
|
||||
raise Exception("{} didn't stop cleanly.".format(service))
|
||||
openstack.set_unit_paused()
|
||||
openstack.set_unit_upgrading()
|
||||
|
||||
|
||||
@hooks.hook('post-series-upgrade')
|
||||
def post_series_upgrade():
|
||||
log("Running complete series upgrade hook", "INFO")
|
||||
openstack.clear_unit_paused()
|
||||
openstack.clear_unit_upgrading()
|
||||
if not openstack.is_unit_paused_set():
|
||||
for service in services():
|
||||
started = service_start(service)
|
||||
if not started:
|
||||
raise Exception("{} didn't start cleanly.".format(service))
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
hooks.execute(sys.argv)
|
||||
|
|
|
@ -148,8 +148,18 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
|
|||
# Authenticate admin with keystone
|
||||
self._init_keystone_admin_client(api_version)
|
||||
|
||||
force_v1_client = False
|
||||
if self._get_openstack_release() == self.trusty_icehouse:
|
||||
# Updating image properties (such as arch or hypervisor) using the
|
||||
# v2 api in icehouse results in:
|
||||
# https://bugs.launchpad.net/python-glanceclient/+bug/1371559
|
||||
u.log.debug('Forcing glance to use v1 api')
|
||||
force_v1_client = True
|
||||
|
||||
# Authenticate admin with glance endpoint
|
||||
self.glance = u.authenticate_glance_admin(self.keystone)
|
||||
self.glance = u.authenticate_glance_admin(
|
||||
self.keystone,
|
||||
force_v1_client=force_v1_client)
|
||||
|
||||
keystone_ip = self.keystone_sentry.info['public-address']
|
||||
keystone_relation = self.keystone_sentry.relation(
|
||||
|
@ -449,13 +459,18 @@ class SwiftProxyBasicDeployment(OpenStackAmuletDeployment):
|
|||
read_headers = {'X-Container-Read': ".r:*,.rlistings"}
|
||||
self.swift.post_container(container_name, headers=read_headers)
|
||||
|
||||
if float(self.glance.version) < 2.0:
|
||||
object_count = 1
|
||||
else:
|
||||
object_count = 2
|
||||
|
||||
headers, objects = self.swift.get_container(container_name)
|
||||
if len(objects) != 2:
|
||||
if len(objects) != object_count:
|
||||
msg = "Expected 2 swift object, found {}".format(len(objects))
|
||||
amulet.raise_status(amulet.FAIL, msg=msg)
|
||||
|
||||
swift_object_size = objects[1].get('bytes')
|
||||
swift_object_md5 = objects[1].get('hash')
|
||||
swift_object_size = objects[object_count - 1].get('bytes')
|
||||
swift_object_md5 = objects[object_count - 1].get('hash')
|
||||
|
||||
if img_size != swift_object_size:
|
||||
msg = "Glance image size {} != swift object size {}".format(
|
||||
|
|
Loading…
Reference in New Issue