Commit Graph

195 Commits

Author SHA1 Message Date
Lin Ma
4484f473cd char: Track/Show the state of virtio channels in channel details
crobinso: Add a test case

Signed-off-by: Lin Ma <lma@suse.com>
2018-07-12 15:25:23 -04:00
Lin Ma
8f78b33d1c Output the qemu guest agent lifecycle events in debug mode
Signed-off-by: Lin Ma <lma@suse.com>
2018-07-12 15:19:34 -04:00
Lin Ma
099ec95ac8 connection: Add callback parameter for function _add_domain_xml_event
Further patches will pass in the callback instead of the default one.

Signed-off-by: Lin Ma <lma@suse.com>
2018-07-12 15:19:34 -04:00
Cole Robinson
ffab20782f connection: Handle more openauth cred types
Like ECHOPROMPT which is needed for libssh hosts file management.
Sync the two implementations a bit
2018-05-03 06:16:28 -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
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
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
20d5c1887a baseclass: Export GObject.SignalFlags.RUN_FIRST
Saves some typing and imports
2018-03-15 21:24:48 -04:00
Cole Robinson
6959a41ff2 connection: Drop vm-added emission on connect
We don't use this for most other signals and it's kind of unexpected
2018-03-15 21:24:48 -04:00
Cole Robinson
fbf1bc80b5 connection: Dispatch object remove signals on close 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
b3c69a05a2 connection: Fix connecting to conn with no objects
Our thread handling leaves us permanently in the 'connecting' state
2018-03-15 21:24:48 -04:00
Cole Robinson
c6c24c59ac connection: Remove unused argument 2018-03-15 21:24:48 -04:00
Radostin Stoyanov
1ae5c4ff75 pylint: Resolve logging-not-lazy
A new Python checker was added to warn about using a + operator inside
call of logging methods when one of the operands is a literal string.

https://pylint.readthedocs.io/en/latest/whatsnew/1.8.html

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-03-03 16:04:12 -05:00
Cole Robinson
1d8cd69f82 connection: Map event vals to libvirt enum names in debug output
Shove this logic into its own class LibvirtEnumMap in its own file,
since this may grow over time.
2018-02-27 12:31:56 -05:00
Cole Robinson
da0d0600da connection: Show event name in debug output for xml misc events 2018-02-27 11:59:15 -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
Chen Hanxiao
3e3ffe1e2d pylint: remove a unnecessary pass
pylint complains:
  Unnecessary pass statement (unnecessary-pass)

Reviewed-by: Pavel Hrdina <phrdina.redhat.com>
Signed-off-by: Chen Hanxiao <chenhanxiao@gmail.com>
2017-12-22 21:48:35 +08:00
Cole Robinson
c174b5509f connection: Another py3 exception variable fix 2017-12-20 14:16:13 -05:00
Cédric Bosdonnat
60968fa259 py3: store exception variables for use outside except
In python3 exceptions aren't defined outside the except block. Leading
to 'UnboundLocalError: local variable 'e' referenced before assignment'
errors.

To work around this, store the local variable into one that will have a
longer life.
2017-12-20 14:13:27 -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
Pavel Hrdina
12117ba148 connection: change blacklist from array to dict
If initialization of new object fails we put it into blacklist and
newer parse it again until virt-manager is restarted.  This helps to
reduce number of failures if some object fails initialization every
time.

However, there are some cases where we put object into blacklist
incorrectly.  One of the cases is while creating new storage pool.
If the storage pool requires to be build before started but user
doesn't check to build it as well the start of the new storage pool
fails.  The issue is that at first we define that object which triggers
a lifecycle event for storage pool and queues new poll operation over
storage pools.  Before the poll operation starts the starting of the
storage pools fails and we undefine that storage pool before it is
initialized.  The initialization fails and the storage pool is never
managed from that point.

This patch modifies the blacklist to allow 3 failures before we give up
on a specific object and if the object is initialized without error
we remove it from blacklist completely.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1446486
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1093394

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:12:12 +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
a9903ae0e0 connection: Remove clear_cache callback
It doesn't actually accomplish what we want for the virt-manager case,
and cache_new_pool should cover our needs now
2017-07-20 17:30:37 -04:00
Cole Robinson
4792c7cb8e connection: Add a default impl of cache_new_pool
Inserts it into the cache, and adds its associated volumes too
2017-07-20 17:30:36 -04:00
Cole Robinson
a9d9c0d035 connection: rename s/add_new_pool/cache_new_pool/g
Better describes exactly what's going on
2017-07-20 17:29:55 -04:00
Cole Robinson
5cffae0c68 connection: Fix virt-manager UI cache_new_pool impl
The current implementation calls _new_object_cb, which isn't
expected to be run from a non-main thread, and can cause crashes.

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

