Commit Graph

6431 Commits

Author SHA1 Message Date
Cole Robinson
cc1d34edaf cli: Drop exec() and eval() usage
We have helpers that do manually do what we were using it for. Gives
a nice speedup too
2019-05-12 17:22:13 -04:00
Cole Robinson
4ecc4930dd cli: Rename __init_class__ to _init_class
Seems like a bad idea to define our own double underscore function,
incase a future python version wants to use that name.

Tweak some minor InitClass details while we are in the area
2019-05-10 14:02:44 -04:00
Cole Robinson
3bd7c7c55b cli: Clarify guest_propname and list_propname
There's conflicting 'propname' naming now, so rename some usage
to match
2019-05-10 14:02:44 -04:00
Cole Robinson
764bf1ad29 xmlapi: rename and move get_prop/set_prop to util
Change to set_prop_path and get_prop_path to make it a bit more
clear, and move out of xmlapi since it's not xml specific
2019-05-10 14:02:44 -04:00
Cole Robinson
0d90bbd5d5 cli: Drop support_cb
This is some extra validation to catch some char opt combos that
libvirt doesn't explicitly reject. It's not really interesting and
dropping it simplifies the cli parsing
2019-05-10 14:02:44 -04:00
Cole Robinson
e0d05cc79f cli: Rename attrname to propname
propname always refers to a virtinst object property/XMLProperty,
change the name to match
2019-05-10 14:02:44 -04:00
Cole Robinson
766dcc4e67 cli: Drop the dict() handling for parsedata
Require passing in a Class. Let's not complicate the cli machinery
any more than it has to be
2019-05-10 14:02:44 -04:00
Cole Robinson
7ec4c48268 cli: Swap add_arg cliname and attrname argument order
Every add_arg call needs a cliname (the option name on the command
line), but not all calls need an attrname (the propery/method name
of the virtinst API object) because they rely on a callback for
less simple functionality.

So swap the ordering so that cliname is the first argument. Drop
redundant attrname=None arguments and validate that either attrname
or cb=X is passed.
2019-05-10 11:36:23 -04:00
Cole Robinson
274d686252 host: Ellipsize long net/pool object names
https://bugzilla.redhat.com/show_bug.cgi?id=1698088#c5

Reported-by: Martin Kolman <mkolman@redhat.com>
2019-04-18 15:31:14 -04:00
Pino Toscano
23b87295fc details: avoid extra check when showing application names
The current code already prefers the "display name" over the "name" of
each application; hence, use "name" only if the "display name" is not
available.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-18 13:44:34 -04:00
Pino Toscano
4f79c22bf4 inspection: switch to g.inspect_list_applications2
Use the non-deprecated g.inspect_list_applications2() call to list the
installed applications.  It is available since libguestfs >= 1.20, which
is lower than the current requirement (i.e. 1.22).

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-18 13:44:34 -04:00
Pino Toscano
83f1544d32 inspection: create and use a separate vmmInspectionApplication
Instead of passing around the raw results of
g.inspect_list_applications(), create an helper vmmInspectionApplication
object with the data of an inspected application that we use.  This is
done for different reasons:
- when using the data, it is easier to use member variables instead of
  looking up values in a dictionary
- we keep only the data needed, slightly lowering the memory/objects
  used for the inspected applications
- it will be easier to switch from g.inspect_list_applications() to
  g.inspect_list_applications2() without changing code outside the
  inspection code

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-18 13:44:34 -04:00
Pino Toscano
a9277d22b5 spec: suggest python3-libguestfs
virt-manager can optionally use libguestfs for inspecting the guests, so
at least add it as suggestion.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-17 19:11:12 -04:00
Pino Toscano
b8b8aa5774 Document the optional libguestfs usage.
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-17 19:11:12 -04:00
Pino Toscano
6a5b06b8ed inspection: save the package format
Save the package format of a guest as part of its inspection data, so
later on it can be used to tweak other results (like the version of
installed packages).

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-17 19:11:12 -04:00
Pino Toscano
ceed47558c inspection: fix check of mounted filesystems
The old code basically always set filesystems_mounted to True, even when
no filesystems were mounted successfully, unless
g.inspect_get_mountpoints() failed (very unlikely).

