Merge "Add test case description and modify task file for TC042"
[yardstick.git] / tools / yardstick-img-dpdk-finalize.sh
1 #!/bin/bash
2
3 # installs dpdk and pktgen packages on modified image
4
5 # PREREQUISITES
6 # modified image (yardstick-wily-server) must be uploaded to OpenStack
7 # heat must be installed: apt-get install python-heatclient, python-glanceclient, python-nova
8 # must have a public yardstick-key uploaded in openstack
9 # must have a proper flavor for the image (i.e. m1.small)
10
11
12 stackname="yardstick-modify-stack"
13 template=dpdk_install.yml
14 new_image_name="yardstick-image-pktgen-ready"
15
16 openstack stack create $stackname -f yaml -t $template
17 progress="WARMING_UP"
18
19 while [ "$progress" != "CREATE_COMPLETE" ]
20 do
21   sleep 10
22   echo "check stack status......."
23   show_output=$(openstack stack show $stackname)
24   progress=$(echo $show_output | sed 's/^.*stack_status . \([^ ]*\).*$/\1/')
25   echo "$progress"
26   if [ "$progress" == "CREATE_FAILED" ];then
27     echo "create $stackname failed"
28     exit 1
29   fi
30 done
31
32 # workaround: Without wait time, the file size of pktgen is zero in the snapshot.
33 sleep 60
34
35 status=$(nova image-create --poll $stackname $new_image_name)
36 if [[ "$status" =~ "Finished" ]];then
37   echo "$new_image_name finished"
38 fi
39
40 nova delete $stackname
41 sleep 10
42 openstack stack delete --yes $stackname