Commit Graph

74 Commits

Author SHA1 Message Date
Cole Robinson
a4a577bd23 tests: Finish off installer and kernelupload coverage 2019-06-11 17:55:09 -04:00
Cole Robinson
f056798918 virtinst: Add a bunch of # pragma: no cover 2019-06-11 17:51:25 -04:00
Cole Robinson
b7465fdcf8 installertreemedia: Move url() to is_network_url()
And then have callers just access location. It's more clear IMO
2019-06-11 17:51:25 -04:00
Cole Robinson
4dd12e2e56 installer: Generate the unattended script only in installer
And pass it down to treemedia, which acts on our script wrapper
object. This is conceptually a bit simpler because we can see in
one place what data feeds the script build process, depending on
installer props
2019-06-09 20:19:42 -04:00
Cole Robinson
20bb798a5f virtinst: mv *inject.py into single installerinject.py
Share the mapping logic between them
2019-06-09 19:00:03 -04:00
Cole Robinson
b3a9b98e08 osdict: Standardize on OsMedia usage
* Make all API calls go through the _OsMedia object
* Move most of the unattended specific processing to unattended.py
* Rename requires_internet to is_netinst to clarify what it is checking
2019-06-09 11:26:28 -04:00
Cole Robinson
d9b41bf887 tests: Add clitest coverage for network-install resources 2019-06-09 10:14:48 -04:00
Cole Robinson
4a04af38f1 tests: clitest: Add windows unattended unittest 2019-06-08 15:33:37 -04:00
Cole Robinson
d3b20b16d0 unattended: Don't use custom subdir for storing tempfiles
The reason this was done, is because we need to inject files with
certain names into the initrd/cdrom media so the guest OS can find
them, but our injection infrastructure didn't have the knowledge
necessary to rename files at injection time.

Having to deal with the subdir complicates cleanup and unattended
data generation, so let's do away with it. Teach the injection
bits about renaming, and adjust all the related bits to use
standard tempdirs
2019-06-08 15:25:12 -04:00
Cole Robinson
3495a8f1f9 unattended: Share more script generation bits
- Break out the installer* unattended prep to its own function
- Move logging into common unattended call
- Use libosinfo APIs to generate script str, then we write it
- Move commandline lookup to installertreemedia
- Rename path->scriptpath for clarity
2019-06-08 14:16:52 -04:00
Cole Robinson
e9dcb4056d installer: Rework some test suite urlfetcher hacking
Rather than alter where we save the files, behave like normal but
only change what we store in the XML
2019-06-07 21:40:47 -04:00
Cole Robinson
c2de4d7c36 util: Move get_cache_dir to VirtinstConnection
Renaming it get_app_cache_dir so it doesn't conflict with get_cache_dir
usage in virtManager
2019-06-07 17:53:15 -04:00
Cole Robinson
c603ea4084 util: Move *_meter to progress.py 2019-06-07 17:32:51 -04:00
Cole Robinson
ca10e4094b util: move is_error_nosupport to SupportCache 2019-06-07 16:49:19 -04:00
Cole Robinson
2a4a03e37a util: Move scratchdir helpers to InstallerTreeMedia
They are only really needed by the Installer handling
2019-06-07 14:00:00 -04:00
Fabiano Fidêncio
fd5bd5d90f installer: Prefer "cdrom" over "floppy"
Instead of using "floppy" as the way to perform unattended installations
for Windoes, let's prefer using "cdrom" instead.

The main reasons behind this change are:
- VMs using q35 may have floppy device disabled in some systems;
- We can drop mstools dependency;

Generating the ISO depends on genisofs, tho. However, it's not a big
deal as genisofs is already a virt-manager dependency.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-06-07 13:41:57 -04:00
Fabiano Fidêncio
473f5c14d6 installer*.py: Remove temporary dirs
Together with the temporary files removal, let's also remove the
directories created to store those files.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-06-07 13:41:57 -04:00
Fabiano Fidêncio
2dd006d6f2 installer: Log when cleaning up the unattended files
Similarly to what's already done in installertreeinfo.py, let's log when
removing the files used during the unattended installation.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-06-07 13:41:57 -04:00
Cole Robinson
87a73b07e2 installer: Remove cdrom by path, not device handle
The latter doesn't play well with Customize wizard XML editing, which
recreates objects
2019-06-05 11:13:33 -04:00
Cole Robinson
135b97637e guest: Rename memory properties to match XML values
Right now we have:

