Commit Graph

6377 Commits

Author SHA1 Message Date
Cole Robinson
49ae679702 osdict: Report available profile names on error 2019-03-05 16:38:22 -05:00
Cole Robinson
9dd758dee8 osdict: Add a helper for iterating over osinfo lists 2019-03-05 16:38:22 -05:00
Cole Robinson
8e53ee15f2 cli: Don't error on --disk size=X with missing --name
We will fail later with missing --name, but don't throw an error
generating disk paths before that
2019-03-05 16:38:22 -05:00
Cole Robinson
3a29b40af6 virt-install: Error earlier when --unattended is missing --os-variant 2019-03-05 16:38:22 -05:00
Cole Robinson
de8a0754de cli: Use consister ParseX class naming 2019-03-05 16:38:22 -05:00
Cole Robinson
d470019cda tests: osdict: Add more install script testing 2019-03-05 16:38:22 -05:00
Cole Robinson
1f6879c811 unattended: Split out make_installconfig
The building process here is mostly independent of the InstallScript
object. Moving it to its own function makes that more clear, makes
InstallScript smaller, and the code is indented less
2019-03-05 16:38:22 -05:00
Cole Robinson
e87e3a71fe unattended: Improve some error reporting
* Explicitly error if libosinfo is too old
* Fix an error string
* disable pylint errors on old libosinfo
2019-03-05 16:38:22 -05:00
Cole Robinson
5126694fa7 unattended: Add generate_install_script
Split out from prepare_install_script. Makes things easier to
unit test.
2019-03-05 16:38:22 -05:00
Cole Robinson
402a95bb31 osdict: Improve some errors for OS 'generic' 2019-03-05 16:38:22 -05:00
Cole Robinson
0031d15098 virtinst: move OSInstallScript to unattended
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2019-03-05 16:38:22 -05:00
Cole Robinson
a8d0fb5a38 osdict: Don't lowercase gi imports
It's a pointless divergence
2019-03-05 16:38:22 -05:00
Cole Robinson
cb9d610a05 osdict: Move OSDB definition closer to _OSDB class 2019-03-05 16:38:22 -05:00
Cole Robinson
6537659ea6 osdict: Add OSInstallScript class
To wrap Libosinfo.InstallScript interactions
2019-03-05 16:38:22 -05:00
Cole Robinson
a3147e95db tests: osdict: test basic get_install_script 2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
49e21723b3 virt-install: Make --unattended useful
--unattedend now can be used to perform tree based installations.

The way it's implemented, it takes advantage of the code we currently
have for setting --os-variant install="location|cdrom".

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
a0aebf77e8 virt-install: --unattended conflicts with --initrd-inject and --extra-args
As --unattended will take care of generating the install script to be
inject in the initrd and also of the kernel command line to be used
during the installation, we should not mix whatever user is passing as
--initrd-inject or --extra-args when using --unattended.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
14991ef726 installertreemedia: Perform a unattended installation
In case the InstallerTreeMedia has any unattended_data set, let's just
generate the install script and have everything set up for performing a
unattended installation.

path is appended to the tmpfiles as it's the generated unattended script
and it has to be cleaned up when no longer needed.

cmdline is preppended to the args gotten from _prepare_kernel_url() in
order to be used during the first OS boot (and only there!).

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
b64219eb13 installer: Add set_unattended_data() method
The new method will be used to pass down the unattended_data to the
InstallerTreeMedia class.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
44a3539c7c installertreemedia: Add unattended_data to the class
unattended_data will be used when we add support for unattended
installations. It'll be passed down to the helper that's responsible for
actually generating the script and the kernel command line to be used
with it during prepare(); nevertheless, the addition does nothing right
now.

Together with the addition of the unattended_data, a setter has been
added.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
e5e0c33156 unattended: Add helper method to generate the install script
generate_install_script() is a helper that will do all the needed
plumbing related to create, populating and generating the install script
and its config.

