Commit Graph

6959 Commits

Author SHA1 Message Date
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 3009888a0e urlfetcher: Don't override fullurl when it's explicitly set
acquireFile method receives an optional "fullurl" argument. In case it's
not passed, its value is set as the same value of the filename. However,
when fullurl is passed, it should be used and not overriden by the
filename, otherwise fetcher.acquireFile() will just bail.

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 5324582747 urlfetcher: Force a flush after writing to a file
While downloading really small files, on some file systems, the files
may not be flushed on time for whatever reason they've been downloaded.

This issue was noticed after trying to perform unattended installations
and noticing that some files, particularly really small ones, where just
empty.

While the original issue would be fixed by doing the flush on
_HTTPURLFetcher::_write(), let's also force it on _URLFetcher::_write()
to do the same.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-08-06 17:59:05 -04:00
Athina Plaskasoviti 7f8648c53d cli: Add --boot initdir, inituser, initgroup options
XML Mapping:

<os>
...
<initdir>X</initdir>
<inituser>X</inituser>
<initgroup>X</initgroup>
...
</os>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-08-03 19:34:18 -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
Fabiano Fidêncio f4d91dfcd2 unattended,installer*: Deal with multiple install scripts
Windows' unattended installations have more than one installation script
in order to perform a "post" installation of some drivers
(spice-guest-tools, actually).

In order to do so, let's:
- Change unattended::_lookup_rawscript() to return a list of scripts;
  - And also rename it to _lookup_rawscripts();
- Change unattended::prepare_install_script to return a list of scripts;
  - And also rename it to prepare_install_scripts
- Change installer::_prepare_unattended_data() to deal with a list of
  scripts;
  - And also do the "renaming" changes accordingly;
- Change installertreeinfo::_prepare_unattended_data() to deal with a
  list of scripts;
  - And also do the "renaming" changes accordingly;
  - Mind that this change is not exactly needed as Linux unattended
    installations have only one install script. However, the change has
    been done ir order to be consitent with the changes done in the
    installer;
- Change installertreeinfo::_prepare_kernel_args() to deal with a list
  of scripts;
  - And also do the "renaming" changes accordingly;
  - As the changes above, this one is not exactly needed for the very
    same reason;

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
Cole Robinson cd72213b85 storage: Exclude a line from code coverage
To get back to 100% coverage
2019-07-31 17:53:51 -04:00
Cole Robinson b85a5558f9 tests: Fix testsuite with older libosinfo
We need to handle if get/set_installation_url is missing
2019-07-31 17:43:49 -04:00
Cole Robinson b20c5764bc man: Document the --keywrap option 2019-07-28 18:11:04 -04:00
Athina Plaskasoviti e70ead5098 cli: Add --blkiotune device[0-9]*.read_bytes_sec/write_bytes_sec/read_iops_sec/write_iops_sec options
XML Mapping:

<blkiotune>
  <device>
    ...
    <read_bytes_sec>X</read_bytes_sec>
    <write_bytes_sec>X</write_bytes_sec>
    <read_iops_sec>X</read_iops_sec>
    <write_iops_sec>X</write_iops_sec>
    ...
  </device>
</blkiotune>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-07-25 19:13:13 -04:00
Fabiano Fidêncio 414ffa5ef8 virt-install: Use minutes instead of seconds on get_time_string()
get_time_string() currently uses self._wait_secs, while it should use
self._wait_mins, resulting on confusing messages when using `--wait`
option, as shown below:

fidencio@laerte ~/src/upstream/virt-manager $ ./virt-install --install fedora30 --unattended --wait 20
 ...
Waiting 1200 minutes for installation to complete.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-07-25 19:13:13 -04:00
Athina Plaskasoviti 9afe51a0f8 cli: Add --keywrap cipher[0-9]*.name=aes|des, cipher[0-9]*.state=on|off
XML Mapping:

<domain>
...
  <keywrap>
    <cipher name="X" state="X"/>
  </keywrap>
...
</domain>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-07-23 16:59:32 -04:00
Cole Robinson 567463a07c tests: Drop iso symlinking
This was originally added so we had stable paths in the XML. It's
not required anymore, and if it becomes an issue we should fix it
by scrubbing the compared xml
2019-07-17 17:47:46 -04:00
Cole Robinson 2897951ce1 tests: Drop os.system calls
Use python native code instead. This seems to avoid an occasional
crash or abort of some sort with latest libosinfo
2019-07-17 16:54:59 -04:00
Cole Robinson ef46af706a storage: Don't leave thread stranded on error
Move thread callback outside the StorageVolume class, so we are
forced to explicitly pass in every bit it may act on. Ensure we
always cancel and clean up the thread
2019-07-17 12:57:38 -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 4d3b756e70 unattended: Use generate_*_for_tree()
Let's use generate_for_tree() and generate_command_line_for_tree()
methods whenever it's possible.

This method, similarly to generate_for_media() and
generate_command_line_for_media() will take an OsinfoTree as parameter
and will use its info in order to better decide how to properly generate
the install-script and kernel command-line.

