summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xhooks/lxd_hooks.py29
-rw-r--r--hooks/lxd_utils.py10
l---------hooks/post-series-upgrade1
l---------hooks/pre-series-upgrade1
4 files changed, 40 insertions, 1 deletions
diff --git a/hooks/lxd_hooks.py b/hooks/lxd_hooks.py
index aa27a59..b65d58c 100755
--- a/hooks/lxd_hooks.py
+++ b/hooks/lxd_hooks.py
@@ -56,6 +56,13 @@ from charmhelpers.fetch import (
add_source,
)
+from charmhelpers.contrib.openstack.utils import (
+ clear_unit_paused,
+ clear_unit_upgrading,
+ set_unit_paused,
+ set_unit_upgrading,
+)
+
hooks = Hooks()
@@ -133,6 +140,27 @@ def lxd_migration_relation_changed(rid=None, unit=None):
[configure_lxd_remote(settings, u) for u in users]
+@hooks.hook('pre-series-upgrade')
+def pre_series_upgrade():
+ log("Running prepare series upgrade hook", "INFO")
+ # NOTE: The Ceph packages handle the series upgrade gracefully.
+ # In order to indicate the step of the series upgrade process for
+ # administrators and automated scripts, the charm sets the paused and
+ # upgrading states.
+ set_unit_paused()
+ set_unit_upgrading()
+
+
+@hooks.hook('post-series-upgrade')
+def post_series_upgrade():
+ log("Running complete series upgrade hook", "INFO")
+ # In order to indicate the step of the series upgrade process for
+ # administrators and automated scripts, the charm clears the paused and
+ # upgrading states.
+ clear_unit_paused()
+ clear_unit_upgrading()
+
+
def main():
try:
hooks.execute(sys.argv)
@@ -140,5 +168,6 @@ def main():
log("Unknown hook {} - skipping.".format(e))
assess_status()
+
if __name__ == "__main__":
main()
diff --git a/hooks/lxd_utils.py b/hooks/lxd_utils.py
index 1b34a9c..768366d 100644
--- a/hooks/lxd_utils.py
+++ b/hooks/lxd_utils.py
@@ -50,6 +50,9 @@ from charmhelpers.core.host import (
is_container,
CompareHostReleases,
)
+from charmhelpers.contrib.openstack.utils import (
+ is_unit_upgrading_set,
+)
from charmhelpers.contrib.storage.linux.utils import (
is_block_device,
zap_disk,
@@ -543,7 +546,11 @@ def lxd_start():
def assess_status():
'''Determine status of current unit'''
- if lxd_running():
+ if is_unit_upgrading_set():
+ status_set('blocked',
+ 'Ready for do-release-upgrade and reboot. '
+ 'Set complete when finished.')
+ elif lxd_running():
status_set('active', 'Unit is ready')
else:
status_set('blocked', 'LXD is not running')
@@ -566,6 +573,7 @@ def zpools():
except CalledProcessError:
return []
+
SUBUID = '/etc/subuid'
SUBGID = '/etc/subgid'
DEFAULT_COUNT = '327680000' # 5000 containers
diff --git a/hooks/post-series-upgrade b/hooks/post-series-upgrade
new file mode 120000
index 0000000..4a63a15
--- /dev/null
+++ b/hooks/post-series-upgrade
@@ -0,0 +1 @@
+lxd_hooks.py \ No newline at end of file
diff --git a/hooks/pre-series-upgrade b/hooks/pre-series-upgrade
new file mode 120000
index 0000000..4a63a15
--- /dev/null
+++ b/hooks/pre-series-upgrade
@@ -0,0 +1 @@
+lxd_hooks.py \ No newline at end of file

This mirror site include all the OpenStack related repositories under: openstack, openstack-dev and openstack-infra.

NOTE: All repositories are updated every one hour.

Usage

For Git Clone
 git clone http://git.trystack.cn/openstack/nova.git 
For DevStack

Add GIT_BASE, NOVNC_REPO and SPICE_REPO variables to local.conf file.

[[local|localrc]]

# use TryStack git mirror
GIT_BASE=http://git.trystack.cn
NOVNC_REPO=http://git.trystack.cn/kanaka/noVNC.git
SPICE_REPO=http://git.trystack.cn/git/spice/spice-html5.git