Commit Graph

128 Commits

Author SHA1 Message Date
Cole Robinson ae8a4f3db3 engine: Fix first run startup error (bz 1674040)
unitpath can be used uninitialized

https://bugzilla.redhat.com/show_bug.cgi?id=1674040
2019-02-08 15:50:15 -05:00
Cole Robinson a391613b9f engine: More logging for --test-first-run 2019-02-03 15:46:32 -05:00
Cole Robinson a00152d72a manager: fix some --test-leak-debug issues 2018-10-13 14:27:10 -04:00
Cole Robinson a1d1b4d5a0 engine: Drop PackageKit integration
On first run of the app we will check to see if libvirt and qemu
are installed, and if not, offer to install them. In theory anyways.
In practice this stuff breaks repeatedly and is a pain to test because
every desktop has their own API provider with subtly different behavior.

My last round of testing about 12 months ago: apper on KDE was completely
busted and apparently unmaintained (although that may have changed lately),
gnome-software is the latest packagekit provider on gnome and completely
changes the semantics of the API compared to old style gnome-packagekit
that break a lot of virt-manager assumptions.

So I'm tired of it and want it all gone. Still use systemd to try and
check if libvirtd is running, and provide error messages at startup
to guide people.
2018-10-07 14:24:05 -04:00
Cole Robinson 75c64151b1 engine: Exit app if if --show-X bits fail
We were missing some cases. Simplify the code while we are at it
and add some extra ui test cases
2018-09-30 20:55:18 -04:00
Daniel P. Berrangé 48e32b429d Fix copyright header to specify GPLv2 or later, not GPLv2 only.
The copyright headers in every file were chjanged in this previous commit

  commit b6dcee8eb7
  Author: Cole Robinson <crobinso@redhat.com>
  Date:   Tue Mar 20 15:00:02 2018 -0400

    Use consistent and minimal license header for every file

Where before this they said "

  "either version 2 of the License, or (at your option) any later version."

Now they just say

  "GNU GPLv2"

This fixes it to say "GNU GPLv2 or later" again.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-04 16:51:37 -04:00
Daniel P. Berrangé 24a8b66b35 avoid referencing ConnectError if it is None
Currently it throws an exception at startup which is hidden unless you
run with --no-fork

  $ python3 ./virt-manager --no-fork
  Traceback (most recent call last):
    File "/home/berrange/src/virt/virt-manager/virtManager/baseclass.py", line 225, in wrap_func
      return func(*wrapargs)
    File "/home/berrange/src/virt/virt-manager/virtManager/engine.py", line 206, in conn_open_completed
      ConnectError.details)
  AttributeError: 'NoneType' object has no attribute 'details'

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-04 16:51:37 -04:00
Cole Robinson b6dcee8eb7 Use consistent and minimal license header for every file 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 defdfd4b51 engine: Fix backtrace from manager->exit 2018-03-17 18:47:13 -04:00
Cole Robinson b5377f8f0f engine: Make a decorator function for showing startup errors 2018-03-17 18:46:40 -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 483a8de6c1 systray: Change window tracking a bit
We should only prevent app closing if the systray is actually embedded
2018-03-17 12:18:38 -04:00
Cole Robinson dac860e8ce engine: Show modal startup errors if window open fails 2018-03-16 19:09:55 -04:00
Cole Robinson ee817c32ce s/connect_opt_out/connect_once/ for open-completed callback
Forgot about that helper function...
2018-03-16 18:05:52 -04:00
Cole Robinson ad632383c8 virt-manager: if new --connect fails, don't save the URI 2018-03-16 18:05:52 -04:00
Cole Robinson dabbc8d5bd engine: Remove centralized conn.open handling
Move connection opening logic to each caller, since needs are
slightly different.
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 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 6180a3c81f engine: Cleanup function names, comments, etc. 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 f088537798 engine: break out vmmConnectionManager
Have a separate class for tracking the connection list, and emitting
conn-added and conn-removed signals. It exists as a singleton instance
that UI classes can talk directly to
2018-03-15 21:24:48 -04:00
Cole Robinson befafe9dc7 engine: connect conn-added in UI classes
This creates a weird situation where we pass the engine to those
classes UI functions, but this is a step towards untangling that.

While here, get rid of the conn-added connect magic and add a
simpler way to access the connection list from the engine
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 33def3c4af preferences: Convert to singleton 2018-03-15 21:24:48 -04:00
Cole Robinson b6a61818af about: Convert to singleton 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 6ad6f44920 connection: Call virConnectClose and log the return value
This can help us find object leaks within the code. virConnectClose
is just a deference and will return 1 if other references are still
floating around.
2018-03-15 21:24:48 -04:00
Cole Robinson 7e1cddef18 virt-manager: Add hidden --test-leak-debug option
That enables the pre-existing debug_ref_leaks behavior
2018-03-15 21:24:48 -04:00
Cole Robinson 56cf42e6ea engine: Only init systray if launching new app
We were doing it too early, and the systray could pop up for a moment
when connecting to a remote app
2018-03-15 21:24:48 -04:00
Radostin Stoyanov 5854b7bb17 Replace "Queue" with "queue"
The Queue module has been renamed to queue in Python 3. [1]

[1] https://docs.python.org/2/library/queue.html
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
Cole Robinson b4a2c46f6a virt-manager: If --connect passed, wait for it to init
...before showing the UI. This helps the UI test suite be less
racy at least.
2018-01-09 13:51:53 -05:00
Cole Robinson ab1b4f8628 virt-manager: Gracefully exit app on ctrl-c, not sys.exit
Will be needed for uitests coverage support
2018-01-09 09:57:20 -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
Cole Robinson 2fe444323b engine: Don't attempt --test-first-run if --connect passed
Which we do for uitests, we don't want it trying to connect to
qemu:///system while uitests are running
2017-10-20 11:47:15 -04:00
Christian Ehrhardt e76b904656 engine: improve message about missing binaries
The message when failing to connect can be misleading as package names
will differ per Distribution as well as not apply for e.g. self built
binaries.
This changes the message in a way to be more generic not implying literal
package names.

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
2017-08-16 17:32:18 -04:00
Cole Robinson cf522bfc0c engine: Remove manual line wrapping of connect error messages
This was needed once upon a time when the UI was wrong, but it
wraps correctly now
2017-08-07 18:17:00 -04:00
Cole Robinson 9e7426b64f engine: Drop offer to install askpass package (bz 1354304)
Dealing with packagekit across desktops and in a consistent
manner is a pain. This code path is rarely exercised and difficult
to test, so just fallback to giving a hint error message and
let the user install if they care.
2017-08-07 17:41:52 -04:00
Cole Robinson 4cdae27cb2 engine: With --test-first-run, don't try default URI detection
default URI detection gets testing via the 'connect' dialog, this
makes it easier to test the fallback when no packages are locally
present
2017-08-07 17:27:30 -04: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 62feeb02a8 Switch to python3 style 'except X as Y' notation
Which also works with python2.7
2017-05-05 14:52:11 -04:00
Pino Toscano 409ae0bcf4 inspection: add a way to refresh the inspection info
Introduce a 'Refresh' button in the 'Information' page of a VM, and
wire it up so a refresh of the inspection data for it is triggered.
2017-03-01 16:25:47 -05:00
Cole Robinson 435de2d40c pylint: Fix some issues with F25 version 2016-12-13 12:36:49 -05:00
Pavel Hrdina b327191a20 maint: fix pylint warnings wrong-import-order
standard import "import logging" comes before "from gi.repository import GLib"

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-06-07 17:37:06 +02:00