Commit Graph

34 Commits

Author SHA1 Message Date
Frediano Ziglio
1a91da8689 migrate.py: By default try to search system qemu executable
Do not look to "../../qemu/x86_64-softmmu/qemu-system-x86_64",
this will be searched with which if no found, just use the name.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-03-09 12:28:45 +00:00
Frediano Ziglio
768360018a migrate.py: Use python3 as executable interpreter
The script was updated to use Python 3 syntax.
Although you can launch with "python3 ./tests/migrate.py ..."
better to also update the script source to make it
executable directly.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2020-03-09 12:28:39 +00:00
Victor Toso
84f257e263 migrate.py: add seamless migration option
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@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-03-04 16:09:49 +00:00
Victor Toso
81d28cac55 migrate.py: cosmetic changes
Make one argument per line;
Indent with arguments;

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-03-04 16:09:46 +00:00
Victor Toso
4882e01370 migrate.py: add option for hostname change
This is used in the migrate message and being able to tweak it allows
clients from different machines to test this local migration test.

Example of usage:
    ./migrate.py --hostname 192.168.122.1 --wait-user-connect

In a VM with access to 192.168.122.1:
    remote-viewer spice://192.168.122.1:5911

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-03-04 16:09:44 +00:00
Victor Toso
49e3e7a6d4 migrate.py: style, break line of qmp's command
Preparatory patch for adding support to change hostname.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-03-04 16:09:41 +00:00
Victor Toso
632cfa1c3d migrate.py: cosmetic changes on start_qemu()
This function can be tweak quite a bit due all possibilities around
QEMU configuration. This patch removes incoming_args and extra_args
and move their values to the right place in the function.

I'm also applying a more extensive coding style for parameters, so
when we need to do changes it should happen with fewer lines.

While at it, change to string interpolation from 3.6+, suggested by
Kevin Pouget.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-03-04 16:09:39 +00:00
Victor Toso
57af035749 migrate.py: simplify wait_active()
We are only interested in the running state of qmp (or VCPUS) here
which is what we check. Moving this check to the try branch allows
removing some extra checks.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-03-04 16:09:37 +00:00
Victor Toso
f75236bf42 migrate.py: migrate count starts with 1
As this is not some index but a counter. The first print happens after
first migration was done, meaning 1 instead of 0

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-03-04 16:09:33 +00:00
Victor Toso
b124ebe53e migrate.py: fix events race
Currently, when we run migrate.py with --client option we get stuck
waiting for SPICE_CONNECTED event on target qmp (while receiving only
QMP). Problem is, only after event SPICE_INITIALIZED in the source qmp
is that the client will be able to do migration (to properly exchange
spice messages).

So, it is a must that if we have a test where a client is connected,
to wait for SPICE_INITIALIZED event in the source qmp.

To clarify, this patches fixes the following test:

    ./migrate.py --client spicy

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Kevin Pouget <kpouget@redhat.com>
2020-03-04 16:09:27 +00:00
Uri Lublin
603b100ba1 migrate.py: do not run with snapshot
Instead, create a new image with backing-file of the original image
(a "permanent" snapshot), use it during the test and remove it at the end.

Also use 'writeback' cache instead of 'unsafe'.

Signed-off-by: Uri Lublin <uril@redhat.com>

squash: actually remove the snapshot. mention cache change
2020-02-20 21:45:00 +02:00
Uri Lublin
eafde16358 migrate.py: a helper function for shell commands
Signed-off-by: Uri Lublin <uril@redhat.com>
2020-02-20 19:18:10 +02:00
Uri Lublin
dd9b5bd483 migrate.py: print qemu command line
Signed-off-by: Uri Lublin <uril@redhat.com>
2020-02-20 19:18:10 +02:00
Uri Lublin
5d82ed42d0 migrate.py: enable kvm
I LOVE KVM
(or Make the guest run faster)

Signed-off-by: Uri Lublin <uril@redhat.com>
2020-02-20 19:18:10 +02:00
Uri Lublin
77ae94a214 migrate.py: python3: when there is no output do not print the heading
Also don't try to decode a possibly None value.

Signed-off-by: Uri Lublin <uril@redhat.com>
2020-02-20 19:18:10 +02:00
Uri Lublin
7318565ecc migrate.py: python3: raw_input and more
There is no raw_input() in python3 -- define it as input()