The method returns the path to the generated install script and the
kernel command line to be used with it.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
3f942f7385 osdict: Add methods for generating the script and its cmdline
generate_install_script_output() generates the install script,
accordingly to the config passed, in a specific directory.

generate_install_script_cmdline() generates the kernel command line that
has to be used in order to perform the unattended installation.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
72d93ee7d8 osdict: Add set_install_script_installation_source()
As some of the install scripts may act differently depending on whether
the installation is going to be done via the OS media or via network
let's have a wrapper around set_installation_source(), from
Libosinfo.InstallScript, in order to be able to properly set which is
going to be the used installation source.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
68640f3401 osdict: Add set_install_script_preferred_injection_method()
As not all unattended installations will be done by the same method,
let's have a wrapper around set_preferred_injection_method(), from
Libosinfo.InstallSript, in order to be able to properly set which is
going to be the preferred injection method for a script.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
929adeb654 osdict: Properly set language and kbd layout for install script config
Let's try to guess the language and keyboard layout from the system's
language.

In case we can't do the guess, let's just let it be and libosinfo will
use the 'en_US' default for both language and keyboard layout.

There's a big issue here, though, that quite often users will *not* have
their keyboard layout matching with the language of their systems and,
unfortunately, I don't see any easy way to detect that unless we totally
rely on GLib.Settings (which, according to my understanding, we can't).

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
35da347e6d osdict: Properly set the timezone for the install script config
Let's try to guess the timezone from '/etc/localtime' and use it, if
possible. Otherwise, let's just let it be and libosinfo will use the
default 'America/New_York' one.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
5a17c04208 osdict: Add get_install_script_config()
get_install_script_config() method returns an OsinfoInstallScriptConfig
object that's tied to an OsinfoInstallScript object, already configured
based in the info provided by the user and it's ready to be used.

For now, the config will always set the timezome to 'America/New_York'
and the language and keyboard layout to 'en_US'.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
8f991e3ea2 osdict: Add get_install_script()
get_install_script() method returns an installer script of a specific
profile type for a specific OS.

In case no OS is defined, None is returned.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Fabiano Fidêncio
e8893f2178 virt-install: Add --unattended
--unattended is currently a no-op parameter that will be used to perform
unattended installations.

For now, if someone tries to use --unattended virt-install will fail as
the option is still not supported.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-05 16:38:22 -05:00
Pavel Hrdina
b206931eb9 virtManager: domain: override rename_domain in vmmDomainVirtinst
If user renames guest in VM details page before installation starts
there is no need to rename NVRAM file as well.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-03-05 15:49:23 +01:00
Cole Robinson
ef279273af virt-manager: add --show-domain-delete
Launches delete wizard on top of a VM window, so when domain is
deleted, VM window disappears and the whole app exits
2019-03-04 14:04:34 -05:00
Cole Robinson
4f66c423f7 cloner: Handle --nonsparse for qcow2 images (bz 1675743)
https://bugzilla.redhat.com/show_bug.cgi?id=1675743
2019-03-04 14:04:34 -05:00
Pavel Hrdina
26a433fc42 virtManager: clone: check which storage pools supports volume cloning
When cloning a guest in virt-manager the GUI shows a list of disks and
select default cloning policy for every disk.  For storage pools where
we know that cloning is not possible we should not select that option
as default one.

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

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-03-04 13:23:45 +01:00
Cole Robinson
be15a01bb2 tests: test_urls: require explicit distro= value
Most tests have a distro= value specified already. Make distro=none
required for those tests since they are limited
2019-03-02 16:52:24 -05:00
Cole Robinson
ad53d59038 kernelupload: Revive upload support check
Needed so that test_urls doesn't fail attempting to upload
2019-03-02 16:25:55 -05:00
Pavel Hrdina
7672b1b010 virtinst: cli: fix ParserBoot to return the parsed object
This fixes virt-xml to return an XML for command:

    virt-xml --build-xml --boot os_type=hvm

The VirtCLIParser.parse() expects the _parse() method to return
the parsed object.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-03-01 16:47:56 +01:00
Pavel Hrdina
57db41854c virt-clone: fix force-copy of empty cdrom or floppy disk
There is nothing to copy so don't try to generate new path.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-02-28 18:05:31 +01:00
Pavel Hrdina
6f5762ab1f guest: remove useless has_virtio_scsi variable
Apart from the fact, that 'virtio' is not a valid scsi controller model
the 'has_virtio_scsi' variable is not needed at all.  It is used only
in one condition where both 'has_any_scsi' and 'has_virtio_scsi' has to
be false which can happen only if there is no 'scsi' controller defined
by user.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-02-28 15:36:24 +01:00
Pavel Hrdina
a0b42327c6 graphics: move all listen code into one place
Instead of duplicating the code into CLI and GUI move it into graphics
device file which is used from both places.  This also fixes a bug in
virt-xml where changing listen to address was not working.

This also changes behavior to always configure one listen type when
using CLI listen option or GUI.  If user wants to modify only specific
listen type they can use listens[] options from CLI.

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

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-02-28 11:48:09 +01:00
Pino Toscano
9cd405b6ef osinfo: deal with rolling distros for EOL status
If a distribution has no EOL date set, always consider it supported if
its release status is "rolling".

(crobinso: reformat a bit, appease pylint)

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2019-02-19 15:57:21 -05:00
Cole Robinson
05f4abe0d7 tests: Add osdict get_location/--os-variant install=X tests
Just failure coverage for the command line so far, we will need
some new infrastructure to test more than that
2019-02-18 11:17:57 -05:00
Cole Robinson
d48ea2f5ff virt-install: Explicitly fail on bad os-variant install=X 2019-02-18 11:17:57 -05:00
Cole Robinson
8139b3839e osdict: Raise exception on get_location failure
It's better to error immediately if we know this won't work
2019-02-18 10:56:38 -05:00
Fabiano Fidêncio
5f7d49d6a3 virt-install: Deal with os-variant's install param
As os-variant has a new "install" parameter that can be passed, let's
take advantage of it and automatically fill options.location with data
from osinfo-db whenever install=location is passed (and, of course,
osinfo-db has the information).

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-02-14 13:33:48 -05:00
Fabiano Fidêncio
cbe84879db cli: Add "install" parameter to os-variant
The new "install" parameter receives "location|cdrom" and will be used,
at least for now, to automatically get the URL location of an OS from
osinfo-db.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-02-14 13:33:48 -05:00
Fabiano Fidêncio
08d3a5786c osdict: add get_location()
get_location() is a new method that returns the osinfo-db tree URL of an
OS, according to the passed architecture.

This method will need some improvement later on once we start having a
specific set of definitions on osinfo-db about what's the type of the OS
we're dealing with (like Server, Desktop, ...).

For now, the new method returns the first URL found without taking into
the consideration the types speficied above.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-02-14 13:33:48 -05:00
Fabiano Fidêncio
e103aab7cc virt-install: Set options.disk if the value comes from osinfo-db
Commit 45ab922b2c moved the code to the way it was before the libosinfo
default changes. However, by not setting "options.disk" the parser will
error out and bail the installation as this option must be set. Only
parsing the disk doesn't seem to be enough as the check is actually done
against "options.disk".

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-02-14 13:33:48 -05:00
Cole Robinson
ae8a4f3db3 engine: Fix first run startup error (bz 1674040)
unitpath can be used uninitialized

https://bugzilla.redhat.com/show_bug.cgi?id=1674040
2019-02-08 15:50:15 -05:00
Cole Robinson
fb5aadc636 guest: Move compare_device to Device class
It operates on a Device object, so it makes sense
2019-02-07 17:42:55 -05:00
Cole Robinson
10973c7932 guest: Add find_device to Guest
It operates on a Guest object, so it makes sense
2019-02-07 17:36:10 -05:00