Switch the impl to just wait for 3 seconds for the pool to show
up in our cache.
2017-07-20 17:28:36 -04:00
Cole Robinson
a0a8470362 connection: Cache host arch CPU model list on startup
Rather than hardcode x86_64
2017-07-17 11:47:01 -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
4e7a6ad728 tests: pylint: Silence/fix a bunch of new warnings 2017-06-16 12:54:56 -04:00
Pavel Hrdina
1686511886 virtManager.connection: introduce cb_add_new_pool
The cb_add_new_pool callback will add a newly created storage pool
into virt-manager's cache so we don't have to wait for the libvirt
event to be handled.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-05-22 19:43:49 +02:00
Cole Robinson
34c193108c Use python3 compatible octal notation 2017-05-05 14:52:11 -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
Mikhail Feoktistov
5a70b946c7 Add GUI to create wizard for virtuozzo containers
Add virtuozzo hypervisor to connection list.
Add radio buttons for choosing VM or container virtualization type.
New wizard window for setting template name for containers.
2017-03-22 11:00:50 -04:00
Jovanka Gulicoska
44dd5ae0a6 Fix storage pool refresh event signal
When creating a storage volume, it wouldn't show up in the list
since the refresh signaling was busted.
Code was using VIR_STORAGE_POOL_EVENT_REFRESHED which was dropped
from lifecycle event type, refresh is introduced as top level
event.
2016-08-19 11:06:44 -04:00
Jovanka Gulicoska
bc42fac710 Use node device update event support
API will be available in upcoming libvirt 2.2.0
2016-08-17 09:03:10 -04:00
Jovanka Gulicoska
ead5fdffff Use node device lifecycle events
API will be available in upcoming libvirt 2.2.0
2016-08-11 10:14:30 -04:00
Cole Robinson
9a67fc4d6e storagepool: Don't double invoke 'refresh' when events are present
We need to tweak refresh() handling to work similar to the shared
XML and status caching in libvirtobject.py: when the user manually
invokes the refresh() operation, and storage events are set up,
we just invoke the refresh() but let the event loop handle
refreshing the cache.

This fixes a backtrace when invoking a manual refresh via the
host details dialog
2016-06-23 15:38:31 -04:00
Cole Robinson
cdf5d32434 libvirtobject: Rename refresh_...->recache_from_event_loop
Since 'refresh' is kind of ambiguous now that we support pool
refresh events
2016-06-23 14:48:04 -04:00
Cole Robinson
53459cb0f6 conn: Don't process any pool REFRESHED events during conn startup
When new pool objects appear, we call refresh() on them, to ensure
we have the latest data (in case manual changes were made to the
storage pool directory behind libvirt's back, which is quite common).

However with the storage event support, this results in lots of
REFRESHED signals during initial connection startup, which kick
off redundant object polling.

Avoid storage REFRESHED events if they come in before the connection
is finished starting up to skip this redundant polling.
2016-06-20 17:07:26 -04:00
Cole Robinson
6a740ff91c conn: Build default pool before registering events
Otherwise this triggers some event calls and results in double
polling during connection startup. Doesn't cause any issues, just
spams the logs and needless libvirt calls
2016-06-20 17:03:12 -04:00
Jovanka Gulicoska
b904d62e47 Use storage pool lifecycle events
API will be available in upcoming libvirt 2.0.0
2016-06-18 11:08:14 -04: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
Cole Robinson
f4dfb6de9d Fix recent pylint/pep8 output 2016-04-18 16:42:12 -04:00
Pavel Hrdina
c39592ae7b localization: mark several strings as translatable
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-02-06 16:25:08 +01:00
Pavel Hrdina
89c3638b63 connection: fix detection that libvirtd is stopped
In case that libvirtd is stopped, we could receive another type of error
from libvirt "libvirtError: internal error: client socket is closed".
This one is usually reported from local connection.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-01-08 10:21:42 +01:00