summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openstack/recipes-devtools')
-rw-r--r--meta-openstack/recipes-devtools/python/python-barbican/barbican.init5
-rw-r--r--meta-openstack/recipes-devtools/python/python-ceilometer/ceilometer.init23
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinder/cinder-volume38
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinder/cinder.init38
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinder/glusterfs_setup.sh7
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinder/nfs_setup.sh7
-rw-r--r--meta-openstack/recipes-devtools/python/python-cinder_git.bb45
-rw-r--r--meta-openstack/recipes-devtools/python/python-glance/glance.init29
-rw-r--r--meta-openstack/recipes-devtools/python/python-heat/heat.init24
-rw-r--r--meta-openstack/recipes-devtools/python/python-keystone/keystone39
-rw-r--r--meta-openstack/recipes-devtools/python/python-keystone_git.bb4
-rw-r--r--meta-openstack/recipes-devtools/python/python-neutron/neutron-agent.init4
-rw-r--r--meta-openstack/recipes-devtools/python/python-neutron/neutron-server.init50
-rw-r--r--meta-openstack/recipes-devtools/python/python-nova/nova.init29
-rw-r--r--meta-openstack/recipes-devtools/python/python-nova/openrc21
-rw-r--r--meta-openstack/recipes-devtools/python/python-swift/swift.init29
-rw-r--r--meta-openstack/recipes-devtools/python/python-swift_git.bb3
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 ;;
100esac 101esac
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
73reset()
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
73case "$1" in 91case "$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 ;;
91esac 112esac
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
72reset()
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
72case "$1" in 105case "$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 ;;
90esac 126esac
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
74reset()
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
74case "$1" in 107case "$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 ;;
92esac 128esac
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
3is_default=%IS_DEFAULT%
4if [ $# -eq 1 ]; then
5 is_default=$1
6fi
7
3# Default setup 8# Default setup
4if [ "$1" == "1" ]; then 9if [ "$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
3is_default=%IS_DEFAULT%
4if [ $# -eq 1 ]; then
5 is_default=$1
6fi
7
3# Default setup 8# Default setup
4if [ "$1" == "1" ]; then 9if [ "$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
7fi 12fi
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
35CINDER_LVM_VOLUME_BACKING_FILE_SIZE ?= "2G"
36CINDER_NFS_VOLUME_SERVERS_DEFAULT = "controller:/etc/cinder/nfs_volumes"
37CINDER_NFS_VOLUME_SERVERS ?= "${CINDER_NFS_VOLUME_SERVERS_DEFAULT}"
38CINDER_GLUSTERFS_VOLUME_SERVERS_DEFAULT = "controller:/glusterfs_volumes"
39CINDER_GLUSTERFS_VOLUME_SERVERS ?= "${CINDER_GLUSTERFS_VOLUME_SERVERS_DEFAULT}"
40
35do_install_append() { 41do_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
81CINDER_LVM_VOLUME_BACKING_FILE_SIZE ?= "2G" 86 #Create cinder volume group backing file
82CINDER_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
83CINDER_NFS_VOLUME_SERVERS ?= "${CINDER_NFS_VOLUME_SERVERS_DEFAULT}" 88 mkdir -p ${D}/etc/tgt/
84CINDER_GLUSTERFS_VOLUME_SERVERS_DEFAULT = "controller:/glusterfs_volumes" 89 echo "include /etc/cinder/data/volumes/*" > ${D}/etc/tgt/targets.conf
85CINDER_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
87pkg_postinst_${SRCNAME}-setup () { 104pkg_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
126PACKAGES += "${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup ${SRCNAME}-api ${SRCNAME}-volume ${SRCNAME}-scheduler ${SRCNAME}-backup" 133PACKAGES += "${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup ${SRCNAME}-api ${SRCNAME}-volume ${SRCNAME}-scheduler ${SRCNAME}-backup"
127ALLOW_EMPTY_${SRCNAME}-setup = "1" 134ALLOW_EMPTY_${SRCNAME}-setup = "1"
128 135
129FILES_${PN} = "${libdir}/*" 136FILES_${PN} = "${libdir}/* /etc/tgt"
130 137
131FILES_${SRCNAME}-tests = "${sysconfdir}/${SRCNAME}/run_tests.sh \ 138FILES_${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
73reset()
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
73case "$1" in 97case "$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 ;;
91esac 118esac
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
79reset()
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
79case "$1" in 98case "$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 ;;
97esac 119esac
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
70reset()
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
70case "$1" in 104case "$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 ;;
88esac 125esac
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
71pkg_postinst_${SRCNAME}-setup () { 75pkg_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 ;;
89esac 89esac
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
74reset()
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
74case "$1" in 119case "$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 ;;
92esac 140esac
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
89reset()
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
89case "$1" in 113case "$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 ;;
107esac 134esac
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%
4export OS_AUTH_URL="http://%CONTROLLER_HOST%:5000/v2.0/" 4export OS_AUTH_URL="http://%CONTROLLER_HOST%:5000/v2.0/"
5export SERVICE_ENDPOINT="http://%CONTROLLER_HOST%:35357/v2.0" 5export SERVICE_ENDPOINT="http://%CONTROLLER_HOST%:35357/v2.0"
6export SERVICE_TOKEN=%SERVICE_TOKEN% 6export SERVICE_TOKEN=%SERVICE_TOKEN%
7
8function 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
19function 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
53reset()
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
54case "$1" in 78case "$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 ;;
72esac 99esac
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
88pkg_postinst_${SRCNAME}-setup () { 91pkg_postinst_${SRCNAME}-setup () {