forked from docc-lab/openstack-build-ubuntu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-images-x86_64.sh
executable file
·83 lines (68 loc) · 2.15 KB
/
setup-images-x86_64.sh
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/sh
##
## Download and configure the default x86_64 images.
##
set -x
DIRNAME=`dirname $0`
# Gotta know the rules!
if [ $EUID -ne 0 ] ; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Grab our libs
. "$DIRNAME/setup-lib.sh"
if [ "$HOSTNAME" != "$CONTROLLER" ]; then
exit 0;
fi
logtstart "images-x86_64"
if [ -f $SETTINGS ]; then
. $SETTINGS
fi
cd $IMAGEDIR
echo "*** Configuring a xenial-server x86_64 image ..."
imgfile=xenial-server-cloudimg-amd64-disk1.img
imgname=xenial-server
#
# First try the local boss, then Apt, then just grab from Ubuntu.
#
imgfile=`get_url "http://boss.${OURDOMAIN}/downloads/openstack/$imgfile http://boss.apt.emulab.net/downloads/openstack/$imgfile https://cloud-images.ubuntu.com/xenial/current/$imgfile"`
if [ ! $? -eq 0 ]; then
echo "ERROR: failed to download $imgfile from Cloudlab or Ubuntu!"
else
old="$imgfile"
imgfile=`extract_image "$imgfile"`
if [ ! $? -eq 0 ]; then
echo "ERROR: failed to extract $old"
else
(fixup_image "$imgfile" \
&& sched_image "$IMAGEDIR/$imgfile" "$imgname" ) \
|| echo "ERROR: could not configure default VM image $imgfile !"
fi
fi
#
# Setup the Manila service image so that Manila works out of the box.
#
echo "*** Configuring the manila-service-image image ..."
imgfile=manila-service-image-master.qcow2
imgname=manila-service-image
imgfile=`get_url "http://boss.${OURDOMAIN}/downloads/openstack/$imgfile http://boss.apt.emulab.net/downloads/openstack/$imgfile http://tarballs.openstack.org/manila-image-elements/images/$imgfile"`
if [ ! $? -eq 0 ]; then
echo "ERROR: failed to download $imgfile from Cloudlab or Ubuntu!"
else
old="$imgfile"
imgfile=`extract_image "$imgfile"`
if [ ! $? -eq 0 ]; then
echo "ERROR: failed to extract $old"
else
(fixup_image "$imgfile" \
&& sched_image "$IMAGEDIR/$imgfile" "$imgname" ) \
|| echo "ERROR: could not configure default VM image $imgfile !"
fi
fi
# glance image-create --name manila-service-image --file $imgfile \
# --disk-format qcow2 --container-format bare --progress \
# --visibility public
#
# NB: do not exit; we are included!
#
logtend "images-x86_64"