Commit Graph

114 Commits

Author SHA1 Message Date
Cole Robinson
8079c421bd connection: De-duplicate ui and cli version logging
Remove the open coded version logging in cli.py and virt-manager
connection.py, and move it into virtinst connection open

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-08-01 06:04:48 -04:00
Daniel P. Berrangé
b5e8e58d74 virtinst: include host capbilities in debug log
This is critical information when debugging many user problems.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-07-27 17:53:14 -04:00
Cole Robinson
9da917b8ac connection: Add get_libvirt_data_root_dir()
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-06-20 09:10:59 -04:00
Cole Robinson
79da19ad07 Fix some pylint, exclude some new warnings
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2021-10-04 16:04:33 -04:00
Roman Bogorodskiy
dab099d413 virtinst: prefer SATA bus for bhyve
Choose SATA as a default bus for bhyve as it doesn't support IDE.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
2021-02-15 13:27:48 -05:00
Martin Pitt
4d0e323227 virtinst: Fix TOCTOU in domain enumeration
Similar to commit 49a01b5482, _fetch_all_domains_raw() has a race
condition where a domain may disappear (from parallel libvirt
operations) in between enumerating and inspecting the objects.

Ignore these missing domains instead of crashing.

https://bugzilla.redhat.com/show_bug.cgi?id=1901081
2020-12-01 13:56:30 -05:00
Martin Pitt
49a01b5482 virtinst: Fix TOCTOU in pool and volume enumeration
_fetch_all_pools_raw() and _fetch_vols_raw() have a race condition where
a pool/volume may disappear (from parallel libvirt operations) in
between enumerating and inspecting the objects.

_fetch_vols_raw() already expected that failure in the loop, but not for
the initial storagePoolLookupByName() call.

Also tighten the expected exception: This *should* crash on errors like
AttributeError or SystemExit, just not on dynamic libvirt errors. (Bare
exceptions are highly frowned upon in Python)

https://bugzilla.redhat.com/show_bug.cgi?id=1894359
2020-11-08 17:01:40 -05:00
Cole Robinson
fa82508e53 virt-manager: drop libvirt 0.6.0 version check
This is comically old and completely unrealistic anyone would
attempt to use that nowadays.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-29 12:37:12 -04:00
Cole Robinson
bc9d6cf6d5 Drop some explicit openvz handling
I don't think many, if any, people are using virt-manager with
openvz. Drop the specific handling the filesystem UI, users can use
the raw XML editor if they need special behavior

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-26 15:20:05 -04:00
Cole Robinson
380a44318a virtinst: Centralize in_testsuite checking
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 19:08:27 -04:00
Cole Robinson
e79b550419 Fix pylint with latest pylint version
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-03-30 16:04:12 -04:00
Cole Robinson
bea5e56c26 virtinst: connection: Add is_privileged
Replace the is_session and is_system distinction with variants
of is_privileged. This matches what libvirt uses internally, and
will help with supporting qemu:///embed at some point

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 07:05:11 -05:00
Cole Robinson
9a0d49a718 virtinst: uri: Rework MagicURI to work with passed in fakeuri
Rather than individual options for each possible hypervisor,
and annotations like 'remote' or 'session', just have it take a
fake URI to mock

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-02-03 07:05:11 -05:00
Cole Robinson
d9d5caad0d virtinst: connection: Drop is_closed() helper
We have is_open, just use that

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-28 11:42:33 -05:00
Cole Robinson
eb5e087366 tests: Add full coverage for pollhelpers and VirtinstConnection
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson
cf76c1517c connection: Simplify keepAlive error checking
This checking is overly involved, keepAlive is not an essential
feature, so just log an error if it fails

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson
f023b9f8c9 connection: Drop dead __getattr__ code
__getattr__ is only called when an attr is not already found
in __dict__, so this path will never trigger

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson
7ccba87966 connection: Share helper function for fetch APIs
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson
156926b78d connection: Drop glib usage for cache dir
Our fallback implementation is the same as glib for all usage we
care about, so don't bother with calling glib

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson
f107e39989 Switch to more traditional logging structure
Init a shared log instance in virtinst/logger.py, and use that
throughout the code base, so we aren't calling directly into
'logging'. This helps protect our logging output from being
cluttered with other library output, as happens with some
'requests' usage
2019-06-17 00:12:31 -04:00
Cole Robinson
95d685420b connection: Fix --location with --connect test:///default
Some scratchdir changes made us now attempt vol upload, which doesn't
work for the test driver. Make sure we don't attempt kernelupload
for this case
2019-06-08 12:58:38 -04:00
Cole Robinson
756dab784c kernelupload: Add test suite mocking 2019-06-08 09:41:52 -04:00
Cole Robinson
e9dcb4056d installer: Rework some test suite urlfetcher hacking
Rather than alter where we save the files, behave like normal but
only change what we store in the XML
2019-06-07 21:40:47 -04:00
Cole Robinson
c2de4d7c36 util: Move get_cache_dir to VirtinstConnection
Renaming it get_app_cache_dir so it doesn't conflict with get_cache_dir
usage in virtManager
2019-06-07 17:53:15 -04:00
Cole Robinson
b34800decd util: Move local_libvirt_version to VirtinstConnection
Make it private because we want people to use
conn.local_libvirt_version, and adjust the one other user
2019-06-07 17:15:10 -04:00
Cole Robinson
f85e6def55 support: Convert callers to the new format 2019-06-07 16:26:03 -04:00
Cole Robinson
566a4681a8 support: Rework support check invocations
SupportCache.check_support(SUPPORT_FOOBAR, args) becomes
SupportCache.foobar(args)

