[Spice-devel] [spice v2 5/8] tests: migrate: remove multiple client option

Victor Toso victortoso at redhat.com
Wed Sep 25 10:02:57 UTC 2019


From: Victor Toso <me at victortoso.com>

Not supported feature to be tested so reduce unused/untested code for
now.

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

diff --git a/tests/migrate.py b/tests/migrate.py
index c20d5e3a..fbbc505c 100755
--- a/tests/migrate.py
+++ b/tests/migrate.py
@@ -54,7 +54,6 @@ def get_args():
     parser.add_argument('--spice_port1', dest='spice_port1', type=int, default=5911)
     parser.add_argument('--spice_port2', dest='spice_port2', type=int, default=6911)
     parser.add_argument('--migrate_port', dest='migrate_port', type=int, default=8000)
-    parser.add_argument('--client_count', dest='client_count', type=int, default=1)
     parser.add_argument('--qemu', dest='qemu', default='../../qemu/x86_64-softmmu/qemu-system-x86_64')
     parser.add_argument('--log_filename', dest='log_filename', default='migrate.log')
     parser.add_argument('--image', dest='image', default='')
@@ -134,14 +133,13 @@ class Migrator(object):
 
     migration_count = 0
 
-    def __init__(self, log, client, qemu_exec, image, monitor_files, client_count,
+    def __init__(self, log, client, qemu_exec, image, monitor_files,
                  spice_ports, migration_port, vdagent):
         self.client = client
         self.log = log
         self.qemu_exec = qemu_exec
         self.image = image
         self.migration_port = migration_port
-        self.client_count = client_count
         self.monitor_files = monitor_files
         self.spice_ports = spice_ports
         self.vdagent = vdagent
@@ -153,7 +151,7 @@ class Migrator(object):
         self.target = start_qemu(qemu_exec=qemu_exec, image=image, spice_port=spice_ports[1],
                                  qmp_filename=monitor_files[1], incoming_port=migration_port)
         self.remove_monitor_files()
-        self.clients = []
+        self.connected_client = None
 
     def close(self):
         self.remove_monitor_files()
@@ -173,14 +171,13 @@ class Migrator(object):
     def iterate(self, wait_for_user_input=False):
         wait_active(self.active.qmp, True)
         wait_active(self.target.qmp, False)
-        if len(self.clients) == 0:
-            for i in range(self.client_count):
-                self.clients.append(start_client(client=self.client,
-                    spice_port=self.spice_ports[0]))
-                wait_for_event(self.active.qmp, 'SPICE_INITIALIZED')
+        if not self.connected_client:
+            self.connected_client = start_client(client=self.client, spice_port=self.spice_ports[0])
+            wait_for_event(self.active.qmp, 'SPICE_INITIALIZED')
             if wait_for_user_input:
                 print "waiting for Enter to start migrations"
                 raw_input()
+
         self.active.qmp.cmd('client_migrate_info', {'protocol':'spice',
             'hostname':'localhost', 'port':self.target.spice_port})
         self.active.qmp.cmd('migrate', {'uri': 'tcp:localhost:%s' % self.migration_port})
@@ -212,7 +209,7 @@ def main():
     migrator = Migrator(client=args.client, qemu_exec=args.qemu_exec,
         image=args.image, log=log, monitor_files=[args.qmp1, args.qmp2],
         migration_port=args.migrate_port, spice_ports=[args.spice_port1,
-        args.spice_port2], client_count=args.client_count, vdagent=(args.vdagent=='on'))
+        args.spice_port2], vdagent=(args.vdagent=='on'))
     atexit.register(cleanup, migrator)
     while True:
         migrator.iterate()
-- 
2.21.0



More information about the Spice-devel mailing list