IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
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>
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>
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>
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>
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>
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.