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
22 OUTPUT_FILE=/tmp/output-qemu.log
26 echo "Execution of Live Migration"
28 echo "info status" | nc -U $src
30 echo "migrate_set_speed 0" | nc -U $src
31 # set the expected max downtime
32 echo "migrate_set_downtime ${max_down_time}" | nc -U $src
33 # start live migration
34 echo "migrate -d tcp:${dst_ip}:${migrate_to_port}" | nc -U $src
35 # wait until live migration completed
37 while [ "${status}" == "" ]
39 status=`echo "info migrate" | nc -U $src |grep completed | cut -d: -f2`
44 echo "End of Live Migration"
50 echo "Checking status of Migration"
51 # print detail information
52 echo "info migrate" | nc -U $src
53 echo "quit" | nc -U $src
54 echo "quit" | nc -U $dst
56 echo "Migration executed successfully"
62 totaltime=$(grep "total time" $OUTPUT_FILE | cut -d' ' -f3)
63 downtime=$(grep "downtime" $OUTPUT_FILE | cut -d' ' -f2)
64 setuptime=$(grep "setup" $OUTPUT_FILE | cut -d' ' -f2)
66 \"totaltime\":\"$totaltime\", \
67 \"downtime\":\"$downtime\", \
68 \"setuptime\":\"$setuptime\" \
75 # Perform LiveMigration
78 # LiveMigration Status
81 # LiveMigration JSON output