-
Notifications
You must be signed in to change notification settings - Fork 1
/
ds-amphora-image-update
executable file
·99 lines (82 loc) · 2 KB
/
ds-amphora-image-update
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/sh
set -xe
#export DIB_HAPROXY_SOURCE_OCTAVIA_HAPROXY_VERSION=2.1.7
#default_args="-b haproxy-source"
export DIB_OCTAVIA_AMP_USE_NFTABLES=True
branch=
while [ $# -gt 0 ]; do
case $1 in
-b)
branch=$2
shift 2
;;
*)
break
;;
esac
done
export DIB_REPOLOCATION_octavia_lib=/mnt/host/octavia-lib
export DIB_REPOREF_octavia_lib=${branch:-master}
name=$1
shift 1
extra_args="$*"
case "$name" in
xenial)
args="-i ubuntu -d xenial"
;;
bionic)
args="-i ubuntu -d bionic -s 3"
name=ubuntu
;;
ubuntu|focal)
args="-i ubuntu -d focal -s 3"
name=ubuntu
;;
fedora)
args="-i fedora -s 3"
;;
rhel)
args="-i rhel -d 8 -p -s 3"
export DIB_LOCAL_IMAGE=/mnt/host/rhel-guest-image-8.1-109.x86_64.qcow2
;;
centos7)
args="-i centos -d 7 -s 3"
;;
source)
args="-i centos -d 8-stream -s 3 -b haproxy-source"
;;
centos8)
args="-i centos -d 8-stream -s 3"
name=centos9
;;
centos|*)
args="-i centos -d 9-stream -s 3"
name=centos-stream
;;
esac
cd /opt/stack/octavia/diskimage-create
export DIB_REPOLOCATION_amphora_agent=/opt/stack/octavia
if [ -z "$branch" ]; then
export DIB_REPOREF_amphora_agent=$(git symbolic-ref --short HEAD)
else
args="$args -g ${branch}"
export DIB_REPOREF_amphora_agent=$branch
fi
./diskimage-create.sh $default_args $args $extra_args -r root
image_name=amphora-$name
old_amphora_ids=$(openstack image list -f value -c ID --tag amphora || true)
old_id=$(openstack image show -f value -c id $image_name || true)
openstack image create \
--tag amphora \
--project admin \
--disk-format qcow2 \
--container-format bare \
--file amphora-x64-haproxy.qcow2 \
--property hw_rng_model=virtio \
$image_name
for id in $old_amphora_ids; do
openstack image unset --tag amphora $id
done
if [ -n "$old_id" ]; then
openstack image delete $old_id
fi