Commit Graph

199 Commits

Author SHA1 Message Date
Fabiano Fidêncio
efb0220510 osdict: Add get_pre_installable_devices()
Let's add a new method to get the devices which are supported when
taking advantage of a pre / post installable drivers.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-10-02 11:58:34 -04:00
Fabiano Fidêncio
eac05bfbec osdict: Add supports_unattended_agents()
The post-installable drivers provided by osinfo-db are merely agents,
which are not a blocker for an installation to succeed using virtio &
having a bootable guest.

Let's add this method as a counter part of supports_unattended_drivers()
and use it in the future, when we re-work the installation code of
virt-install and are able to perform installations of MSIs.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-10-02 11:58:34 -04:00
Fabiano Fidêncio
89a2a71328 osdict: Re-purpose supports_unattended_drivers()
supported_unattended_drivers() was originally added as a way to tell
whether a guest could support pre & post installable drivers.

This is wrong for two reasons:
- virt-install cannot deal with post-installable drivers/agents;
- pre-installable drivers are the only ones needed in order to perform
  an unattended installation taking advantage of virtio-win drivers;

Knowing that, let's only check for pre-installable drivers in
supported_unattended_drivers().

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-10-02 11:58:34 -04:00
Fabiano Fidêncio
d6d97c6587 osdict: Choose the most appropriate tree when a profile is set
As some OSes, as Fedora, have variants (which we rely to be standardised
on osinfo-db side), let's select the most appropriate variant according
to the selected profile of the unattended installation.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-09-11 16:22:40 -04:00
Fabiano Fidêncio
0f1acc9f8f osdict: Always return the most generic tree
Some OSes, as Fedora, have variants (which we rely to be standardised on
osinfo-db side), which we can use to return the most generic tree
possible, in case no profile is specified, in order to avoid failing to
install a "Workstation" system because a "Server" variant tree was used.

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

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-09-11 16:22:40 -04:00
Fabiano Fidêncio
7bc40eeed1 osdict: Add supports_unattended_drivers()
Let's add a method which tells us whether pre & post installable drivers
are supported when performing unattended installations.

This is going to help us in the future in order to force virtio-win
usage when unattended installing guests which support it.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-08-06 17:59:05 -04:00
Fabiano Fidêncio
ff337843e6 osdict: Add get_{pre,post}_installable_drivers_location()
Let's add two new methods to get the pre & post installable drivers'
location, returning a list of URLs (strings).

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-08-06 17:59:05 -04:00
Fabiano Fidêncio
8ab2e49e36 osdict: Add _get_{pre,post}_installable_drivers()
Let's add two new *private* methods to get the pre & post installable
drivers, returning a list of OsinfoDeviceDrivers;

Those are going to be used later on this series in order to get the
drivers' locations.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-08-06 17:59:05 -04:00
Fabiano Fidêncio
6c7a586a9c osdict: Remove extra new line
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-08-01 21:05:45 -04:00
Cole Robinson
9c051fe65f osdict: Use media_create_from_location_with_flags
If it's available, because it fixes detection of non-bootable
media, like debian s390x
2019-08-01 19:15:08 -04:00
Cole Robinson
e77066b713 osdict: Use get_short_id_list
Some osed have multiple short-ids, like debian10 also has debianbuster.
Use the API if it's available. This will make it easier to remove
our back compat aliases eventually
2019-08-01 18:57:36 -04:00
Fabiano Fidêncio
7148727a05 osdict: Use identify_tree()
Let's use identify_tree(), which is part of libosinfo v1.6.0 release,
instead of using guess_os_from_tree().

The API has been implemented on libosinfo in order to be consistent with
what was already done for medias.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-07-16 16:54:30 -04:00
Fabiano Fidêncio
0e60a25066 osdict: Return a _OsTree instead of OsinfoTree when guessing an OS
Instead of returning an OsinfoTree, let's be consistent with what we
already do in guess_os_from_iso() and return our internal _OsTree
object.

This change doesn't affect any code as the only place using it doesn't
care about the returned tree object.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-07-16 16:54:29 -04:00
Fabiano Fidêncio
7fee11a29c osdict: Add _OsTree() class
Similarly to the _OsMedia() class, let's create a _OsTree() class which,
at least for now, has only one method that returns the OsinfoTree
object.

