Commit Graph

6967 Commits

Author SHA1 Message Date
Athina Plaskasoviti
050d4dd62a cloudinit: Add cli option root-password-file=/path/to/file
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
66d95c6792 cloudinit: Move password generation inside class CloudInitData
Function generate_password() provides random 16 digit password and
get_root_password() handling root_password assignment.

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
db0e524e8d cloudinit: Add basic testing for cli option --cloud-init
Tests now cover default --cloud-init behavior, and
root-password=(generate and given password),disable=no.

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
9266cc47c1 cloudinit: Change iso suffix for cloud image installations
Generated iso now called ...-cloudinit.iso.

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
dadaf8eb45 cloudinit: Fixed broken testsuite
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
0e5b1b3048 cloudinit: Clean up create_metadata and create_userdata functions from unused/unwanted arguments
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
0bbfc80b68 cloudinit: Add disable=yes|no
Cli option to permanently disable cloud-init after first boot by user request.
Handled so that bare --cloud-init defaults to --cloud-init root-password=generate,disable=yes.

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:10 -05:00
Cole Robinson
ec47c9dafc cloudinit: Fix setting root password in user-data 2019-11-20 16:41:10 -05:00
Athina Plaskasoviti
19317024cc Introduction of cloud-init configuration in virt-install
Usage:
--cloud-init

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-11-20 16:41:05 -05:00
Cole Robinson
c311b28979 cli: Add 'clearxml' arg for options it doesn't apply to
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-20 16:40:00 -05:00
Fabiano Fidêncio
1d9d91910a installertreemedia: Respect os_variant when setting kernel_url_arg
Currently, the kernel_url_arg is get based on the cached data. However,
when the cached data is created, the store is already set to a "generic"
distro and the os_variant is not respected when getting the
kernel_url_arg.

In order to avoid ignoring os_variant when looking up the kernel_url_arg,
let's also take into the consideration the the os_variant passed via
command line, which was used to set Guest's osinfo name, returning then
the expected value to the caller.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-11-20 16:04:09 -05:00
Fabiano Fidêncio
b78b8a96cf virt-install: Respect --os-variant
When the user explicitly passes --os-variant via command line, its value
must be respected, always.

By setting the os name earlier, we force the os-variant to be respected
when the installer creates the Distro Store.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-11-20 16:04:09 -05:00
Fabiano Fidêncio
54edd0a0a6 unattended: Never use "root" as user-login
When running virt-install as root, user-login would be automatically set
to "root", causing an installation failure in the most part of the
distros (if not all of them).

In order to avoid such failures, let's raise a runtime error in case the
user-login used is "root".

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-11-20 16:04:09 -05:00
Cole Robinson
82b75a93b6 delete: Add _DiskData class for tracking path delete metadata
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-20 15:22:03 -05:00
Cole Robinson
57a1f19841 delete: Clean up code layout a bit
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-20 14:47:07 -05:00
Cole Robinson
5d8bd316c1 tests: test_urls: Reset cached guest os_variant before short circuit test
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-12 16:16:55 -05:00
Fabiano Fidêncio
cdcec1fb03 unattended: Add option to set the user-login
Let's allow setting the login of the guest user.

Using the user from the system is a quite good fallback, but would break
unattended installations when running virt-install as root. Thus, for
those cases, it makes sense to have the option of setting the user
login.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-11-12 16:07:07 -05:00
Cole Robinson
0e9905d057 uitests: Fix memory hotplug test with latest libvirt
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-11-12 14:23:08 -05:00
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
Michael Weiser
51d84c54cb connection: Avoid repeated default pool creation attempts
During startup virtinst.StoragePool.build_default_pool() tries to
determine whether the default storage pool already exists. Because
events have not yet been processed, the list of existing storage pools
is still empty. Therefore it seems as if it does not exist yet and
build_default_pool() falls back to creating it which causes an error
message from libvirtd in the system log:

libvirtd: operation failed: pool 'default' already exists with uuid.

Move default pool creation after event processing to avoid these
redundant creation attempts.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2019-11-12 12:28:34 -05:00
Florian Ludwig
ae19d6d6ec fix resizing of spice clients with guest resizing enabled
Fixes 1414718
2019-11-12 11:46:35 -05:00
Cole Robinson
062ff8227a tests: Update output with latest libvirt
Which forces disk type='file' when <source> is missing

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-10-22 10:29:19 -04: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
d9736db9d9 addhardware: Add "bochs" display to the video list
https://bugzilla.redhat.com/show_bug.cgi?id=1753644

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-10-04 11:17:14 -04: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
4e07c3d8f3 Fix tests with latest osinfo-db
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-10-03 06:57:42 -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
b6e4e4538d virt-install: Use virtio-win drivers if possible
Let's ensure the Windows guests being installed through unattended
installations, which are able to have pre installable drivers intalled,
will use virtio devices when possible.

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
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
Cole Robinson
aadaaf8785 manager: Don't hardcode black text color
Improves readability on dark theme

Resolves: #52

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-10-02 10:32:04 -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