* memory -> ./currentMemory
* maxmem -> ./memory
* hotplugmaxmem -> ./maxMemory

Which is just a mess to know what we might be really setting behind
the scenes. Rename the properties to match the XML element name, and
adjust all users to the new names. cli options aren't changed though
2019-05-12 17:25:47 -04:00
Fabiano Fidêncio
d5af67d077 installer: add support for windows unattended install
The Windows unattended installation is quite similar to the Linux one
with a few major differences:
- It uses floppy injection instead of initrd injection
  - Yes, it does. Then we have to create a floppy, add the device and,
    when finishing the installation, remove the device;
- There's no InstallerTreeMedia in the game making us end up duplicating
  some code in the Installer class as:
  - keeping track of files that have to be cleanup up;
  - actually cleaning up the files;
  - generating the install script

Apart from that, some obvious differences in the scripts where already
done in a previous commit, but those were basically:
- Not using /dev/*da as a target disk, but use "C" instead;
- Set the product-key
- Explicitly set the injection method as "floppy"

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-04-01 16:28:52 -04:00
Fabiano Fidêncio
ec102a07a1 installer: add unattended data
Let's add unattended data to the Installer class as it's going to be
used whenever a Windows unattended installation is performed.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-04-01 16:28:52 -04:00
Fabiano Fidêncio
a9a983af30 installer: deal with unattended files
Let's have a way to keep track of unattended files that are going to be
used when performing a unattended installation of a Windows guest so we
can clean them up whenever the installation is done.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-04-01 16:28:52 -04:00
Fabiano Fidêncio
889936f857 installer: deal with floppy devices used during install
A floppy device is going to be used when performing a unattended
installation in a Windows guest.

In order to have it done cleanly, let's mimic the what's already
existent for dealing with cdrom devices used during installation.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-04-01 16:28:52 -04:00
Fabiano Fidêncio
cb6600296c installer: Set the network install resources when needed
Some distros (as Fedora, RHEL, and CentOS) require a bigger amount of
RAM during network installation than the recommended amount to run the
system.

In order to properly have it set, let's take advantages of the libosinfo
network-install resources API and change the guest amount of ram for the
installation.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-28 15:56:44 -04: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
Cole Robinson
bc98c21758 installer: Remove need_scratchdir
create.py doesn't really need to know about it. It just needs to know
what paths the install process is going to be accessing.
2019-02-07 13:58:55 -05:00
Fabiano Fidêncio
0aebc73793 installer: Don't call _cleanup() when starting an installation
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-02-07 11:50:45 -05:00
Cole Robinson
39bb8968d0 virt-install: add --location LOCATION,kernel=X,initrd=X
Add kernel= and initrd= --location suboptions. These can be
used to override the default kernel/initrd and specify new
paths, relative to LOCATION.

For example, if you have an ISO that libosinfo doesn't know
about called my-unknown.iso, with a kernel at 'kernel/fookernel'
and initrd at +'kernel/fooinitrd', you can make this work with:

--location my-unknown.iso,kernel=kernel/fookernel,initrd=kernel/fooinitrd
2019-02-03 12:05:18 -05:00
Cole Robinson
71c9ff487a installer: Modernize the docstring 2019-02-03 12:05:18 -05:00
Cole Robinson
c20e78926b installer: Drop check_location
detect_distro does it all already nowadays, so there's no
real reason to have a separate entry point.
2019-02-03 12:05:18 -05:00
Cole Robinson
2f89ecf4a9 Remove Author lines from file headers
Similar to what was done in libvirt. See these commits:

600462834f
c99e954973
2019-01-08 11:45:35 -05:00
Cole Robinson
f102d2a256 tests: inject: use virt-install, not direct API
Simplifies the code and gives us actual command line coverage,
but requires a small hack to work correctly for modern
centos/fedora test cases, inst.repo from --location takes
precedence over our kickstart URL
2018-10-13 16:31:04 -04:00
Cole Robinson
e212ce84e6 installer: extraargs -> extra_args
Better matches what's on the command line
2018-10-13 16:29:32 -04:00
Cole Robinson
4ae24802d7 installer: Fix --initrd-inject 2018-10-13 15:51:38 -04:00
Cole Robinson
41d0f8fdf1 installer: Order install CDROM before any manual CDROMs
This is important for the virtio-win case: --cdrom media should
always be ordered first, so it's the boot preference.

https://www.redhat.com/archives/virt-tools-list/2018-September/msg00048.html
2018-10-13 10:44:09 -04:00
Cole Robinson
2e6093d6b6 create: Show inserted CDROM media in customize
This makes it easier for people to change install media afterwards
if they want:

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

But also this makes it more clear that if users want to use virtio-win,
they need to add an additional CDROM and not try to reuse the install
CDROM device
2018-10-13 10:17:50 -04:00
Cole Robinson
2482e57a15 create: Fix customize boot page
Installer reworks dropped the guest.autostart flag, need to add
it back. Add Uitest for it
2018-10-13 09:46:06 -04:00
Cole Robinson
11d1cbdf06 installer: DistroInstaller -> InstallerTreeMedia
Now we have only one Installer class, and callers don't need to
worry about choosing a particular class type depending on their
needs, just pass cdrom vs. location to the installer init and
we figure out everything behind the scenes.

Besides simplifying the callers this makes the control flow a
lot easier to follow whether looking at InstallerTreeMedia or
Installer classes
2018-10-13 09:42:11 -04:00
Cole Robinson
286dbf6d51 installer: Fold PXEInstaller into base Installer class
PXEInstaller is really just 'boot off bootdev=network' which is
easy enough to model without a separate class
2018-10-12 15:15:20 -04:00
Cole Robinson
bd35f4711c devices: disk: Rename setup() to build_storage()
It's more explicit. Plus drop the supposedly generic setup()
entry point, storage is handled specially everywhere so it's
not a generic interface
2018-09-04 14:55:04 -04:00
Cole Robinson
852d7b564d virtinst: Remove name field validate_cb usage
Either openly do this at callers, or wrap it in a validate() call.
Doing this at set time has always had issues, like the self.replace hack
2018-09-04 14:55:04 -04:00
Cole Robinson
f1bbc5f67a guest: move set_install_defaults to installer class
It's only called explicitly in one place, so update the caller
2018-09-04 14:55:04 -04:00
Cole Robinson
8a6a491306 guest: Drop self.autostart and self.replace
Require callers to pass autostart as an argument to start_install
self.replace isn't even used for guest installs
2018-09-04 14:55:04 -04:00
Cole Robinson
9e05c56397 guest: Drop self.domain
The only user is virt-install, make its usage explicit
2018-09-04 14:55:04 -04:00
Cole Robinson
fdbb1f9e5a installer: Absorb all guest start_install handling
Really it makes more conceptual sense that the Installer class
should handle start_install and friends, but that's difficult
because the layering is all mixed up.

Start to untangle it by moving all those routines to the Installer
class and adding wrapper APIs to Guest to maintain compat for now.
2018-09-04 14:55:04 -04:00
Cole Robinson
1abbdfc551 installer: Drop isinstall parameter
Separate the install from postinstall config case more clearly,
so the installer is only ever altering bits for the install-time
case, and Guest handles actually writing postinstall bits
2018-09-04 14:55:04 -04:00
Cole Robinson
068c8aedd2 installer: Remove ContainerInstaller and ImportInstaller
Fold their non-logic into the base Installer class
2018-09-04 14:55:04 -04:00
Daniel P. Berrangé
48e32b429d Fix copyright header to specify GPLv2 or later, not GPLv2 only.
The copyright headers in every file were chjanged in this previous commit

  commit b6dcee8eb7
  Author: Cole Robinson <crobinso@redhat.com>
  Date:   Tue Mar 20 15:00:02 2018 -0400

    Use consistent and minimal license header for every file

Where before this they said "

  "either version 2 of the License, or (at your option) any later version."

Now they just say

  "GNU GPLv2"

This fixes it to say "GNU GPLv2 or later" again.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-04 16:51:37 -04:00
Cole Robinson
5b111b3d9f guest: Move get_all_devices to devices.get_all 2018-03-21 12:59:46 -04:00