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
24 echo "To check the parameters:"
27 echo "DST_IP: $dst_ip"
28 echo "MIGRATE_PORT: $migrate_to_port"
29 echo "DOWN_TIME: $max_down_time"
33 echo "Execution of Live Migration"
35 echo "info status" | nc -U $src
37 echo "migrate_set_speed 0" | nc -U $src
38 # set the expected max downtime
39 echo "migrate_set_downtime ${max_down_time}" | nc -U $src
40 # start live migration
41 echo "migrate -d tcp:${dst_ip}:${migrate_to_port}" | nc -U $src
42 # wait until live migration completed
44 while [ "${status}" == "" ]
46 status=`echo "info migrate" | nc -U $src |grep completed | cut -d: -f2`
51 echo "End of Live Migration"
56 echo "Checking status of Migration"
57 # print detail information
58 echo "info migrate" | nc -U $src
59 echo "quit" | nc -U $src
60 echo "quit" | nc -U $dst
62 echo "Migration executed successfully"
68 totaltime=$(grep "total time" $OUTPUT_FILE | cut -d' ' -f3)
69 downtime=$(grep "downtime" $OUTPUT_FILE | cut -d' ' -f2)
70 setuptime=$(grep "setup" $OUTPUT_FILE | cut -d' ' -f2)
72 \"totaltime\":\"$totaltime\", \
73 \"downtime\":\"$downtime\", \
74 \"setuptime\":\"$setuptime\" \
80 echo "Perform LiveMigration"
82 echo "LiveMigration Status"
84 echo "LiveMigration JSON output "