Commit Graph

208 Commits

Author SHA1 Message Date
Cole Robinson
635361f0bd tests: Add osinfo URL and URL unattended tests 2019-06-08 10:20:36 -04:00
Cole Robinson
388850f04e virtinst: Rename util to xmlutil
The only functions left in there are largely for xml handling, so
make it explicit
2019-06-07 18:21:24 -04:00
Cole Robinson
c0ddb86918 tests: clitest: define XML generated from compare tests
All our virt-install/virt-clone compare tests aren't actually
attempting to define the XML, meaning we could be generating bogus
output. Enable it, then fix the fallout, mostly some places we are
triggering libvirt XML validation
2019-05-14 11:57:50 -04:00
Cole Robinson
12440b00c1 osdict: return _OsResources to callers
Use the class helper routines to save some tedious dict management
2019-05-12 17:25:47 -04:00
Cole Robinson
2a30a5f0bf cli: make parse() guest argument optional
Because the non-guest parsers don't need it.
2019-05-12 17:22:13 -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
Christian Borntraeger
5bc847ebb0 virt-install: Do not warn about consoles on s390x
s390x guests usually detect the sclp or virtio console. The current
warning might actually break setups. Let us disable the warning.

Reported-by: Andre Wild <wild1@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-03-14 18:21:51 +01:00
Fabiano Fidêncio
d97b528710 virt-install: Deal with "--cdrom" unattended installations
When dealing with unattended installation, we safely can assume that
"--cdrom" can be treated as "--location". The reason for that is that
we'll need to, under the hooks, extract its kernel/initrd and perform an
initrd injection.

This commit makes "--unattended" work properly when combined with
"--cdrom".

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-03-08 17:11:38 -05:00
Cole Robinson
3a29b40af6 virt-install: Error earlier when --unattended is missing --os-variant 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
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
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
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
4a2ff83b51 cli: Parameterize --os-variant
For now it just takes a single name= parameter that maps to
the current behavior
2019-02-07 16:27:01 -05:00
Cole Robinson
1ad1c2acd1 virt-install: Drop --os-variant tolower()
This could break some command line invocations, but there's no
guarantee libosinfo might not add capitalized IDs in the future,
and there's an easy workaround to just lowercase the passed value
2019-02-07 16:05:12 -05:00
Cole Robinson
a9eecd591c cli: Rename options.distro_variant to options.os_variant
We don't really use the 'distro' naming any more, and the
command line option is called os_variant, so stick with that
2019-02-07 15:48:40 -05:00
Cole Robinson
ada5b49d3b virt-install: Remove remote URL error
This is for very old libvirt versions. Just let it fail later on
2019-02-07 15:22:48 -05:00
Cole Robinson
91cdb485cb virt-install: Drop xenpv install warnings
These may still be relevant, but I think it's fine just to let
the config fail to install. I'm not even sure if anyone is trying
xenpv these days...
2019-02-07 15:13:30 -05:00
Cole Robinson
a5e01c947d virt-install: set_install_defaults before disk validation
So we validate the CDROM disk contents too. This revealed we were
using a cdrom path in the test driver that was assigned as a
writeable disk to another test VM, which is a correct warning, so
fix the fallout, and ensure that we don't warn when colliding with
another cdrom device
2019-02-07 15:00:27 -05:00
Cole Robinson
45ab922b2c virt-install: Parse option strings before installer creation
This is how it was before the libosinfo defaults changes. In general
this pattern is more sensible: we serialize all the Guest data, then
create the installer which acts on a Guest, then fill in any missing
config with libosinfo bits.

