-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathvalidateResize.sh
executable file
·107 lines (98 loc) · 4.07 KB
/
validateResize.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash -xe
# Copyright (C) 2020 David Vallee Delisle <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#### Description:
#
# Validates server resize functionality
#
# This was written based on Red Hat OpenStack Platforn 16.1 (Train)
# Make sure you edit the variables at the top
#
#### Usage:
# stack@undercloud $ . overcloudrc
# stack@undercloud $ ./validate_resize.sh
#
set -ex
# We need to adjust to create the ports if we want to try SR-IOV
NET_NAME=admin-tenant-overlay
AZ=ess-az1
SSH_KEY=ess-key
IMAGE_NAME=cirros
IMAGE_FOLDER=${HOME}/images
CIRROS_FILE=cirros-0.3.0-x86_64-disk.img
function get_xmldump() {
dump_label=$1
for v in ess-require ess-isolate;do
HV=$(openstack server show -f value -c OS-EXT-SRV-ATTR:host $v | sed 's/.ess.int.redhat.com//')
INSTANCE=$(openstack server show -f value -c OS-EXT-SRV-ATTR:instance_name $v);ssh $HV "sudo podman exec -u0 -ti nova_libvirt virsh dumpxml $INSTANCE" > ${v}-${dump_label}.xml
done
}
if ! openstack image show $IMAGE_NAME; then
mkdir -p $IMAGE_FOLDER
curl --ipv4 -o ${IMAGE_FOLDER}/$CIRROS_FILE "https://launchpad.net/cirros/trunk/0.3.0/+download/$CIRROS_FILE"
openstack image create --file ${IMAGE_FOLDER}/$CIRROS_FILE --unprotected --public --disk-format qcow2 $IMAGE_NAME
fi
if ! openstack keypair show $SSH_KEY; then
openstack keypair create --private-key ${SSH_KEY}.key ${SSH_KEY}
fi
if ! openstack flavor show ess-small; then
openstack flavor create ess-small --ram 4096 --disk 10 --vcpus 2
fi
if ! openstack flavor show ess-small-isolate; then
openstack flavor create ess-small-isolate --ram 4096 --disk 10 --vcpus 2
openstack flavor set --property hw:cpu_policy=dedicated --property hw:cpu_thread_policy=isolate ess-small-isolate
fi
if ! openstack flavor show ess-small-require; then
openstack flavor create ess-small-require --ram 4096 --disk 10 --vcpus 2
openstack flavor set --property hw:cpu_policy=dedicated --property hw:cpu_thread_policy=require ess-small-require
fi
if openstack server show ess-isolate; then
openstack server delete ess-isolate
fi
if openstack server show ess-require; then
openstack server delete ess-require
fi
openstack server create --image $IMAGE_NAME \
--flavor ess-small-isolate \
--nic net-id=$NET_NAME \
--availability-zone $AZ \
--key-name $SSH_KEY \
ess-isolate \
--wait
openstack server create --image $IMAGE_NAME \
--flavor ess-small-require \
--nic net-id=$NET_NAME \
--availability-zone $AZ \
--key-name $SSH_KEY \
ess-require \
--wait
get_xmldump original
openstack server resize --flavor ess-small-require ess-isolate --wait
openstack server resize confirm ess-isolate
openstack server resize --flavor ess-small-isolate ess-require --wait
openstack server resize confirm ess-require
get_xmldump first_swap
openstack server resize --flavor ess-small ess-isolate --wait
openstack server resize confirm ess-isolate
openstack server resize --flavor ess-small ess-require --wait
openstack server resize confirm ess-require
get_xmldump second_swap
for context in first_swap second_swap; do
echo -e "---------------------------------------\nDiff between original and $context\n---------------------------------------\n"
for v in ess-require ess-isolate; do
diff ${v}-original.xml ${v}-${context}.xml
done
done