Commit Graph

1483 Commits

Author SHA1 Message Date
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
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
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
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
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
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
4a04af38f1 tests: clitest: Add windows unattended unittest 2019-06-08 15:33:37 -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
635361f0bd tests: Add osinfo URL and URL unattended tests 2019-06-08 10:20:36 -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
37adfb0150 urlfetcher: Add http and ftp unit test mocking 2019-06-07 21:25:41 -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
c603ea4084 util: Move *_meter to progress.py 2019-06-07 17:32:51 -04:00
Cole Robinson
7d17d5d03b virtinst: Run register_libvirt_error_handler on import
We basically want this everywhere, and transparently, so run it on
import like we do for gettext setup
2019-06-07 16:56:57 -04:00
Cole Robinson
ecc3e3d34e support: add is_libvirt_error_no_domain
Repurpose the generic util.exception_is_libvirt_error for the one
purpose that it's actually used, add it as a SupportCache staticmethod,
and test it
2019-06-07 16:44:14 -04:00
Cole Robinson
f85e6def55 support: Convert callers to the new format 2019-06-07 16:26:03 -04:00
Cole Robinson
566a4681a8 support: Rework support check invocations
SupportCache.check_support(SUPPORT_FOOBAR, args) becomes
SupportCache.foobar(args)

And SupportCache absorbs the caching infrastructure from
VirtinstConnection.

For now we add some hackery to hide the API change from callers, but
this will be undone in the next patch
2019-06-07 16:25:39 -04:00
Cole Robinson
e58d765ae5 tests: xmlconfig: Add tests for real uuid and mac generation 2019-06-06 18:35:36 -04:00
Cole Robinson
50addfebca nodedev: Drop the non-standard .parse() handling 2019-06-05 16:35:34 -04:00
Cole Robinson
ab0c99057b nodedev: Fold DRMDevice into NodeDevice 2019-06-05 16:35:34 -04:00
Cole Robinson
87b2ea4672 nodedev: Fold SCSIBus into NodeDevice 2019-06-05 16:35:34 -04:00
Cole Robinson
8d13125564 nodedev: Fold StorageDevice into NodeDevice 2019-06-05 16:35:34 -04:00
Cole Robinson
eeb7babef7 nodedev: Fold SCSIDevice into NodeDevice 2019-06-05 16:35:34 -04:00
Cole Robinson
cf3bc3eb3b nodedev: Remove unused USBBus parsing 2019-06-05 16:35:34 -04:00
Cole Robinson
b7ac99473d nodedev: Fold USBDevice into NodeDevice 2019-06-05 16:35:34 -04:00
Cole Robinson
a0881bc6f2 nodedev: Fold PCIDevice into NodeDevice 2019-06-05 16:35:34 -04:00
Cole Robinson
ca804c5b5e nodedev: Fold NetDevice into NodeDevice 2019-06-05 16:35:34 -04:00
Cole Robinson
966b0b5a6b nodedev: Drop cap 'system' parsing
We don't use it for anything internally
2019-06-05 16:35:34 -04:00
Cole Robinson
d167021b0f osdict: Drop the solaris10 x2apic hack
The upstream kvm bug has never been resolved. I think this is
obscure enough nowadays that we don't need to track and test it
2019-06-05 16:35:34 -04:00
Cole Robinson
2510c299f5 Use shutil.which instead of distutils find_executable
The former is the more standard library method for this
with python3
2019-06-05 16:35:34 -04:00
Cole Robinson
d65f54dc9d uitests: Enable accessibility if it's turned off 2019-06-05 16:28:05 -04:00
Cole Robinson
09b0caec42 uitests: More work to fix newvm.py flakiness 2019-06-05 16:22:41 -04:00
Cole Robinson
3734148b8c uitests: Improve click() onscreen handling 2019-06-05 12:27:03 -04:00
Cole Robinson
85f5b18a08 uitests: Improve mediachange assertion check 2019-06-05 12:26:35 -04:00
Cole Robinson
bc232eb8de devices: disk: Drop DIR+floppy validation
Libvirt already gives us a similar warning at parse time, this is
obscure enough that we don't need to catch it upfront
2019-06-05 11:13:33 -04:00
Cole Robinson
08b26e9b1c devices: disk: Add tests for missing _storage_backend 2019-06-05 11:13:33 -04:00
Cole Robinson
f22a0ec2e4 xmlbuilder: Add replace_child
This will be used for UI XML editing of devices
2019-06-05 11:13:33 -04:00
Athina Plaskasoviti
27a51b2210 cli: Add --iothreads iothreadids.iothread[0-9]*.id
XML Mapping:

