Commit Graph

2012 Commits

Author SHA1 Message Date
Cole Robinson fb2bfd610f details: Use Guest.lookup_domcaps helper
This ensures the Guest object domcaps cache is primed as well, which
prevents the CPU security features handling from constantly refetching
domcaps info.

We need to tweak the cache invalidation check in Guest to handle
some of the test suite hackery we do

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-12 14:20:36 -05:00
Cole Robinson 5d91237386 domcaps: Tweak cpu security feature log statements
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-12 14:17:21 -05:00
Cole Robinson d934d6f266 domcaps: Fix check for uncached security features
We need to check against None, which is the initial value, otherwise
a host with none of the security features present will repeatedly poll
libvirt baseline APIs

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-12 14:17:21 -05:00
Pavel Hrdina df48a77e6a virtinst: fix detection if baselineHypervisorCPU API is available
With libvirt-python >= 4.4.0 and libvirt < 4.4.0 we would receive
libvirt.libvirtError exception because the python binding knows about
the function but it's not supported by libvirt.  However, in case that
the python binding is older then 4.4.0 it will raise AttributeError
because the function is not implemented in python binding as well.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-10-22 13:42:21 +02:00
Fabiano Fidêncio 8f4c53ea96 video: Prefer "bochs" when it's supported.
Preferring "bochs" display device is the way to go when dealing with a
Linux guest using UEFI and that's quite well described here:
https://www.kraxel.org/blog/2019/09/display-devices-in-qemu/

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

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-10-04 11:17:10 -04:00
Fabiano Fidêncio 2e20b128a1 domcapabilities: Add supports_video_bochs()
Returns whether bochs display is supported, according to the domain
capabilities.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-10-04 11:15:09 -04:00
Fabiano Fidêncio 1547e16d62 domcapabilities: Get video devices
domcapabilities already handles disk and hostdev. Let's add support for
getting video devices as well.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-10-04 11:15:09 -04:00
Cole Robinson 651e5b6d75 devices: video: Simplify model hvm check
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-10-03 15:41:44 -04:00
Cole Robinson 534f2e03d0 guest: Drop set_capabilities_defaults call from get_uefi_path
Callers need to handle this themselves, and all callers do AFAICT

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-10-03 15:35:59 -04:00
Cole Robinson 355d7fed80 installer: Clean up unattended preinstall drivers
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-10-02 11:58:37 -04:00
Fabiano Fidêncio e7704d3c8b guest: Add add_extra_drivers()
Let's add a new API to set extra drivers that can be used during
installation time when performing unattended installations. This is
needed for pre-installing virtio-win drivers on Windows guests.

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 e32e609243 installer: install the pre-installable drivers
Let's download and install the pre-installable drivers, if they're
available.

The reason we're only dealing with pre-installable drivers here is that
post-installable drivers would have to keep the unattended is available
accross reboots, resulting in a file that can't be cleaned up at this
point.

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 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 e59585b58b unattended: Add method to download drivers
This will be used by unattended installations in order to download both
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 9465da4174 urlfetcher: Deal with 'file://' in _LocalURLFetcher()
osinfo-db may contain files pointing to local paths, which will have the
format 'file:///usr/share/...'.

With the current code, virt-install would just bail as it doesn't
understand the 'file://' schema. Let's start using urllib (which is
already imported in the very same file) and parse the URL so both
'file:///usr/share/...' and '/usr/share/...' would work.

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 96af1de49f unattended: Avoid invalid chars on hostname
Some installations (Microsoft Windows was the problematic one here) will
bail if the Computer's name / hostname contains one of the following
characterers:  "[{|}~[\\]^':; <=>?@!\"#$%`()+/.,*&]".

Let's take a safe path and ensure that we never set those, replacing
them by "-".

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