Commit Graph

170 Commits

Author SHA1 Message Date
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
Cole Robinson d5e5068699 engine: Update details window mapping when VM is renamed
Fixes this issue:

- Rename VM from 'foo' to 'foo1'
- Create new VM named 'foo'
- It raises 'foo1' window
2015-11-03 16:01:04 -05:00
Cole Robinson a91137dbdd engine: Clean up some object lifecycle leaks
pygobject doesn't seem to choke on debug_leak_check anymore, so we
can use it to find object leaks. just doing a few for now since it's
generally not a big deal.
2015-09-20 15:30:00 -04:00
Cole Robinson a9d3cbd6cc connection: Add infrastructure to blacklist failing objects
It happens every now and then that a libvirt bug means calling XMLDesc
on an object will always fail. For example:

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

We don't handle this very well and it can bleed into many other parts of
the code in a bad way. So if the initial polling of the object fails,
blacklist it entirely and ignore it for all future polling.
2015-09-17 15:51:52 -04:00
Cole Robinson 053cda8de7 virt-manager: Add hidden options --test-old-poll and --test-no-events
For easy testing of fallback codepaths
2015-09-17 15:18:22 -04:00
Cole Robinson 5f0433700b connection: Don't immediately encode pretty_name into gconf
Allows the app to change the defaults and users aren't stuck with the
bad names
2015-09-15 19:35:30 -04:00
Cole Robinson 71362cfb7e connection: Tweak pretty_name for Xen connections 2015-09-15 19:30:09 -04:00
Cole Robinson d896dd7347 create: Allow switching between KVM and TCG for armv7l (bz 1214592)
Otherwise we tried to always force KVM which reduces the usefulness
here. We still get the defaults right though

https://bugzilla.redhat.com/show_bug.cgi?id=1214592
2015-09-14 19:27:48 -04:00
Cole Robinson 1d7b74ba52 uri: Add a MagicURI class for handling magic virtinst URIs
And document it
2015-09-06 12:00:25 -04:00
Cole Robinson 77423e7a8d connection: catch more errors in filter_nodedevs (bug 1225771)
https://bugzilla.redhat.com/show_bug.cgi?id=1225771 Has an example of
libvirt failing to generate nodedev XML, so handle that too.
2015-06-09 11:41:39 -04:00
Cole Robinson 68908c2d81 connection: Handle nodedevs disappearing in filter_nodedevs (bz 1225545)
Not exactly sure how we end up with a nodedev in the list that doesn't
have cached XML, but whatever
2015-06-06 14:21:05 -04:00
Giuseppe Scrivano 2c1e482b2d virt-manager: fix --show-host-summary error windows flooding
Break an endless loop vmmHost.overview_name_changed ->
vmmHost.conn_state_changed -> vmmHost._overview_name_changed.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-11 20:20:10 +02:00
Cole Robinson 88e18c86d3 connection: Fix sending net-removed signal 2015-05-07 12:30:28 -04:00
Cole Robinson cb0eaf23d8 conn/domain: Privatize stats list 2015-05-04 18:42:17 -04:00
Cole Robinson fbf841151d conn/domain: Condense the internal stats APIs 2015-05-04 18:05:54 -04:00
Cole Robinson 892e13d2c0 connection: Tweak pretty names a bit 2015-05-02 19:20:18 -04:00
Ján Tomko be7611b645 connection: refresh domain XML on device hotplug
Listen to the VIR_DOMAIN_EVENT_ID_DEVICE_ADDED event
too, added by libvirt 1.2.15.

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

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2015-04-29 09:52:10 -04:00
Cole Robinson 62ad0e91ee migrate: Big reworking of the dialog
It's largely the same, but now

- The code is better organized
- The UI is much more streamlined, only showing relevant fields when
  required.
- We warn about the hostname/URI cases that we know libvirt will error on
- Drop some of the attempts at being smart, and just mimic what libvirt
  will do.
2015-04-21 17:15:58 -04:00
Cole Robinson 6dbe19bd83 libvirtobject: Fix deleting a running VM
The recent XML rework wasn't catching when a domain disappears while
trying to refresh it's state from the event loop.
2015-04-13 18:24:46 -04:00
Cole Robinson 10ad151d4b connection: Clarify tick functions and who should use them 2015-04-13 16:56:46 -04:00
Cole Robinson e9495110ca connection: Refresh XML for every libvirt object event
We tried to split up status vs XML refreshing, but they are tied together
in various ways (like the runtime XML changes when a VM starts). This
was breaking console connecting when starting a VM
2015-04-11 17:24:30 -04:00
Cole Robinson 839ce682b1 Drop support for non-managed save/restore
All major drivers either support it, or don't support save at all,
so I think we can safely drop it. If people still need it they can
get by with virsh.
2015-04-11 13:52:48 -04:00
Cole Robinson 3d2afbaf6f connection: Allow setting a custom 'pretty name' (bz 784701)
We've had multiple requests over the years for something similar. People
might have to connect to multiple IP addresses, or really large hostnames,
that become difficult to distinguish in the UI.

Add a field in the host details page that allows setting a custom name,
and store it in gsettings.
2015-04-11 13:39:25 -04:00
Cole Robinson 4781ad6cd6 connection: Simplify manager row 'pretty name' handling
Unify all the callers, and use some UI ellipsizing to handle
crazy long hostnames.

This drops the conn name collision prevention stuff which can be
useful when you have lots of similar connection names. But upcoming
patches will make it mostly redundant.
2015-04-11 12:57:32 -04:00
Cole Robinson fc171fc31d connection: Bunch of minor tweaks handling TCP URIs 2015-04-11 12:08:57 -04:00
Cole Robinson 8c107f87f9 host: Remove some redudant conn details
And some minor UI spacing fixes
2015-04-11 11:29:03 -04:00