summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-glance_git.bb
diff options
context:
space:
mode:
authorMark Asselstine <mark.asselstine@windriver.com>2017-12-01 15:19:42 -0500
committerBruce Ashfield <bruce.ashfield@windriver.com>2017-12-01 21:46:36 -0500
commit38973e8bc393a4ca36090c58c8b6eb6d093ea69a (patch)
tree3e9559be43f0e19f9067ae1524838ea78614e9ea /meta-openstack/recipes-devtools/python/python-glance_git.bb
parent2cf8169090392f6a7a4f8f119776f499f181fdf2 (diff)
downloadmeta-cloud-services-38973e8bc393a4ca36090c58c8b6eb6d093ea69a.tar.gz
python-glance: uprev to latest stable/pike
Complete the uprev and the transition to systemd. The configuration is cleaned up to match the setup documentation found in the openstack installation guide. Once a build is completed with these changes the controller image is able to have images added via: %> . /etc/keystone/admin-openrc %> openstack image create "cirros" \ --file cirros-0.3.5-x86_64-disk.img \ --disk-format qcow2 --container-format bare \ --public Images can be listed with 'openstack image list' or 'glance image-list' or via the horizon web interface. Requires introduction of python-glance-store... Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-glance_git.bb')
-rw-r--r--meta-openstack/recipes-devtools/python/python-glance_git.bb261
1 files changed, 131 insertions, 130 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-glance_git.bb b/meta-openstack/recipes-devtools/python/python-glance_git.bb
index 4c408c9..6a6cded 100644
--- a/meta-openstack/recipes-devtools/python/python-glance_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-glance_git.bb
@@ -6,19 +6,27 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=1dece7821bf3fd70fe1309eaa37d52a2"
6 6
7SRCNAME = "glance" 7SRCNAME = "glance"
8 8
9SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=master \ 9SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/pike \
10 file://glance.init \ 10 file://glance.init \
11 file://glance-api.service \
12 file://glance-registry.service \
13 file://glance-init.service \
14 file://glance-init \
11 " 15 "
12 16
13# removed. juno uses store library: file://0001-glance-store-only-load-known-stores-not-all-stores.patch 17SRCREV = "06af2eb5abe0332f7035a7d7c2fbfd19fbc4dae7"
14# file://glance-change-builtin-tests-config-location.patch 18PV = "15.0.0+git${SRCPV}"
15
16SRCREV = "69516fad5f651a085a047a337a05c58b39023c1b"
17PV = "11.0.0+git${SRCPV}"
18 19
19S = "${WORKDIR}/git" 20S = "${WORKDIR}/git"
20 21
21inherit setuptools update-rc.d identity default_configs hosts monitor 22inherit setuptools identity default_configs hosts monitor useradd systemd
23
24USER = "glance"
25GROUP = "glance"
26
27USERADD_PACKAGES = "${PN}"
28GROUPADD_PARAM_${PN} = "--system ${GROUP}"
29USERADD_PARAM_${PN} = "--system -m -d ${localstatedir}/lib/glance -s /bin/false -g ${GROUP} ${USER}"
22 30
23GLANCE_DEFAULT_STORE ?= "file" 31GLANCE_DEFAULT_STORE ?= "file"
24GLANCE_KNOWN_STORES ?= "glance.store.rbd.Store,\ 32GLANCE_KNOWN_STORES ?= "glance.store.rbd.Store,\
@@ -40,9 +48,9 @@ SERVICECREATE_PARAM_${SRCNAME}-setup = "name type description region publicurl a
40python () { 48python () {
41 flags = {'type':'image',\ 49 flags = {'type':'image',\
42 'description':'OpenStack Image Service',\ 50 'description':'OpenStack Image Service',\
43 'publicurl':"'http://${KEYSTONE_HOST}:9292/v2'",\ 51 'publicurl':"'http://${KEYSTONE_HOST}:5000'",\
44 'adminurl':"'http://${KEYSTONE_HOST}:9292/v2'",\ 52 'adminurl':"'http://${KEYSTONE_HOST}:35357'",\
45 'internalurl':"'http://${KEYSTONE_HOST}:9292/v2'"} 53 'internalurl':"'http://${KEYSTONE_HOST}:35357'"}
46 54
47 d.setVarFlags("SERVICECREATE_PARAM_%s-setup" % d.getVar('SRCNAME',True), flags) 55 d.setVarFlags("SERVICECREATE_PARAM_%s-setup" % d.getVar('SRCNAME',True), flags)
48} 56}
@@ -55,110 +63,105 @@ do_install_prepend() {
55} 63}
56 64
57do_install_append() { 65do_install_append() {
58 TEMPLATE_CONF_DIR=${S}${sysconfdir} 66 SRC_SYSCONFDIR=${S}${sysconfdir}
59 GLANCE_CONF_DIR=${D}${sysconfdir}/glance 67 GLANCE_CONF_DIR=${D}${sysconfdir}/glance
60
61 for file in api registry cache
62 do
63 install -m 0600 ${TEMPLATE_CONF_DIR}/glance-$file.conf ${WORKDIR}
64 sed -e "s!^#connection =.*!connection = postgresql://%DB_USER%:%DB_PASSWORD%@localhost/glance!g" \
65 -i ${WORKDIR}/glance-$file.conf
66 sed -i '/\[keystone_authtoken\]/aidentity_uri=http://127.0.0.1:8081/keystone/admin' ${WORKDIR}/glance-$file.conf
67 done
68
69 sed -e "s:^filesystem_store_datadir =.*:filesystem_store_datadir = ${sysconfdir}/${SRCNAME}/images/:g" \
70 -i ${WORKDIR}/glance-api.conf
71 68
72 # send samples to rabbitmq for ceilometer integration 69 install -o root -g ${GROUP} -m 750 -d ${GLANCE_CONF_DIR}
73 sed -e "s:^# notification_driver = noop:notification_driver = rabbit:g" \
74 -i ${WORKDIR}/glance-api.conf
75 70
76 sed 's:^default_store =.*:default_store = ${GLANCE_DEFAULT_STORE}:g' -i ${WORKDIR}/glance-api.conf 71 # Start with pristine copies from upstream
77 sed 's:^swift_store_auth_address =.*:swift_store_auth_address = http\://127.0.0.1\:8081/keystone/main/:g' -i ${WORKDIR}/glance-api.conf 72 install -m 644 -o root -g ${GROUP} ${SRC_SYSCONFDIR}/glance-registry.conf ${GLANCE_CONF_DIR}/
78 sed 's:^swift_store_user =.*:swift_store_user = %SERVICE_TENANT_NAME%\:${SRCNAME}:g' -i ${WORKDIR}/glance-api.conf 73 install -m 644 -o root -g ${GROUP} ${SRC_SYSCONFDIR}/glance-api.conf ${GLANCE_CONF_DIR}/
79 sed 's:^swift_store_key =.*:swift_store_key = %SERVICE_PASSWORD%:g' -i ${WORKDIR}/glance-api.conf 74 install -m 644 -o root -g ${GROUP} ${SRC_SYSCONFDIR}/glance-cache.conf ${GLANCE_CONF_DIR}/
80 sed 's:^swift_store_create_container_on_put =.*:swift_store_create_container_on_put = True:g' -i ${WORKDIR}/glance-api.conf 75 install -m 644 -o root -g ${GROUP} ${SRC_SYSCONFDIR}/glance-registry-paste.ini ${GLANCE_CONF_DIR}/
81 76 install -m 644 -o root -g ${GROUP} ${SRC_SYSCONFDIR}/glance-api-paste.ini ${GLANCE_CONF_DIR}/
82 # multi line match, replace the known stores with the ones we support. 77 install -m 644 -o root -g ${GROUP} ${SRC_SYSCONFDIR}/policy.json ${GLANCE_CONF_DIR}/
83 sed '1!N; s:#known_stores = glance.store.*\n.*#.*glance.store.http.*:known_stores = ${GLANCE_KNOWN_STORES}:g' -i ${WORKDIR}/glance-api.conf 78 install -m 644 -o root -g ${GROUP} ${SRC_SYSCONFDIR}/schema-image.json ${GLANCE_CONF_DIR}/
84
85 install -d ${GLANCE_CONF_DIR}
86 install -m 600 ${WORKDIR}/glance-registry.conf ${GLANCE_CONF_DIR}/
87 install -m 600 ${WORKDIR}/glance-api.conf ${GLANCE_CONF_DIR}/
88 install -m 600 ${WORKDIR}/glance-cache.conf ${GLANCE_CONF_DIR}/
89
90 install -m 600 ${S}/etc/glance-registry-paste.ini ${GLANCE_CONF_DIR}/
91 install -m 600 ${S}/etc/glance-api-paste.ini ${GLANCE_CONF_DIR}/
92 install -m 600 ${S}/etc/policy.json ${GLANCE_CONF_DIR}/
93 install -m 600 ${S}/etc/schema-image.json ${GLANCE_CONF_DIR}/
94
95 install -d ${GLANCE_CONF_DIR}/images
96 install -d ${D}${localstatedir}/lib/glance/image_cache
97
98 install -d ${D}${localstatedir}/log/${SRCNAME}
99 79
100 for file in api registry cache 80 for file in api registry cache
101 do 81 do
102 sed -e "s:%SERVICE_TENANT_NAME%:${SERVICE_TENANT_NAME}:g" \ 82 sed -e "/^#connection = .*/aconnection = postgresql+psycopg2://${DB_USER}:${DB_PASSWORD}@localhost/glance" \
103 -i ${GLANCE_CONF_DIR}/glance-$file.conf 83 -i ${GLANCE_CONF_DIR}/glance-$file.conf
104 sed -e "s:%SERVICE_USER%:${SRCNAME}:g" -i ${GLANCE_CONF_DIR}/glance-$file.conf 84 sed -e "/^#filesystem_store_datadir = .*/afilesystem_store_datadir = ${localstatedir}/lib/${SRCNAME}/images/" \
105 sed -e "s:%SERVICE_PASSWORD%:${SERVICE_PASSWORD}:g" \ 85 -i ${GLANCE_CONF_DIR}/glance-$file.conf
106 -i ${GLANCE_CONF_DIR}/glance-$file.conf 86 sed -e "/^#service_token_roles_required = .*/aservice_token_roles_required = true" \
107 sed -e "s:%DB_PASSWORD%:${DB_PASSWORD}:g" \
108 -i ${GLANCE_CONF_DIR}/glance-$file.conf
109 sed -e "s:%DB_USER%:${DB_USER}:g" \
110 -i ${GLANCE_CONF_DIR}/glance-$file.conf 87 -i ${GLANCE_CONF_DIR}/glance-$file.conf
111 done 88 done
112 89
113 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then 90 CONF_FILE=${GLANCE_CONF_DIR}/glance-api.conf
114 install -d ${D}${sysconfdir}/init.d 91 sed -e '/^#stores = .*/astores = ${GLANCE_KNOWN_STORES}' -i ${CONF_FILE}
115 sed 's:@suffix@:api:' < ${WORKDIR}/glance.init >${WORKDIR}/glance-api.init.sh 92 sed -e '/^#default_store = .*/adefault_store = ${GLANCE_DEFAULT_STORE}' -i ${CONF_FILE}
116 install -m 0755 ${WORKDIR}/glance-api.init.sh ${D}${sysconfdir}/init.d/glance-api 93 #sed -e 's:^swift_store_auth_address =.*:swift_store_auth_address = http\://127.0.0.1\:8081/keystone/main/:g' -i ${CONF_FILE}
117 sed 's:@suffix@:registry:' < ${WORKDIR}/glance.init >${WORKDIR}/glance-registry.init.sh 94 #sed -e 's:^swift_store_user =.*:swift_store_user = %SERVICE_TENANT_NAME%\:${SRCNAME}:g' -i ${CONF_FILE}
118 install -m 0755 ${WORKDIR}/glance-registry.init.sh ${D}${sysconfdir}/init.d/glance-registry 95 #sed -e 's:^swift_store_key =.*:swift_store_key = %SERVICE_PASSWORD%:g' -i ${CONF_FILE}
119 fi 96 sed -e '/^#swift_store_create_container_on_put = .*/aswift_store_create_container_on_put = True' -i ${CONF_FILE}
120 97
121 cp run_tests.sh ${GLANCE_CONF_DIR} 98 # As documented in https://docs.openstack.org/glance/pike/install/install-debian.html
122} 99 for file in api registry
100 do
101 CONF_FILE=${GLANCE_CONF_DIR}/glance-$file.conf
102 keystone_authtoken="#\n# Setup at install by python-glance_git.bb\n#"
103 keystone_authtoken="$keystone_authtoken\nauth_uri = http://${CONTROLLER_IP}:5000"
104 keystone_authtoken="$keystone_authtoken\nauth_url = http://${CONTROLLER_IP}:35357"
105 keystone_authtoken="$keystone_authtoken\nmemcached_servers = ${CONTROLLER_IP}:11211"
106 keystone_authtoken="$keystone_authtoken\nauth_type = password"
107 keystone_authtoken="$keystone_authtoken\nproject_domain_name = Default"
108 keystone_authtoken="$keystone_authtoken\nuser_domain_name = Default"
109 keystone_authtoken="$keystone_authtoken\nproject_name = service"
110 keystone_authtoken="$keystone_authtoken\nusername = ${USER}"
111 keystone_authtoken="$keystone_authtoken\npassword = ${ADMIN_PASSWORD}"
112 sed -e "/^\[keystone_authtoken\].*/a$keystone_authtoken" -i ${CONF_FILE}
113 sed -e "/^#flavor = .*/aflavor = keystone" -i ${CONF_FILE}
114 done
115
116 # Install and setup systemd service files
117 install -d ${D}${systemd_system_unitdir}/
118 for service in glance-api.service glance-registry.service glance-init.service
119 do
120 SERVICE_FILE=${D}${systemd_system_unitdir}/$service
121 install -m 644 ${WORKDIR}/$service ${D}${systemd_system_unitdir}/
122 sed -e "s:%SYSCONFDIR%:${sysconfdir}:g" -i ${SERVICE_FILE}
123 sed -e "s:%LOCALSTATEDIR%:${localstatedir}:g" -i ${SERVICE_FILE}
124 sed -e "s:%USER%:${USER}:g" -i ${SERVICE_FILE}
125 sed -e "s:%GROUP%:${GROUP}:g" -i ${SERVICE_FILE}
126 done
123 127
124pkg_postinst_${SRCNAME}-setup () { 128 # Setup the glance initialization script
125 if [ -z "$D" ]; then 129 INIT_FILE=${GLANCE_CONF_DIR}/glance-init
126 # This is to make sure postgres is configured and running 130 install -o root -g ${USER} -m 750 ${WORKDIR}/glance-init ${INIT_FILE}
127 if ! pidof postmaster > /dev/null; then 131 sed -e "s:%DB_USER%:${DB_USER}:g" -i ${INIT_FILE}
128 /etc/init.d/postgresql-init 132 sed -e "s:%GLANCE_USER%:${USER}:g" -i ${INIT_FILE}
129 /etc/init.d/postgresql start 133 sed -e "s:%GLANCE_GROUP%:${GROUP}:g" -i ${INIT_FILE}
130 sleep 5 134 sed -e "s:%CONTROLLER_IP%:${CONTROLLER_IP}:g" -i ${INIT_FILE}
131 fi 135 sed -e "s:%ADMIN_USER%:${ADMIN_USER}:g" -i ${INIT_FILE}
132 136 sed -e "s:%ADMIN_PASSWORD%:${ADMIN_PASSWORD}:g" -i ${INIT_FILE}
133 mkdir /var/log/glance 137 sed -e "s:%ADMIN_ROLE%:${ADMIN_ROLE}:g" -i ${INIT_FILE}
134 sudo -u postgres createdb glance 138 sed -e "s:%SYSCONFDIR%:${sysconfdir}:g" -i ${INIT_FILE}
135 glance-manage db_sync
136 fi
137} 139}
138 140
139PACKAGES += " ${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-setup ${SRCNAME}-api ${SRCNAME}-registry" 141PACKAGES += " ${SRCNAME} ${SRCNAME}-setup ${SRCNAME}-api ${SRCNAME}-registry"
140ALLOW_EMPTY_${SRCNAME}-setup = "1"
141ALLOW_EMPTY_${SRCNAME}-registry = "1"
142ALLOW_EMPTY_${SRCNAME}-api = "1"
143 142
144FILES_${PN} = " \ 143FILES_${PN} = " \
145 ${libdir}/* \ 144 ${libdir}/* \
146 ${datadir}/etc/${SRCNAME}* \ 145 ${datadir}/etc/${SRCNAME}* \
147 " 146 "
148 147
149FILES_${SRCNAME}-tests = "${sysconfdir}/${SRCNAME}/run_tests.sh"
150
151FILES_${SRCNAME} = "${bindir}/* \ 148FILES_${SRCNAME} = "${bindir}/* \
152 ${sysconfdir}/${SRCNAME}/* \ 149 ${sysconfdir}/${SRCNAME}/* \
153 ${localstatedir}/* \ 150 ${localstatedir}/* \
154 " 151 "
155 152
156FILES_${SRCNAME}-api = "${bindir}/glance-api \ 153FILES_${SRCNAME}-setup = " \
157 ${sysconfdir}/init.d/glance-api \ 154 ${systemd_unitdir}/system/glance-init.service \
155 "
156
157FILES_${SRCNAME}-api = " \
158 ${bindir}/glance-api \
159 ${systemd_unitdir}/system/glance-api.service \
158 " 160 "
159 161
160FILES_${SRCNAME}-registry = "${bindir}/glance-registry \ 162FILES_${SRCNAME}-registry = "\
161 ${sysconfdir}/init.d/glance-registry \ 163 ${bindir}/glance-registry \
164 ${systemd_unitdir}/system/glance-registry.service \
162 " 165 "
163 166
164DEPENDS += " \ 167DEPENDS += " \
@@ -166,68 +169,66 @@ DEPENDS += " \
166 python-pbr \ 169 python-pbr \
167 " 170 "
168 171
169RDEPENDS_${PN} += "python-greenlet \ 172RDEPENDS_${PN} += " \
170 python-sqlalchemy \ 173 coreutils \
171 python-anyjson \ 174 python-pbr \
172 python-eventlet \ 175 python-sqlalchemy \
173 python-pastedeploy \ 176 python-eventlet \
174 python-routes \ 177 python-pastedeploy \
175 python-webob \ 178 python-routes \
176 python-boto \ 179 python-webob \
177 python-sqlalchemy-migrate \ 180 python-sqlalchemy-migrate \
178 python-httplib2 \ 181 python-sqlparse \
179 python-kombu \ 182 python-alembic \
180 python-iso8601 \ 183 python-httplib2 \
181 python-oslo.config \ 184 python-oslo.config \
182 python-pip \
183 python-lxml \
184 python-paste \
185 python-pycrypto \
186 python-jsonschema \
187 python-keystoneclient \
188 python-swiftclient \
189 python-pbr \
190 python-i18n \
191 python-oslo.i18n \
192 python-osprofiler \
193 python-retrying \
194 python-glancestore \
195 python-enum34 \
196 python-semantic-version \
197 python-oslo.vmware \
198 python-oslo.concurrency \ 185 python-oslo.concurrency \
199 python-oslo.context \ 186 python-oslo.context \
200 python-oslo.service \
201 python-oslo.utils \ 187 python-oslo.utils \
202 python-stevedore \ 188 python-stevedore \
203 python-futurist \ 189 python-futurist \
204 python-taskflow \ 190 python-taskflow \
191 python-keystoneauth1 \
205 python-keystonemiddleware \ 192 python-keystonemiddleware \
206 python-wsme \ 193 python-wsme \
194 python-prettytable \
195 python-paste \
196 python-jsonschema \
197 python-keystoneclient \
207 python-pyopenssl \ 198 python-pyopenssl \
208 python-six \ 199 python-six \
209 python-oslo.db \ 200 python-oslo.db \
201 python-oslo.i18n \
210 python-oslo.log \ 202 python-oslo.log \
211 python-oslo.messaging \ 203 python-oslo.messaging \
212 python-oslo.middleware \ 204 python-oslo.middleware \
213 python-oslo.policy \ 205 python-oslo.policy \
214 python-oslo.serialization \ 206 python-retrying \
215 python-castellan \ 207 python-osprofiler \
208 python-glance-store \
209 python-debtcollector \
216 python-cryptography \ 210 python-cryptography \
217 " 211 python-cursive \
212 python-iso8601 \
213 python-monotonic \
214 "
215
216RDEPENDS_${SRCNAME} = " \
217 ${PN} \
218 postgresql \
219 postgresql-client \
220 python-psycopg2 \
221 "
218 222
219RDEPENDS_${SRCNAME} = "${PN} \
220 postgresql postgresql-client python-psycopg2"
221RDEPENDS_${SRCNAME}-api = "${SRCNAME}" 223RDEPENDS_${SRCNAME}-api = "${SRCNAME}"
222RDEPENDS_${SRCNAME}-registry = "${SRCNAME}" 224RDEPENDS_${SRCNAME}-registry = "${SRCNAME}"
223RDEPENDS_${SRCNAME}-setup = "postgresql sudo ${SRCNAME}" 225RDEPENDS_${SRCNAME}-setup = "postgresql-setup keystone-setup sudo ${SRCNAME}"
224RDEPENDS_${SRCNAME}-tests = "python-psutil qpid-python bash" 226RDEPENDS_${SRCNAME}-tests = "python-psutil qpid-python bash"
225 227
226INITSCRIPT_PACKAGES = "${SRCNAME}-api ${SRCNAME}-registry" 228SYSTEMD_PACKAGES = "${SRCNAME}-api ${SRCNAME}-registry ${SRCNAME}-setup"
227INITSCRIPT_NAME_${SRCNAME}-api = "glance-api" 229SYSTEMD_SERVICE_${SRCNAME}-api = "glance-api.service"
228INITSCRIPT_PARAMS_${SRCNAME}-api = "${OS_DEFAULT_INITSCRIPT_PARAMS}" 230SYSTEMD_SERVICE_${SRCNAME}-registry = "glance-registry.service"
229INITSCRIPT_NAME_${SRCNAME}-registry = "glance-registry" 231SYSTEMD_SERVICE_${SRCNAME}-setup = "glance-init.service"
230INITSCRIPT_PARAMS_${SRCNAME}-registry = "${OS_DEFAULT_INITSCRIPT_PARAMS}"
231 232
232MONITOR_SERVICE_PACKAGES = "${SRCNAME}" 233MONITOR_SERVICE_PACKAGES = "${SRCNAME}"
233MONITOR_SERVICE_${SRCNAME} = "glance" 234MONITOR_SERVICE_${SRCNAME} = "glance"