We need to manually parse a disk option string now which is a bit funky
2019-02-07 14:51:28 -05:00
Cole Robinson
0afe0c1797 virt-install: Break out set_resources_from_osinfo 2019-02-07 14:38:32 -05:00
Cole Robinson
951aba41b9 virt-install: Split apart set_distro_variant
There's two cases: for an explicitly requested --os-variant, we
want to set it ASAP, since more things will depend on it in the
future, like grabbing install media from libosinfo. For the
'auto' case, we need to wait until the installer is setup.
2019-02-07 14:30:00 -05:00
Cole Robinson
6e4b4a5cba virt-install: Simplify convert_old_os_options 2019-02-07 14:09:37 -05:00
Cole Robinson
921a604abe virt-install; Don't add os-variant storage for containers 2019-02-03 15:46:32 -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
137be83232 cli: Use VirtCLIParser for --location
No-op change for now, just adds a default subopt location=. But
more subopts will be added in the future
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
6c28f53590 cli; Share --os-variant option registering
And improve the help message for both users
2019-01-08 12:44:53 -05:00
Fabiano Fidêncio
050acb68f1 virt-install: Default to libosnfo recommended disk size
If no disk options are passed, let's fallback to the libosinfo
recommended disk size for the OS variant.

The guest.set_capabilities_default(), build_installer() and the set of
the distro variant have been moved earlier in the code in order to fetch
the correct information from libosinfo and then set the recommended disk
size without changing much of build_guest_instance() logic.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-01-07 12:24:06 +01:00
Lin Ma
f6076a0eb0 virt-install: Add auto complete support for the general options
With this patchset, the general options completion is available. ex:

$ virt-install -<TAB><TAB>
...
--arch      --check     --cpu       --dry-run   -h
--autostart --clock     --cputune   --events    --help
...

$ virt-install --a<TAB><TAB>
--arch       --autostart

Signed-off-by: Lin Ma <lma@suse.com>
2018-12-18 11:20:35 -05:00
Andrea Bolognani
751fb88c58 virt-install: Add "Guest OS" options group
The --os-variant option doesn't quite fit perfectly into
its current "Installation method" group, plus we want to
add the same option to virt-xml which can't have that
group for obvious reasons.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-11-12 16:15:33 +01:00
Andrea Bolognani
a550a95727 virt-install: Fix description for --os-variant
Since we're messing with it either way, might as well use
modern OS names as examples.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2018-11-12 16:15:33 +01: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
0cbb420347 virt-install: Limit --os-variant warning to kvm+x86
As that's really all that libosinfo defaults presently matter for
2018-10-13 12:55:34 -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
4f320c2b98 distroinstaller: Remove implied cdrom installs
This is an obscure feature that I'm skeptical anyone is relying on,
and has weirdly subtle semantics that are hard to test.
2018-10-12 15:33:05 -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
42a96cfd59 virt-install: add --destroy-on-exit
This makes the console window behave like a raw qemu command line:
when the user closes it, the VM is hard powered off.
2018-10-11 15:24:16 -04:00
Cole Robinson
96ac896e1a cli: Remove redundant argparse dest= options 2018-10-11 12:53:03 -04:00
Cole Robinson
3e55e89453 tests: Add better virt-install console testing 2018-10-11 12:19:48 -04:00
Cole Robinson
63b4d1f154 virt-install: Encode guest defaults earlier
We need this for determining correct console tool to launch,
and probably other checks later
2018-10-11 12:19:09 -04:00
Cole Robinson
a4097b7691 cli: Merge multiple instances of single use opts
So --memory 123,maxmem=456 --memory 555 is equivalent to
--memory 555,maxmem=45
2018-10-05 13:23:20 -04:00
Cole Robinson
b51104ad22 guest: Tweak error with invalid --os-variant
Try to point people in the right direction if they specify an
unknown distro name on the cli, like was reported here:

https://bugzilla.redhat.com/show_bug.cgi?id=1576473
2018-10-03 19:32:09 -04:00
Cole Robinson
6063538750 guest: Replace os_variant with set_os_name
And have callers directly access osinfo.name if they need it
2018-09-12 17:24:28 -04:00
Cole Robinson
4e30161f44 guest: Absorb UEFI default setup
Rather than force callers to deal with it
2018-09-12 14:02:23 -04:00
Cole Robinson
a2fa799478 capabilities: Drop lookup_virtinst_guest
Users should just init Guest() directly, and call
set_capabilities_defaults if they need default arch data
2018-09-06 20:28:05 -04:00