It's important to mention that those APIs are part of libosinfo v1.6.0
release and that's the reason the check for them has been added.

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 6aa18520c6 unattended, installer: Pass _OsTree to prepare_install_script()
Later on, it'll be used to generate the install-script and the kernel
command-line based on the specific tree being used.

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 0a3dcdd1b9 installertreemedia: Add get_os_tree()
Let's allow to get the tree object from InstallerTreeMedia class.

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 5c494cef66 installertreemedia: Add os_tree to the _LocationData class
Let's get the _OsTree object and have it added to the _LocationData
class.

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 016cc1d866 urldetect: Add get_os_tree()
Let's add a method that allows the tree object to be retrieved from the
_DistroTree class.

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 6c15382847 urldetect: Store _OsTree object
As already done for _OsMedia, let's store the _OsTree object detected
as it'll be used later on in order to improve the installer script and
the kernel command line used for (tree based) unattended installations.

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 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
Cole Robinson f4d62660f1 tests: Don't use the root logger
Stops logging spam from requests
2019-07-16 16:53:22 -04:00
Cole Robinson 0df8577e11 test_urls: dont try ftp:// with --force-libosinfo 2019-07-16 16:53:14 -04:00
Cole Robinson 3eeef679da test_urls: Remove dead mageia link 2019-07-16 16:53:08 -04:00
Athina Plaskasoviti 2b24a85884 cli: Add --clock timer[0-9]*.track, timer[0-9]*.mode, timer[0-9]*.frequency options
XML Mapping:

<clock>
...
  <timer track="X" mode="X" frequency="X"/>
...
</clock>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-07-15 16:11:51 -04:00
Cole Robinson a15770fbaf Fix codespell errors 2019-07-12 16:10:39 -04:00
Cole Robinson 0c223ab21f guest: Don't set default uefi if firmware= is set 2019-07-12 16:01:21 -04:00
Fabiano Fidêncio e5980863dd unattended: Always set "media" as install-source for ISOs
Let's set "media" as installation source for all the ISOs, even the
net-installer ones, as this can be dealt with on osinfo-db side.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-07-12 15:07:22 -04:00
Fabiano Fidêncio e775dd09f6 unattended: Use generate_*_for_media when possible
Let's use generate_for_media() generate_command_line_for_media() methods
whenever it's possible.

This method, differently from generate() and generate_command_line(),
will take an OsinfoMedia as parameter and will use its info in order to
better decide how to properly generate the install-script and the kernel
command-line.

It's important to mention that those APIs were released as part of
libosinfo v0.2.12, from May 26th, 2015. Knowing it's out for 4+ years
from the moment of this comment, I'm taken the path as not checking
whether the libosinfo used has this API or not.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-07-12 15:07:22 -04:00
Fabiano Fidêncio a3b9d6ffc4 unattended: Pass OsinfoMedia to OSInstallScript
Let's pass the OsinfoMedia object down to the OSInstallScript class so
it can be used, later on, to generate the install-script and kernel
command-line specifically for the media being used.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-07-12 15:07:22 -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
Fabiano Fidêncio 6d8bf5dff1 unattended: Simplify _generate_debug()
Instead of a creating a new Config object and setting and the needed
fields, let's just save the original user & admin passwords, set the
"[SCRUBBLED]" one for generating the debug output, and reset the
original values after that.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-07-12 15:07:22 -04:00
Cole Robinson e678d94b45 tests: Add debian10 URL testing 2019-07-11 14:29:17 -04:00
Pavel Hrdina 3c6e85375d guest: fix warning message when machine type is changed for secure boot
Introduced by commit <3586d1897>.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-07-08 10:57:46 +02:00
Cole Robinson dbfdc099d8 Prep for release 2.2.1 2019-07-03 20:25:19 -04:00
Cole Robinson aaa065d38e createpool: Add more coverage testing 2019-07-03 19:37:01 -04:00
Cole Robinson 616a7f2dd5 createpool: Simplify LVM volume group UI
Only show the volgroup name, and nothing else, which is all mostly
extraneous

https://bugzilla.redhat.com/show_bug.cgi?id=1316977
2019-07-03 19:37:01 -04:00
Cole Robinson 105553563a storage: Simplify source pool enumeration
Don't return an XML object stub, just return the relevant data.
Make it explicit that we currently are only supporting lvm
enumeration
2019-07-03 19:37:01 -04:00
Cole Robinson 4d86e1129b createpool: Add _get_visible_text helper 2019-07-03 19:37:01 -04:00
Cole Robinson fd8847c24e storage: test default_target_path 2019-07-03 19:37:01 -04:00
Cole Robinson 199e9593bf storage: test default_source_name 2019-07-03 19:37:01 -04:00
Cole Robinson f21d7e4c27 storage: Add explicit StoragePool.lookup_default_pool
Rather than adding an option to build_default_pool which is only
used in one location
2019-07-03 19:37:01 -04:00
Cole Robinson 67bb8fabdb storage: Drop redundant validation
libvirt catches most of this, and it's not all that useful to
duplicate it ourselves
2019-07-03 19:37:01 -04:00