Although this class & method are not extrictly needed, having them makes
the code more consistent.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-07-16 16:54:29 -04:00
Fabiano Fidêncio
224d29b799 osdict: Add get_osinfo_media() to _OsMedia class
Let's add a way to get the OsinfoMedia from the _OsMedia class. It's
going to be needed in order to properly generate the command line for
the unattended installations, when doing an installation from a media.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-07-12 15:07:22 -04:00
Andrea Bolognani
72fc6781c8 osdict: Add supports_virtioballoon()
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-06-17 13:50:11 -04: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
fbe388b26a virt-install: Warn if mem less than OS recommended
And if mem is abnormally low, like it appears user tried to specify
GiB not MiB
2019-06-14 11:24:10 -04:00
Cole Robinson
17ac0d017c virt-install: Drop --os-variant suboption parsing
Not sure I want to go down that route if we can avoid it. Instead
just fold the full_id support into the existing option handling.
Streamline the OSVariantData usage throughout the cli tools
2019-06-13 21:25:05 -04:00
Cole Robinson
21723706f5 virt-install: Add --install OSNAME
Replace the unreleased --os-variant OSNAME,install=location with just

  --install OSNAME

Unwind the --unattended dependency on upfront --os-variant while
we are at it, since they are all intertwined. Now we can just do:

  virt-install --install OSNAME
and
  virt-install --install OSNAME --unattended
2019-06-13 20:26:26 -04:00
Cole Robinson
a9d33d49db osdict: Add testing and finish of code coverage 2019-06-13 14:00:04 -04:00
Cole Robinson
b3a9b98e08 osdict: Standardize on OsMedia usage
* Make all API calls go through the _OsMedia object
* Move most of the unattended specific processing to unattended.py
* Rename requires_internet to is_netinst to clarify what it is checking
2019-06-09 11:26:28 -04:00
Cole Robinson
195d775c5b installertree: abspath convert MEDIA_DIR
Various parts of the code implicitly expect an absolute path
2019-06-09 10:50:21 -04:00
Cole Robinson
d9b41bf887 tests: Add clitest coverage for network-install resources 2019-06-09 10:14:48 -04:00
Cole Robinson
af12b32928 osdict: Don't use a variable named 'os' 2019-06-07 21:26:02 -04:00
Cole Robinson
37adfb0150 urlfetcher: Add http and ftp unit test mocking 2019-06-07 21:25:41 -04:00
Cole Robinson
9fc20d4a97 osdict: Fix url arg detection for fedora-rawhide distro 2019-06-07 21:13:51 -04:00
Cole Robinson
d167021b0f osdict: Drop the solaris10 x2apic hack
The upstream kvm bug has never been resolved. I think this is
obscure enough nowadays that we don't need to track and test it
2019-06-05 16:35:34 -04:00
Cole Robinson
4e3e38cad1 tests: Fix test suite failures on f29 libvirt 4.7.0 2019-05-16 11:29:12 -04:00
Cole Robinson
12440b00c1 osdict: return _OsResources to callers
Use the class helper routines to save some tedious dict management
2019-05-12 17:25:47 -04:00
Cole Robinson
e76e350a8d osdict: Add _OsResources helper class
It's just an implementation detail for now, but we will use it to
simplify callers interactions with resources data
2019-05-12 17:25:47 -04:00
Cole Robinson
efa8c6f2c0 osdict: Don't limit qemu TCG to vcpus=1
Modern qemu has multithread TCG support for all the arches we
support, so don't limit things
2019-05-12 17:25:47 -04:00
Cole Robinson
4238e3f7d7 osdict: Fix get_recommended_resources minimum logic
If an OS has a <minimum> resources section, and a <recommended>
resources section, but there's a field in the former that isn't in
the latter, currently we throw out the former field entirely. This
is the case for n-cpus for a few OS. Instead we should be using
the <minimum> ncpus value. This changes the default <vcpu> value
for a quite a few test cases.
2019-05-12 17:25:47 -04:00
Cole Robinson
9199c2d157 osdict: Remove "cpus" resources tracking
It's for CPU speed but we don't use it anywhere
2019-05-12 17:25:47 -04:00
Fabiano Fidêncio
12ec663f0b osdict: Fix OsMedia::requires_internet() logic
In case there's no self.osinfo_media, it means the installation won't
happen from the media itself, so it should return "True" (as in, it
requires internet).