Use decode() when writing subprocess output to the log, to make
sure the argument for write is a string (in python3
stdout.read() returns bytes).

There is no has_key in python3 -- use "in" instead

Signed-off-by: Uri Lublin <uril@redhat.com>
2020-02-20 14:10:09 +02:00
Uri Lublin
d109bd3577 migrate.py: python3: print
Add parenthesis to all print calls

Signed-off-by: Uri Lublin <uril@redhat.com>
2020-02-13 15:50:55 +02:00
Uri Lublin
189c38f04f migrate.py: remove unused variable err
Signed-off-by: Uri Lublin <uril@redhat.com>
2020-02-13 15:50:55 +02:00
Victor Toso
e86d4e3e48 tests: migrate: fix migration with --vdagent option
Before this patch, running the test with --vdagent option would error
in the second migration attempt with:

 | qemu-system-x86_64: Unknown savevm section or instance
 | '0000:00:04.0/virtio-console' 0. Make sure that your current VM setup
 | matches your saved VM setup, including any hotplugged devices

The reason is that target host created for migration was lacking the
configuration for vdagent that is present in the first source/target
migration VMs.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-10-04 13:32:13 +02:00
Victor Toso
6777ec31f1 tests: migrate: wait user launch client option
Useful to test different clients running different tools (gdb,
valgrind).

Signed-off-by: Victor Toso <victortoso@redhat.com>
2019-10-04 13:31:55 +02:00
Victor Toso
878d3bd1ab tests: migrate: default to not launch client
This supports doing migration without any client to be connected.
If tester wants client, it needs to pass an option to --client.

Change of default still is to keep the test as simple as possible
when no arguments are given.

Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Uri Lublin <uril@redhat.com>
2019-10-04 13:31:20 +02:00
Victor Toso
bc928ad2a8 tests: migrate: add counter for tests
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:53 +02:00
Victor Toso
37507c928a 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@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:53 +02:00
Victor Toso
4241806de7 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@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:53 +02:00
Victor Toso
0d351864b1 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@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:48 +02:00
Victor Toso
6ca34325f5 tests: migrate: fix relative qmp.py path
Moved in qemu, see:

 | commit 8f8fd9edba4bd6768da2c8e2bea49ad5c16ced1a
 | Author: Cleber Rosa <crosa@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@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:07 +02:00
Victor Toso
973779961f tests: migrate: add support to run with remote-viewer
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:07 +02:00
Victor Toso
a0a310befe tests: migrate: use uri for default's spicy client
Signed-off-by: Victor Toso <victortoso@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:07 +02:00
Victor Toso
f82cf87e65 tests: migrate: remove spicec option
Removed, see:

 | commit 1876971442
 | Author: Christophe Fergeau <cfergeau@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@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
2019-09-25 14:44:07 +02:00
Alon Levy
13a6c8b3a1 tests/migrate.py: add --vdagent
Adds the required options to provide a vdagent to the guest in both source and target qemu
instances.

This will be the last update of the in spice git tests directory, I've moved those tests
to the repository spice-tests. The longer term goal remains autotest integration, but since
this test (and some minor others for qemu) need a home it is:

http://cgit.freedesktop.org/~alon/spice-tests/

(I'm reluctant to put it under spice/ because of my wish to go to autotest, but still, there
they are. Nothing as permanent as the temporary).

Independent (of external modules, i.e. qemu) tests (server/tests) should remain in tree.
2011-08-23 17:01:14 +03:00
Alon Levy
26851b8ae6 server/tests/migrate.py: make executable 2011-08-23 17:01:14 +03:00
Alon Levy
b5d204b6ef tests/migrate: update to use argparse and run spicy by default
Most helpful change is that it prints help if you do --help.
It can take --image parameter, and --client parameter, defaults to spicy.

Incidentally, spicy switch host seems broken - if you run with --client spicec
(assuming spicec is in the PATH), it works fine, but using the default spicy (or
--client spicy) it fails after a single switch.
2011-07-05 14:24:41 +02:00
Alon Levy
2f9d1e7715 tests/migrate.py: refactor to allow importing for later use 2011-02-11 19:13:03 +02:00
Alon Levy
fc3637bf32 tests/migrate.py: add a migration test 2011-01-15 20:54:48 +02:00