Commit Graph

156 Commits

Author SHA1 Message Date
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
Cole Robinson
0031d15098 virtinst: move OSInstallScript to unattended
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-03-05 16:38:22 -05:00
Cole Robinson
a8d0fb5a38 osdict: Don't lowercase gi imports
It's a pointless divergence
2019-03-05 16:38:22 -05:00
Cole Robinson
cb9d610a05 osdict: Move OSDB definition closer to _OSDB class 2019-03-05 16:38:22 -05:00
Cole Robinson
6537659ea6 osdict: Add OSInstallScript class
To wrap Libosinfo.InstallScript interactions
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
3f942f7385 osdict: Add methods for generating the script and its cmdline
generate_install_script_output() generates the install script,
accordingly to the config passed, in a specific directory.

generate_install_script_cmdline() generates the kernel command line that
has to be used in order to perform the unattended installation.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
72d93ee7d8 osdict: Add set_install_script_installation_source()
As some of the install scripts may act differently depending on whether
the installation is going to be done via the OS media or via network
let's have a wrapper around set_installation_source(), from
Libosinfo.InstallScript, in order to be able to properly set which is
going to be the used installation source.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
68640f3401 osdict: Add set_install_script_preferred_injection_method()
As not all unattended installations will be done by the same method,
let's have a wrapper around set_preferred_injection_method(), from
Libosinfo.InstallSript, in order to be able to properly set which is
going to be the preferred injection method for a script.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
929adeb654 osdict: Properly set language and kbd layout for install script config
Let's try to guess the language and keyboard layout from the system's
language.

In case we can't do the guess, let's just let it be and libosinfo will
use the 'en_US' default for both language and keyboard layout.

