The Python binding of libguestfs errors out in case any of the details
(e.g. summary, description) of an application are not proper UTF-8.
This seems a rare situation, which nevertheless causes the failure of
the inspection of a guest, making the rest of the metadata not used.
While these encoding issues are tackled, and fixed in python-libguestfs
(or libguestfs itself), gracefully handle the failure of
inspect_list_applications(), so at least the rest of the details of a
guest are used/shown.
Recently the Python binding of libguestfs was adapted to properly use
bytes in APIs that return data, instead of (ab)using strings [1].
This change was done only when built for Python 3, which has this
distinct bytes and strings.
Because of that, now the 'icon == ""' (empty string) checks fail, using
whatever inspect_get_icon() returns, including empty arrays of bytes.
Hence, change the checks to use the length of the data as condition, as
also the libguestfs Python API documentation says. Leave also the
checks for None, in the remote case the API will return None in the
future for no data.
[1] 0ee02e0117
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>
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
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
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.
Now we act for each item in the queue, so there is no more need to drain
it fully before doing anything. Thus, turn _run into a simple
get+process+done loop.
We might get 'conn-added' signals for the same connections more than
once, so make sure to skip a new connection notification when the
connection is already known.
Currently, the handling of the 'vm_added' element in the queue (added as
consequence of the 'vm-added' signal) is to act as trigger to rescan
every VM in every local connection; this operation is "fast" because
every VM except the newly added is already marked as visited. Still, it
is an not really efficient way to visit new VMs.
Instead, just push in the queue all the data we get in vm_added, so when
processing the queue we can process each VM straight away. Because of
this, make sure to gracefully handle VMs that were removed while the
'vm_added' item for them was sitting in the queue (which is something
the old code did not handle properly).
When there is no high quality icon for a guest, try getting the low
quality icon. This should make virt-manager show icons for Ubuntu and
Windows guests.
And clean up the API mess while we are at it. Treat the key as an opaque
value that users shouldn't depend on.
Besides the improved code clarity and API layout, this will help diagnose
'key error' issues, since we'll see an object name instead of UUID which
is hard to trace back.
libguestfs adds an atexit handler to clean up handles on exit. This
is convenient in single-threaded programs, but causes problems in
multithreaded programs, for example:
https://bugzilla.redhat.com/show_bug.cgi?id=1043520
Disable the atexit handler for all guestfs handles created by
virt-manager.
Note this change requires libguestfs >= 1.20. However the change to
config.py should ensure that if an earlier version of libguestfs is
installed it should silently fall back to not using inspection.
Ensure that any file touched by a @redhat.com author in 2013 has an
updated copyright header.
The files were updated using the build-aux/update-copyright gnulib
script and manually added where the copyright line wasn't present.
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This is a hack. Should libvirt have a way to mark these VMs?
Note you'll only come across this problem if you run virt-manager as
root with libguestfs >= 1.20 on Fedora >= 18 (libguestfs using libvirt).
Now that virt-manager requires very modern versions of gtk, it's
quite unlikely that we will even run on a system with an old
libguestfs version, so don't bother checking versions.
Despite being a known quantity, autotools is so overkill for our needs,
so let's drop it and replace it with a much simpler and easy to customize
system.