@@ -31,11 +31,11 @@ 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" }
34
35
JOURNAL_DIR=/var/log/journal
35
- VGPU_TEST_LOG_DIR =${VGPU_TEST_LOG_DIR :- " /opt/stack/workspace/test_vgpu/logs" }
36
+ OPENSTACK_LOGS =${OPENSTACK_LOGS :- " /opt/stack/workspace/test_vgpu/logs" }
36
37
TMP_LOG_DIR=/tmp/openstack
37
38
38
-
39
39
SLEEP_TIME_GAP=3
40
40
SLEEP_MAX_TRIES=40
41
41
@@ -56,17 +56,42 @@ on_exit()
56
56
do
57
57
sudo journalctl --unit $service > $TMP_LOG_DIR /$service " .log" ;
58
58
done
59
- cp $TMP_LOG_DIR /* $VGPU_TEST_LOG_DIR /
59
+ cp $TMP_LOG_DIR /* $OPENSTACK_LOGS /
60
60
echo " ###################Clean environment if requested#####################"
61
61
if [ $keep_env != " true" ]; then
62
62
pushd $DEVSTACK_PATH /
63
63
nova delete $VM_NAME
64
+ openstack image delete $SNAPSHOT_NAME
64
65
./clean.sh
65
66
popd
67
+ rm $DEVSTACK_PATH -rf
68
+
66
69
fi
67
70
set +x
68
71
}
69
72
73
+ until_vm_active ()
74
+ {
75
+ count=0
76
+ vm_name = $1
77
+ while :
78
+ do
79
+ echo " Waitting to VM active"
80
+ sleep $SLEEP_TIME_GAP
81
+ count=$(( count + 1 ))
82
+ vm_state=$( nova show $vm_name | grep -w ' status' | awk ' {print $4}' )
83
+ if [ $vm_state = " ERROR" ]; then
84
+ error_log=$error_log " \n\tVM create failed"
85
+ exit 1
86
+ elif [ $vm_state = " ACTIVE" ]; then
87
+ break
88
+ elif [ $count -gt $SLEEP_MAX_TRIES ]; then
89
+ error_log=$error_log " \n\tVM can not reach active status"
90
+ exit 1
91
+ fi
92
+ done
93
+ }
94
+
70
95
trap on_exit EXIT
71
96
72
97
error_log=" VGPU test failed with the following errors: "
@@ -77,6 +102,15 @@ _SSH_OPTIONS="\
77
102
-o UserKnownHostsFile=/dev/null \
78
103
-i /opt/stack/.ssh/id_rsa"
79
104
105
+ pushd $ROOT_DIR
106
+ rm $DEVSTACK_PATH -rf
107
+ git clone https://github.com/openstack-dev/devstack.git
108
+
109
+ sed -i ' /iniset $NOVA_CONF DEFAULT flat_injected \"False\"/a\ iniset $NOVA_CONF xenserver image_handler "$vdi_remote_stream"' $DEVSTACK_PATH /lib/nova_plugins/hypervisor-xenserver
110
+ popd
111
+
112
+ cp $ROOT_DIR /local.conf $DEVSTACK_PATH
113
+
80
114
DOM0_IP=$( grep XENAPI_CONNECTION_URL ${DEVSTACK_PATH} /local.conf | cut -d' =' -f2 | sed ' s/[^0-9,.]*//g' )
81
115
82
116
echo " Dom0 IP is: $DOM0_IP "
@@ -155,14 +189,18 @@ done
155
189
END_OF_REQ_VGPU_TYPE
156
190
)
157
191
158
- echo " ###################Devstack start stack#####################"
159
192
pushd $DEVSTACK_PATH /
160
193
if ! grep " enabled_vgpu_types=" ${DEVSTACK_PATH} /local.conf; then
161
194
echo " [devices]" >> ${DEVSTACK_PATH} /local.conf
162
195
echo " enabled_vgpu_types = $first_vgpu_type " >> ${DEVSTACK_PATH} /local.conf
163
196
fi
197
+ echo " ###################Set image handler to remote stream#####################"
198
+ echo " [xenserver]" >> ${DEVSTACK_PATH} /local.conf
199
+ echo " image_handler = vdi_remote_stream" >> ${DEVSTACK_PATH} /local.conf
200
+
164
201
sudo find $JOURNAL_DIR -name " *.journal" -exec rm {} \;
165
202
sudo systemctl restart systemd-journald
203
+ echo " ###################Devstack start stack#####################"
166
204
./stack.sh
167
205
popd
168
206
@@ -182,23 +220,7 @@ prv_net=$(openstack network list | grep "private" | awk '{print $2}')
182
220
nova boot --image $IMAGE_NAME --flavor 1 --nic net-id=$prv_net $VM_NAME
183
221
184
222
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
223
+ until_vm_active $VM_NAME
202
224
203
225
echo " ###################Check VGPU create status#####################"
204
226
if [ $vm_state = " ACTIVE" ]; then
@@ -215,10 +237,22 @@ END_OF_VGPU_CONFIRM
215
237
fi
216
238
217
239
if [ -n " $result " ]; then
218
- echo " VGPU create success"
240
+ echo $VGPU_CREATE_SUCCESS_FLAG
241
+ echo " ###################Check LVM image upload status#####################"
242
+ nova image-create --poll $VM_NAME $SNAPSHOT_NAME
243
+ if ! openstack image show $SNAPSHOT_NAME ; then
244
+ error_log=$error_log " \n\tImage create failed!"
245
+ echo $error_log
246
+ exit 1
247
+ fi
248
+ nova boot --image $SNAPSHOT_NAME --flavor 1 --nic net-id=$prv_net $VM_NAME
249
+ until_vm_active $VM_NAME
219
250
else
220
- error_log=$error_log " \n\tVGPU create failed"
251
+ error_log=$error_log " \n\tVGPU create failed! "
221
252
echo $error_log
253
+ exit 1
222
254
fi
223
255
256
+
257
+
224
258
set +ex
0 commit comments