Series Upgrade
Implement the series-upgrade feature allowing to move between Ubuntu series. Change-Id: Ib5f234c219437c14b54ebe248c9598492542fd23
This commit is contained in:
parent
37efe8a2a7
commit
9f33b8135e
|
@ -0,0 +1 @@
|
|||
swift_storage_hooks.py
|
|
@ -0,0 +1 @@
|
|||
swift_storage_hooks.py
|
|
@ -71,6 +71,8 @@ from charmhelpers.core.host import (
|
|||
rsync,
|
||||
write_file,
|
||||
umount,
|
||||
service_start,
|
||||
service_stop,
|
||||
)
|
||||
|
||||
from charmhelpers.core.sysctl import create as create_sysctl
|
||||
|
@ -82,6 +84,11 @@ from charmhelpers.contrib.openstack.utils import (
|
|||
openstack_upgrade_available,
|
||||
set_os_workload_status,
|
||||
os_application_version_set,
|
||||
clear_unit_paused,
|
||||
clear_unit_upgrading,
|
||||
is_unit_paused_set,
|
||||
set_unit_paused,
|
||||
set_unit_upgrading,
|
||||
)
|
||||
from charmhelpers.contrib.network.ip import (
|
||||
get_relation_ip,
|
||||
|
@ -369,6 +376,30 @@ def update_status():
|
|||
log('Updating status.')
|
||||
|
||||
|
||||
@hooks.hook('pre-series-upgrade')
|
||||
def pre_series_upgrade():
|
||||
log("Running prepare series upgrade hook", "INFO")
|
||||
if not is_unit_paused_set():
|
||||
for service in SWIFT_SVCS:
|
||||
stopped = service_stop(service)
|
||||
if not stopped:
|
||||
raise Exception("{} didn't stop cleanly.".format(service))
|
||||
set_unit_paused()
|
||||
set_unit_upgrading()
|
||||
|
||||
|
||||
@hooks.hook('post-series-upgrade')
|
||||
def post_series_upgrade():
|
||||
log("Running complete series upgrade hook", "INFO")
|
||||
clear_unit_paused()
|
||||
clear_unit_upgrading()
|
||||
if not is_unit_paused_set():
|
||||
for service in SWIFT_SVCS:
|
||||
started = service_start(service)
|
||||
if not started:
|
||||
raise Exception("{} didn't start cleanly.".format(service))
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
hooks.execute(sys.argv)
|
||||
|
|
|
@ -130,8 +130,18 @@ class SwiftStorageBasicDeployment(OpenStackAmuletDeployment):
|
|||
self._get_openstack_release())
|
||||
)
|
||||
|
||||
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(
|
||||
|
@ -452,12 +462,17 @@ class SwiftStorageBasicDeployment(OpenStackAmuletDeployment):
|
|||
|
||||
headers, objects = self.swift.get_container(container_name)
|
||||
|
||||
if len(objects) != 2:
|
||||
if float(self.glance.version) < 2.0:
|
||||
object_count = 1
|
||||
else:
|
||||
object_count = 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