Commit Graph

224 Commits

Author SHA1 Message Date
Cole Robinson f36e8b36bc virt-install: Rework install option detection a bit
Add an explicit no_install to Installer to encode that the user is
not expecting an install phase. Use that to determine later if any
install options were specified. This saves later code from having
to deal with installer=None, and is the basis for further clarifications
2019-06-13 16:36:21 -04:00
Cole Robinson 3b396e8321 virt-install: Split out --wait handling into a helper class
And add much more clitest coverage
2019-06-13 16:02:58 -04:00
Cole Robinson 8234b55fe8 tests: clitest: Fill in much more virt-install coverage 2019-06-13 16:02:52 -04:00
Cole Robinson 3cc42c2f24 virt-install: Drop install option collision errors
It's getting hard to track this correctly with the addition of
--install. Drop it. The important thing is validating when no install
options were specified
2019-06-13 14:13:29 -04:00
Cole Robinson c5bbf2f48d virt-install: Drop --transient and --noreboot rejection
It's a nonsensical request but it should be obscure enough to not
warrant explicit validation
2019-06-13 14:05:22 -04:00
Cole Robinson 19bcec651c virt-install: Push validation down into the installer
It's hard to validate whether something like --extra-args or
--initrd-inject is supported based on the command line arguments. It's
easier to let the installer.py figure it out because it's the
authoritative source
2019-06-13 14:00:04 -04:00
Cole Robinson b746d919a9 virt-install: Add --install kernel_args=X,kernel_args_overwrite=yes|no
--install kernel_args=X acts like --extra-args. If
kernel_args_overwrite=yes is also specified, it overwrites whatever
default kernel args we would have used for the install method.
2019-06-13 14:00:04 -04:00
Cole Robinson 1f4a5a1b43 cli: Add --install bootdev=X,kernel=X,initrd=Z
This is the beginning of a big --install option, which will be used
for tweaking less common elements of the install process
2019-06-11 17:55:09 -04:00
Cole Robinson 436c471b15 virt-install: Drop the serial extra_args warnings
There's been multiple reports that these aren't really valid nowadays.
systemd is smart enough to make this work automagically. So just drop
it
2019-06-11 17:55:09 -04:00
Cole Robinson de90716eb4 unattended: Choose a default profile name if none specified
We default to 'desktop' if none specified, otherwise we choose the
first alphabetical profile available. Make bare '--unattended' a
valid option
2019-06-11 17:55:09 -04:00
Cole Robinson 13b3790829 virt-install: Print when we set default memory and disk
Since we never defaulted here before, print out the values we are
setting. Users can see right away if they actually want those values
or not.
2019-06-11 17:55:09 -04:00
Cole Robinson b3e6ebe28b virt-install: Generate default --name
This uses the same logic as virt-manager. The name is mostly
derived from --os-variant naming, but we have fallback defaults too.

Print the name to stdout so users are informed about what we are
doing.
2019-06-11 17:55:05 -04:00
Cole Robinson 01a07a1051 virt-install: Share required option logic for resources
There's some cases we were incorrectly setting osinfo defaults, when
mem or storage values had already been specified elsewhere
2019-06-11 17:54:45 -04:00
Cole Robinson 17d157820f guest: move libosinfo resource setting to virt-install
This puts all the default resource setting in one place, and the
only place that was depending on it, as virt-manager explicitly sets
the values on its own. This will be used in future patches to add
more default setup and report the values to the user
2019-06-11 17:51:25 -04:00
Cole Robinson cc366fff7d cli: Add more code coverage 2019-06-11 17:51:25 -04:00
Cole Robinson 203c0d4a6c virt-install: Call install.get_search_paths
Similar to what we do via create.py
2019-06-11 17:51:25 -04:00
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