Commit Graph

305 Commits

Author SHA1 Message Date
Cole Robinson
eee1caa946 domain: Drop most device list wrappers
There's lots of hacks stuffed into the domain device lists. Formalize
some of it, move some of the specific stuff to details.py, and drop
a lot of the needless API wrappers
2018-03-21 16:10:45 -04:00
Cole Robinson
f69b823fad devices: Switch to normal _XML_PROP_ORDER
Drop the register_device stuff, rename virtual_device_type
2018-03-21 11:17:36 -04:00
Cole Robinson
fe9ed2340c virtinst: move <domain> XML files to virtinst/domain
And give the classes consistent naming
2018-03-21 11:17:36 -04:00
Cole Robinson
b6dcee8eb7 Use consistent and minimal license header for every file 2018-03-21 07:29:40 -04:00
Cole Robinson
1c911ce567 virtinst: Give device classes consistent DeviceX naming
Previous state was inconsistenty and needlessly wordy. Fix up
a few other class namings that have redundant Virtual in the name
2018-03-21 07:29:40 -04:00
Cole Robinson
a55abc8e89 details: Again fix default page showing 2018-03-18 11:36:02 -04:00
Cole Robinson
4d4a07c65b tests: uitests: Add window cleanup tests
And fix some bugs I found as a result
2018-03-17 19:42:19 -04:00
Cole Robinson
3c1e0a8a12 virtManager/*: Give pylint hints about singleton classes
It can't seem to figure out that what 'cls' is in this context,
so make it explicit.
2018-03-17 18:46:39 -04:00
Cole Robinson
dac860e8ce engine: Show modal startup errors if window open fails 2018-03-16 19:09:55 -04:00
Cole Robinson
5ebe8b8184 create: Fix customize dialog launching
After the increment/decrement rework
2018-03-15 21:24:48 -04:00
Cole Robinson
cad809fe80 Make all dialogs clean up when vm/conn disappears
Moves all the window cleanup handling to each class and audit for
all --test-leak-debug errors and fix
2018-03-15 21:24:48 -04:00
Cole Robinson
20d5c1887a baseclass: Export GObject.SignalFlags.RUN_FIRST
Saves some typing and imports
2018-03-15 21:24:48 -04:00
Cole Robinson
1d17b98852 engine: Move most remaining window tracking to UI classes
Kind of a big mess but it was difficult to untangle piecemeal.
Basically this drops nearly all the centralized window tracking
in engine.py and moves it to each UI class. If manager.py wants
to open a details window it does it directly, and vmmDetails tracks
the window object list itself. This simplifies things and makes
the code easier to follow.

There's still some weirdness with vmmConnect and connection callbacks,
but future patches will break those apart.
2018-03-15 21:24:48 -04:00
Cole Robinson
92aea7c565 engine: Have windows increment/decrement windows directly 2018-03-15 21:24:48 -04:00
Cole Robinson
9fa9777f1c engine: Have windows call exit_app directly 2018-03-15 21:24:48 -04:00
Cole Robinson
58f872a205 clone: Convert to per-connection singleton-ish pattern
And convert the dialog VM handling to match other dialogs
2018-03-15 21:24:48 -04:00
Cole Robinson
b94a9fdffb migrate: convert to singleton 2018-03-15 21:24:48 -04:00
Cole Robinson
65b512ae6f delete: Convert to singleton 2018-03-15 21:24:48 -04:00
Cole Robinson
1780d0e9f0 details: Call inspection VM refresh directly 2018-03-15 21:24:48 -04:00
Cole Robinson
2dcfaafcac inspection: Show inspection error in details page 2018-03-15 21:24:48 -04:00
Cole Robinson
6b1278ccda prefs: Add a setting to enable/disable libguestfs inspection
Rather than key it on the library being available. Makes it much
easier to test both modes of behavior.

Fix up a few inspection bugs while I'm in the area, and convert
it to be more singleton like.
2018-03-15 21:24:48 -04:00
Cole Robinson
717ff72684 engine: Move VM action callbacks to vmmenu.py
Call the callbacks directly rather than using signals. engine.py
has become a bit of a catchall for shared functionality and this
is a step towards disentangling it
2018-03-15 21:24:48 -04:00
Cole Robinson
f04b284f21 xmlbuilder: Abstract libxml2 API and cleanup
Moves the libxml2 bits to a separate xmlapi file and class, a bunch
of cleanups to xmlbuilder internals dealing with XML stuff.

The main point is to experiment with different XML library impls,
since libxml2 is unfun to deal with and we are having python3
issues like

https://bugzilla.gnome.org/show_bug.cgi?id=776815
2018-02-20 11:23:37 -05:00
Radostin Stoyanov
4d9c6141dd Convert the output of range() to list
In Python 2 the range() function returns a list [1].
In Python 3 the range function returns a range type [2] which
represents an immutable sequence of numbers [3].

[1] https://docs.python.org/2.7/library/functions.html#range
[2] https://docs.python.org/3/library/functions.html#func-range
[3] https://docs.python.org/3/library/stdtypes.html#typesseq-range
2018-02-06 18:49:17 -05:00
Radostin Stoyanov
978fb25ac7 Wrap keys(), values() in a list
In Python 3 dict.values() [1] , dict.keys() [2] and dict.items() [3]
return a view [4] of the dictionary’s values, keys and items.

In Python 2 these functions return a list. [5] [6] [7]

To resolve this we can convert the result of these function to a list.

[1] https://docs.python.org/3/library/stdtypes.html#dict.values
[2] https://docs.python.org/3/library/stdtypes.html#dict.keys
[3] https://docs.python.org/3/library/stdtypes.html#dict.items
[4] https://docs.python.org/3/library/stdtypes.html#dict-views
[5] https://docs.python.org/2/library/stdtypes.html#dict.items
[6] https://docs.python.org/2/library/stdtypes.html#dict.keys
[7] https://docs.python.org/2/library/stdtypes.html#dict.values
2018-02-06 18:49:17 -05:00
Radostin Stoyanov
6712261510 Python 2/3 division compatability
In Python 2 the classic devision of integers returns an integer
but in Python 3 it might return float.

Example:
- Python 2:          - Python 3:
    >>> 9 / 4            >>> 9 / 4
    2                    2.25
    >>> 9 // 4           >>> 9 // 4
    2                    2
    >>> 9 / 4.0          >>> 9 / 4.0
    2.25                 2.25
    >>> 9 // 4.0         >>> 9 // 4.0
    2.0                  2.0

For more info see: https://www.python.org/dev/peps/pep-0238/
2018-01-27 15:30:17 -05:00
Cole Robinson
94e4e8bf5a details: Tweak sound hwlist entry to be consistent with others
Dropping the colon
2018-01-21 14:42:44 -05:00
Lin Ma
c4c78d2894 details: Show attached disk information in scsi controller page
It helps users to recognize controllers <-> disks mapping relationship.

Signed-off-by: Lin Ma <lma@suse.com>
2018-01-06 16:40:30 -05:00
Lin Ma
12c5945be0 details: Disallow removing the scsi controller if disks attached to it
Through virt-manager, After we removed a virtio-scsi controller which
virtual disks still attach to it, Libvirt will add a LSI scsi controller
for this guest automatically and trigger a lifecycle event, virt-manager
updates and shows this new scsi controller in details panel once it got
the lifecycle event.

It may confuse user that a LSI scsi controller occurs while one removes
the virtio-scsi controller.

This patch prevents removing a scsi controller if any disks attaching to
it.

Signed-off-by: Lin Ma <lma@suse.com>
2018-01-06 16:40:30 -05:00
Lin Ma
066b91b2a0 ui: details: Add ui for showing attached controller devices in the future
Signed-off-by: Lin Ma <lma@suse.com>
2018-01-06 16:40:30 -05:00
Lin Ma
2c06086495 details: Rename the variable 'dev' to 'controller' in refresh_controller_page
Use the more appropriate name for more correctly identifies controllers.

Signed-off-by: Lin Ma <lma@suse.com>
2018-01-06 16:01:54 -05:00
Cole Robinson
29a5e7a230 details: Remove q35 support warning (bz #1443021)
It's been around long enough and in use long enough that this
isn't required anymore
2017-11-25 15:15:08 -05:00
Lin Ma
2e85ad5675 details: Show controller description + index
This patch and future patches can help users to better recognize which
disks connect to which scsi controllers.

Signed-off-by: Lin Ma <lma@suse.com>
2017-11-21 17:18:56 -05:00
Chen Hanxiao
7f1b4cee82 pycodestyle: fix all E125 warnings
Fix all E125:
     Continuation line with same indent as next logical line

   Also remove ignore options of E125

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-10-21 23:26:16 +08:00
Radostin Stoyanov
63fce081ed pycodestyle: Use isinstance() for type checking
This is E721 in pycodestyle [1]:
   "do not compare types, use ‘isinstance()’"

The main differece between "type() is" and "isinstance()" is that
isinstance() supports inheritance. [1]

This can be seen in the example below:
    >>> type(True) is int
    False
    >>> isinstance(True, int)
    True

As we can see in python 'bool' a subclass of 'int'.

[1] https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes
[2] https://docs.python.org/2/library/functions.html#isinstance
2017-10-20 11:49:13 -04:00
Cole Robinson
901dbaf4b7 details: Fix displaying isa panic device 2017-09-15 19:36:58 -04:00
Chen Hanxiao
04e35b2d85 pycodestyle: fix all E124 warnings
Fix all E124:
     Closing bracket does not match visual indentation

   Also remove ignore options of E124

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-09-09 23:21:42 +08:00
Pavel Hrdina
36230c9a18 devicepanic: use model instead of address.type
There are multiple models of the panic device, the address type is only
one and is valid only for "isa" model.

To not break the virt-install/virt-xml the command line parser needs to
be updated.  Before this patch there was only one parameter that
configured the "iobase".  Now the first parameter configures a model
but to keep it backward compatible it follows these rules:

1. there is only one parameter and it matches known model:

  --panic isa

  <panic model='isa'>
    <address iobase='0x505' type='isa'/>
  </panic>

2. there is only one parameter and it doesn't match any model:

  --panic 0x505

  <panic model='isa'>
    <address iobase='0x505' type='isa'/>
  </panic>

3. there are two parameters:

  --panic isa,iobase=0x505

  <panic model='isa'>
    <address iobase='0x505' type='isa'/>
  </panic>

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:09:46 +02:00
Pavel Hrdina
9655f7dfaf virtManager: remove panic iobase from GUI
This is advanced configuration and it's not required to configure
at all to have a working panic device.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:09:46 +02:00
Chen Hanxiao
c92aade081 pycodestyle: fix all E203 warnings
Fix all E203 whitespace before ':'
   Also remove E203 ignore option of pycodestyle

Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-08-11 00:01:38 +08:00
Radostin Stoyanov
b93cc3bbc9 pycodestyle: Do not use bare 'except:'
A bare 'except:' catches all exceptions [1], including SystemExit,
KeyboardInterrupt, and GeneratorExit (which is not an error and should
not normally be caught by user code). In situations where you need to
catch all “normal” errors, you can catch the base class for all normal
exceptions, Exception [2].

[1] https://docs.python.org/2/howto/doanddont.html#except
[2] https://docs.python.org/2/library/exceptions.html#Exception
2017-08-02 13:57:43 -04:00
Cole Robinson
7d03190cb5 spice: s/OK/Close/ in USB redirection dialog (bz 1465907)
To make it more clear that USB redirection happens immediately

https://bugzilla.redhat.com/show_bug.cgi?id=1465907
2017-07-17 15:46:12 -04:00
Cole Robinson
ca56f74ed7 capabilities: Fix model list caching for different archs (bz 1451113)
We could return cached x86_64 results for aarch64 VMs

https://bugzilla.redhat.com/show_bug.cgi?id=1451113
2017-07-17 11:47:01 -04:00
Cole Robinson
a213c8d9e9 details: Allow removing USB controllers on non-x86
It's only x86 where we are forced to have a USB controller (more or
less), so make it VM arch dependent
2017-06-27 15:35:54 -04:00
Cole Robinson
30e2f314a7 details: Don't allow changing model for PCI controller
It's not functional for any case we really care about. Also don't allow
attempting to 'remove' it either.
2017-06-27 15:32:54 -04:00
Cole Robinson
0672b86450 details: Simplify PCIe controller listing
Don't list every <controller>, just filter it all down to one listing.
There isn't anything interesting to tweak anyways, at least not anything
the UI supports.
2017-06-27 15:28:12 -04:00
Cole Robinson
b9d0f267fd connection: Rename is_test_conn -> is_test
To match virtinst connection helper names
2017-06-27 14:13:36 -04:00
Cole Robinson
f551d7e55d Replace file() usage with open()
Same semantics, but the latter is needed for python3
2017-05-05 14:53:12 -04:00
Cole Robinson
62feeb02a8 Switch to python3 style 'except X as Y' notation
Which also works with python2.7
2017-05-05 14:52:11 -04:00
Cole Robinson
cfc4e903b7 details: Remove some debug printing 2017-03-22 12:28:04 -04:00