Commit Graph

7506 Commits

Author SHA1 Message Date
Cole Robinson 8560138cf2 cli: Add --xml xpath option for virt-install and virt-xml
The --xml option allows users to request raw XML edits to virt-install
or virt-xml generated XML. This gives users a bit of a workaround
incase we don't have proper support for some XML property. The --xml
option can gain more features in the future if it makes sense, like
setting XML namespaces for example.

Basic usage is like: virt-install --xml ./@foo=bar ...

Which will change the generated <domain> XML to have

<domain foo='bar' ...

virt-xml works similarly. It can only be combined with --edit currently.
This only works with xpaths rooted against the entire document.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 15:04:37 -04:00
Cole Robinson aa8572048b uitests: Add a fixture for passing in VMMDogtailApp
Reproducing what the custom unittest TestCase does. Convert
test_about as a demo

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 14:25:53 -04:00
Cole Robinson ebf76563b8 uitests: Big code reorganization
Break utils.py apart into a whole uitests/lib/ directory with

* lib/_dogtailinit.py: all the dogtail library init we need
* lib/_node.py: extending our dogtail node class with more functions
* lib/app.py: VMMDogtailApp
* lib/util.py: util functions plus all the special helpers previously
    in our custom TestCase
* lib/testcase.py: The TestCase that sets and tears down self.app

Adjust callers to match and make it easier to eventually convert to
native pytest usage

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 13:55:54 -04:00
Cole Robinson aa9fcdfdb2 uitests: details: use treeview search to speed up hardware selection
This uncovered some areas in details.py we weren't handling that
the search view unselects the current selection

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 12:22:25 -04:00
Cole Robinson 78cd8c90ea console: Rework default page flow a bit
Move the VM status and viewer open checks into the default page
path as well, otherwise opening the details dialog for an offline
VM attempts to connect to the inactive VM console and logs backtraces

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 11:34:06 -04:00
Cole Robinson 3ff829dc1f DESIGN.md: Mention existing VM name search support
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 11:12:20 -04:00
Cole Robinson 1b48772bc1 virt-install: Don't reboot VM is user manually stopped it
Similar to behavior we have in virt-manager, if the user destroys the
VM during the VM install process, don't invoke the post install
reboot.

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 09:00:33 -04:00
Cole Robinson 9c5c1f3e44 virt-install: Move more install process handling into separate functions
Try to save us having to pass around a ton of options, and make
things cleaner for upcoming changes

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 09:00:33 -04:00
Cole Robinson 0cd7cc7d77 virt-install: Restrict disk cleanup to small failure scenario
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 09:00:33 -04:00
Cole Robinson 9ea97e8537 cli: Drop unused 'domain' option from console callback chain
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 09:00:33 -04:00
Cole Robinson ac51ff8684 cli: Fill in all --filesystem suboptions
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 09:00:33 -04:00
Cole Robinson d24b3ba1d1 cli: Add virtio driver packed= option
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 09:00:33 -04:00
Cole Robinson bc246aeaba cli: Add --iommu comment heading
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 09:00:33 -04:00
Cole Robinson 65f93e5d60 cli: support --sysinfo type=fwcfg,entry...
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 09:00:33 -04:00
Cole Robinson 5643a560d5 domain: Fix details performance page graph scaling
This was busted in a88a28d0

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-11 09:00:33 -04:00
Cole Robinson ac8591192f console: Add option to disable autoconnect
As part of making virt-manager cooperate better with external viewers,
add an option to disable console autoconnect. When opening a VM window
for a running VM, you'll see a 'Connect to console' button in place
of the spice/vnc viewer. Click that and things proceed like normal.

This is useful to prevent virt-manager from disconnecting a virt-viewer
instance that's already attached to a VM

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 19:59:31 -04:00
Cole Robinson bbbfd4b7c8 vmwindow: Default the console widget to 1024x768
When a VM window is launched for the first for a VM, currently we
set the top window size to 800x600 which is small and arbitrary and
is universally shrinks the viewer too much to fit any OS installer
I can find.

Instead do some hacks to resize the window to accomodate a viewer
widget of 1024x768 which seems to be what QXL graphics give us for
win10 and Fedora 32 installers. So for new VMs hitting the OS installer
we don't see scrollbars.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 19:37:11 -04:00
Cole Robinson 43512302f7 vmwindow: Cleanup the interaction with vmmConsolePages
- Add ui/console.ui for console-pages and below
- Add move auth and graphics unavailable pages to a new subnotebook
- Move all the menubar handling up into vmwindow
- Clarify the control flow as much as I can come up with

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 19:37:11 -04:00
Cole Robinson 48bf5c6ab8 uitests: Fix some clonevm flakiness
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 19:22:19 -04:00
Cole Robinson aafb874c85 viewers: Enable window modifiers when viewer doesn't have keyboard
Right now this is tied to widget focus, which is too strong. This
changes it so that say clicking on the window title or toolbar then
allows the user to use Alt+F to trigger the File menu for example.
This roughly matches how virt-viewer works

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 11:25:50 -04:00
Cole Robinson 33a61f7f30 prefs: Remove 'Force console accels' option
This is very obscure and definitely not in line with our DESIGN.md
nowadays

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 09:15:53 -04:00
Cole Robinson 971a3e58f8 uitests: Fix createvm test after tests/data move
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 09:11:23 -04:00
Cole Robinson ec90d1360d createvm: Help make UI tests more reliable
We check if the page moved forward in uitests by scraping the top
label. Make sure we do that last when the page changes

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 08:49:12 -04:00
Cole Robinson b88e755a52 console: Text console submenu improvements
* Move all the menu building to its own class, for clarity
* Rename the menu 'Consoles' since it contains graphical choice as well
* Strip out the VM console duplicate if it exists
* Simplify the code a bit

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-09 08:49:12 -04:00
Cole Robinson 5473695fe1 installer: Upload unattended and cloudinit data to remote connections
* rename kernelupload.py to volumeupload.py and make the entrypoint
  more generic
