Commit Graph

1693 Commits

Author SHA1 Message Date
Cole Robinson
536cd64515 cli: --blkiotune: use predictable cli subarg names
To match the XML schema, rename these subarguments and add aliases
to preserve compatibility:

- device_path -> device.path
- device_weight -> device.weight
2019-05-12 18:21:49 -04:00
Cole Robinson
375dd4c563 cli: --numatune: use predictable cli subarg names
To match the XML schema, rename:

- mode -> memory.mode
- nodeset -> memory.nodeset
2019-05-12 18:21:49 -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
7f9e21f9b5 cli: Rename boot_order to boot.order
And add a backcompat alias to match
2019-05-12 17:25:47 -04:00
Cole Robinson
cbb7d369ef cpu: Convert 'cache' to a singleton
Libvirt doesn't represent it at as a list, and tracking it as a list
complicates the cli machinery
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
ad36657b72 guest: Set vcpus from cpu.topology, if it's specified
We already did this in cli.py, but that's the wrong place to do it
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
e76e350a8d osdict: Add _OsResources helper class
It's just an implementation detail for now, but we will use it to
simplify callers interactions with resources data
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
9199c2d157 osdict: Remove "cpus" resources tracking
It's for CPU speed but we don't use it anywhere
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
97d92794bc cli: Make parser aliases a per-class dictionary
Rather than associate them per virt argument. It's less of a clean
fit this way, but I think it will make it less likely that aliases
are cargo culted around and added unnecessarily
2019-05-12 17:25:47 -04:00
Cole Robinson
80947bd0c5 cli: --memdev: Use cli names with '.', not underscore
And add back compat aliases so we don't break the command line
2019-05-12 17:25:47 -04:00
Cole Robinson
5f4b781580 cli: Tweak introspection sorting a bit
- Put clearxml at the very top, because it's a bit special and I
  don't like it mixed in with the interesting settings
- Put address.X at the top, after clearxml, because there's a lot of
  settings and I'd like to keep them away from the users' visual field
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
d8ed9a3678 cli: Fix --serial=help quadruple output
_init_class was being called multiple times
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
2a30a5f0bf cli: make parse() guest argument optional
Because the non-guest parsers don't need it.
2019-05-12 17:22:13 -04:00
Cole Robinson
a7c620549a cli: Consistently name parsers as ParserX 2019-05-12 17:22:13 -04:00
Cole Robinson
c97d6bfd41 cli: Drop parse is_novalue
This isn't a pattern we should propagate. Open code the one instance
that depends on it
2019-05-12 17:22:13 -04:00
Cole Robinson
d1e1ee2770 cli: Drop parse is_list
The only place we were using it is for some funky --cpu back compat,
which we can open code easily enough
2019-05-12 17:22:13 -04:00
Cole Robinson
0575d60744 cli: Make propname mandatory again
Turns out propname is used for virt-xml device matching, even if we
have a cb, so it's useful to specify if the cliname truly maps to
a single propname. Add a programming error exception to try and
explain this situation so it doesn't slip in by accident.
2019-05-12 17:22:13 -04:00
Cole Robinson
b0a629ca72 cli: Make more usage of set_prop_path
It's more future proof
2019-05-12 17:22:13 -04:00
Cole Robinson
cc1d34edaf cli: Drop exec() and eval() usage
We have helpers that do manually do what we were using it for. Gives
a nice speedup too
2019-05-12 17:22:13 -04:00
Cole Robinson
4ecc4930dd cli: Rename __init_class__ to _init_class
Seems like a bad idea to define our own double underscore function,
incase a future python version wants to use that name.

Tweak some minor InitClass details while we are in the area
2019-05-10 14:02:44 -04:00
Cole Robinson
3bd7c7c55b cli: Clarify guest_propname and list_propname
There's conflicting 'propname' naming now, so rename some usage
to match
2019-05-10 14:02:44 -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
e0d05cc79f cli: Rename attrname to propname
propname always refers to a virtinst object property/XMLProperty,
change the name to match
2019-05-10 14:02:44 -04:00
Cole Robinson
766dcc4e67 cli: Drop the dict() handling for parsedata
Require passing in a Class. Let's not complicate the cli machinery
any more than it has to be
2019-05-10 14:02:44 -04:00
Cole Robinson
7ec4c48268 cli: Swap add_arg cliname and attrname argument order
Every add_arg call needs a cliname (the option name on the command
line), but not all calls need an attrname (the propery/method name
of the virtinst API object) because they rely on a callback for
less simple functionality.

So swap the ordering so that cliname is the first argument. Drop
redundant attrname=None arguments and validate that either attrname
or cb=X is passed.
2019-05-10 11:36:23 -04:00
Cole Robinson
3980f79ab8 guest: Fix pylint 'unneeded-not' 2019-04-14 20:49:52 -04:00
Cole Robinson
550e8f243c Fix pylint 'Unnecessary pass statement' 2019-04-14 20:22:56 -04:00
Cole Robinson
1cc2a0ae8b storage: Add ensure_pool_is_running
We pretty much require a referenced storage pool to be running if
it's intended to be used as a virt-install or virt-manager requested
disk. So add a helper to start a pool if needed and optionally refresh
it
2019-04-14 20:22:02 -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
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
Pavel Hrdina
291f2ef214 DomainCpu: fix detection of CPU security features
VM configured with mode="host-model" will have the CPU definition
expanded once the VM is started.  Libvirt will try to use the closest
CPU model with some features enabled/disabled.

The issue is that there are some models that include spec-ctrl or ibpb
features and they will not appear in the explicit list of features and
virt-manager will not correctly detect if all security features are
enabled or not.  As a workaround we can check the suffix of CPU model to
figure out which security features are enabled by the model itself.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-04-09 13:30:25 +02: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
955a3ee62e os: Add RISC-V support
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
8720637cff virt-manager: add new checkbox to control CPU security features
By default we copy CPU security features to the guest if specific CPU
model is selected.  However, this may break migration and will affect
performance of the guest.  This adds an option to disable this default
behavior.

The checkbox is clickable only on x86 and only on host where we can
detect any CPU security features, otherwise a tooltip is set to notify
users that there is nothing to copy.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-04-04 15:32:42 +02:00
Pavel Hrdina
00f8dea370 domcapabilities: add caching of CPU security features
We will call this function multiple times so it makes sense to cache the
result so we don't have to call libvirt APIs every time we will check
what security features are available on the host.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-04-04 13:40:45 +02:00