Commit Graph

6852 Commits

Author SHA1 Message Date
Cole Robinson 59f1eabf27 installtreemedia: Simplify unattended kernel_args logic
Let unattended kernel args take precedence, we implicitly require
a new enough osinfo-db that provides the info we need
2019-06-11 17:51:25 -04:00
Cole Robinson 41757d8e2d man: virt-install: Drop reference to mageia URL support
We support it, but we don't do distro detection so defaults are
going to be crappy.
2019-06-11 17:51:25 -04:00
Cole Robinson 66ffafe148 urldetect: Drop old mandriva URL support
Mandriva hasn't existed since 2011. Drop references to it
2019-06-11 17:51:25 -04:00
Cole Robinson fe82973e1c urldetect: Drop explict ALTLinux support
libosinfo should cover this for us now
2019-06-11 17:51:25 -04:00
Erik Skultety 5ed4a77d6c man: Provide a documentation for the SEV feature
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-06-11 13:00:34 -04:00
Erik Skultety 8ab9dcd33f virtinst: guest: Provide further SEV support checks
These include platform checks - libvirt & QEMU - as well as
configuration - SEV is only supported with UEFI.
Another configuration requirement made in this patch is Q35 machine,
since ADM recommends Q35 in their setups even though SEV can work with
the legacy PC machine type, but we'd have to turn on
virtio-non-transitional for all virtio devices with some other potential
pitfalls along the way.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-06-11 13:00:34 -04:00
Erik Skultety 1a8728fc2d virtinst: guest: Fill in SEV platform specific data automatically
The data in question are 'cbitpos' denoting which addressing bit is the
encryption bit and 'reduced_phys_bits' denoting how many physical
address space we lose by turning on the encryption. Both of these are
hypervisor dependent and thus will be the same for all the guest
residing on the same host, but need to be specified for future migration
purposes.
But given we can probe them from domain capabilities, we don't need the
user to provide them and thus enhancing cli user experience. This
requires a new _SEV domaincapabilities XML class to be created so that
we can query the specific properties.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-06-11 13:00:34 -04:00
Erik Skultety 480a6834c2 virtinst: cli: Provide a default value for the 'policy' argument
Policy is a 4-byte bitfield used to turn on/off certain behaviour within
the SEV firmware. For a detailed table of supported flags, see
https://libvirt.org/formatdomain.html#launchSecurity.
Most of the flags are related to advanced features (some of them don't
even exist at the moment), except for the first 2 bits which determine
whether debug mode should be turned on and whether the same key should
be used to encrypt memory of multiple guests respectively.

>From security POV, most users will probably want separate keys for
individual guests, thus the value 0x03 was selected as the policy
default.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-06-11 13:00:34 -04:00
Erik Skultety 45f3a47c84 virtinst: cli: Introduce parser support for SEV launch security
Introduce both the launchSecurity XML and parser classes. While at it,
add launchSecurity as a property instance to the Guest class too.

The parser requires the 'type' argument to be mandatory since in the
future it will determine different code paths, therefore
'--launchSecurity foo=bar' is incorrect.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-06-11 13:00:34 -04:00
Erik Skultety 9bfdd92c0e tests: Introduce real-world AMD SEV domain capabilities
Rather than editing existing Intel domain capabilities by hand, use
capabilities from a real AMD HW. We're later going to use these to fill
in SEV platform specific data automatically.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Erik Skultety <eskultet@redhat.com>
2019-06-11 13:00:34 -04:00
Cole Robinson a80242d998 cli: Call validate() on is_single objects too
The way the code was nested, we skipped calling validate() on
XMLChildProperty is_single objects. There's no reason to do that,
so adjust it.

We need to do some hasattr checking here, because --os-variant and
--location objects aren't XMLBuilders with validate defined. That's
really an issue of having XMLBuilder assumptions baked into the
generic CLI parsing infrastructure. Unwinding that is for another day
2019-06-11 11:09:56 -04:00
Cole Robinson 102a49771f urlfetcher: Unlink file if download is aborted 2019-06-10 13:13:26 -04:00
Cole Robinson c9af3f94ce installinject: Use genisoimage instead of mkisofs
On Fedora mkisofs and genisoimage are identical and shipped in the
same package. On debian only genisoimage is shipped due to some
historical weirdness or licensing dispute or something. So just
prefer the genisoimage naming
2019-06-10 09:54:07 -04:00
Athina Plaskasoviti 7a52e4c80d cli: Add --numatune memory.placement
XML Mapping:

