Commit Graph

1566 Commits

Author SHA1 Message Date
Cole Robinson c6830740f3 tests: uitests: Use keyfile to test initial conn loading
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-26 15:20:05 -04:00
Cole Robinson a121c943ef tests: Fix failure with newer pytest
This is with latest packages on Fedora 33, I didn't investigate deeper

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-18 14:33:00 -04:00
Cole Robinson a2829e65e9 tests: Don't show debug output by default on failure
Require --log-level=debug to see output

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-18 19:28:04 -04:00
Cole Robinson fe1747e2fc tests: Add urldetect.py unit test coverage
Add data/urldetect with a bunch of distro tree content to trigger
full code coverage of virtinst/install/urldetect.py

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-18 19:28:04 -04:00
Cole Robinson 25b3113ba9 osdict: Drop post_install driver bits
osinfo library doesn't return data for these with the fedora 32
version, so it's hard to get coverage testing. Since we aren't
even using this code yet anyways, let's remove it until it is needed

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-18 19:28:04 -04:00
Cole Robinson 2170efc9a5 virtinst: Unify test code paths when run as root
CI runs the code as root by default, fix up some of the differences

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-18 19:28:04 -04:00
Cole Robinson aa89a48371 xmlutil: Centralize all 'programming error' exceptions
Raise them directly instead of adding the hard to read conditional
into the function

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 19:08:27 -04:00
Cole Robinson 380a44318a virtinst: Centralize in_testsuite checking
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 19:08:27 -04:00
Cole Robinson 44aa0b093e tests: cli: Clean up global module data a bit
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 16:47:58 -04:00
Cole Robinson f6c6f033d9 tests: Move checkprops.py magic skipping to pytest
We want to skip these tests if previous tests failed or were skipped,
but current impl depends on unittest specifics. Move it to pytest

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 16:47:58 -04:00
Cole Robinson 61a947d667 tests: Rename clistate -> TESTCONFIG
Makes it more clear it's a constant class, and its purpose

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 16:38:40 -04:00
Cole Robinson 4226a4c1d5 setup: Kill old test_* command infrastructure
pytest invocations are now preferred. Leave plain `./setup.py test`
as a stub that errors and points to pytest.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 16:00:32 -04:00
Cole Robinson 92844eb2f8 tests: Wire pytest --log-level=debug to cli tests debug infrastructure
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 16:00:06 -04:00
Cole Robinson f086c75560 tests: Add pytest --regenerate-output
Duplicate of ./setup.py test --regenerate-output

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 14:57:03 -04:00
Cole Robinson 0aa030245c tests: Move `setup.py test_urls` suboptions to pytest
Adds --urls-skip-libosinfo, --urls-force-libosinfo, --urls-iso-only,
    and --urls-url-only

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 14:57:03 -04:00
Cole Robinson e9b3ed509f tests: Add pytest conftest.py
Makes 'pytest' and 'pytest --cov' work for the standard tests.
uitests run with `pytest --uitests --cov=virtManager`.
test_urls.py, test_dist.py, test_inject.py need to be invoked like

pytest $PATH

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 14:57:03 -04:00
Cole Robinson 247170c066 tests: cli: Make test names easier to match with pytest
pytest doesn't like './' in the name

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 13:03:54 -04:00
Petr Benes 2862b68292 cli: Add --graphics websocket= support
Add a --graphics websocket option to configure VNC WebSocket port
as described in https://libvirt.org/formatdomain.html#elementsGraphics

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2020-07-16 14:52:03 -04:00
Pino Toscano 2760b20c84 i18n: create single strings for texts/messages
Use single strings with proper placeholders for texts, so there is no
need to join together bits of translated texts.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-15 10:22:26 -04:00
Cole Robinson 00fa636682 tests: uitests: Fix after string changes
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-13 15:37:00 -04:00
Pino Toscano 6d970949f1 i18n: use "Generic OS" as label for generic
Change the label for a generic OS to "Generic OS", and making it
translatable.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-13 15:37:00 -04:00
Pino Toscano 0145d9838b i18n: fix few spellings
"iSCSI", "KVM", "QEMU", "UNIX", "UUID", "VirtIO", "XML", "vCPU".

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-13 15:37:00 -04:00
Cole Robinson e2b1e2d59b tests: dist: Add xgettext warning check
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-12 17:08:10 -04:00
Menno Lageman 25419db9ca virtinst: add support for configuring the IOMMU
Add a --iommu option to configure IOMMU parameters as described in
https://libvirt.org/formatdomain.html#elementsIommu

E.g. 'virt-install --iommu model=intel,driver.aw_bits=48,driver.iotlb=on ...'
will generate the following domain XML:

  <devices>
    <iommu model="intel">
      <driver aw_bits="48" iotlb="on"/>
    </iommu>
  </devices>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Menno Lageman <menno.lageman@oracle.com>
2020-07-12 09:15:52 -04:00
Cole Robinson fec9f0b136 po: Fix message format warnings printed from xgettext
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-11 19:18:38 -04:00
Cole Robinson a8d2438d5a devices: interface: Rename is_conflict_net -> check_mac_in_use
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-06 10:17:10 -04:00
Cole Robinson f27e203732 cli: Skip MAC collision error with --check mac_in_use=
There's valid cases where a VM can be defined with a conflicting MAC
address. Prior to  ebd6091cc8 and related refactorings we were more
lax here if the conflicting VM wasn't running, but now we are blocking
some valid usage.

Hoist the validation check up to cli.py and add --check mac_in_use=off
to skip the validation. Advertise it like we do for other checks, so
now a collision error will look something like:

