Commit Graph

55 Commits

Author SHA1 Message Date
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
Cole Robinson
7b61c45d3b guest: Move all_devices to guest.devices.X
The way we enumerate devices doesn't conform with the way all
other XMLBuilder instances expose child objects. Move more towards
that direction.

This requires some virt-xml and cli.py hacks but we will remove those
in future patches
2018-03-21 11:17:36 -04:00
Cole Robinson
fe9ed2340c virtinst: move <domain> XML files to virtinst/domain
And give the classes consistent naming
2018-03-21 11:17:36 -04:00
Cole Robinson
b6dcee8eb7 Use consistent and minimal license header for every file 2018-03-21 07:29:40 -04:00
Cole Robinson
3909c10441 virtinst: Move all devices to virtinst/devices/ 2018-03-21 07:29:40 -04:00
Cole Robinson
1c911ce567 virtinst: Give device classes consistent DeviceX naming
Previous state was inconsistenty and needlessly wordy. Fix up
a few other class namings that have redundant Virtual in the name
2018-03-21 07:29:40 -04:00
Radostin Stoyanov
1ae5c4ff75 pylint: Resolve logging-not-lazy
A new Python checker was added to warn about using a + operator inside
call of logging methods when one of the operands is a literal string.

https://pylint.readthedocs.io/en/latest/whatsnew/1.8.html

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-03-03 16:04:12 -05:00
Cole Robinson
d108bbe143 Convert docstrings to standard reStructuredText param format 2018-02-14 11:08:09 -05:00
Radostin Stoyanov
b93cc3bbc9 pycodestyle: Do not use bare 'except:'
A bare 'except:' catches all exceptions [1], including SystemExit,
KeyboardInterrupt, and GeneratorExit (which is not an error and should
not normally be caught by user code). In situations where you need to
catch all “normal” errors, you can catch the base class for all normal
exceptions, Exception [2].

[1] https://docs.python.org/2/howto/doanddont.html#except
[2] https://docs.python.org/2/library/exceptions.html#Exception
2017-08-02 13:57:43 -04:00
Cole Robinson
ff3b4dc5b0 cli: Don't overwrite install bootorder with manual --boot (bz 1438946)
--boot should be for post-install bootorder only

https://bugzilla.redhat.com/show_bug.cgi?id=1438946
2017-04-04 18:22:15 -04:00
Pavel Hrdina
4c3e7969c6 virt-install: concatenate all extra-args argument
So far we used only the last --extra-args argument from virt-install
command line, but it makes more sense to use all occurrences of
--extra-args and pass them to kernel.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2016-03-18 03:28:17 +01:00
Cole Robinson
bfa5762d9e guest: Add install cdrom in set_defaults, not start_install (bz 1220180)
Fixes weirdness when using addhardware wizard for a customized VM,
and makes the code easier to follow anyways.
2015-06-06 17:02:20 -04:00
Cole Robinson
86f1133777 guest: Encode defaults into the XML at install time
Previously we made all the default encoding non-permanent by XML objects
before generating the XML, making changes to the copies, and restoring
to the old state after the XML is returned to the user.

This allows us to call start_install multiple times with the same Guest
object and not alter it's original config... but that feature isn't really
useful anymore, and this behavior makes the 'customize before install'
dialog difficult to handle.

So drop most of it, and fix some of the minor fallout.
2015-04-07 18:36:06 -04:00
Cole Robinson
92663eb1de devicedisk: Drop transient parameter
Just patch it in from distroinstaller
2014-12-05 21:49:10 -05:00
Cole Robinson
eb7612356e virtinst: Switch to relative imports, fix cyclic import warnings 2014-09-12 16:28:38 -04:00
Chen Hanxiao
2987c721fb virtinst: fix a pylint warning
fix a "attribute-defined-outside-init" warning.
We set installer.livecd in virt-install.

Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
2014-09-11 09:33:50 +08:00
Cole Robinson
a8843e5807 virtinst: Remove redundant LiveCDInstaller
DistroInstaller can basically do the same thing. This also gives us distro
detection when using virt-install --livecd
2014-09-07 13:42:56 -04:00
Cole Robinson
1247e8d43e installer: Don't needlessly pass around scratchdir 2014-09-07 13:35:34 -04:00
Cole Robinson
a722eeac78 virt-install: Enable libosinfo detection for --cdrom
This streamlines virt-manager and virt-install implementations, requiring
installer.distro_detect to be called if we want distro detection. As
a side effect, we now get CDROM detection for free.
2014-09-07 12:20:26 -04:00
Cole Robinson
719f23a273 cli: Support per-device <boot order=> 2014-02-09 14:07:27 -05:00