Commit Graph

1541 Commits

Author SHA1 Message Date
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
Cole Robinson 1e1cd4c564 cloner: Clear domain <title> as well
Otherwise in virt-manager the two VMs will be identical

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-29 18:34:38 -05:00
Cole Robinson 7313f9ff6a diskbackend: Add full local clone test coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-29 09:09:40 -05:00
Cole Robinson e7bb021c4c diskbackend: Add lots of test coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-29 08:38:18 -05:00
Cole Robinson 04c0d48ef7 devices: disk: Always set a stub storage backend
This reworks the existing code to never have storage_backend = None,
instead carrying around a stub class, and resolving the actual
storage info when necessary. This makes the logic easier to follow.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-29 06:52:29 -05:00
Cole Robinson 519fed3b91 addhardware: Remove dead virtio-scsi collision code
The way we set controller_model earlier, means all the virtio-scsi
allocation code is essentially never set. That code does still fix
a valid case of when trying to add a scsi device when there isn't
any remaining slots open, but that should be rare enough that I'm
fine telling the user to edit manually set up a controller themselves
first.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-29 06:52:29 -05:00
Cole Robinson ac202f40ac tests: uitests: Fix live hotplug test after delete rework
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-29 06:44:41 -05:00
Cole Robinson 4cb775773f devices: disk: Add change_bus()
Taken from virt-manager code. Move it here because it is strictly
an XML operation, and it will be easier to unit test

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-29 06:44:33 -05:00
Cole Robinson 0f295ec5dc devices: disk: Add more test coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-29 06:40:43 -05:00
Cole Robinson d9d5caad0d virtinst: connection: Drop is_closed() helper
We have is_open, just use that

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-28 11:42:33 -05:00
Cole Robinson 4f7e25e9fe uitests: Fix with latest delete wizard
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-28 11:39:14 -05:00
Cole Robinson 11d6536542 guest: Finish off test coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 13:08:12 -05:00
Cole Robinson dbcebeb734 guest: Move VM replace helper to cloner
It's the only user. Rework it a bit and add full coverage

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 13:08:12 -05:00
Cole Robinson 796ba8f3c5 guest: Fix --graphics spice usage if USB is disabled
We already have a check for this for adding a tablet device, do
the same for redirdev devices

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 13:08:12 -05:00
Cole Robinson 6d2483f09d virtinst: install: Fill out more test coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 13:08:12 -05:00
Cole Robinson 3440d8c59d urlfetcher: move mock code to the testsuite
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 13:08:12 -05:00
Cole Robinson c64009ecdd domaincapabilities: Finish test coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 13:08:12 -05:00
Cole Robinson dcab14e0b4 domain: cpu: Finish test coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 13:08:12 -05:00
Cole Robinson 6f95ebc7fd devices: controller: Add get_attached_devices
Move the opencoded impl out of virt-manager details.py and into
virtinst, since this is entirely about XML comparison. Add tests for
it

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 13:08:12 -05:00
Cole Robinson ec580f82a2 tests: Cover Guest.find_device and Device.compare_device
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 07:38:53 -05:00
Cole Robinson e40f71a689 tests: cli: Cover DeviceVideo bochs default
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:52 -05:00
Cole Robinson 91d4c39bb6 tests: cli: cover --controller address=X failure
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson eb5e087366 tests: Add full coverage for pollhelpers and VirtinstConnection
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson e784376699 tests: Rename all test files to have test_ prefix
This will help for a possible future conversion to pytest

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson 78c8aef75e tests: Move all data directories to data/
This cleans up the file hierarchy a bit

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson 8fe0a208db Move virt-* code into their modules
This layout is closer to what most python modules have nowadays.
It also simplifies testing and static analysis setup.

Keep virt-* wrappers locally, for ease of running these commands
from a git checkout.

Adjust the wrapper binaries we install on via packaging to be
pure python, which makes things like running gdb easier.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 18:27:20 -05:00