Commit Graph

222 Commits

Author SHA1 Message Date
Cole Robinson
f13c8d87fb guest: Remove the hyperv + uefi workaround for win7 + win2k8r2
Both these windows versions are now longer supported, and UEFI isn't
the default, so I don't think this hack is much needed anymore

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 12:05:45 -05:00
Cole Robinson
45eb83f93a osdict: Remove outdated 'no cover' annotation
The test suite does cover this line

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-19 13:45:46 -05:00
Daniel P. Berrangé
d9044419ac virtinst: fix return type in guess_os_by_iso
Accidentally changed in

  commit 302ef1f096
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Fri Nov 26 18:51:49 2021 +0000

    virtinst/osdict: add a property for the OsinfoDb object

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-19 13:44:54 -05:00
Cole Robinson
92c0c4e1a7 tests: Fix test coverage after osdict changes
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-17 14:51:36 -05:00
Daniel P. Berrangé
9423f6680a virtinst/osdict: remove internal cache of OS objects
Now that we've removed all internal aliases, there is no longer any
reason to keep a cache of OS objects internally. We can directly
query the DB when we need it.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-17 14:51:36 -05:00
Daniel P. Berrangé
6b584b183f virtinst/osdict: refactor setup of generic fallback OsinfoOs
Introduce a property for accessing the generic fallback Os object, which
will be useful in future refactoring.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-17 14:51:36 -05:00
Daniel P. Berrangé
302ef1f096 virtinst/osdict: add a property for the OsinfoDb object
This simplies the code a little bit by avoiding visible indirection
via the loader every time.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-17 14:51:36 -05:00
Daniel P. Berrangé
35ef83d628 virtinst/osdict: remove osinfo legacy aliases
The code comment suggests removing the aliases after a year. It has
now been three years, so it is time for them to go.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-17 14:51:36 -05:00
Cole Robinson
cdd7061f8e pylint: Fix some deprecation warnings and minor bits
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-11 12:32:23 -05:00
Cole Robinson
7f56717006 osdict: Remove dead code after get_kernel_url_argument usage
This would still be used for old osinfo (mid 2019), and only for
the case of installing 7+ year old RH distros. I think we can safely
delete it.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-11 12:32:22 -05:00
Pino Toscano
0038d750c9 osinfo: use the OS kernel-url-argument if available
Each OS may specify which kernel argument is needed to specify the
installation source; use it as primary source, falling back to the
current logic. This should help supporting new OSes OOTB.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2021-12-10 16:30:50 +00:00
Cole Robinson
d0650aa48f osdict: Handle possible conflicting os named 'generic'
It's not impossible osinfo-db adds a 'generic' OS of its own, in
which case we will start misbehaving. Rework the way we implement
our synthetic 'generic' OS internally, using a stub Libosinfo.Os()

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-10-21 18:49:11 -04:00
Pino Toscano
20c2f633d0 osdict: extend non-EOL distros range to 10 years
Commit d52d9885c8 added a logic to
consider as EOL a distribution with no EOL date set and release date
earlier than 5 years from the current day. This was done because there
were (and still are, even if fewer now) many old OSes in osinfo-db with
no EOL date set, which were thus considered "supported". Sadly, OSes
that are still supported, like Windows 10, Windows Server 2012, or
earlier versions of RHEL/CentOS/OL 6/7, are now considered "EOL".

As a hack on top of the initial hack, extend the range from 5 years to
10 years: this will consider some of the aforementioned OSes as
supported, without adding too many other OSes.

Of course the long term solution is to make sure all the OSes in
osinfo-db that are EOL upstream have a EOL date set, so there is no more
need to arbitrary exclusion logic.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-08-18 13:50:59 -04:00
Cole Robinson
3e0155b055 osdict: Fix resource checking inheritance
-1 returned from osdict resource lookup means the value is unspecified.
When we encounter that value we should also check the 'all' arch
category, instead of stop processing.

This fixes some vcpus calculation for --os-variant rhel7.0 with
latest osdict

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-08-11 16:50:50 -04:00
Cole Robinson
25b3113ba9 osdict: Drop post_install driver bits
osinfo library doesn't return data for these with the fedora 32
version, so it's hard to get coverage testing. Since we aren't
even using this code yet anyways, let's remove it until it is needed

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-18 19:28:04 -04:00
Cole Robinson
380a44318a virtinst: Centralize in_testsuite checking
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 19:08:27 -04:00
Pino Toscano
6d970949f1 i18n: use "Generic OS" as label for generic
Change the label for a generic OS to "Generic OS", and making it
translatable.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-13 15:37:00 -04:00
Cole Robinson
fec9f0b136 po: Fix message format warnings printed from xgettext
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-11 19:18:38 -04:00
Cole Robinson
6d2483f09d virtinst: install: Fill out more test coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 13:08:12 -05:00
Fabiano Fidêncio
ef8c772be7 guest,osdict: Pass down extra_devs to supports_virtio*() methods
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
35f6938c10 osdict: Pass down extra_devs to _device_filter()
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
afd3a98c1d osdict: Add extra_devs to supports_* methods
Similarly to what has been done for _device_filter(), let's add
"extra_args" parameter to support_* methods so we can pass them down to
_device_filter().

Only supports_virtio* methos would actually need the extra argument, but
let's be consistent here and add it to all supports_* methods.

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
e522a0edcb osdict: Add extra_devs to _device_filter()
Let's add "extra_devs" to _device_filter() so we can pass a list of
devices which can be used by an OS but are not part of the distro / OS
itself.

By doing this, we also expand the _device_filter() check and take those
into account when they're passed.

That's exactly the case of pre-installable drivers for Microsoft
Windows.

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
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