[Spice-devel] [spice v1 8/8] tests: migrate: add seamless-migration option

Victor Toso victortoso at redhat.com
Mon Oct 7 12:19:35 UTC 2019


From: Victor Toso <me at victortoso.com>

Now we always add seamless-migration option to qemu command line and
disabled (off) by default although seamless migration is supported for
over 7 years already!

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 tests/migrate.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/tests/migrate.py b/tests/migrate.py
index a9a2c1cb..3dcbc9f1 100755
--- a/tests/migrate.py
+++ b/tests/migrate.py
@@ -69,6 +69,8 @@ def get_args():
                         help="Wait spice client to connect to move to next step of migration (default False)")
     parser.add_argument('--count', dest='counter', type=int, default=100,
                         help="Number of migrations to run (set 0 for infinite)")
+    parser.add_argument('--seamless-migration', dest="seamless_migration", action='store_true', default=False,
+                        help="Enable seamless-migration support")
     args = parser.parse_args(sys.argv[1:])
     if os.path.exists(args.qemu):
         args.qemu_exec = args.qemu
@@ -79,11 +81,12 @@ def get_args():
         sys.exit(1)
     return args
 
-def start_qemu(qemu_exec, image, spice_port, qmp_filename, incoming_port=None, with_agent=False):
+def start_qemu(qemu_exec, seamless_migration, image, spice_port, qmp_filename, incoming_port=None, with_agent=False):
+    seamless_option = "on" if seamless_migration else "off"
     args = [
         qemu_exec,
         "-qmp", "unix:%s,server,nowait" % qmp_filename,
-        "-spice", "disable-ticketing,port=%s" % spice_port
+        "-spice", "seamless-migration=%s,disable-ticketing,port=%s" % (seamless_option, spice_port)
     ]
     if incoming_port:
         args += ("-incoming tcp::%s" % incoming_port).split()
@@ -153,7 +156,7 @@ class Migrator(object):
     migration_count = 0
 
     def __init__(self, log, client, qemu_exec, image, monitor_files,
-                 spice_ports, migration_port, vdagent, hostname):
+                 spice_ports, migration_port, vdagent, hostname, seamless_migration):
         self.client = client if client != "none" else None
         self.log = log
         self.qemu_exec = qemu_exec
@@ -163,16 +166,19 @@ class Migrator(object):
         self.spice_ports = spice_ports
         self.vdagent = vdagent
         self.hostname = hostname
+        self.seamless_migration = seamless_migration
 
         self.active = start_qemu(qemu_exec = qemu_exec,
                                  image = image,
                                  spice_port = spice_ports[0],
                                  qmp_filename = monitor_files[0],
+                                 seamless_migration = self.seamless_migration,
                                  with_agent = self.vdagent)
         self.target = start_qemu(qemu_exec = qemu_exec,
                                  image = image,
                                  spice_port = spice_ports[1],
                                  qmp_filename = monitor_files[1],
+                                 seamless_migration = self.seamless_migration,
                                  with_agent = self.vdagent,
                                  incoming_port = migration_port)
         self.remove_monitor_files()
@@ -235,6 +241,7 @@ class Migrator(object):
         del dead
         self.active = self.target
         self.target = start_qemu(spice_port = new_spice_port,
+                                 seamless_migration = self.seamless_migration,
                                  qemu_exec = self.qemu_exec,
                                  image = self.image,
                                  qmp_filename = new_qmp_filename,
@@ -256,6 +263,7 @@ def main():
                         migration_port = args.migrate_port,
                         spice_ports = [args.spice_port1, args.spice_port2],
                         vdagent = args.vdagent,
+                        seamless_migration = args.seamless_migration,
                         hostname = args.hostname)
     atexit.register(cleanup, migrator)
     counter = 0
-- 
2.21.0



More information about the Spice-devel mailing list