3 #############################################################################
4 #Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
14 # Commandline arguments
21 OUTPUT_FILE=/tmp/output-qemu.log
25 # local src=`echo $OPTIONS | cut -d ':' -f 2 | cut -d ',' -f 1`
26 echo "info status" | nc -U $src
28 echo "migrate_set_speed 0" |nc -U $src
29 # set the expected max downtime
30 echo "migrate_set_downtime ${max_down_time}" |nc -U $src
31 # start live migration
32 echo "migrate -d tcp:${dst_ip}:$migrate_to_port" |nc -U $src
33 # wait until live migration completed
35 while [ "${status}" == "" ]
37 status=`echo "info migrate" | nc -U $src |grep completed | cut -d: -f2`
45 # print detail information
46 echo "info migrate" | nc -U $src
47 echo "quit" | nc -U $src
54 totaltime=$(grep "total time" $OUTPUT_FILE | cut -d' ' -f3)
55 downtime=$(grep "downtime" $OUTPUT_FILE | cut -d' ' -f2)
56 setuptime=$(grep "setup" $OUTPUT_FILE | cut -d' ' -f2)
58 \"totaltime\":\"$totaltime\", \
59 \"downtime\":\"$downtime\", \
60 \"setuptime\":\"$setuptime\" \