<domain>
...
<iothreadids>
  <iothread id="X"/>
  ...
</iothreadids>
...
</domain>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-06-04 14:17:01 -04:00
Athina Plaskasoviti
8c708210db cli: Add --iothreads
XML Mapping:

<domain>
...
  <iothreads>X</iothreads>
...
</domain>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-06-04 10:58:31 -04:00
Athina Plaskasoviti
304b323f5d cli: Fix add --memballoon stats.period
XML Mapping

<memballoon model=...>
  <stats period="10"/>
</memballoon>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-05-29 14:03:14 -04:00
Athina Plaskasoviti
5b443fd383 cli: Fix --memballoon autodeflate
Fixing commit ebf2199875

XML Mapping:

<memballoon model="virtio" autodeflate="on"/>

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-05-28 17:32:58 +02:00
Athina Plaskasoviti
ebf2199875 cli: Add --memballoon autodeflate
XML Mapping:

<memballoon model=...>
  <autodeflate>on</autodeflate>
</memballoon>

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-05-23 10:03:27 -04:00
Pavel Hrdina
06c2f87397 cli: fix cpu secure option to actually work
The 'secure' option is processed after the model is already set.
CPU security options are resolved while setting CPU model so we need
to know the 'secure' option value before we set the CPU model.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-05-22 16:40:54 +02:00
Pavel Hrdina
abda575e48 tests: include CPU security features in kvm q35 domcapabilities
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-05-22 14:09:59 +02:00
Athina Plaskasoviti
35c53fc02c cli: Add --disk rawio
XML mapping:

<disk type=... rawio="yes">
...
</disk>

Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-05-20 15:32:04 +02:00
Athina Plaskasoviti
d171489f7d cli: Add --disk wwn
XML mapping:

<disk>
  <wwn>...</wwn>
</disk>

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Athina Plaskasoviti <athina.plaskasoviti@gmail.com>
2019-05-17 15:29:18 -04:00
Cole Robinson
bc4573a14b Fix codespell errors 2019-05-16 14:43:31 -04:00
Cole Robinson
de59d33a59 tests: clitest: Move all skip checks into their own class 2019-05-16 14:24:20 -04:00
Cole Robinson
4e3e38cad1 tests: Fix test suite failures on f29 libvirt 4.7.0 2019-05-16 11:29:12 -04:00
Cole Robinson
6394ab7f9a cli: --graphics: Add zlib.compression=
This maps --graphics zlib.compression=auto to the XML:

  <graphics>
    <zlib compression='auto'/>
  </graphics>
2019-05-16 10:21:19 -04:00
Cole Robinson
aeff4e248f tests: Fix testsuite on non-latest libvirt
The memory hotplug changes only work on libvirt 5.3.0, among a few
other pieces. Still do the XML compare but skip domain define if
the new check_version_define comparison fails.
2019-05-15 20:19:58 -04:00
Cole Robinson
4d5f6951a2 man: Don't document broken --controller virtio-scsi
AFAICT this has never worked.
2019-05-15 18:00:24 -04:00
Cole Robinson
f5c5c815e4 cli: Add --seclabel alias for --security
The <domain> XML it alters is called <seclabel>, and security is
really generic sounding. Add the alias and switch the documentation
over to prefer --seclabel
2019-05-15 17:49:58 -04:00
Cole Robinson
656045478d tests: Verify all cli subopts and aliases are triggered
Add some cli infrastructure and testsuite magic to track whether
a cli suboption and cli alias is triggered. This makes it harder
to accidentally add cli option regressions.