The MAC address '22:11:11:11:11:11' is in use by another virtual
machine. (Use --check mac_in_use=off or --check all=off to override)

Reported-by: Pino Toscano <ptoscano@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-06 10:17:10 -04:00
Cole Robinson 3ea9a96961 tests: pylint: Silence some false positives
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-04 18:05:27 -04:00
Cole Robinson 4c84d086ec tests: codespell: ignore 'hda'
codespell thinks it is a typo for 'had'

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-04 18:05:27 -04:00
Daniel Henrique Barboza ae3e92f0f5 tpm.py: make MODEL_SPAPR the default when running in ppc64
Users are fond of using "--tpm /dev/tpm0" to create a TPM device
for their VMs. ppc64 users, however, are experiencing errors because
the default TPM model is 'tpm-tis', which does not work in ppc64, and
they need to specify 'model=tpm-spapr' to work around that.

This patch makes the default TPM model change to 'tpm-spapr' when
running virt-install on a ppc64 host. A new test was added in test_cli.py
to test this new condition. This also keeps the 100% coverage of
the tpm.py file.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
CC: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com>
CC: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-04 17:56:57 -04:00
Daniel Henrique Barboza ec87485852 test_xmlconfig.py: use single quote strings in testDiskNumbers
codespell complains that one of the asserts is a typo:

tests/test_xmlconfig.py:92: ba  ==> by, be

Using single quote strings in that assert will make codespell
pass. For consistency, let's change all the strings in the
test to be single quoted.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-04 17:56:57 -04:00
Daniel Henrique Barboza 21f1c90c2b codespell_dict.txt: add 'msdos' string
This will avoid codespell flagging 'msdos' as a typo.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-07-04 17:56:57 -04:00
Cole Robinson b4181e7d77 tests: test_urls: Update
* latest SL is detected as centos again
* ubuntu URLs have moved, bump them forward

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-05-27 14:42:37 -04:00
Fabiano Fidêncio b55b7e9462 urldetect: Deal with ubuntu 20.04 legacy installer
Ubuntu 20.04 has a new installer, which is yet not supported by
virt-install / osinfo-db, and this made ubuntu switch their URLs
for the old installer to current/legacy-images/... instead of
current/images/...

Let's adapt URL detect so it can deal with this new "legacy"
style.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2020-05-27 14:42:37 -04:00
Cole Robinson 1afdc7ae32 createvm: Rework to track all Guest/Installer params explicitly
Rather than build a guest and installer instance depending on where
we are in the UI, track each input property in an explicit class, so
we can rebuild the guest/installer on demand with data accumulated
up to that point.

This makes the flow easier to follow and simplifies a lot of hacks we
have to do when backing up through the wizard, because we are trying
to unwind changes from an existing object, rather than just blowing
it away and easily reassembling it with updated info.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-05 19:39:45 -05:00
Cole Robinson eb605cccd8 tests: uitests: More createvm testing
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-05 19:39:45 -05:00
Cole Robinson 01eb65bd61 tests: Don't report UID/GID in fake caps data
Otherwise uitests can have different behavior depending on host state

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-05 19:39:45 -05:00
Cole Robinson 150b6ac95e virt-install: Add --reinstall=DOMAIN option
This allows using virt-install's install logic on an existing VM

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 09:03:02 -05:00
Cole Robinson 5c64d35756 tests: uitests: Add a NewVM failure test
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 07:05:11 -05:00
Cole Robinson b24892448c tests: Add armv7l domcaps data, and use it
Rather than using a hacked x86 domcaps data

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 07:05:11 -05:00
Cole Robinson c0c69b1708 tests: uitests: Make NewVMManual more robust
There's a timing issue with changing pages

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 07:05:11 -05:00
Cole Robinson bea5e56c26 virtinst: connection: Add is_privileged
Replace the is_session and is_system distinction with variants
of is_privileged. This matches what libvirt uses internally, and
will help with supporting qemu:///embed at some point

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 07:05:11 -05:00
Cole Robinson 9a0d49a718 virtinst: uri: Rework MagicURI to work with passed in fakeuri
Rather than individual options for each possible hypervisor,
and annotations like 'remote' or 'session', just have it take a
fake URI to mock

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 07:05:11 -05:00
Cole Robinson 1b6e33e8b9 tests: osdict: Finish coverage
Requires libosinfo git which has a bug fix to help trigger
post install code in osdict.py

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 07:05:11 -05:00
Cole Robinson f380d43e58 cli: Print more info about console commands
Googling for 'Graphics requested but DISPLAY is not set' shows there's
some confusion about virt-install's behavior in this area. This gives
more output in several related cases about what commands we are
running and the state of the VM

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 07:05:11 -05:00
Cole Robinson 9ddf2799a8 tests: More work to make dir search test host independent
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-30 16:18:20 -05:00
Cole Robinson 8e7745f5e1 tests: Don't check against host UID
We are using static test suite data to compare against resolved
host username

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-30 10:15:21 -05:00
Cole Robinson 82be5dccad cli: Add --disk type= support
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-29 19:17:54 -05:00
Cole Robinson 8c0704a921 diskbackend: Treat /dev paths on remote connections as 'block'
Currently if the path isn't managed on a remote connection we
treat it as file. Add this simple heuristic to improve the common
case.

https://bugzilla.redhat.com/show_bug.cgi?id=1726202

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-29 19:07:27 -05:00
Cole Robinson 140a1f3b15 cloner: Drop ability to clone a paused VM
Generally this doesn't work with qemu metadata locking nowadays,
and it was never a safe idea to begin with, because disk contents
could be in an inconsistent state.

https://bugzilla.redhat.com/show_bug.cgi?id=1725330

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-29 18:34:38 -05:00