File: oci-manila-image

package info (click to toggle)
openstack-cluster-installer 43.0.22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,544 kB
  • sloc: php: 19,169; sh: 18,137; ruby: 75; makefile: 31; xml: 8
file content (31 lines) | stat: -rwxr-xr-x 893 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh

set -e
set -x

MANILA_IMAGE_NAME=manila-service-image

if ls debian*manila*-amd64.qcow2 2>/dev/null ; then
	MANILA_IMAGE=$(ls debian*manila*-amd64.qcow2)
elif ls debian*manila*-amd64.raw 2>/dev/null ; then
	MANILA_IMAGE=$(ls debian*manila*-amd64.raw)
else
	echo "Cannot find Manila image"
	exit 1
fi

if echo ${MANILA_IMAGE} | grep -q qcow2 2>/dev/null ; then
	MANILA_IMAGE_FORMAT=qcow2
else
	MANILA_IMAGE_FORMAT=raw
fi

### Upload the image if it isn't present in Glance
. /root/oci-openrc

MANILA_IMAGE_ID=$(openstack image list --name ${MANILA_IMAGE_NAME} -f value -c ID 2>/dev/null | head -n 1)
if [ -z "${MANILA_IMAGE_ID}" ] ; then
	openstack image create --container-format bare --disk-format ${MANILA_IMAGE_FORMAT} --file "${MANILA_IMAGE}" "${MANILA_IMAGE_NAME}"
	MANILA_IMAGE_ID=$(openstack image list --name ${MANILA_IMAGE_NAME} -f value -c ID 2>/dev/null | head -n 1)
fi