We make some exceptions for shared options, requiring them to only
be tested once, otherwise trying to test all address options for
every device will be a giant pain.
2019-05-15 17:45:19 -04:00
Cole Robinson
23f7b4fa7e tests: clitest: Cover all address.* options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
7eedcac1e7 tests: clitest: Cover all char options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
2b613d2ef5 tests: clitest: Cover all --rng options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
65f3197a02 tests: clitest: Cover all --vcpus and --video options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
cc6ca85ce8 tests: clitest: Cover all --network options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
e2e9c0cadd tests: clitest: Cover all --sysinfo options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
a8fedab9f2 tests: clitest: Cover all --memdev options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
d5c7771e49 tests: clitest: Cover all --graphics options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
56f47faf49 tests: clitest: Cover all --features options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
4543ef2baa tests: clitest: Cover all --disk options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
0947045f11 tests: clitest: Cover all --cpu options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
58daf6722e tests: clitest: Cover all --controller options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
5f5c7daca1 tests: clitest: Cover all --clock options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
f986273e17 tests: cli: Cover all --hostdev options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
fa8cbe5628 tests: clitest: Cover all --memorybacking options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
0da94e25b2 tests: clitest: Cover all --blkiotune and --idmap aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
dbb6f338ab tests: clitest: Cover all --vsock options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
084122dfbe tests: clitest: Cover all --tpm options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
0b2206be0e tests: clitest: Cover all --pm and --numatune options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
300400f26c tests: clitest: Cover all --boot options and aliases 2019-05-15 17:34:01 -04:00
Cole Robinson
dc0f9632ee tests: Repurpose spice-gl test as a generic singleton test
We need another entrypoint for singleton testing
2019-05-15 17:34:01 -04:00
Cole Robinson
1403815a3f tests: Add a bunch of example devices to the test drivers
Eventually we may want these for virt-xml or UI testing. Fill in
some XML for every top level element libvirt currently supports.
2019-05-15 15:23:59 -04:00
Cole Robinson
61639d9b14 cli: Only use regex matching if the subopt contains [
If we use regex matching all the time, we can erroneously match
certain strings. This already let some cli regressions through
with recent patches.
2019-05-15 14:47:53 -04:00
Cole Robinson
384607e502 cli: Strip find_inst regex from completion results
It doesn't really work with the argcompleter, so show the non-regex
version of the suboption
2019-05-15 13:18:39 -04:00
Cole Robinson
7c835321be cli: --blkiotune: Convert device.* to device[0-9]*.
Libvirt can represent multiple <device> blocks here, so mirror that
on the command line
2019-05-15 09:59:25 -04:00
Cole Robinson
af2182d890 cli: --memorybacking: Add discard= and allocation.mode= 2019-05-14 15:58:36 -04:00
Cole Robinson
90f5b29789 cli: --memorybacking: Convert hugepages.page to a list
There can be more than 1 <memoryBacking><hugepages><page> element.
Adjust the cli options to match:

- hugepages.page[0-9]*.size
- hugepages.page[0-9]*.unit
- hugepages.page[0-9]*.nodeset
2019-05-14 15:58:36 -04:00
Cole Robinson
334d18ab93 cli: --vcpus: add vcpus.vcpu[0-9]* config
This adds the following suboptions to configure the <domain><vcpus>
list:

- vcpus.vcpu[0-9]*.id
- vcpus.vcpu[0-9]*.enabled
- vcpus.vcpu[0-9]*.hotpluggable
- vcpus.vcpu[0-9]*.order
2019-05-14 15:58:36 -04:00
Cole Robinson
908faaffee cli: --cpu: add topology.*
We already expose these via --vcpus, but that's for back compat. New
options are under --cpu at:

topology.sockets
topology.cores
topology.threads
2019-05-14 14:36:40 -04:00
Cole Robinson
a6b5f11f13 cli: --metadata: add genid= and genid_enable=
The latter is for triggering <genid/> bool XML, which tells libvirt
to auto-allocate a UUID. The cli isn't really XML conformant but
I can't think of anything better that is self advertising
2019-05-14 14:36:40 -04:00
Cole Robinson
7083294e2c cli: --sysinfo: Add oemStrings.entry[0-9]* 2019-05-14 14:36:40 -04:00
Cole Robinson
d16425aa8f cli: --sysinfo: Add chasis suboptions
Add the following --sysinfo suboptions:

- chassis.manufacturer
- chassis.version
- chassis.serial
- chassis.asset
- chassis.sku
2019-05-14 14:36:40 -04:00
Cole Robinson
773625bfab cli: --boot: add initarg[0-9]*=X
We keep the old initargs="string" support as well, but also advertise the
explict XML list support
2019-05-14 14:36:40 -04:00
Cole Robinson
e5480829b6 cli: --boot: Add explicit boot[0-9].dev config
We keep the old bootorder support as well, but also advertise the
explict XML list support
2019-05-14 14:36:40 -04:00
Cole Robinson
c31443a810 cli: Add driver.ats= and driver.iommu for virtio devices
This is shared XML schema used by multiple devices that support virtio
2019-05-14 12:45:57 -04:00
Cole Robinson
2344de6f38 cli: device: Add boot.loadparm= 2019-05-14 12:33:07 -04:00
Cole Robinson
13dbc715be cli: Add common device options for --memdev and chardevices
They both can handle explicit address config and alias config, so
wire it up
2019-05-14 12:25:00 -04:00
Cole Robinson
0e8e3c0bbf cli: device: add alias.name= 2019-05-14 12:23:00 -04:00
Cole Robinson
0eb2b167f9 cli: device: Add address.zpci.uid and address.zpci.fid 2019-05-14 12:20:53 -04:00
Cole Robinson
ca0f9e18cc cli: Add --serial target.model.name=
This maps to XML like:

  <serial>
    <target>
      <model name='X'/>
    </target>
  </serial>
2019-05-14 11:57:50 -04:00
Cole Robinson
bf2fe0790e cli: Add --serial target.port= option
This maps to the XML like:

  <serial>
    <target port='X'/>
  </serial>
2019-05-14 11:57:50 -04:00
Cole Robinson
0f81eff588 clitest: Remove long option newline escaping
Apparently we don't actually need it
2019-05-14 11:57:50 -04:00
Cole Robinson
f3fd6d200b cli: --smartcard: support database= and certificate[0-9]*=
For mode=host-certificates config
2019-05-14 11:57:50 -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
5e98bfba80 tests: clitest: Break up test run() function 2019-05-14 11:57:50 -04:00
Cole Robinson
c85bb61559 devices: char: Wire up seclabels in CharSource
And expose the config options on the command line for all CharSource
users
2019-05-14 11:57:50 -04:00
Cole Robinson
423b084e02 cli: Share char source arguments among all CharSource users
Add char source arguments to all users:

--serial
--parallel
--console
--channel
--smartcard
--rng
--redirdev

Not all source options apply to all types, but libvirt doesn't
really discriminate, so we should do the same.
2019-05-14 11:57:50 -04:00
Cole Robinson
354dc4df4a cli: --rng: use predictable cli subarg names
To match the XML schema, rename these subarguments and add aliases
to preserve compatibility:

* backend_connect_host -> backend.source.connect_host
* backend_connect_service -> backend.source.connect_service
* backend_host -> backend.source.host
* backend_mode -> backend.source.mode
* backend_service -> backend.source.service
* backend_type -> backend.type
* rate_bytes -> rate.bytes
* rate_period -> rate.period

'type', and 'device' are kept as advertised options,
due to them being commonly specified and documented
2019-05-14 11:57:50 -04:00
Cole Robinson
873a35dcee devices: char: move 'protocol' and 'log*' to CharSource
This violates our typical XML hierarchy, but that's how it's modeled
internally in libvirt, and these properties are shared among all
charsource users.
2019-05-14 11:57:50 -04:00
Cole Robinson
43a39dc158 devices: smartcard: Use CharSource
smartcard does the same internally for libvirt, so let's follow that
pattern, and fix the fallout
2019-05-14 11:57:50 -04:00
Cole Robinson
9d78759ac5 devices: redirdev: Use CharSource
redirdev does the same internally for libvirt, so let's follow that
pattern, and fix the fallout
2019-05-14 11:57:50 -04:00
Cole Robinson
6d46e37e09 devices: rng: Use CharSource
Re-use CharSource, just like libvirt does internally. Adjust all
callers to match. Rename type -> backend_model while we are here,
because type is ambiguous
2019-05-14 11:57:50 -04:00
Cole Robinson
b2b9d7d366 devices: char: Add CharSource
Move all ./source handling into CharSource, which will be reused by
other device classes as well. This requires us to add ../ handling
into our xmlapi xpath engine
2019-05-14 11:57:50 -04:00
Cole Robinson
ba1764943b devices: char: drop tty fallback reading
This is only for ancient rhel5 era libvirt, We don't need it anymore
and it complicates XML handling
2019-05-13 12:36:17 -04:00
Cole Robinson
e6eb1d447b devices: char: Rename some properties to better match XML
* bind_port -> bind_service
* source_host -> connect_host
* source_port -> connect_service
2019-05-13 12:35:55 -04:00
Cole Robinson
472cfbc2a7 xmlbuilder: Validate root element of object parsexml
Ensure that for example a DeviceDisk is actually passed <disk> XML
2019-05-13 12:09:39 -04:00
Cole Robinson
4141f5c79b createnet: Shrink to one page
Name and forward mode config are always visible. ipv4, ipv6, and
domain name are under their own expanders which are collapsed by
default.

This will fit better with the XML editor pattern and reduce the
urge to squeeze more UI elements into the now smaller wizard
2019-05-13 12:08:55 -04:00
Cole Robinson
7597750a59 virtinst: network: streamline pretty desc output 2019-05-13 12:08:55 -04:00
Cole Robinson
5b0b90c33e createpool: Switch to a single page
Just combine the pages. This simplifies the code and navigation, and
makes it easier to add XML editing
2019-05-13 12:08:55 -04:00
Cole Robinson
58d0d43db1 tests: Drop most interface XML testing
No part of the app requires the <interface> details any more, so
drop testing
2019-05-13 12:08:55 -04:00
Cole Robinson
622a363e5b clone: Fix inverted --nonsparse check
I botched 4f66c423f7 and inverted the sparse check, meaning --nonsparse
on the command line would actually request a sparse image. Fix it

https://bugzilla.redhat.com/show_bug.cgi?id=1675743
2019-05-13 09:58:13 -04:00
Cole Robinson
721ac4f745 cli: --clock: add timer[0-9]*.{name,present,tickpolicy} 2019-05-12 19:24:36 -04:00
Cole Robinson
20e60603d8 cli: --clock: Make invalid X_tickpolicy options no-ops
tickpolicy is only handled in libvirt for pit and rtc timers. Accept
the other options but make them silent no-ops
2019-05-12 19:14:05 -04:00
Cole Robinson
2d80a0b4b9 cli: Add --memory opts to match XML names
Sort out the memory property naming ambiguity on the command line.

* memory -> currentMemory
* maxmemory -> memory
* hotplugmemorymax -> maxMemory
* hotplugmemoryslots -> maxMemory.slots

To maintain back compat, we need to do some funky handling with
memory and maxmemory values. Basically if currentMemory is specfied,
we interpret them as new style, otherwise preserve the old behavior.
2019-05-12 17:25:47 -04:00
Cole Robinson
a5ae150201 guest: Rename curvcpus and cpuset to better match XML hierarchy 2019-05-12 17:25:47 -04:00
Cole Robinson
3c57b13322 devices: panic: drop DeviceAddress wrapper opts
Just use regular address handling to represent 'type' and 'iobase'.
Add address handling to the command line
2019-05-12 17:25:47 -04:00
Cole Robinson
913c9de29b domain: features: treat <vmcoreinfo/> as a tristate
When it was initially introduced, vmcoreinfo was a boolean option,
but that was changed a release latest to be a tristate.
2019-05-12 17:25:47 -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
efa8c6f2c0 osdict: Don't limit qemu TCG to vcpus=1
Modern qemu has multithread TCG support for all the arches we
support, so don't limit things
2019-05-12 17:25:47 -04:00
Cole Robinson
4238e3f7d7 osdict: Fix get_recommended_resources minimum logic
If an OS has a <minimum> resources section, and a <recommended>
resources section, but there's a field in the former that isn't in
the latter, currently we throw out the former field entirely. This
is the case for n-cpus for a few OS. Instead we should be using
the <minimum> ncpus value. This changes the default <vcpu> value
for a quite a few test cases.
2019-05-12 17:25:47 -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
Cole Robinson
a274cc97cd tests: clitest: Add explicit coverage for virt-xml unsetting
For example, '--edit --disk path=' can be used to unset a disk path.
Internally we map empty string to None
2019-05-12 17:22:13 -04:00
Cole Robinson
76d5113941 xmlbuilder: Make is_* handling more future proof
If libvirt changes XML handling in the future, we shouldn't restrict
what we return to the user with the is_yesno/is_onoff convertors
2019-05-12 17:22:13 -04:00
Cole Robinson
4142b73c71 cli: Fix introspection for non-virt options
Like --location and --check
2019-05-12 17:22:13 -04:00
Cole Robinson
764bf1ad29 xmlapi: rename and move get_prop/set_prop to util
Change to set_prop_path and get_prop_path to make it a bit more
clear, and move out of xmlapi since it's not xml specific
2019-05-10 14:02:44 -04:00
Cole Robinson
0d90bbd5d5 cli: Drop support_cb
This is some extra validation to catch some char opt combos that
libvirt doesn't explicitly reject. It's not really interesting and
dropping it simplifies the cli parsing
2019-05-10 14:02:44 -04:00
Cole Robinson
96beae9ba3 tests: Don't use bogus net model names
Libvirt is rejecting them now
2019-04-17 10:07:35 -04:00
Pavel Hrdina
413858f3dc domcapabilities: actually fix detection if host-model is safe to use
The original code created a new list which had True/False items.  The
only case where the returned value would be False is for empty list
which never happens in real environment.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-04-11 15:13:29 +02:00
Pavel Hrdina
ac9bd77ed3 tests: add CPU defult test case for old QEMU
With old QEMU we should not use host-model because it's not safe and it
might fail to start.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-04-11 15:11:10 +02:00
Pavel Hrdina
fab7af30a1 tests: add kvm-x86_64-rhel7-domcaps
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-04-11 14:47:37 +02:00
Pavel Hrdina
44021bde6e tests: update kvm-x86_64-rhel7 capabilities
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-04-11 14:41:22 +02:00
Pavel Hrdina
c1ebd6730c DomainCpu: check CPU model name only if model exists
For CPU modes other then "custom" there is no model so we should not
check the suffix of model name.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-04-11 09:38:14 +02:00
Cole Robinson
d7fed32947 Bump gtk dep to 3.22 for new popup routines
Given that we bumped deps to fairly modern distros with the
python3 change, I think this is safe. gtk 3.22 is from sep 2016, it's
in debian9 and fedora 25+, which seems fine for our needs.
2019-04-07 13:54:00 -04:00
Andrea Bolognani
20c212cdfc guest: Enable USB input devices for RISC-V virt guests
If USB support is available, we can use USB input devices too.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-04-04 18:57:39 -04:00
Andrea Bolognani
9bec57723e guest: Enable USB for RISC-V virt guests
Unlike other features we have enabled earlier, this one requires
version checks because RISC-V guests have only started using PCI
by default very recently, and we can't have USB without PCI.

More specifically, we need QEMU commit d6c1bd4a2237 (included
in 4.0.0) and libvirt commit 7c48fb08e0cd (included in 5.3.0).

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-04-04 18:57:39 -04:00
Andrea Bolognani
1e3de807a6 video: RISC-V virt guests support virtio-gpu
QXL, on the other hand, is still x86-only for some reason.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-04-04 18:57:39 -04:00
Andrea Bolognani
1c907488f3 guest: RISC-V virt guests support virtio-rng
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-04-04 18:57:39 -04:00
Andrea Bolognani
193879b257 guest: RISC-V virt guests have VirtIO support
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-04-04 18:57:39 -04:00
Andrea Bolognani
a6fa81ba23 guest: Recommend virt machine for RISC-V
The default machine at the QEMU level is spike_v1.10, but most
people will really want to use the virt machine type instead.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-04-04 18:57:39 -04:00
Andrea Bolognani
53a41ce955 tests: Add riscv64-headless and riscv64-graphics
These test cases mirror thoses we already have for all other
architectures.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-04-04 18:57:39 -04:00
Andrea Bolognani
a989986cb9 tests: Add RISC-V support
RISC-V doesn't support KVM yet, so we are forced to use TCG
on x86 until that's working.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-04-04 18:57:39 -04:00
Pavel Hrdina
22342ef7ee cli: introduce CPU secure parameter
This will allow users to override the default behavior of virt-install
which copies CPU security features available on the host to the guest
XML if specific CPU model is configured.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-04-04 13:40:20 +02:00
Pavel Hrdina
29f815fbd2 domcapabilities: remove recommended CPU features from security features
These features are only recommended to be enabled since they improve
performance of the VMs if security features are enabled.

pcid is a very useful perf feature, but missing in some silicon
so not portable.

pdpe1gb lets the guest use 1 GB pages which is good for perf
but again not all silicon can do it.

amd-ssbd is a security feature which fixes the same SSBD flaws as the
virt-ssbd feature does. virt-ssbd is usable across all CPU models
affected by SSBD, while amd-ssbd is only available in very new silicon.
So virt-ssbd is the bette rchoice.

amd-no-ssb just indicates that the CPU is not affected by SSBD, so not
critical to expose. I expect a future named CPU model will include that
where appropriate.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-04-04 11:49:29 +02:00
Cole Robinson
d252061b4b tests: inject: Update test cases 2019-04-03 20:23:55 -04:00
Fabiano Fidêncio
5de172501c unattended: Add product-key to Unattended data
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-04-01 16:28:52 -04:00
Lin Ma
4c3b27c835 testdriver: Add genid example
Signed-off-by: Lin Ma <lma@suse.com>
2019-04-01 13:54:21 -04:00
Pavel Hrdina
986097d5f8 cloner: don't fail to clone VM if nvram file doesn't exist
If a VM is defined and never started the nvram file might not exist and
in that case it's created by libvirt automatically on the first start.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-03-28 16:07:13 +01:00
Cole Robinson
ffe7be601b tests: uitests: Fix CPU model test
We need to use a fake domcaps URI after 95d1275f57
2019-03-26 11:43:12 -04:00
Cole Robinson
fcabcb7a95 tests: clitest: Add a test case for the last commit
We need a custom test driver input to reproduce the pool collision
2019-03-26 11:15:46 -04:00
Cole Robinson
3be238b03e tests: test_urls: Add --*libosinfo, --iso-only, --url-only
These are options that will help tweak the test_urls logic,
to help as we try to ensure libosinfo covers all the cases
we care about.
2019-03-24 12:32:03 -04:00
Cole Robinson
97a5af1e43 urldetect: Use libosinfo for tree detection too
Ask libosinfo for tree detection, but still fall back to our
own implementation if libosinfo fails
2019-03-24 12:27:46 -04:00
Cole Robinson
e7cdb695c3 test_urls: debian8 urls are dead, remove them 2019-03-24 11:14:47 -04:00
Andrea Bolognani
7b9de27a99 guest: Add default RNG to s390x guests
As long as it's supported by both QEMU and the guest OS,
there's really no reason not to add it.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-03-21 14:16:28 -04:00
Jim Fehlig
8d9743d69f virt-install: Add support for xenbus controller
libvirt commit 09eb1ae0 added support for a new 'xenbus' controller
type. Add support for the controller in virtinst, including support
for the maxGrantFrames attribute.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2019-03-21 14:15:40 -04:00
Cole Robinson
7afbb90b4d virt-xml: Handle VM names that look like id/uuid (bz 1679025)
Previously we assume they are id/uuid, so if it's actually the VM
name then the command fails. Now we always check for a name first,

https://bugzilla.redhat.com/show_bug.cgi?id=1679025
2019-03-21 13:45:58 -04:00
Andrea Bolognani
f23b01be53 guest: Add VirtIO input devices to s390x guests with graphics
We're not including any input devices in the generated XML
for s390x guests, and the results is that it's not possible
to interact with them short of using the serial console or
connecting through ssh, which is fine but probably not what
is expected when graphics are present.

USB input devices are not a good fit for s390x guests: USB
requires PCI, and PCI is not widely available or used on
s390x; VirtIO devices, on the other hand, are a perfect
match since s390x guests use basically no emulated devices
and rely on VirtIO for most functionality.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-03-21 15:31:20 +01:00
Andrea Bolognani
5dad99216e guest: Add USB input devices to pSeries guests with graphics
libvirt already does this for us, sort of: it will automatically
add a USB keyboard and mouse to ppc64 guests with graphics;
in addition, these devices are impossible to remove.

Unfortunately this results in a pretty poor experience for the
user, since the relative pointing device makes interacting with
the GUI an exercise in frustration.

As of commit 186bb479d0f4, libvirt will still add the USB
keyboard automatically but will skip the USB mouse if a USB
tablet is already present, so by explicitly including USB input
devices in the generated XML we can create guests that are
actually usable.

We can do this unconditionally, without having to worry about
what version of libvirt we're running against: if it's new
enough we'll take advantage of the fix, and if not then the
resulting guest will not be any more broken than it would have
been before.

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

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-03-21 15:31:20 +01:00
Andrea Bolognani
6a24a2a13a tests: cli: Add simple guests with graphics
These cover the use case "I want to get an existing guest
image running in the cloud, and I need graphics".

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-03-21 15:29:46 +01:00
Andrea Bolognani
e5b8c97896 tests: cli: Add simple headless guests
These cover the use case "I want to get an existing guest
image running in the cloud, and I don't need graphics".

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-03-21 15:28:25 +01:00
Andrea Bolognani
d409c76848 tests: cli: Drop existing aarch64-graphics test
We're going to add a number of tests covering the same scenario
on multiple architectures soon, so this one is no longer needed
and would in fact cause a name clash if it stayed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-03-21 14:54:04 +01:00
Pavel Hrdina
fb5136a6a9 domain: cpu: automatically add CPU security features for "custom" mode
If user selects specific CPU model to be configured for guest we will
automatically add CPU security features to make sure that the guest is
not vulnerable to these CPU HW bugs.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-03-19 13:45:49 +01:00
Pavel Hrdina
6423f653fd domain: cpu: introduce set_model function
We will need to pass another variable into the setter so we cannot use
the property setter.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-03-19 13:45:49 +01:00
Pavel Hrdina
f7bdebc0de tests: capabilities: remove testCPUAPI
This test case is pointless, get_cpu_values() calls only libvirt API
which will return list of CPUs known to libvirt and we check whether
that list is correct.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-03-19 13:41:49 +01:00
Pavel Hrdina
8f870c3fca tests: xmlparse: use set_special_mode function
CPU mode is never set directly using mode attribute, instead we use
setter function with some extra logic that needs to be done.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-03-19 13:41:46 +01:00
Vasudeva Kamath
648115334d virt-install: Add driver_queues argument to --controller
<controller> can have additional <driver> sub element with queues as property,
which is currently not exposed via virt-install. This commit exposes this option
similar to queues in network configuration.

(crobinso: add test case)
2019-03-12 10:17:06 -04:00
Cole Robinson
81b26de46d tests: test_urls: centos5 detection works now 2019-03-12 09:50:28 -04:00
Cole Robinson
9688815237 urldetect: Rework _allstores building a bit
Rename it ALLSTORES since it's a global variable
Split out the building from the altering
2019-03-08 16:52:33 -05:00
Cole Robinson
32034c6847 Revert "devices: disk: Use virtio-scsi for CDROMs where supported"
This reverts commit a746150bef.

See discussion:
https://www.redhat.com/archives/virt-tools-list/2019-March/msg00058.html

Apparently some debian versions struggle with this. Let's stick with
the old method until there's a sufficiently compelling reason to change

Some adjustment is required to deal with changes added by later patches
2019-03-08 11:39:20 -05:00
Cole Robinson
6780bc0c0e tests: clitest: Tweak test input to match latest libvirt
rbd volumes no longer report format=raw. adjust the test input
to generate the expected output.
2019-03-06 14:35:15 -05:00
Andrea Bolognani
db6c7070e2 devices: disk: Don't prefer virtio-scsi for aarch64/virt
Back when this was introduced in 2014 (commit aa772f01e1) using
virtio-scsi instead of virtio-blk made sense, because virtio-pci
support on aarch64/virt was still not widely available and
virtio-mmio couldn't do hotplug.

These days, however, virtio-pci availability is something that
we can assume is present on any remotely reasonable deployment
target, so it's better to no longer behave differently than
other architectures.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-03-06 14:00:11 -05:00
Andrea Bolognani
a746150bef devices: disk: Use virtio-scsi for CDROMs where supported
We already use virtio-blk for regular disks whenever possible,
and there's no good reason not to do the same with virtio-scsi
when dealing with CDROMs instead of artificially limiting its
use to s390x and ppc64/pseries guests.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-03-06 14:00:11 -05:00
Andrea Bolognani
47753eab26 guest: Use virtio-scsi where supported
Right now we're limiting use of virtio-scsi to ppc64/pseries
and aarch64/virt guests, but there's really no reason not to
use it wherever it's available.

This results in virtio-scsi being now used on s390x, where no
other sensible SCSI controller implementation is available
anyway, and x86, where you alreayd didn't want end up using
lsilogic.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2019-03-06 14:00:11 -05:00
Cole Robinson
0c82a6b78c tests: uitests: Fix createpool with new libvirt collision checks 2019-03-06 13:46:24 -05:00
Marc Hartmayer
908b8e8d7c tests: virt-xml: Add test cases for --start option
The test cases verify that:

 + --start works
 + --define --start works
 + --no-define --start works
 + --start works in combination with --add and --remove
 + combination of --start --update isn't valid
 + combination of --define --no-define --start isn't valid

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-03-06 13:15:38 -05:00
Marc Hartmayer
c2bff50977 tests: cli: Add test case for --no-define argument
Add a test case validating mutual exclusivity of `--no-define` and
'--define' arguments.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-03-06 13:15:38 -05:00
Marc Hartmayer
c896d19d76 tests: cli: Add boot.order tests
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-03-06 13:15:38 -05:00
Marc Hartmayer
1b53594002 tests: Add test case for reorder_boot_order method
Add a test case for `reorder_boot_order`. It verifies that the OS boot
order is removed and that all other boot order indices are adjusted
accordingly.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-03-06 13:15:38 -05:00
Marc Hartmayer
ecc0861c89 tests: xmlparse: refactor method for generating out file path
Refactor method for generating out file path. It will be used in a
upcoming patch.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-03-06 13:15:38 -05:00
Marc Hartmayer
5bad22e837 tests: Use (get|set)_prop
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
2019-03-06 13:13:13 -05:00
Cole Robinson
d470019cda tests: osdict: Add more install script testing 2019-03-05 16:38:22 -05:00
Cole Robinson
a3147e95db tests: osdict: test basic get_install_script 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
ef279273af virt-manager: add --show-domain-delete
Launches delete wizard on top of a VM window, so when domain is
deleted, VM window disappears and the whole app exits
2019-03-04 14:04:34 -05:00
Cole Robinson
4f66c423f7 cloner: Handle --nonsparse for qcow2 images (bz 1675743)
https://bugzilla.redhat.com/show_bug.cgi?id=1675743
2019-03-04 14:04:34 -05:00