<numatune>
  ...
  <memory placement=X/>
  ...
</numatune>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-06-10 09:53:36 -04:00
Cole Robinson 578451fe72 urldetect: Don't run regex against None SUSE product name
We are implicitly depending on random dict ordering for what
order we process Distro matching. Our test suite mocking and
different debian ordering revealed a case we could be trying to
run a regex against None. Fix it. The dict ordering issue will
be fixed separately
2019-06-10 08:44:20 -04:00
Cole Robinson b4c9e4b114 tests: Skip unattended tests unless osinfo is new enough 2019-06-09 20:19:45 -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 ae5e9d9a2c virtinst: Add full test coverage for xml*.py files 2019-06-09 19:00:03 -04:00
Cole Robinson 361657ad15 virtinst: Add a lot of test code coverage
* Delete dead code
* Add tests for various device default code paths
* Rework certain conditions a bit so code coverage always hits them
2019-06-09 18:59:50 -04:00
Cole Robinson 261a0a0482 domain: seclabel: Drop some unneeded logic
* imagelabel is a runtime only XML attribute which we don't use at
  all, so drop parsing
* drop validation checks that libvirt will do for us
2019-06-09 18:34:48 -04:00
Cole Robinson b5a664bd1b virtinst: move UI only functions into virtManager
These throw off code coverage testing. They are mostly:

* pretty* device helpers
* network + snapshot validation + creation routines
2019-06-09 18:33:45 -04:00
Cole Robinson c9233aa6c3 tests: uitests: Run whole suite without testsuite hacks
We want to hit real network fetching, etc.
2019-06-09 14:26:03 -04:00
Cole Robinson ae06ed7aaa setup: Omit progress.py from coverage output
Since it's copied code that we rarely touch
2019-06-09 11:36:07 -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 195d775c5b installertree: abspath convert MEDIA_DIR
Various parts of the code implicitly expect an absolute path
2019-06-09 10:50:21 -04:00
Cole Robinson e8e8853c22 guest: Don't log when setting default os name=generic 2019-06-09 10:48:13 -04:00
Cole Robinson 0113455065 tests: osdict: add basic list_os unittest 2019-06-09 10:40:26 -04:00
Cole Robinson d9b41bf887 tests: Add clitest coverage for network-install resources 2019-06-09 10:14:48 -04:00
Cole Robinson f6a4326a9a unattended: Drop glib/gio usage
Use native python lib bits to do timezone and locale lookup
2019-06-09 09:50:28 -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 08baf0ee5f unattended: Handle libosinfo returning kernel url arg
Latest libosinfo will handle this. Check for it so we don't end up
with double options on the command line
2019-06-08 13:03:08 -04:00
Cole Robinson 95d685420b connection: Fix --location with --connect test:///default
Some scratchdir changes made us now attempt vol upload, which doesn't
work for the test driver. Make sure we don't attempt kernelupload
for this case
2019-06-08 12:58:38 -04:00
Cole Robinson 635361f0bd tests: Add osinfo URL and URL unattended tests 2019-06-08 10:20:36 -04:00
Cole Robinson 1914f0f6cd initrdinject: Try harder to clean up tempdir on error 2019-06-08 09:55:09 -04:00
Cole Robinson 756dab784c kernelupload: Add test suite mocking 2019-06-08 09:41:52 -04:00
Cole Robinson f01a534cfb tests: Use testsuirebr0 as the fake bridge name
It's more obvious in the output than 'eth0'
2019-06-08 09:24:33 -04:00
Cole Robinson b97003ddfc interface: Get more unittest coverage of _default_* 2019-06-08 09:24:25 -04:00
Cole Robinson f3b0830cf3 tests: Add run_without_testsuite_hacks decorator 2019-06-08 09:11:00 -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 af12b32928 osdict: Don't use a variable named 'os' 2019-06-07 21:26:02 -04:00
Cole Robinson 37adfb0150 urlfetcher: Add http and ftp unit test mocking 2019-06-07 21:25:41 -04:00
Cole Robinson 9fc20d4a97 osdict: Fix url arg detection for fedora-rawhide distro 2019-06-07 21:13:51 -04:00
Cole Robinson 6caa085f6c tests: test_urls: Update 2019-06-07 21:13:51 -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 6677f677da util: move generate_name to generatename.py 2019-06-07 18:16:53 -04:00
Cole Robinson 5ed8f2aa5f util: move validate_name to XMLBuilder.validate_generic_name 2019-06-07 18:04:12 -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