Commit Graph

6920 Commits

Author SHA1 Message Date
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
Cole Robinson
0eb571f9e1 cli: Add --tpm backend.encryption.secret=
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-09-04 08:29:58 -04:00
Menno Lageman
0254558e6e cli: add --features kvm.hint-dedicated.state=
QEMU version 2.12.1 introduced a performance feature under commit
be7773268d98 ("target-i386: add KVM_HINTS_DEDICATED performance hint").
Support for this performance hint was added in libvirt 5.7.0 by commit
cb12c59dac04 ("qemu: support for kvm-hint-dedicated performance hint").

This patch extends virt-install's existing --features option to insert the
appropriate XML into the guest definition if this feature is specified
on the command line.

    E.g. --features='kvm.hint-dedicated.state=on' would result
    in the following XML:

      <features>
        ...
        <kvm>
          <hint-dedicated state='on'/>
        </kvm>
        ...
      </features>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Menno Lageman <menno.lageman@oracle.com>
2019-09-03 14:04:18 -04:00
Cole Robinson
1f0c262051 cli: Add --controller driver.iothread
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-08-28 13:17:32 -04:00
Cole Robinson
cee3f6b48e cli: Add --disk driver.iothread
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-08-28 12:43:56 -04:00
Athina Plaskasoviti
2e49041d85 cli: Add --clock timer[0-9]*.catchup options
Added:
-timer[0-9]*.catchup.threshold
-timer[0-9]*.catchup.slew
-timer[0-9]*.catchup.limit

Catchup attributes need timer with assigned tickpolicy=catchup.

XML Mapping:

<clock>
  ...
  <catchup threshold="X" slew="X" limit="X"/>
  ...
</clock>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-08-19 15:39:47 -04:00
Athina Plaskasoviti
cc60d558c0 cli: Add --cputune memorytune options
--memorytune[0-9]*.vcpus
--memorytune[0-9]*.node[0-9]*.id
--memorytune[0-9]*.node[0-9]*.bandwidth

XML Mapping:

<cputune>
  ...
  <memorytune vcpus="X">
    <node id="X" bandwidth="X"/>
  </memorytune>
  ...
</cputune>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-08-19 15:39:47 -04:00
Athina Plaskasoviti
9cea262b85 cli: Add --cputune cachetune options
- cachetune[0-9]*.vcpus
- cachetune[0-9]*.cache[0-9]*.level
- cachetune[0-9]*.cache[0-9]*.id
- cachetune[0-9]*.cache[0-9]*.type
- cachetune[0-9]*.cache[0-9]*.size
- cachetune[0-9]*.cache[0-9]*.unit

XML Mapping:

<domain>
...
  <cputune>
  ...
    <cachetune vcpus="X">
      <cache level="X" id="X" type="X" size="X" unit="X"/>
    </cachetune>
  ...
  </cputune>
...
</domain>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-08-19 15:39:47 -04:00
Erik Skultety
3d5a72e18a man: virt-install: Fix a couple of launchSecurity related typos
Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
2019-08-14 09:25:26 +02:00
Cole Robinson
92f6109eef tests: osdict: Add coverage testing for driver helpers
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-08-06 17:59:05 -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
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