Instead, set it when at least one filesystem is mounted; considering
that the first filesystem to be mounted is usually /, then failing to
mount it will usually prevent the mounting of the others.  In any case,
we can try to extract data even when only / is mounted, which can work
depending on the mount points of the guest.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-17 19:11:12 -04:00
Pino Toscano
ac2949bab3 inspection: simplify mount points sort/mount
Rely on the Python 3 sorting facilities to sort the mount points using
a key based on the length of the mount point, doing the same effect as
the old compare function.

As side change required by this, enable python_return_dict on the
GuestFS handle, so we get proper hashes instead of lists.  This requires
libguestfs 1.22, which is 6 years old by now (and other virt-manager
requires are way more recent than that).

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-17 19:11:12 -04:00
Pino Toscano
cf9f4a73f4 inspection: remove extra try/catch block
This block only catches failures in g.inspect_get_mountpoints(), as the
g.mount_ro() calls are already within own try/catch blocks.  Considering
that:
- g.inspect_get_mountpoints() is a simple API to query one of the
  results of the inspection, it is very unlikely that it fails
- the whole _inspect_vm function (that contains the inspection code) is
  already run within an own try/catch block, so even a failure in
  g.inspect_get_mountpoints() will not crash virt-manager
then just remove this extra try/catch block.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-17 19:11:12 -04:00
Cole Robinson
96beae9ba3 tests: Don't use bogus net model names
Libvirt is rejecting them now
2019-04-17 10:07:35 -04:00
Cole Robinson
3980f79ab8 guest: Fix pylint 'unneeded-not' 2019-04-14 20:49:52 -04:00
Cole Robinson
03fe68dedd addhardware: separate device building and explicit validation
Have two clear paths. This will be useful when we add direct XML
editing UI
2019-04-14 20:48:36 -04:00
Cole Robinson
550e8f243c Fix pylint 'Unnecessary pass statement' 2019-04-14 20:22:56 -04:00
Cole Robinson
cda9525a87 netlist: separate device building and explicit validation
Have two clear paths. This will be useful when we add direct XML
editing UI
2019-04-14 20:22:02 -04:00
Cole Robinson
11ffe2e569 addstorage: separate device building and explicit validation
Have two clear paths. This will be useful when we add direct XML
editing UI
2019-04-14 20:22:02 -04:00
Cole Robinson
eb870e4658 addstorage: Drop prompting to start default pool
Just let virtinst try and start it for us, and fail if it's the
startup fails. Prompting about this doesn't really buy us anything
2019-04-14 20:22:02 -04:00
Cole Robinson
1cc2a0ae8b storage: Add ensure_pool_is_running
We pretty much require a referenced storage pool to be running if
it's intended to be used as a virt-install or virt-manager requested
disk. So add a helper to start a pool if needed and optionally refresh
it
2019-04-14 20:22:02 -04:00
Cole Robinson
202ac53831 addhardware: Drop self._dev
Return the generated virtinst device up through the call chain.
Makes the flow a lot more sensible, and will be needed for separating
device building from extra UI validation/prompting
2019-04-14 20:22:02 -04:00
Cole Robinson
5a90b669ff addhardware: Use vmmHost style error page paradigm
Rather than making the error page one of the hardware pages which is
the wrong layering approach
2019-04-14 18:24:35 -04:00
Cole Robinson
c3ea2d3119 host: Don't try to confirm changes on window close
It's a bit of a pain to get right, so only do it on net/pool list
change
2019-04-14 18:24:04 -04:00
Cole Robinson
f7ba2f2f99 error: Add helper confirm_unapplied_changes
For the common dialog we use to confirm changes
2019-04-14 18:24:04 -04:00
Cole Robinson
f246895a66 storagelist: Modernize code style
* Have clear UI callbacks
* Group functions
* Simplify active_edits
* Remove no longer needed _reset_pool_state
* Clean up selection callbacks
2019-04-14 18:24:04 -04:00
Cole Robinson
86a13699ce host: separate out hostnets.ui and hostnets.py
Helps organize things by limiting the files to a single class of
operations, and follows the storagelist.py pattern
2019-04-14 18:23:58 -04:00
Cole Robinson
891968085c host: Modernize code style
* Privatize non-public functions
* Have clear UI callbacks
* Group functions
* Simplify active_edits
* Remove no longer needed reset_net_state
2019-04-14 17:05:14 -04:00
Cole Robinson
de773179ef host: Remember window dimensions
Like we do for details and manager windows, save window size in
gsettings and remember it across app runs
2019-04-14 17:05:14 -04:00
Cole Robinson
3784864e10 baseclass: Add is_visible
Remove the duplicated implementations everywhere
2019-04-14 17:05:14 -04:00
Cole Robinson
5367f3343a details: Clean up vsockdetails on window cleanup 2019-04-13 16:45:26 -04:00
Pavel Hrdina
413858f3dc domcapabilities: actually fix detection if host-model is safe to use
The original code created a new list which had True/False items.  The
only case where the returned value would be False is for empty list
which never happens in real environment.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-04-11 15:13:29 +02:00
Pavel Hrdina
ac9bd77ed3 tests: add CPU defult test case for old QEMU
With old QEMU we should not use host-model because it's not safe and it
might fail to start.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-04-11 15:11:10 +02:00
Pavel Hrdina
fab7af30a1 tests: add kvm-x86_64-rhel7-domcaps
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-04-11 14:47:37 +02:00
Pavel Hrdina
44021bde6e tests: update kvm-x86_64-rhel7 capabilities
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-04-11 14:41:22 +02:00
Pavel Hrdina
c1ebd6730c DomainCpu: check CPU model name only if model exists
For CPU modes other then "custom" there is no model so we should not
check the suffix of model name.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-11 09:38:14 +02:00
Pavel Hrdina
291f2ef214 DomainCpu: fix detection of CPU security features
VM configured with mode="host-model" will have the CPU definition
expanded once the VM is started.  Libvirt will try to use the closest
CPU model with some features enabled/disabled.