There's a big issue here, though, that quite often users will *not* have
their keyboard layout matching with the language of their systems and,
unfortunately, I don't see any easy way to detect that unless we totally
rely on GLib.Settings (which, according to my understanding, we can't).

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
35da347e6d osdict: Properly set the timezone for the install script config
Let's try to guess the timezone from '/etc/localtime' and use it, if
possible. Otherwise, let's just let it be and libosinfo will use the
default 'America/New_York' one.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
5a17c04208 osdict: Add get_install_script_config()
get_install_script_config() method returns an OsinfoInstallScriptConfig
object that's tied to an OsinfoInstallScript object, already configured
based in the info provided by the user and it's ready to be used.

For now, the config will always set the timezome to 'America/New_York'
and the language and keyboard layout to 'en_US'.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
8f991e3ea2 osdict: Add get_install_script()
get_install_script() method returns an installer script of a specific
profile type for a specific OS.

In case no OS is defined, None is returned.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Pino Toscano
9cd405b6ef osinfo: deal with rolling distros for EOL status
If a distribution has no EOL date set, always consider it supported if
its release status is "rolling".

(crobinso: reformat a bit, appease pylint)

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2019-02-19 15:57:21 -05:00
Cole Robinson
8139b3839e osdict: Raise exception on get_location failure
It's better to error immediately if we know this won't work
2019-02-18 10:56:38 -05:00
Fabiano Fidêncio
08d3a5786c osdict: add get_location()
get_location() is a new method that returns the osinfo-db tree URL of an
OS, according to the passed architecture.

This method will need some improvement later on once we start having a
specific set of definitions on osinfo-db about what's the type of the OS
we're dealing with (like Server, Desktop, ...).

For now, the new method returns the first URL found without taking into
the consideration the types speficied above.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-02-14 13:33:48 -05:00
Fabiano Fidêncio
071c885e84 osdict: Use identify_media() instead of guess_os_from_media()
guess_os_from_media() has been deprecated for a while and
identify_media() should be used instead.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-02-07 11:50:45 -05:00
Cole Robinson
f035f313a4 osdict: Absorb get_kernel_url_arg from urldetect
Since nowadays it's entirely a function of the detected OS name
2019-02-03 12:05:18 -05:00
Cole Robinson
2b4e1cadf3 osdict: Rename lookup_os_by_media to guess_os_by_iso
And have it return the media object up to the caller
2019-02-03 12:05:18 -05:00
Cole Robinson
069653b744 osdict: Drop -unknown mapping for ISO media detection
This was originally added for fedora to give better names in the UI,
but that's a loose reasoning IMO. The pattern was extended to
other -unknown distros but instead of maintaining that going
forward I'd rather just remove the magic for it.
2019-01-08 16:02:34 -05:00
Cole Robinson
2f89ecf4a9 Remove Author lines from file headers
Similar to what was done in libvirt. See these commits:

600462834f
c99e954973
2019-01-08 11:45:35 -05:00
Fabiano Fidêncio
ee0ac5f2c7 osdict: adapt latest_os_version() to ignore "-unknown" distros
As some enterprise distros adopted the "unknown" approach in osinfo-db,
and those usually support different versions at the same time, there may
be different "unknown" entries (like rhel-unknown, rhel-8-unknown,
rhel-7-unknown, and so on) for the very same distro.

This situation can easily happen when some ISO matches, for exmaple,
"rhel-unknown" and then the latest one selected would be
"rhel-8-unknown".

In order to avoid this situation from happening, let's just ignore the
"unknown" entries when calling latest_regex().

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2018-12-05 15:04:59 +01:00
Fabiano Fidêncio
fbcea0b63c osdict: adapt latest_regex() to openSUSE's versioning
Due to OpenSUSE's decision of versioning their OS as 11.x, 12.x, 42.x,
15.x, we have to add a specific check in latest_regex() in order to make
sure we skip the 42.x series in the sorted list of OSes when returning
the OS name to the user.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2018-12-05 15:04:59 +01:00
Fabiano Fidêncio
7612c5bdcd osdict: expand the "unknown" check for any distro
Currently osinfo-db has "unknown" entries for fedora, opensuse and
asianux. Considering this list may grow even more at some point, let's
just make the check more generic and use it for all of them instead of
keeping it for fedora only.

Changes have also been done in urldetect and tests_url, as those also
used latest_fedora_version().

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2018-12-05 15:04:59 +01:00
Lukáš Doktor
30b7c33c6d virt-install: Fix guest-os deprecation msg
Arguments to logging needs to be individual args, otherwise it
fails with "not enough arguments for format string"                             

Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
2018-11-14 18:25:06 +01:00
Cole Robinson
edab908f42 guest: Use q35 chipset by default for new qemu + supported OS
There's been various discussions about changing the x86 default
from 'pc' to 'q35' over the years, but it's unlikely to happen
at the qemu or libvirt level for compatibility reasons. So
let's start using it for new enough OS that support it.
2018-10-13 14:58:57 -04:00
Cole Robinson
046a242bd4 guest: Use USB3 for x86 qemu if OS supports it
Using new annotations in osinfo-db
2018-10-03 19:02:07 -04:00
Pino Toscano
8227b820ee osinfo: warn when using deprecated osinfo IDs
At some point in the future it could be a good idea to drop the _aliases
mapping altogether; it will be hard to do so, in case the users are not
informed that they are using a deprecated ID.

(crobinso: Tweak format and message)

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2018-10-02 11:41:34 -04:00
Cole Robinson
760dc32bac osdict: Clarify comment about rhel virtio-serial hack 2018-10-01 11:39:58 -04:00
Cole Robinson
ff3d6c65d8 Fix some pep8 warnings 2018-10-01 11:37:28 -04:00
Cole Robinson
b2e7986c7b osdict: Switch device lookups to be ID based
I'm not positive device names will never change, but presumably the IDs
won't, so use them instead
2018-10-01 11:24:45 -04:00
Cole Robinson
b19f94299b details: Add OS name view/edit, + oslist rework
This is just a big nasty commit.

Turn the OS inspection page into an always available page that
shows the libosinfo name from the domain metadata XML. Use oslist.py
and have it absorb more of the common behavior needed by create.py
and details.py. Add UI tests for it all
2018-09-30 20:55:32 -04:00
Cole Robinson
65e1187c10 osdict: Add a helpful __repr__ 2018-09-30 09:37:14 -04:00
Cole Robinson
31e4b72a8b osdict: Drop Glib.Date API usage
Use python datetime instead, it's more python friendly
2018-09-29 15:22:44 -04:00
Cole Robinson
7356afcca7 osdict: Use USB tablet if no OS specified
Most OS users will be installing benefit from it, so make it the
default
2018-09-29 13:36:42 -04:00
Cole Robinson
86ef998023 guest: Lookup osinfo object from libosinfo metadata XML 2018-09-13 15:03:36 -04:00
Cole Robinson
2549e60698 guest: Add an entry point for setting machine=q35 default
We will want this at some point, but it's dependent on libosinfo
work
2018-09-12 15:35:49 -04:00
Cole Robinson
242844fefa osdict: Make the broken uefi+hyperv bit more explicit
And add links to the relevant bug reports
2018-09-04 14:55:40 -04:00
Cole Robinson
d5638eb140 osdict: Make qemu_ga support solely dependent on virtio-serial support
We shouldn't concern ourselves with whether the OS supports qemu_ga
out of the box, just set up the channel regardless, as long as
virtio-serial is supported.

This adds the channel for some aarch64 cases which didn't have OS
specified, but that's desired IMO
2018-09-01 13:23:01 -04:00
Cole Robinson
0f3b7fcc26 osdict: Make sure virtio1.0 matches virtio lookups
Right now this doesn't matter, but possibly a future OS will only
support virtio1.0, and osdict metadata might break us in that case
2018-09-01 13:23:01 -04:00
Cole Robinson
8a87c91888 osdict: Move default_netmodel logic to Guest
Make the entry point just return a list of libosinfo device names,
and have Guest choose the preference. This is more future proof
2018-09-01 13:23:01 -04:00
Cole Robinson
b902fbd54f osdict: Move default_videomodel to guest
It's not really osdict specific
2018-09-01 13:23:01 -04:00
Cole Robinson
717cd87b16 osdict: Add helpers for device filtering 2018-09-01 13:23:01 -04:00
Cole Robinson
4e63267a4f urldetect: Rename urldistro to matching_distros
Allow store classes to track multiple matching types, and use this
to ditch the custom urldistro logic in osdict altogether
2018-09-01 13:23:01 -04:00
Cole Robinson
9330548c3c osdict: Move EOL calculation to its own function 2018-09-01 13:23:01 -04:00