diff options
author | 2017-07-31 06:10:06 +0000 | |
---|---|---|
committer | 2017-07-31 06:10:06 +0000 | |
commit | 54f26bfe1cb139545ab86450342c6a7ab520dd83 (patch) | |
tree | 8a41b5ada71df4cdc9902b5ed0ea9307f1e89250 /yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash | |
parent | 5abe4fe013a14c528bfb1e0ff4c8bcb9b8817551 (diff) | |
parent | a9d81a2bd9c3826e000d99be67a7a726278e3d46 (diff) |
Merge "Testing live migration using qemu"
Diffstat (limited to 'yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash')
-rw-r--r-- | yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash b/yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash new file mode 100644 index 000000000..552098103 --- /dev/null +++ b/yardstick/benchmark/scenarios/compute/qemu_migrate_benchmark.bash @@ -0,0 +1,68 @@ +#!/bin/bash + +############################################################################# +#Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +set -e + +# Commandline arguments + +src=$2 +dst_ip=$4 +migrate_to_port=$5 +max_down_time=$6 + +OUTPUT_FILE=/tmp/output-qemu.log + +do_migrate() +{ +# local src=`echo $OPTIONS | cut -d ':' -f 2 | cut -d ',' -f 1` + echo "info status" | nc -U $src + # with no speed limit + echo "migrate_set_speed 0" |nc -U $src + # set the expected max downtime + echo "migrate_set_downtime ${max_down_time}" |nc -U $src + # start live migration + echo "migrate -d tcp:${dst_ip}:$migrate_to_port" |nc -U $src + # wait until live migration completed + status="" + while [ "${status}" == "" ] + do + status=`echo "info migrate" | nc -U $src |grep completed | cut -d: -f2` + echo ${status} + sleep 1; + done +} >/dev/null + +output_qemu() +{ + # print detail information + echo "info migrate" | nc -U $src + echo "quit" | nc -U $src + sleep 5 + +} > $OUTPUT_FILE + +output_json() +{ +totaltime=$(grep "total time" $OUTPUT_FILE | cut -d' ' -f3) +downtime=$(grep "downtime" $OUTPUT_FILE | cut -d' ' -f2) +setuptime=$(grep "setup" $OUTPUT_FILE | cut -d' ' -f2) +echo -e "{ \ + \"totaltime\":\"$totaltime\", \ + \"downtime\":\"$downtime\", \ + \"setuptime\":\"$setuptime\" \ + }" +} +# main entry +main() +{ + do_migrate +} +main |