Returning "False", though, should be done when no "netinst" variant was
found (but we do have a media).

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-04-01 15:01:04 -04:00
Fabiano Fidêncio
467cb9bc0a urldetect: return osdict.py:OsMedia instead of Libosinfo.Media
Consequently, let's:
- rename urldetect::get_osinfo_media() to get_os_media()
- rename the installertreemedia::_LocationData::osinfo_media to os_media
- rename unattended::prepare_install_script's media argument to os_media
  - and also rename media to os_media on its internal
    _get_installation_source() method
- rename osdict::get_install_script's media argument to os_media

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-28 15:56:44 -04:00
Fabiano Fidêncio
313a95bd8e osdict: Add requires_internet() to OsMedia
In order to properly do a unattended installation of some medias (as net
installers), we have to check whether the media requires or not
internet. Doing so by checking its variant is not the most beautiful way
(as variants do not have a set of predefined names), but that's the best
that can be done with the current state of osinfo-db.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-28 15:56:44 -04:00
Fabiano Fidêncio
0247f97012 osdict: Add OsMedia class
The OsMedia class is a wrapper around OsinfoMedia and will help us
to keep the logic of dealing with media related stuff from inside
osdict.py

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-28 15:56:44 -04:00
Fabiano Fidêncio
6c7d765c60 osdict: Add get_network_install_resources()
get_network_install_resources() is going to be used when performing a
network based installations where more RAM is needed during the
installation time than the recommended one, which is the case of some
distros as CentOS, RHEL, (some versions of) Silverblue and (some
versions of) Fedora.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-28 15:56:44 -04:00
Cole Robinson
97a5af1e43 urldetect: Use libosinfo for tree detection too
Ask libosinfo for tree detection, but still fall back to our
own implementation if libosinfo fails
2019-03-24 12:27:46 -04:00
Andrea Bolognani
708af01c14 osdict: Add supports_virtioinput()
We can use this function to figure out whether the guest OS
supports VirtIO input devices (virtio-tablet, virtio-keyboard
and virtio-mouse).

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-03-21 15:31:20 +01:00
Erik Skultety
67acebc2b3 Fix a few issues reported by codespell
There were a few minor typos across the codebase which codespell pointed
out.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-03-18 13:04:53 -04:00
Cole Robinson
049a735eb2 osdict: Prefix some errors messages with 'OS'
Otherwise it's not entirely clear what we are refering too
2019-03-08 17:26:46 -05:00
Fabiano Fidêncio
db6161c610 osdict: Deal with medias' installer scripts
As medias may also have installer scripts associates to themselves and,
in this case, those should be considered instead the OS ones.

More than that, Libosinfo.Media provides an API that tells whether that
specific media supports installer scripts or not and this must be
checked as the first thing. In case no installer script is supported,
let's just error out and abort the installation.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-08 17:11:30 -05:00
Fabiano Fidêncio
93d3223c87 unattended: Pass the media down to get_install_script()
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-08 17:11:10 -05:00
Fabiano Fidêncio
fbcfc2147d osdict: Refactor get_install_script()
Let's refactor get_install_script() in a way that any addition done in
order to get the install scripts from the media would be cleaner.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-08 17:11:02 -05:00
Andrea Bolognani
c2bcb9e5a6 guest: Add supports_virtioscsi()
This is similar to the existing supports_virtio*() functions,
but for virtio-scsi.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-03-06 14:00:11 -05:00
Cole Robinson
49ae679702 osdict: Report available profile names on error 2019-03-05 16:38:22 -05:00
Cole Robinson
9dd758dee8 osdict: Add a helper for iterating over osinfo lists 2019-03-05 16:38:22 -05:00
Cole Robinson
402a95bb31 osdict: Improve some errors for OS 'generic' 2019-03-05 16:38:22 -05:00