@@ -31,11 +31,12 @@ TEMPEST_DIR=$DEST/tempest
31
31
NOVA_CONF=/etc/nova/nova.conf
32
32
IMAGE_NAME=${IMAGE_NAME:- " cirros-0.3.5-x86_64-disk" }
33
33
VM_NAME=${VM_NAME:- " testVM" }
34
+ SNAPSHOT_NAME=${SNAPSHOT_NAME:- " testSnapshot" }
35
+ SNAPSHOT_VM_NAME=${SNAPSHOT_VM_NAME:- " testSnapshot_VM" }
34
36
JOURNAL_DIR=/var/log/journal
35
- VGPU_TEST_LOG_DIR =${VGPU_TEST_LOG_DIR :- " /opt/stack/workspace/test_vgpu/logs" }
37
+ OPENSTACK_LOGS =${OPENSTACK_LOGS :- " /opt/stack/workspace/test_vgpu/logs" }
36
38
TMP_LOG_DIR=/tmp/openstack
37
39
38
-
39
40
SLEEP_TIME_GAP=3
40
41
SLEEP_MAX_TRIES=40
41
42
@@ -56,17 +57,42 @@ on_exit()
56
57
do
57
58
sudo journalctl --unit $service > $TMP_LOG_DIR /$service " .log" ;
58
59
done
59
- cp $TMP_LOG_DIR /* $VGPU_TEST_LOG_DIR /
60
+ cp $TMP_LOG_DIR /* $OPENSTACK_LOGS /
60
61
echo " ###################Clean environment if requested#####################"
61
62
if [ $keep_env != " true" ]; then
62
63
pushd $DEVSTACK_PATH /
63
- nova delete $VM_NAME
64
+ nova delete $VM_NAME $SNAPSHOT_VM_NAME
65
+ openstack image delete $SNAPSHOT_NAME
64
66
./clean.sh
65
67
popd
68
+ rm $DEVSTACK_PATH -rf
69
+
66
70
fi
67
71
set +x
68
72
}
69
73
74
+ waiting_vm_active ()
75
+ {
76
+ count=0
77
+ vm_name=$1
78
+ while :
79
+ do
80
+ echo " Waitting to VM active"
81
+ sleep $SLEEP_TIME_GAP
82
+ count=$(( count + 1 ))
83
+ vm_state=$( nova show $vm_name | grep -w ' status' | awk ' {print $4}' )
84
+ if [ $vm_state = " ERROR" ]; then
85
+ error_log=$error_log " \n\tVM create failed"
86
+ exit 1
87
+ elif [ $vm_state = " ACTIVE" ]; then
88
+ break
89
+ elif [ $count -gt $SLEEP_MAX_TRIES ]; then
90
+ error_log=$error_log " \n\tVM can not reach active status"
91
+ exit 1
92
+ fi
93
+ done
94
+ }
95
+
70
96
trap on_exit EXIT
71
97
72
98
error_log=" VGPU test failed with the following errors: "
@@ -77,6 +103,13 @@ _SSH_OPTIONS="\
77
103
-o UserKnownHostsFile=/dev/null \
78
104
-i /opt/stack/.ssh/id_rsa"
79
105
106
+ pushd $ROOT_DIR
107
+ rm $DEVSTACK_PATH -rf
108
+ git clone https://github.com/openstack-dev/devstack.git
109
+ popd
110
+
111
+ cp $ROOT_DIR /local.conf $DEVSTACK_PATH
112
+
80
113
DOM0_IP=$( grep XENAPI_CONNECTION_URL ${DEVSTACK_PATH} /local.conf | cut -d' =' -f2 | sed ' s/[^0-9,.]*//g' )
81
114
82
115
echo " Dom0 IP is: $DOM0_IP "
@@ -107,16 +140,21 @@ echo "###################Update openstack repositories#####################"
107
140
PROJECT_LIST=$( echo $ZUUL_CHANGES | tr ' ^' ' \n' | cut -d: -f1 | cut -d/ -f2 | sort | uniq)
108
141
109
142
pushd ${DEST}
143
+
144
+ # remove requirements folder because it contains run time modifications
145
+ rm requirements -rf
146
+
110
147
for dir in ${DEST} /*
111
148
do
112
149
if [ -d " ${dir} " ] ; then
113
150
echo " check ${dir} "
114
151
pushd ${dir}
115
152
if [ -d .git ]; then
116
153
echo " update repository ${dir} "
117
- git checkout master
118
- if ! git diff-index --quiet HEAD --; then
119
- git checkout *
154
+ cur_branch=$( git branch | grep \* | cut -d ' ' -f2)
155
+ if [ $cur_branch != ' master' ]; then
156
+ git checkout master
157
+ git branch -D $cur_branch
120
158
fi
121
159
git pull --ff origin master
122
160
@@ -155,14 +193,20 @@ done
155
193
END_OF_REQ_VGPU_TYPE
156
194
)
157
195
158
- echo " ###################Devstack start stack#####################"
159
196
pushd $DEVSTACK_PATH /
160
197
if ! grep " enabled_vgpu_types=" ${DEVSTACK_PATH} /local.conf; then
161
198
echo " [devices]" >> ${DEVSTACK_PATH} /local.conf
162
199
echo " enabled_vgpu_types = $first_vgpu_type " >> ${DEVSTACK_PATH} /local.conf
163
200
fi
201
+ echo " ###################Set image handler to remote stream#####################"
202
+ if ! grep " image_handler = vdi_remote_stream" ${DEVSTACK_PATH} /local.conf; then
203
+ echo " [xenserver]" >> ${DEVSTACK_PATH} /local.conf
204
+ echo " image_handler = vdi_remote_stream" >> ${DEVSTACK_PATH} /local.conf
205
+ fi
206
+
164
207
sudo find $JOURNAL_DIR -name " *.journal" -exec rm {} \;
165
208
sudo systemctl restart systemd-journald
209
+ echo " ###################Devstack start stack#####################"
166
210
./stack.sh
167
211
popd
168
212
@@ -182,23 +226,7 @@ prv_net=$(openstack network list | grep "private" | awk '{print $2}')
182
226
nova boot --image $IMAGE_NAME --flavor 1 --nic net-id=$prv_net $VM_NAME
183
227
184
228
nova_vm_id=$( nova show $VM_NAME | grep -w ' id' | awk ' {print $4}' )
185
- count=0
186
- while :
187
- do
188
- echo " Waitting to VM active"
189
- sleep $SLEEP_TIME_GAP
190
- count=$(( count + 1 ))
191
- vm_state=$( nova show $VM_NAME | grep -w ' status' | awk ' {print $4}' )
192
- if [ $vm_state = " ERROR" ]; then
193
- error_log=$error_log " \n\tVM create failed"
194
- break
195
- elif [ $vm_state = " ACTIVE" ]; then
196
- break
197
- elif [ $count -gt $SLEEP_MAX_TRIES ]; then
198
- error_log=$error_log " \n\tVM can not reach active status"
199
- break
200
- fi
201
- done
229
+ waiting_vm_active $VM_NAME
202
230
203
231
echo " ###################Check VGPU create status#####################"
204
232
if [ $vm_state = " ACTIVE" ]; then
@@ -215,10 +243,22 @@ END_OF_VGPU_CONFIRM
215
243
fi
216
244
217
245
if [ -n " $result " ]; then
218
- echo " VGPU create success"
246
+ echo $VGPU_CREATE_SUCCESS_FLAG
247
+ echo " ###################Check LVM image upload status#####################"
248
+ nova image-create --poll $VM_NAME $SNAPSHOT_NAME
249
+ if ! openstack image show $SNAPSHOT_NAME ; then
250
+ error_log=$error_log " \n\tImage create failed!"
251
+ echo $error_log
252
+ exit 1
253
+ fi
254
+ nova boot --image $SNAPSHOT_NAME --flavor 1 --nic net-id=$prv_net $SNAPSHOT_VM_NAME
255
+ waiting_vm_active $SNAPSHOT_VM_NAME
219
256
else
220
- error_log=$error_log " \n\tVGPU create failed"
257
+ error_log=$error_log " \n\tVGPU create failed! "
221
258
echo $error_log
259
+ exit 1
222
260
fi
223
261
262
+
263
+
224
264
set +ex
0 commit comments