diff options
author | Amy Fong <amy.fong@windriver.com> | 2014-07-24 13:04:41 -0400 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-07-25 15:45:30 -0400 |
commit | 1491d54da84195dda8c7d5ce1fac21437f2bc519 (patch) | |
tree | cc16576ec9471de2c9d18de8987f5a046971df0f /meta-openstack | |
parent | 3085fa57f54335cfa3794aaf1f45928f5300b000 (diff) | |
download | meta-cloud-services-1491d54da84195dda8c7d5ce1fac21437f2bc519.tar.gz |
openstack initscript: add reset
Some of the openstack data is associated with external resources
(ie glance may have external files), we explicitly invoke the delete commands on those
in additional to dropping and recreating the databases.
Signed-off-by: Amy Fong <amy.fong@windriver.com>
Diffstat (limited to 'meta-openstack')
17 files changed, 361 insertions, 34 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-barbican/barbican.init b/meta-openstack/recipes-devtools/python/python-barbican/barbican.init index 8bf0de1..5b353e1 100644 --- a/meta-openstack/recipes-devtools/python/python-barbican/barbican.init +++ b/meta-openstack/recipes-devtools/python/python-barbican/barbican.init | |||
@@ -86,15 +86,16 @@ case "$1" in | |||
86 | stop) | 86 | stop) |
87 | stop | 87 | stop |
88 | ;; | 88 | ;; |
89 | restart|force-reload|reload) | 89 | restart|force-reload|reload|reset) |
90 | stop | 90 | stop |
91 | sleep 1 | ||
91 | start | 92 | start |
92 | ;; | 93 | ;; |
93 | status) | 94 | status) |
94 | status | 95 | status |
95 | ;; | 96 | ;; |
96 | *) | 97 | *) |
97 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" | 98 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}" |
98 | exit 1 | 99 | exit 1 |
99 | ;; | 100 | ;; |
100 | esac | 101 | esac |
diff --git a/meta-openstack/recipes-devtools/python/python-ceilometer/ceilometer.init b/meta-openstack/recipes-devtools/python/python-ceilometer/ceilometer.init index d3c72e4..ba0f426 100644 --- a/meta-openstack/recipes-devtools/python/python-ceilometer/ceilometer.init +++ b/meta-openstack/recipes-devtools/python/python-ceilometer/ceilometer.init | |||
@@ -70,6 +70,24 @@ status() | |||
70 | echo "$DESC is not running" | 70 | echo "$DESC is not running" |
71 | } | 71 | } |
72 | 72 | ||
73 | reset() | ||
74 | { | ||
75 | stop | ||
76 | |||
77 | # This is to make sure postgres is configured and running | ||
78 | if ! pidof postmaster > /dev/null; then | ||
79 | /etc/init.d/postgresql-init | ||
80 | /etc/init.d/postgresql start | ||
81 | sleep 2 | ||
82 | fi | ||
83 | [ ! -d /var/log/ceilometer ] && mkdir /var/log/ceilometer | ||
84 | sudo -u postgres dropdb ceilometer | ||
85 | sudo -u postgres createdb ceilometer | ||
86 | ceilometer-dbsync | ||
87 | |||
88 | start | ||
89 | } | ||
90 | |||
73 | case "$1" in | 91 | case "$1" in |
74 | start) | 92 | start) |
75 | start | 93 | start |
@@ -84,8 +102,11 @@ case "$1" in | |||
84 | status) | 102 | status) |
85 | status | 103 | status |
86 | ;; | 104 | ;; |
105 | reset) | ||
106 | reset | ||
107 | ;; | ||
87 | *) | 108 | *) |
88 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" | 109 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}" |
89 | exit 1 | 110 | exit 1 |
90 | ;; | 111 | ;; |
91 | esac | 112 | esac |
diff --git a/meta-openstack/recipes-devtools/python/python-cinder/cinder-volume b/meta-openstack/recipes-devtools/python/python-cinder/cinder-volume index aec6ab0..f753810 100644 --- a/meta-openstack/recipes-devtools/python/python-cinder/cinder-volume +++ b/meta-openstack/recipes-devtools/python/python-cinder/cinder-volume | |||
@@ -69,6 +69,39 @@ status() | |||
69 | echo "$DESC is not running" | 69 | echo "$DESC is not running" |
70 | } | 70 | } |
71 | 71 | ||
72 | reset() | ||
73 | { | ||
74 | . /etc/nova/openrc | ||
75 | |||
76 | # Cleanup cinder volume | ||
77 | simple_delete "cinder list --all-tenant" "cinder delete" 1 "cinder volume" | ||
78 | |||
79 | # Cleanup cinder backup | ||
80 | simple_delete "cinder backup-list" "cinder backup-delete" 1 "cinder backup" | ||
81 | |||
82 | stop | ||
83 | |||
84 | if ! pidof postmaster > /dev/null; then | ||
85 | /etc/init.d/postgresql-init | ||
86 | /etc/init.d/postgresql start | ||
87 | fi | ||
88 | [ ! -d /var/log/cinder ] && mkdir /var/log/cinder | ||
89 | sudo -u postgres dropdb cinder | ||
90 | sudo -u postgres createdb cinder | ||
91 | cinder-manage db sync | ||
92 | |||
93 | if [ ! -f /etc/cinder/nfs_shares ]; then | ||
94 | /bin/bash /etc/cinder/drivers/nfs_setup.sh | ||
95 | fi | ||
96 | |||
97 | # Create Cinder glusterfs_share config file with default glusterfs server | ||
98 | if [ ! -f /etc/cinder/glusterfs_shares ] && [ -f /usr/sbin/glusterfsd ]; then | ||
99 | /bin/bash /etc/cinder/drivers/glusterfs_setup.sh | ||
100 | fi | ||
101 | |||
102 | start | ||
103 | } | ||
104 | |||
72 | case "$1" in | 105 | case "$1" in |
73 | start) | 106 | start) |
74 | start | 107 | start |
@@ -83,8 +116,11 @@ case "$1" in | |||
83 | status) | 116 | status) |
84 | status | 117 | status |
85 | ;; | 118 | ;; |
119 | reset) | ||
120 | reset | ||
121 | ;; | ||
86 | *) | 122 | *) |
87 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" | 123 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}" |
88 | exit 1 | 124 | exit 1 |
89 | ;; | 125 | ;; |
90 | esac | 126 | esac |
diff --git a/meta-openstack/recipes-devtools/python/python-cinder/cinder.init b/meta-openstack/recipes-devtools/python/python-cinder/cinder.init index ecf9d66..f130ac8 100644 --- a/meta-openstack/recipes-devtools/python/python-cinder/cinder.init +++ b/meta-openstack/recipes-devtools/python/python-cinder/cinder.init | |||
@@ -71,6 +71,39 @@ status() | |||
71 | echo "$DESC is not running" | 71 | echo "$DESC is not running" |
72 | } | 72 | } |
73 | 73 | ||
74 | reset() | ||
75 | { | ||
76 | . /etc/nova/openrc | ||
77 | |||
78 | # Cleanup cinder volume | ||
79 | simple_delete "cinder list --all-tenant" "cinder delete" 1 "cinder volume" | ||
80 | |||
81 | # Cleanup cinder backup | ||
82 | simple_delete "cinder backup-list" "cinder backup-delete" 1 "cinder backup" | ||
83 | |||
84 | stop | ||
85 | |||
86 | if ! pidof postmaster > /dev/null; then | ||
87 | /etc/init.d/postgresql-init | ||
88 | /etc/init.d/postgresql start | ||
89 | fi | ||
90 | [ ! -d /var/log/cinder ] && mkdir /var/log/cinder | ||
91 | sudo -u postgres dropdb cinder | ||
92 | sudo -u postgres createdb cinder | ||
93 | cinder-manage db sync | ||
94 | |||
95 | if [ ! -f /etc/cinder/nfs_shares ]; then | ||
96 | /bin/bash /etc/cinder/drivers/nfs_setup.sh | ||
97 | fi | ||
98 | |||
99 | # Create Cinder glusterfs_share config file with default glusterfs server | ||
100 | if [ ! -f /etc/cinder/glusterfs_shares ] && [ -f /usr/sbin/glusterfsd ]; then | ||
101 | /bin/bash /etc/cinder/drivers/glusterfs_setup.sh | ||
102 | fi | ||
103 | |||
104 | start | ||
105 | } | ||
106 | |||
74 | case "$1" in | 107 | case "$1" in |
75 | start) | 108 | start) |
76 | start | 109 | start |
@@ -85,8 +118,11 @@ case "$1" in | |||
85 | status) | 118 | status) |
86 | status | 119 | status |
87 | ;; | 120 | ;; |
121 | reset) | ||
122 | reset | ||
123 | ;; | ||
88 | *) | 124 | *) |
89 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" | 125 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}" |
90 | exit 1 | 126 | exit 1 |
91 | ;; | 127 | ;; |
92 | esac | 128 | esac |
diff --git a/meta-openstack/recipes-devtools/python/python-cinder/glusterfs_setup.sh b/meta-openstack/recipes-devtools/python/python-cinder/glusterfs_setup.sh index 30997d1..1c87ff9 100644 --- a/meta-openstack/recipes-devtools/python/python-cinder/glusterfs_setup.sh +++ b/meta-openstack/recipes-devtools/python/python-cinder/glusterfs_setup.sh | |||
@@ -1,7 +1,12 @@ | |||
1 | #! /bin/bash | 1 | #! /bin/bash |
2 | 2 | ||
3 | is_default=%IS_DEFAULT% | ||
4 | if [ $# -eq 1 ]; then | ||
5 | is_default=$1 | ||
6 | fi | ||
7 | |||
3 | # Default setup | 8 | # Default setup |
4 | if [ "$1" == "1" ]; then | 9 | if [ "$is_default" == "1" ]; then |
5 | mkdir /etc/cinder/glusterfs_volumes | 10 | mkdir /etc/cinder/glusterfs_volumes |
6 | /etc/init.d/glusterd start | 11 | /etc/init.d/glusterd start |
7 | gluster volume create glusterfs_volumes controller:/etc/cinder/glusterfs_volumes force | 12 | gluster volume create glusterfs_volumes controller:/etc/cinder/glusterfs_volumes force |
diff --git a/meta-openstack/recipes-devtools/python/python-cinder/nfs_setup.sh b/meta-openstack/recipes-devtools/python/python-cinder/nfs_setup.sh index 1d7c475..f07602a 100644 --- a/meta-openstack/recipes-devtools/python/python-cinder/nfs_setup.sh +++ b/meta-openstack/recipes-devtools/python/python-cinder/nfs_setup.sh | |||
@@ -1,7 +1,12 @@ | |||
1 | #! /bin/bash | 1 | #! /bin/bash |
2 | 2 | ||
3 | is_default=%IS_DEFAULT% | ||
4 | if [ $# -eq 1 ]; then | ||
5 | is_default=$1 | ||
6 | fi | ||
7 | |||
3 | # Default setup | 8 | # Default setup |
4 | if [ "$1" == "1" ]; then | 9 | if [ "$is_default" == "1" ]; then |
5 | mkdir /etc/cinder/nfs_volumes | 10 | mkdir /etc/cinder/nfs_volumes |
6 | echo "/etc/cinder/nfs_volumes *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)" >> /etc/exports | 11 | echo "/etc/cinder/nfs_volumes *(rw,nohide,insecure,no_subtree_check,async,no_root_squash)" >> /etc/exports |
7 | fi | 12 | fi |
diff --git a/meta-openstack/recipes-devtools/python/python-cinder_git.bb b/meta-openstack/recipes-devtools/python/python-cinder_git.bb index c648bae..4e0be66 100644 --- a/meta-openstack/recipes-devtools/python/python-cinder_git.bb +++ b/meta-openstack/recipes-devtools/python/python-cinder_git.bb | |||
@@ -32,6 +32,12 @@ do_install_prepend() { | |||
32 | sed 's:%PYTHON_SITEPACKAGES_DIR%:${PYTHON_SITEPACKAGES_DIR}:g' -i ${S}/${SRCNAME}/tests/conf_fixture.py | 32 | sed 's:%PYTHON_SITEPACKAGES_DIR%:${PYTHON_SITEPACKAGES_DIR}:g' -i ${S}/${SRCNAME}/tests/conf_fixture.py |
33 | } | 33 | } |
34 | 34 | ||
35 | CINDER_LVM_VOLUME_BACKING_FILE_SIZE ?= "2G" | ||
36 | CINDER_NFS_VOLUME_SERVERS_DEFAULT = "controller:/etc/cinder/nfs_volumes" | ||
37 | CINDER_NFS_VOLUME_SERVERS ?= "${CINDER_NFS_VOLUME_SERVERS_DEFAULT}" | ||
38 | CINDER_GLUSTERFS_VOLUME_SERVERS_DEFAULT = "controller:/glusterfs_volumes" | ||
39 | CINDER_GLUSTERFS_VOLUME_SERVERS ?= "${CINDER_GLUSTERFS_VOLUME_SERVERS_DEFAULT}" | ||
40 | |||
35 | do_install_append() { | 41 | do_install_append() { |
36 | TEMPLATE_CONF_DIR=${S}${sysconfdir}/${SRCNAME} | 42 | TEMPLATE_CONF_DIR=${S}${sysconfdir}/${SRCNAME} |
37 | CINDER_CONF_DIR=${D}${sysconfdir}/${SRCNAME} | 43 | CINDER_CONF_DIR=${D}${sysconfdir}/${SRCNAME} |
@@ -76,13 +82,24 @@ do_install_append() { | |||
76 | # test setup | 82 | # test setup |
77 | cp run_tests.sh ${CINDER_CONF_DIR} | 83 | cp run_tests.sh ${CINDER_CONF_DIR} |
78 | cp -r tools ${CINDER_CONF_DIR} | 84 | cp -r tools ${CINDER_CONF_DIR} |
79 | } | ||
80 | 85 | ||
81 | CINDER_LVM_VOLUME_BACKING_FILE_SIZE ?= "2G" | 86 | #Create cinder volume group backing file |
82 | CINDER_NFS_VOLUME_SERVERS_DEFAULT = "controller:/etc/cinder/nfs_volumes" | 87 | sed 's/%CINDER_LVM_VOLUME_BACKING_FILE_SIZE%/${CINDER_LVM_VOLUME_BACKING_FILE_SIZE}/g' -i ${D}/etc/cinder/drivers/lvm_iscsi_setup.sh |
83 | CINDER_NFS_VOLUME_SERVERS ?= "${CINDER_NFS_VOLUME_SERVERS_DEFAULT}" | 88 | mkdir -p ${D}/etc/tgt/ |
84 | CINDER_GLUSTERFS_VOLUME_SERVERS_DEFAULT = "controller:/glusterfs_volumes" | 89 | echo "include /etc/cinder/data/volumes/*" > ${D}/etc/tgt/targets.conf |
85 | CINDER_GLUSTERFS_VOLUME_SERVERS ?= "${CINDER_GLUSTERFS_VOLUME_SERVERS_DEFAULT}" | 90 | |
91 | # Create Cinder nfs_share config file with default nfs server | ||
92 | echo "${CINDER_NFS_VOLUME_SERVERS}" > ${D}/etc/cinder/nfs_shares | ||
93 | sed 's/\s\+/\n/g' -i ${D}/etc/cinder/nfs_shares | ||
94 | [ "x${CINDER_NFS_VOLUME_SERVERS}" = "x${CINDER_NFS_VOLUME_SERVERS_DEFAULT}" ] && is_default="1" || is_default="0" | ||
95 | sed -e "s:%IS_DEFAULT%:${is_default}:g" -i ${D}/etc/cinder/drivers/nfs_setup.sh | ||
96 | |||
97 | # Create Cinder glusterfs_share config file with default glusterfs server | ||
98 | echo "${CINDER_GLUSTERFS_VOLUME_SERVERS}" > ${D}/etc/cinder/glusterfs_shares | ||
99 | sed 's/\s\+/\n/g' -i ${D}/etc/cinder/glusterfs_shares | ||
100 | [ "x${CINDER_GLUSTERFS_VOLUME_SERVERS}" = "x${CINDER_GLUSTERFS_VOLUME_SERVERS_DEFAULT}" ] && is_default="1" || is_default="0" | ||
101 | sed -e "s:%IS_DEFAULT%:${is_default}:g" -i ${D}/etc/cinder/drivers/glusterfs_setup.sh | ||
102 | } | ||
86 | 103 | ||
87 | pkg_postinst_${SRCNAME}-setup () { | 104 | pkg_postinst_${SRCNAME}-setup () { |
88 | if [ "x$D" != "x" ]; then | 105 | if [ "x$D" != "x" ]; then |
@@ -102,31 +119,21 @@ pkg_postinst_${SRCNAME}-setup () { | |||
102 | sudo -u postgres createdb cinder | 119 | sudo -u postgres createdb cinder |
103 | cinder-manage db sync | 120 | cinder-manage db sync |
104 | 121 | ||
105 | #Create cinder volume group backing file | ||
106 | sed 's/%CINDER_LVM_VOLUME_BACKING_FILE_SIZE%/${CINDER_LVM_VOLUME_BACKING_FILE_SIZE}/g' -i /etc/cinder/drivers/lvm_iscsi_setup.sh | ||
107 | echo "include /etc/cinder/data/volumes/*" >> /etc/tgt/targets.conf | ||
108 | |||
109 | # Create Cinder nfs_share config file with default nfs server | 122 | # Create Cinder nfs_share config file with default nfs server |
110 | if [ ! -f /etc/cinder/nfs_shares ]; then | 123 | if [ ! -f /etc/cinder/nfs_shares ]; then |
111 | echo "${CINDER_NFS_VOLUME_SERVERS}" > /etc/cinder/nfs_shares | 124 | /bin/bash /etc/cinder/drivers/nfs_setup.sh |
112 | sed 's/\s\+/\n/g' -i /etc/cinder/nfs_shares | ||
113 | [[ "x${CINDER_NFS_VOLUME_SERVERS}" == "x${CINDER_NFS_VOLUME_SERVERS_DEFAULT}" ]] && is_default="1" || is_default="0" | ||
114 | /bin/bash /etc/cinder/drivers/nfs_setup.sh ${is_default} | ||
115 | fi | 125 | fi |
116 | 126 | ||
117 | # Create Cinder glusterfs_share config file with default glusterfs server | 127 | # Create Cinder glusterfs_share config file with default glusterfs server |
118 | if [ ! -f /etc/cinder/glusterfs_shares ] && [ -f /usr/sbin/glusterfsd ]; then | 128 | if [ ! -f /etc/cinder/glusterfs_shares ] && [ -f /usr/sbin/glusterfsd ]; then |
119 | echo "${CINDER_GLUSTERFS_VOLUME_SERVERS}" > /etc/cinder/glusterfs_shares | 129 | /bin/bash /etc/cinder/drivers/glusterfs_setup.sh |
120 | sed 's/\s\+/\n/g' -i /etc/cinder/glusterfs_shares | ||
121 | [[ "x${CINDER_GLUSTERFS_VOLUME_SERVERS}" == "x${CINDER_GLUSTERFS_VOLUME_SERVERS_DEFAULT}" ]] && is_default="1" || is_default="0" | ||
122 | /bin/bash /etc/cinder/drivers/glusterfs_setup.sh ${is_default} | ||
123 | fi | 130 | fi |
124 | } | 131 | } |
125 | 132 | ||
126 | PACKAGES += "${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup ${SRCNAME}-api ${SRCNAME}-volume ${SRCNAME}-scheduler ${SRCNAME}-backup" | 133 | PACKAGES += "${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup ${SRCNAME}-api ${SRCNAME}-volume ${SRCNAME}-scheduler ${SRCNAME}-backup" |
127 | ALLOW_EMPTY_${SRCNAME}-setup = "1" | 134 | ALLOW_EMPTY_${SRCNAME}-setup = "1" |
128 | 135 | ||
129 | FILES_${PN} = "${libdir}/*" | 136 | FILES_${PN} = "${libdir}/* /etc/tgt" |
130 | 137 | ||
131 | FILES_${SRCNAME}-tests = "${sysconfdir}/${SRCNAME}/run_tests.sh \ | 138 | FILES_${SRCNAME}-tests = "${sysconfdir}/${SRCNAME}/run_tests.sh \ |
132 | ${sysconfdir}/${SRCNAME}/tools" | 139 | ${sysconfdir}/${SRCNAME}/tools" |
diff --git a/meta-openstack/recipes-devtools/python/python-glance/glance.init b/meta-openstack/recipes-devtools/python/python-glance/glance.init index cb94ed7..5b1bf74 100644 --- a/meta-openstack/recipes-devtools/python/python-glance/glance.init +++ b/meta-openstack/recipes-devtools/python/python-glance/glance.init | |||
@@ -70,6 +70,30 @@ status() | |||
70 | echo "$DESC is not running" | 70 | echo "$DESC is not running" |
71 | } | 71 | } |
72 | 72 | ||
73 | reset() | ||
74 | { | ||
75 | . /etc/nova/openrc | ||
76 | |||
77 | # Cleanup all glance images | ||
78 | simple_delete "glance image-list --all-tenant" "glance image-delete" 1 "glance image" | ||
79 | |||
80 | stop | ||
81 | |||
82 | # This is to make sure postgres is configured and running | ||
83 | if ! pidof postmaster > /dev/null; then | ||
84 | /etc/init.d/postgresql-init | ||
85 | /etc/init.d/postgresql start | ||
86 | sleep 5 | ||
87 | fi | ||
88 | |||
89 | [ ! -d /var/log/glance ] && mkdir /var/log/glance | ||
90 | sudo -u postgres dropdb glance | ||
91 | sudo -u postgres createdb glance | ||
92 | glance-manage db_sync | ||
93 | |||
94 | start | ||
95 | } | ||
96 | |||
73 | case "$1" in | 97 | case "$1" in |
74 | start) | 98 | start) |
75 | start | 99 | start |
@@ -84,8 +108,11 @@ case "$1" in | |||
84 | status) | 108 | status) |
85 | status | 109 | status |
86 | ;; | 110 | ;; |
111 | reset) | ||
112 | reset | ||
113 | ;; | ||
87 | *) | 114 | *) |
88 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" | 115 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}" |
89 | exit 1 | 116 | exit 1 |
90 | ;; | 117 | ;; |
91 | esac | 118 | esac |
diff --git a/meta-openstack/recipes-devtools/python/python-heat/heat.init b/meta-openstack/recipes-devtools/python/python-heat/heat.init index 4d8c180..5e0719f 100644 --- a/meta-openstack/recipes-devtools/python/python-heat/heat.init +++ b/meta-openstack/recipes-devtools/python/python-heat/heat.init | |||
@@ -76,6 +76,25 @@ status() | |||
76 | echo "$DESC is not running" | 76 | echo "$DESC is not running" |
77 | } | 77 | } |
78 | 78 | ||
79 | reset() | ||
80 | { | ||
81 | stop | ||
82 | |||
83 | # This is to make sure postgres is configured and running | ||
84 | if ! pidof postmaster > /dev/null; then | ||
85 | /etc/init.d/postgresql-init | ||
86 | /etc/init.d/postgresql start | ||
87 | sleep 2 | ||
88 | fi | ||
89 | |||
90 | [ ! -d /var/log/heat ] && mkdir /var/log/heat | ||
91 | sudo -u postgres dropdb heat | ||
92 | sudo -u postgres createdb heat | ||
93 | heat-manage db_sync | ||
94 | |||
95 | start | ||
96 | } | ||
97 | |||
79 | case "$1" in | 98 | case "$1" in |
80 | start) | 99 | start) |
81 | start | 100 | start |
@@ -90,8 +109,11 @@ case "$1" in | |||
90 | status) | 109 | status) |
91 | status | 110 | status |
92 | ;; | 111 | ;; |
112 | reset) | ||
113 | reset | ||
114 | ;; | ||
93 | *) | 115 | *) |
94 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" | 116 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}" |
95 | exit 1 | 117 | exit 1 |
96 | ;; | 118 | ;; |
97 | esac | 119 | esac |
diff --git a/meta-openstack/recipes-devtools/python/python-keystone/keystone b/meta-openstack/recipes-devtools/python/python-keystone/keystone index d73bc75..6524fed 100644 --- a/meta-openstack/recipes-devtools/python/python-keystone/keystone +++ b/meta-openstack/recipes-devtools/python/python-keystone/keystone | |||
@@ -67,6 +67,40 @@ status() | |||
67 | echo "$DESC is not running" | 67 | echo "$DESC is not running" |
68 | } | 68 | } |
69 | 69 | ||
70 | reset() | ||
71 | { | ||
72 | # Cleanup keystone tenant | ||
73 | . /etc/nova/openrc | ||
74 | simple_delete "keystone user-list" "keystone user-delete" 1 "keystone user" | ||
75 | simple_delete "keystone tenant-list" "keystone tenant-delete" 1 "keystone tenant" | ||
76 | simple_delete "keystone role-list" "keystone role-delete" 1 "keystone role" | ||
77 | simple_delete "keystone endpoint-list" "keystone endpoint-delete" 1 "keystone endpoint" | ||
78 | simple_delete "keystone service-list" "keystone service-delete" 1 "keystone service" | ||
79 | |||
80 | stop | ||
81 | |||
82 | # This is to make sure postgres is configured and running | ||
83 | if ! pidof postmaster > /dev/null; then | ||
84 | /etc/init.d/postgresql-init | ||
85 | /etc/init.d/postgresql start | ||
86 | sleep 2 | ||
87 | fi | ||
88 | |||
89 | sudo -u postgres dropdb keystone | ||
90 | sudo -u postgres createdb keystone | ||
91 | keystone-manage db_sync | ||
92 | keystone-manage pki_setup --keystone-user=root --keystone-group=root | ||
93 | |||
94 | start | ||
95 | |||
96 | sleep 2 | ||
97 | |||
98 | ADMIN_PASSWORD=%ADMIN_PASSWORD% \ | ||
99 | SERVICE_PASSWORD=%SERVICE_PASSWORD% \ | ||
100 | SERVICE_TENANT_NAME=%SERVICE_TENANT_NAME% \ | ||
101 | bash /etc/keystone/identity.sh | ||
102 | } | ||
103 | |||
70 | case "$1" in | 104 | case "$1" in |
71 | start) | 105 | start) |
72 | start | 106 | start |
@@ -81,8 +115,11 @@ case "$1" in | |||
81 | status) | 115 | status) |
82 | status | 116 | status |
83 | ;; | 117 | ;; |
118 | reset) | ||
119 | reset | ||
120 | ;; | ||
84 | *) | 121 | *) |
85 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" | 122 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}" |
86 | exit 1 | 123 | exit 1 |
87 | ;; | 124 | ;; |
88 | esac | 125 | esac |
diff --git a/meta-openstack/recipes-devtools/python/python-keystone_git.bb b/meta-openstack/recipes-devtools/python/python-keystone_git.bb index 190bb23..80118d4 100644 --- a/meta-openstack/recipes-devtools/python/python-keystone_git.bb +++ b/meta-openstack/recipes-devtools/python/python-keystone_git.bb | |||
@@ -66,6 +66,10 @@ do_install_append() { | |||
66 | fi | 66 | fi |
67 | 67 | ||
68 | cp run_tests.sh ${KEYSTONE_CONF_DIR} | 68 | cp run_tests.sh ${KEYSTONE_CONF_DIR} |
69 | |||
70 | sed -e "s/%ADMIN_PASSWORD%/${ADMIN_PASSWORD}/g" -i ${D}${sysconfdir}/init.d/keystone | ||
71 | sed -e "s/%SERVICE_PASSWORD%/${SERVICE_PASSWORD}/g" -i ${D}${sysconfdir}/init.d/keystone | ||
72 | sed -e "s/%SERVICE_TENANT_NAME%/${SERVICE_TENANT_NAME}/g" -i ${D}${sysconfdir}/init.d/keystone | ||
69 | } | 73 | } |
70 | 74 | ||
71 | pkg_postinst_${SRCNAME}-setup () { | 75 | pkg_postinst_${SRCNAME}-setup () { |
diff --git a/meta-openstack/recipes-devtools/python/python-neutron/neutron-agent.init b/meta-openstack/recipes-devtools/python/python-neutron/neutron-agent.init index 8bd4c23..8b11a27 100644 --- a/meta-openstack/recipes-devtools/python/python-neutron/neutron-agent.init +++ b/meta-openstack/recipes-devtools/python/python-neutron/neutron-agent.init | |||
@@ -75,7 +75,7 @@ case "$1" in | |||
75 | stop) | 75 | stop) |
76 | stop | 76 | stop |
77 | ;; | 77 | ;; |
78 | restart|force-reload|reload) | 78 | restart|force-reload|reload|reset) |
79 | stop | 79 | stop |
80 | start | 80 | start |
81 | ;; | 81 | ;; |
@@ -83,7 +83,7 @@ case "$1" in | |||
83 | status | 83 | status |
84 | ;; | 84 | ;; |
85 | *) | 85 | *) |
86 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" | 86 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}" |
87 | exit 1 | 87 | exit 1 |
88 | ;; | 88 | ;; |
89 | esac | 89 | esac |
diff --git a/meta-openstack/recipes-devtools/python/python-neutron/neutron-server.init b/meta-openstack/recipes-devtools/python/python-neutron/neutron-server.init index 63440e8..0c78de6 100644 --- a/meta-openstack/recipes-devtools/python/python-neutron/neutron-server.init +++ b/meta-openstack/recipes-devtools/python/python-neutron/neutron-server.init | |||
@@ -71,6 +71,51 @@ status() | |||
71 | echo "$DESC is not running" | 71 | echo "$DESC is not running" |
72 | } | 72 | } |
73 | 73 | ||
74 | reset() | ||
75 | { | ||
76 | . /etc/nova/openrc | ||
77 | |||
78 | # Cleanup all neutron floating ip | ||
79 | simple_delete "neutron floatingip-list --all-tenant" "neutron floatingip-delete" 1 "neutron floatingip" | ||
80 | |||
81 | # Cleanup all neutron router | ||
82 | neutron router-list | while read line; do | ||
83 | router_id=`echo $line | get_field 1` | ||
84 | neutron router-port-list $router_id | while read line_port; do | ||
85 | port_id=`echo $line_port | get_field 1` | ||
86 | subnet_id=`echo $line_port | get_field 4 | cut -d ' ' -f 2 | cut -d '"' -f 2` | ||
87 | if [ ! -z "$router_id" ] && [ ! -z "$subnet_id" ] ; then | ||
88 | echo ">>> Delete router-port: router_id=$router_id, port_id=$port_id, subnet_id=$subnet_id" | ||
89 | neutron router-interface-delete $router_id $subnet_id > /dev/null 2>&1 | ||
90 | fi | ||
91 | done | ||
92 | if [ ! -z "$router_id" ] ; then | ||
93 | echo ">>> Delete router: router_id=$router_id" | ||
94 | neutron router-delete $router_id > /dev/null 2>&1 | ||
95 | fi | ||
96 | done | ||
97 | |||
98 | # Cleanup all neutron ports | ||
99 | simple_delete "neutron port-list --all-tenant" "neutron port-delete" 1 "neutron port" | ||
100 | |||
101 | # Cleanup all neutron net | ||
102 | simple_delete "neutron net-list --all-tenant" "neutron net-delete" 1 "neutron net" | ||
103 | |||
104 | stop | ||
105 | |||
106 | # This is to make sure postgres is configured and running | ||
107 | if ! pidof postmaster > /dev/null; then | ||
108 | /etc/init.d/postgresql-init | ||
109 | /etc/init.d/postgresql start | ||
110 | sleep 2 | ||
111 | fi | ||
112 | |||
113 | sudo -u postgres dropdb ovs_neutron | ||
114 | sudo -u postgres createdb ovs_neutron | ||
115 | |||
116 | start | ||
117 | } | ||
118 | |||
74 | case "$1" in | 119 | case "$1" in |
75 | start) | 120 | start) |
76 | start | 121 | start |
@@ -85,8 +130,11 @@ case "$1" in | |||
85 | status) | 130 | status) |
86 | status | 131 | status |
87 | ;; | 132 | ;; |
133 | reset) | ||
134 | reset | ||
135 | ;; | ||
88 | *) | 136 | *) |
89 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" | 137 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}" |
90 | exit 1 | 138 | exit 1 |
91 | ;; | 139 | ;; |
92 | esac | 140 | esac |
diff --git a/meta-openstack/recipes-devtools/python/python-nova/nova.init b/meta-openstack/recipes-devtools/python/python-nova/nova.init index 87e72fa..46b28d3 100644 --- a/meta-openstack/recipes-devtools/python/python-nova/nova.init +++ b/meta-openstack/recipes-devtools/python/python-nova/nova.init | |||
@@ -86,6 +86,30 @@ status() | |||
86 | echo "$DESC is not running" | 86 | echo "$DESC is not running" |
87 | } | 87 | } |
88 | 88 | ||
89 | reset() | ||
90 | { | ||
91 | . /etc/nova/openrc | ||
92 | |||
93 | # Nova comute | ||
94 | simple_delete "nova list --all-tenant" "nova delete" 1 "vm" | ||
95 | |||
96 | stop | ||
97 | |||
98 | # This is to make sure postgres is configured and running | ||
99 | if ! pidof postmaster > /dev/null; then | ||
100 | /etc/init.d/postgresql-init | ||
101 | /etc/init.d/postgresql start | ||
102 | sleep 5 | ||
103 | fi | ||
104 | |||
105 | sudo -u postgres dropdb nova | ||
106 | sudo -u postgres createdb nova | ||
107 | sleep 2 | ||
108 | nova-manage db sync | ||
109 | |||
110 | start | ||
111 | } | ||
112 | |||
89 | case "$1" in | 113 | case "$1" in |
90 | start) | 114 | start) |
91 | start | 115 | start |
@@ -100,8 +124,11 @@ case "$1" in | |||
100 | status) | 124 | status) |
101 | status | 125 | status |
102 | ;; | 126 | ;; |
127 | reset) | ||
128 | reset | ||
129 | ;; | ||
103 | *) | 130 | *) |
104 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" | 131 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status|reset}" |
105 | exit 1 | 132 | exit 1 |
106 | ;; | 133 | ;; |
107 | esac | 134 | esac |
diff --git a/meta-openstack/recipes-devtools/python/python-nova/openrc b/meta-openstack/recipes-devtools/python/python-nova/openrc index c28f355..35327ac 100644 --- a/meta-openstack/recipes-devtools/python/python-nova/openrc +++ b/meta-openstack/recipes-devtools/python/python-nova/openrc | |||
@@ -4,3 +4,24 @@ export OS_PASSWORD=%OS_PASSWORD% | |||
4 | export OS_AUTH_URL="http://%CONTROLLER_HOST%:5000/v2.0/" | 4 | export OS_AUTH_URL="http://%CONTROLLER_HOST%:5000/v2.0/" |
5 | export SERVICE_ENDPOINT="http://%CONTROLLER_HOST%:35357/v2.0" | 5 | export SERVICE_ENDPOINT="http://%CONTROLLER_HOST%:35357/v2.0" |
6 | export SERVICE_TOKEN=%SERVICE_TOKEN% | 6 | export SERVICE_TOKEN=%SERVICE_TOKEN% |
7 | |||
8 | function get_field() { | ||
9 | while read data; do | ||
10 | if [ "$1" -lt 0 ]; then | ||
11 | field="(\$(NF$1))" | ||
12 | else | ||
13 | field="\$$(($1 + 1))" | ||
14 | fi | ||
15 | echo "$data" | awk -F'[ \t]*\\|[ \t]*' "{print $field}" | ||
16 | done | ||
17 | } | ||
18 | |||
19 | function simple_delete() { | ||
20 | $1 | while read line; do | ||
21 | id=`echo $line | get_field $3` | ||
22 | if [ ! -z "$id" ] ; then | ||
23 | echo ">>> Delete $4: id=$id" | ||
24 | $2 $id > /dev/null 2>&1 | ||
25 | fi | ||
26 | done | ||
27 | } | ||
diff --git a/meta-openstack/recipes-devtools/python/python-swift/swift.init b/meta-openstack/recipes-devtools/python/python-swift/swift.init index cf12066..256e1d0 100644 --- a/meta-openstack/recipes-devtools/python/python-swift/swift.init +++ b/meta-openstack/recipes-devtools/python/python-swift/swift.init | |||
@@ -50,6 +50,30 @@ status () | |||
50 | $SWIFT_INIT object-server status | 50 | $SWIFT_INIT object-server status |
51 | } | 51 | } |
52 | 52 | ||
53 | reset() | ||
54 | { | ||
55 | stop | ||
56 | |||
57 | CLUSTER_CONF=/etc/swift/cluster.conf | ||
58 | SWIFT_SETUP='/bin/bash /etc/swift/swift_setup.sh' | ||
59 | |||
60 | $SWIFT_SETUP clean | ||
61 | |||
62 | for i in `seq 1 3`; do | ||
63 | BACKING_FILE=/etc/swift/swift_backing_$i | ||
64 | if [ "x%SWIFT_BACKING_FILE_SIZE%" != "x0G" ]; then | ||
65 | truncate -s %SWIFT_BACKING_FILE_SIZE% $BACKING_FILE | ||
66 | fi | ||
67 | done | ||
68 | |||
69 | $SWIFT_SETUP createrings | ||
70 | $SWIFT_SETUP formatdevs | ||
71 | $SWIFT_SETUP mountdevs | ||
72 | $SWIFT_SETUP -i "%CONTROLLER_IP%" adddevs | ||
73 | $SWIFT_SETUP unmountdevs | ||
74 | |||
75 | start | ||
76 | } | ||
53 | 77 | ||
54 | case "$1" in | 78 | case "$1" in |
55 | start) | 79 | start) |
@@ -65,8 +89,11 @@ case "$1" in | |||
65 | status) | 89 | status) |
66 | status | 90 | status |
67 | ;; | 91 | ;; |
92 | reset) | ||
93 | reset | ||
94 | ;; | ||
68 | *) | 95 | *) |
69 | echo "Usage: swift {start|stop|force-reload|restart|status}" | 96 | echo "Usage: swift {start|stop|force-reload|restart|status|reset}" |
70 | exit 1 | 97 | exit 1 |
71 | ;; | 98 | ;; |
72 | esac | 99 | esac |
diff --git a/meta-openstack/recipes-devtools/python/python-swift_git.bb b/meta-openstack/recipes-devtools/python/python-swift_git.bb index 9d7f1a1..7bab0bd 100644 --- a/meta-openstack/recipes-devtools/python/python-swift_git.bb +++ b/meta-openstack/recipes-devtools/python/python-swift_git.bb | |||
@@ -83,6 +83,9 @@ do_install_append() { | |||
83 | 83 | ||
84 | cp -r test ${D}/${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}/ | 84 | cp -r test ${D}/${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}/ |
85 | grep -rl '^from test' ${D}/${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}/test | xargs sed 's/^from test/from swift\.test/g' -i | 85 | grep -rl '^from test' ${D}/${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}/test | xargs sed 's/^from test/from swift\.test/g' -i |
86 | |||
87 | sed "s/%SWIFT_BACKING_FILE_SIZE%/${SWIFT_BACKING_FILE_SIZE}/g" -i ${D}${sysconfdir}/init.d/swift | ||
88 | sed "s/%CONTROLLER_IP%/${CONTROLLER_IP}/g" -i ${D}${sysconfdir}/init.d/swift | ||
86 | } | 89 | } |
87 | 90 | ||
88 | pkg_postinst_${SRCNAME}-setup () { | 91 | pkg_postinst_${SRCNAME}-setup () { |