[Spice-commits] 8 commits - tests/migrate.py
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Sep 25 12:45:21 UTC 2019
tests/migrate.py | 45 ++++++++++++++++++++++++++-------------------
1 file changed, 26 insertions(+), 19 deletions(-)
New commits:
commit bc928ad2a817245ae69225821d8c8ca1e91e53ab
Author: Victor Toso <me at victortoso.com>
Date: Wed Sep 25 11:02:59 2019 +0200
tests: migrate: add counter for tests
Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/tests/migrate.py b/tests/migrate.py
index b76bc877..b11befdd 100755
--- a/tests/migrate.py
+++ b/tests/migrate.py
@@ -62,6 +62,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('--count', dest='counter', type=int, default=100,
+ help="Number of migrations to run (set 0 for infinite)")
args = parser.parse_args(sys.argv[1:])
if os.path.exists(args.qemu):
args.qemu_exec = args.qemu
@@ -214,8 +216,10 @@ def main():
migration_port=args.migrate_port, spice_ports=[args.spice_port1,
args.spice_port2], vdagent=args.vdagent)
atexit.register(cleanup, migrator)
- while True:
+ counter = 0
+ while args.counter == 0 or counter < args.counter:
migrator.iterate(args.wait_user_input)
+ counter += 1
if __name__ == '__main__':
main()
commit 37507c928a4b616bca4abffe83d8c6587ce56952
Author: Victor Toso <me at victortoso.com>
Date: Wed Sep 25 10:53:26 2019 +0200
tests: migrate: add option --wait-user-input
The iterate() method already considers it. This is useful if one wants
to attach gdb on qemu for instance.
Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/tests/migrate.py b/tests/migrate.py
index d0eda099..b76bc877 100755
--- a/tests/migrate.py
+++ b/tests/migrate.py
@@ -60,6 +60,8 @@ def get_args():
parser.add_argument('--client', dest='client', default='spicy', choices=['spicy', 'remote-viewer'])
parser.add_argument('--vdagent', dest="vdagent", action='store_true', default=False,
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")
args = parser.parse_args(sys.argv[1:])
if os.path.exists(args.qemu):
args.qemu_exec = args.qemu
@@ -213,7 +215,7 @@ def main():
args.spice_port2], vdagent=args.vdagent)
atexit.register(cleanup, migrator)
while True:
- migrator.iterate()
+ migrator.iterate(args.wait_user_input)
if __name__ == '__main__':
main()
commit 4241806de70baa114f0e404fe4f1c321eb048131
Author: Victor Toso <me at victortoso.com>
Date: Wed Sep 25 10:46:35 2019 +0200
tests: migrate: bool instead of on/off option in cmd line
Simpler. Make the default to be False as well as
1) No args should run as simple as possible
2) True is currently broken
Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/tests/migrate.py b/tests/migrate.py
index fbbc505c..d0eda099 100755
--- a/tests/migrate.py
+++ b/tests/migrate.py
@@ -58,7 +58,8 @@ def get_args():
parser.add_argument('--log_filename', dest='log_filename', default='migrate.log')
parser.add_argument('--image', dest='image', default='')
parser.add_argument('--client', dest='client', default='spicy', choices=['spicy', 'remote-viewer'])
- parser.add_argument('--vdagent', choices=['on', 'off'], default='on')
+ parser.add_argument('--vdagent', dest="vdagent", action='store_true', default=False,
+ help="Append options for agent's virtserialport")
args = parser.parse_args(sys.argv[1:])
if os.path.exists(args.qemu):
args.qemu_exec = args.qemu
@@ -209,7 +210,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], vdagent=(args.vdagent=='on'))
+ args.spice_port2], vdagent=args.vdagent)
atexit.register(cleanup, migrator)
while True:
migrator.iterate()
commit 0d351864b1d6200d3cb37d7ca7a06a7e22c1b0d3
Author: Victor Toso <me at victortoso.com>
Date: Wed Sep 25 10:21:59 2019 +0200
tests: migrate: remove multiple client option
Not supported feature to be tested so reduce unused/untested code for
now.
Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
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()
commit 6ca34325f56340cd9e4cfe2cb3a0e32f216234f0
Author: Victor Toso <me at victortoso.com>
Date: Wed Sep 25 10:02:41 2019 +0200
tests: migrate: fix relative qmp.py path
Moved in qemu, see:
| commit 8f8fd9edba4bd6768da2c8e2bea49ad5c16ced1a
| Author: Cleber Rosa <crosa at redhat.com>
| Date: Wed Feb 6 11:29:01 2019 -0500
|
| Introduce a Python module structure
|
| This is a simple move of Python code that wraps common QEMU
| functionality, and are used by a number of different tests and
| scripts.
|
| By treating that code as a real Python module, we can more easily:
| * reuse code
| * have a proper place for the module's own unittests
| * apply a more consistent style
| * generate documentation
Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/tests/migrate.py b/tests/migrate.py
index 1e15ffa7..c20d5e3a 100755
--- a/tests/migrate.py
+++ b/tests/migrate.py
@@ -8,7 +8,7 @@ VGA mode since it will just be SeaBIOS).
Dependencies:
either qmp in python path or running with spice and qemu side by side:
-qemu/QMP/qmp.py
+qemu/python/qemu/qmp.py
spice/tests/migrate.py
Will create two temporary unix sockets in /tmp
@@ -32,7 +32,7 @@ try:
import qmp
except:
import sys
- sys.path.append("../../qemu/QMP")
+ sys.path.append("../../qemu/python/qemu/")
try:
import qmp
except:
commit 973779961f66cdfa4479e1f030794fac7e4c078c
Author: Victor Toso <me at victortoso.com>
Date: Tue Sep 24 17:33:24 2019 +0200
tests: migrate: add support to run with remote-viewer
Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/tests/migrate.py b/tests/migrate.py
index 5a0f5930..1e15ffa7 100755
--- a/tests/migrate.py
+++ b/tests/migrate.py
@@ -58,7 +58,7 @@ def get_args():
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='')
- parser.add_argument('--client', dest='client', default='spicy', choices=['spicy'])
+ parser.add_argument('--client', dest='client', default='spicy', choices=['spicy', 'remote-viewer'])
parser.add_argument('--vdagent', choices=['on', 'off'], default='on')
args = parser.parse_args(sys.argv[1:])
if os.path.exists(args.qemu):
@@ -97,6 +97,9 @@ def start_qemu(qemu_exec, image, spice_port, qmp_filename, incoming_port=None, e
def start_client(client, spice_port):
client_cmd = "spicy --uri spice://localhost:%s" % (spice_port)
+ if client == "remote-viewer":
+ client_cmd = "remote-viewer spice://localhost:%s" % (spice_port)
+
return Popen(client_cmd.split(), executable=client)
def wait_active(q, active):
commit a0a310befe59429556fbdb3b0d7547e1ddbfc326
Author: Victor Toso <me at victortoso.com>
Date: Tue Sep 24 17:31:32 2019 +0200
tests: migrate: use uri for default's spicy client
Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/tests/migrate.py b/tests/migrate.py
index 0c302c92..5a0f5930 100755
--- a/tests/migrate.py
+++ b/tests/migrate.py
@@ -96,8 +96,8 @@ def start_qemu(qemu_exec, image, spice_port, qmp_filename, incoming_port=None, e
return proc
def start_client(client, spice_port):
- return Popen(("%(client)s -h localhost -p %(port)d" % dict(port=spice_port,
- client=client)).split(), executable=client)
+ client_cmd = "spicy --uri spice://localhost:%s" % (spice_port)
+ return Popen(client_cmd.split(), executable=client)
def wait_active(q, active):
events = ["RESUME"] if active else ["STOP"]
commit f82cf87e6551dcb77c2a702ccbe5c016949df333
Author: Victor Toso <me at victortoso.com>
Date: Tue Sep 24 17:24:23 2019 +0200
tests: migrate: remove spicec option
Removed, see:
| commit 1876971442ef808b5dcdaa5dc12df617f2179cb5
| Author: Christophe Fergeau <cfergeau at redhat.com>
| Date: Fri Nov 21 11:01:17 2014 +0100
|
| client: Remove client code
|
| The client has been superseded by virt-viewer (
| http://virt-manager.org/download/sources/virt-viewer/ )
| and is no longer being maintained.
Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Frediano Ziglio <fziglio at redhat.com>
diff --git a/tests/migrate.py b/tests/migrate.py
index 9a3cef47..0c302c92 100755
--- a/tests/migrate.py
+++ b/tests/migrate.py
@@ -16,7 +16,7 @@ Will leave a log file, migrate_test.log, in current directory.
"""
#
-# start one spiceclient, have two machines (active and target),
+# start one spice client, have two machines (active and target),
# and repeat:
# active wait until it's active
# active client_migrate_info
@@ -58,7 +58,7 @@ def get_args():
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='')
- parser.add_argument('--client', dest='client', default='spicy', choices=['spicec', 'spicy'])
+ parser.add_argument('--client', dest='client', default='spicy', choices=['spicy'])
parser.add_argument('--vdagent', choices=['on', 'off'], default='on')
args = parser.parse_args(sys.argv[1:])
if os.path.exists(args.qemu):
More information about the Spice-commits
mailing list