Re: [spice/tests/migrate v1 2/4] tests: migrate: wait user launch client option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/3/19 3:47 PM, Victor Toso wrote:
On Thu, Oct 03, 2019 at 03:34:50PM +0300, Uri Lublin wrote:
On 10/3/19 1:14 PM, Victor Toso wrote:
From: Victor Toso <me@xxxxxxxxxxxxxx>

Useful to test different clients running different tools (gdb,
valgrind).

It seems to me it's already solved by --wait-user-input.
The user can start the migration only after running the tool/client.

They are similar but with wait-user-input you can do the wait
without having to launch your own client, that is, it is good to
test the host side migration. Also, both of them should work well
together, that is:

./migrate.py --wait-user-connect --wait-user-input

By default, test does not launch the client so it will wait we
connect remote-viewer, than after connected it waits for user
input to start migration.

Since with wait-user-input the script waits for the user
to manually start the migrations, it can wait for the user to
start run own client/tool.

Thinking about it some more, it may be a good option if you want to run
the script (and client/tool) automatically, without user intervention.


Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx>

OK,

Uri.


---
   tests/migrate.py | 13 +++++++++----
   1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/tests/migrate.py b/tests/migrate.py
index 5ed9eba4..88e17691 100755
--- a/tests/migrate.py
+++ b/tests/migrate.py
@@ -63,6 +63,8 @@ def get_args():
                           help="Append options for agent's virtserialport")
       parser.add_argument('--wait-user-input', dest="wait_user_input", action='store_true', default=False,
                           help="Wait user's input to start migration test")
+    parser.add_argument('--wait-user-connect', dest="wait_user_connect", action='store_true', default=False,
+                        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)")
       args = parser.parse_args(sys.argv[1:])
@@ -174,25 +176,28 @@ class Migrator(object):
               if os.path.exists(x):
                   os.unlink(x)
-    def iterate(self, wait_for_user_input=False):
+    def iterate(self, wait_for_user_input=False, wait_user_connect=False):
           wait_active(self.active.qmp, True)
           wait_active(self.target.qmp, False)
           if not self.connected_client:
               if self.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()
+        # Tester can launch its own client or we wait start_client() to connect
+        if wait_user_connect:
+            wait_for_event(self.active.qmp, 'SPICE_INITIALIZED')
+
           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})
           wait_active(self.active.qmp, False)
           wait_active(self.target.qmp, True)
-        if self.connected_client:
+        if self.connected_client or wait_user_connect:
               wait_for_event(self.target.qmp, 'SPICE_CONNECTED')
           dead = self.active
@@ -224,7 +229,7 @@ def main():
       atexit.register(cleanup, migrator)
       counter = 0
       while args.counter == 0 or counter < args.counter:
-        migrator.iterate(args.wait_user_input)
+        migrator.iterate(args.wait_user_input, args.wait_user_connect)
           counter += 1
   if __name__ == '__main__':



_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]