The issue is that there are some models that include spec-ctrl or ibpb
features and they will not appear in the explicit list of features and
virt-manager will not correctly detect if all security features are
enabled or not.  As a workaround we can check the suffix of CPU model to
figure out which security features are enabled by the model itself.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-04-09 13:30:25 +02:00
Cole Robinson
d7fed32947 Bump gtk dep to 3.22 for new popup routines
Given that we bumped deps to fairly modern distros with the
python3 change, I think this is safe. gtk 3.22 is from sep 2016, it's
in debian9 and fedora 25+, which seems fine for our needs.
2019-04-07 13:54:00 -04:00
Cole Robinson
f2239bad00 console: Use popup_at_rect
Added in gtk 3.22 to fix some wayland ambiguity. Needed for sway wm
multimonitor apparently:

https://bugzilla.redhat.com/show_bug.cgi?id=1694379
2019-04-07 13:54:00 -04:00
Cole Robinson
927d668215 virtManager: Use popup_at_pointer
Added in gtk 3.22 to fix some wayland ambiguity. Needed for sway wm
multimonitor apparently:

https://bugzilla.redhat.com/show_bug.cgi?id=1694379
2019-04-07 13:54:00 -04:00
Cole Robinson
70b42134d2 console: Don't use nested function for send_key click cb 2019-04-07 13:54:00 -04:00
Cole Robinson
4a95d1ba74 console: OverlayToolbar cleanups
- Privatize unaccessed variables
- Use standard __init__ pattern
- Drop some __init__ variables
2019-04-07 13:54:00 -04:00
Andrea Bolognani
20c212cdfc guest: Enable USB input devices for RISC-V virt guests
If USB support is available, we can use USB input devices too.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-04-04 18:57:39 -04:00
Andrea Bolognani
9bec57723e guest: Enable USB for RISC-V virt guests
Unlike other features we have enabled earlier, this one requires
version checks because RISC-V guests have only started using PCI
by default very recently, and we can't have USB without PCI.

More specifically, we need QEMU commit d6c1bd4a2237 (included
in 4.0.0) and libvirt commit 7c48fb08e0cd (included in 5.3.0).

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-04-04 18:57:39 -04:00
Andrea Bolognani
1e3de807a6 video: RISC-V virt guests support virtio-gpu
QXL, on the other hand, is still x86-only for some reason.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-04-04 18:57:39 -04:00