And SupportCache absorbs the caching infrastructure from
VirtinstConnection.

For now we add some hackery to hide the API change from callers, but
this will be undone in the next patch
2019-06-07 16:25:39 -04:00
Cole Robinson
3d2f678c0f support: Add a SupportCache class
For now it just contains all the SUPPORT ID numbers and public
functions.
2019-06-07 15:56:23 -04:00
Cole Robinson
281e796538 connection: Use weakref.proxy instead of weakref.ref
Works more like expected, let's us drop a hack in devicedisk
2019-06-07 15:53:36 -04:00
Cole Robinson
50addfebca nodedev: Drop the non-standard .parse() handling 2019-06-05 16:35:34 -04:00
Cole Robinson
7eaf036acf virtinst: Remove stable_defaults concept
This switch says: if we detect a rhel host, use special version
checks that match rhel backports. This pattern sucks. The way
forward is to have libvirt advertise the bits that are supported,
through domcapabilities. Then virt-manager/virtinst can react
as appropriate.
2018-10-06 19:45:51 -04:00
Cole Robinson
fb1bb26373 support: Drop lots more checks
- Remove anything for less than qemu 0.12 or libvirt 0.10, basically
  rhel6 vintage stuff
- Open code some simple checks
- Remove some that are only used for unnecessary error reporting
2018-08-31 22:21:15 -04:00
Cole Robinson
967ca4eeda virtinst: Drop direct 'support' usage
Except from connection. This requires some reorg in clitest and
some minor changes in a few other places
2018-08-31 18:31:17 -04:00
Cole Robinson
2eaff7fdcf support: Remove getversion/getlibversion checks
They are only used in one place, just handle it there
2018-08-31 18:31:17 -04:00
Cole Robinson
2b41e130d8 connection: rename fetch_all_guests->fetch_all_domains
The virtinst class is erroneously called Guest, but these
functions are dealing with libvirt <domain> XML, so rename them
2018-08-31 16:50:46 -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
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
Marc-André Lureau
39721cbe1b connection: support checking for a list of features
Make check_support() accept a list of features.

This will let tests have more complex conditions on the features they
require.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2018-02-22 16:23:40 -05:00
Cole Robinson
7cf0b310cc capabilities: Move machine canonicalizing to capsinfo
Rather than overright XML content on every parse
2018-02-14 11:08:09 -05:00
Cole Robinson
ec0d3072c0 virtinst: connection: Fix error caching new pool
$ virt-install --connect test:///default --name foo --ram 64 --import --disk /tmp/idontexist.img
ERROR    Error: --disk /tmp/idontexist.img: 'vols'
2017-08-30 10:34:17 -04:00
Cole Robinson
1a09a05dc7 tests: Add a clone test for importing nvram directory
Need to use some callback magic to fake it like there's a file in
an existing directory
2017-07-20 17:51:06 -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
55aa23b400 connection: Return copys of cached object lists
Incase any users manipulate the lists, we don't want that to affect
our caching. Could prevent future mistakes
2017-07-20 17:28:38 -04:00
Cole Robinson
4e4a6c817f connection: Rework cache function layout slightly
Have the internal polling functions not touch the connection cache.
This let's us not worry about the connection cache in the test suite,
where clear_cache wasn't 100% correct.
2017-07-20 17:28:38 -04:00
Cole Robinson
98b5ea8b2c connection: Drop disabling of cache_object_fetch
All cases we care about either provide their own callbacks, or
explicitly want this caching, so enable it unconditionally
2017-07-19 12:57:36 -04:00