Commit Graph

438 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
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
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
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
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
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
Cole Robinson
a0ca387aad cli: Fix pool=default when path belongs to another pool (bz 1692489)
Using 'virt-install --disk size=X' implicitly uses pool=default. If
a pool named 'default' exists we use that; if not, and a pool using
the default path exists under a different name, we attempt to use
that as well, and if that doesn't exist, we create pool=default

The second case is broken, so if there's no pool=default and eg.
pool=FOO points to /var/lib/libvirt/images, we still attempt to
look up pool=default which understandably fails

https://bugzilla.redhat.com/show_bug.cgi?id=1692489
2019-03-26 11:15:46 -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
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
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
887ee45cf6 cli: Remove boot.order support check
Our support.py check is not exhaustive based on libvirt code checking.
Don't reject this case so users have a chance to make it work. The
support check is really more valuable in the UI where we can screw
things up easier.
2019-03-06 13:33:13 -05:00
Marc Hartmayer
b83a0a61a0 cli: Use reorder_boot_order for setting the boot order
Use the newly introduced method `reorder_boot_order` for setting
the boot index of a device. This ensures that all other boot order
values of domain guest definition 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
7768eb17d9 cli: Add check if device boot order is supported
Add a check if device boot order is supported to
Parser(Network|Disk|Redirdev|...) and throw an exception if not.

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
adf30349c3 cli: refactor get_prop
Refactor get_prop since it will be used in the next patches at other
places as well.

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
de8a0754de cli: Use consister ParseX class naming 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
Pavel Hrdina
7672b1b010 virtinst: cli: fix ParserBoot to return the parsed object
This fixes virt-xml to return an XML for command:

    virt-xml --build-xml --boot os_type=hvm

The VirtCLIParser.parse() expects the _parse() method to return
the parsed object.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-03-01 16:47:56 +01:00
Pavel Hrdina
a0b42327c6 graphics: move all listen code into one place
Instead of duplicating the code into CLI and GUI move it into graphics
device file which is used from both places.  This also fixes a bug in
virt-xml where changing listen to address was not working.

This also changes behavior to always configure one listen type when
using CLI listen option or GUI.  If user wants to modify only specific
listen type they can use listens[] options from CLI.

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

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2019-02-28 11:48:09 +01:00
Fabiano Fidêncio
cbe84879db cli: Add "install" parameter to os-variant
The new "install" parameter receives "location|cdrom" and will be used,
at least for now, to automatically get the URL location of an OS from
osinfo-db.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2019-02-14 13:33:48 -05:00
Cole Robinson
8a02081ebf cli: Add --os-variant full_id=X sub option
For specifying a distro via the full osinfo URL ID
2019-02-07 16:29:38 -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
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
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