* move all upload invocation to the Installer class
* use it with cloudinit and unattended ISO generation if required

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-08 19:24:21 -04:00
Cole Robinson 44033b43bb virt-xml: Handle removing <console> <serial> dup device
This is a quirk of libvirt that the first <device> is usually a
logical duplicate of the first <serial> device. Adjust virt-xml to
understand this quirk and remove both devices at the same time,
like we already do in virt-manager

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-08 17:55:09 -04:00
Cole Robinson e2419869e7 tests: data: Move all cli/ bits to their own directories
Move the content to:

* cli/virtclone/
* cli/unattended/
* fakemedia/

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-08 17:48:40 -04:00
Cole Robinson 900ff8c3e1 tests: Move cli virt-xml input XML to a virtxml/ dir
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-08 17:39:38 -04:00
Cole Robinson 38cd19b0c3 domain: Fix VM deletion with firmare='efi'
Our check for nvram was not complete for that case

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-08 17:32:00 -04:00
Cole Robinson 1689ebb251 viewers: spice: remove unused audio channel handle
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-08 17:32:00 -04:00
Cole Robinson 7d69783042 virtManager: misc reference leak fixes
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-08 17:32:00 -04:00
Cole Robinson d073ee9a48 addstorage: Revive disk serial UI
coreos is going to start using disk serial for ignition disk, so
setting this in the UI for distro testing will become more common

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-08 17:32:00 -04:00
Cole Robinson c54da68535 addstorage: Absorb advanced field UI
Share the UI for changing all these disk properties:

- shareable
- readonly
- removable
- cache
- discard
- detect zeroes

Move them all under the 'Advanced options' expander in details, and
add the checkbox options to the addhardware wizard.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-08 17:32:00 -04:00
Cole Robinson 8d5439567b uitests: finish statsmanager.py coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 17:50:57 -04:00
Cole Robinson 5e495ebd46 migrate: Add XML editor support
Allows the user to tweak the XML at the destination, which is already
something that libvirt supports

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 17:50:48 -04:00
Cole Robinson 16ebab2230 clone: Rework the UI
* Drop the network editing, users can use the details window
* Drop the combo box approach in favor of a regular treeview
* Drop a lot validation checks which are redundant with modern
  virtinst. We probably lose some checks but I don't think it's
  too important
* Use the cloner API
* Add uitest coverage

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson b9de8ad919 cloner: Fix some corner cases with name generation
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson 5c1a1076c0 cloner: Log the generated XML diff, not the whole thing
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson 4a47d32b09 xmlutil: add a diff() helper
And centralize all the scattered difflib calls we have

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson 7f1f5e343e codespell: Whitelist 'cloneable'
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson 8856b781d0 cloner: Write preserve vs share vs clone into DiskInfo
This let's us move more of the preserve logic to virtclone.py
and prep more things to share with virt-manager

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson e6df73261b cloner: Rename clone_disk -> new_disk
The latter is more clear in most contexts, and will make more
sense for future changes

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson 9c1453a253 disk: lookup volumes in disk.set_backend_for_existing_path
Seems like it should be doing this.
Make use of that helper in cloner afterwards

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson 8f60e4af47 tests: Add our own test:///default driver XML
test:///default saves changes for the lifetime of the connecting
process, which can cause weird interdependent issues in the test
suite. Duplicating it with driver XML will avoid those issues
popping up.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson f06325904b cloner: Share more clone disk building logic
We use this in virt-manager for nvram move on VM rename, so
let's simplify things for all callers

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson f23a27639f cloner: Big API rework
* Centralize lots of disk building
* Open code virt-clone specific behavior at the source
* Drop a lot or properties
* Move most testing to test_cli.py
* Generally a ton of cleanup

virt-manager clone wizard has not been converted yet so is totally
broken after this commit

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson c0d1e76941 tests: Cover more of cloner.py from test_cli.py
Cover more cases via the virt-clone CLI testing, than just the
test_cloner.py unit style testing.

Change most of the virt-clone --print-xml testing to also attempt the
clone operation as well via a hidden cli option, to ensure we aren't
testing XML of any bogus operations

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson f157aa1839 diskbackend: Simplify path a case of path joining
We are reimplementing os.path.join. Make sure the standard cli
test suite hits this case too

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson f46e1a395c tests: cli: Drop most usage of virt-clone --clone-running
This is just a test suite hack from before we had other methods
of specifying cloneable guests. It will be removed soon

We need to tweak some test XML to fix code coverage after

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00
Cole Robinson 39e8d60bea tests: cli: drop some clone --original-xml arg redundancy
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-09-05 15:49:55 -04:00