Commit Graph

700 Commits

Author SHA1 Message Date
Cole Robinson
4b15073572 cli: Drop unnecessary --disk prop aliases
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-08-17 10:27:36 -04:00
Lin Ma
11a887ece5 cli: --disk: Add driver.metadata_cache options
Properly setting the metadata cache size can provide better performance
in case of using big qcow2 images.

This patch introduces two driver options:
* driver.metadata_cache.max_size
* driver.metadata_cache.max_size.unit

E.g. --disk ...,driver.type=qcow2,\
     driver.metadata_cache.max_size=2,\
     driver.metadata_cache.max_size.unit=MiB

BTW, Metadata cache size control is currently supported only for qcow2.
Regarding how to properly caluclate the cache size of qcow2, Please refer
to qemu's documentation.

Signed-off-by: Lin Ma <lma@suse.com>
2022-08-17 09:57:29 -04:00
Cole Robinson
02e6abad48 cli: Break up parse_option_strings
Into run_parser and run_all_parsers. Opencode some of the special
case handling in virtxml

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-08-03 12:34:47 -04:00
Lin Ma
2984c13cff cli: Add --iothreads defaultiothread.thread_pool_{min,max}
It allows to set the thread pool size to optimize spawning worker threads
for the default event loop in real time environment. For example:

--iothreads defaultiothread.thread_pool_min=8,\
defaultiothread.thread_pool_max=16

Signed-off-by: Lin Ma <lma@suse.com>
2022-08-02 14:56:09 -04:00
Lin Ma
0d84bcfbfa cli: Add iothreadids attributes thread_pool_min and thread_pool_max
These two optional attributes allow setting lower and upper boundary for
number of worker threads for given IOThread. For example:

--iothreads iothreads=2,\
iothreadids.iothread0.id=1,\
iothreadids.iothread1.id=2,\
iothreadids.iothread1.thread_pool_min=8,\
iothreadids.iothread1.thread_pool_max=16

Signed-off-by: Lin Ma <lma@suse.com>
2022-08-01 11:32:23 -04:00
Cole Robinson
8079c421bd connection: De-duplicate ui and cli version logging
Remove the open coded version logging in cli.py and virt-manager
connection.py, and move it into virtinst connection open

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-08-01 06:04:48 -04:00
Daniel P. Berrangé
92ba8e5d35 virtinst: log libvirt version numbers after connecting
The various version numbers reported by libvirt are all relevant pieces
of information when debugging problem reports.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-07-27 17:53:14 -04:00
Daniel P. Berrangé
01ff867f56 virtinst: include the version number in first log message
Knowledge of the version number is not always available from the user
bug report. They may merely have a log file from an automated system.
Including the version number in the log message is key information.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-07-27 17:53:14 -04:00
Cole Robinson
7ae10b5566 cli: Add --serial source.tls=on|off
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-06-20 18:06:40 -04:00
Cole Robinson
137cfdc347 cli: Add --serial source.channel
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-06-20 18:03:55 -04:00
Cole Robinson
d0e6213643 cli: Add --memorybacking allocation.threads
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-06-20 17:54:50 -04:00
Jonathon Jongsma
44355e5ed0 virt-install: add support for qemu-vdagent channel
This allows support for host/guest clipboard sharing when using vnc
guests (and possibly other graphics types in the future). This channel
is similar to the spicevmc channel, but it contains a couple additional
options to enable/disable clipboard sharing and specify the mouse mode.
In the case of spice, these settings are specified on the 'graphics'
element, but for qemu-vdagent, they are specified on the channel. For
example:

   --channel=qemu-vdagent,source.clipboard.copypaste=on,source.mouse.mode=client

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-06-13 13:49:08 -04:00
Cole Robinson
34662fecc9 tests: Fix with latest argcomplete
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-06-13 13:20:01 -04:00
Cole Robinson
22478f307d virt-install: Add --cloud-init clouduser-ssh-key=
This sets the sshkey for the default cloud-init username

Resolves: https://github.com/virt-manager/virt-manager/issues/307

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-03-01 14:29:46 -05:00
Cole Robinson
c8afd1f51e virt-install: Rename --cloud-init ssh-key -> root-ssh-key
Originally we thought it would be for the clouduser, but then
we changed it, and now it's ambiguous. Rename it to make the
usage clear, and add an alias to keep any users working

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-03-01 14:29:46 -05:00
Cole Robinson
e0c5d74e82 domain: launch_security: simplify defaults and validation
* libvirt fills in cbitpos and reducedPhysBits for us
* libvirt errors if type is missing
* libvirt errors if host/qemu doesn't support sev

So drop it all. This simplifies testing because we don't need
sev domcaps in place just to generate the XML

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-28 08:45:18 -05:00
Cole Robinson
d6b74a83d1 cli: Add xpath.* subargs to XML options
This adds the power of --xml to individual device options. For example
this makes it easier to make custom XML changes for a single --disk
device from both virt-install and virt-xml

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-27 11:46:54 -05:00
Cole Robinson
6c47fa56b9 xmlbuilder: Make XMLManualActions work more like XMLChildProperty
This will help us in upcoming patches add xpath subarguments to
cli device options

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-27 11:38:13 -05:00
Cole Robinson
e1b168c69b cli: Clean up _init_class mechanism
This will make it easier in future patches to register some objects
programatically

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-26 15:12:51 -05:00
Cole Robinson
b275e3c266 cli: Add --boot refresh-machine-type=yes
This is a virt-xml option to refresh a VM to use the latest machine
type version for the machine type it's currently using. Ex:

pseries-2.11 -> pseries
pc-q35-5.0 -> q35

This is useful for when qemu deprecates and removes the machine type
out from under you, or to pick up bug fixes.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-26 14:11:56 -05:00
Cole Robinson
2a3ff3609b Use pcie_root_ports for arm and riscv machvirt
Libvirt defaults to PCIe for arm32/aarch64 and riscv -M virt too.

Rename q35_pcie_root_ports to num_pcie_root_ports and extend the
logic to those archs too

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-26 14:11:56 -05:00
Cole Robinson
cd5c34a3f3 cli: Add basic --audio type=XXX,id=Y support
Closes: #264

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-24 14:18:41 -05:00
Cole Robinson
4760d11bd8 cli: Fix busted --controller example in --help
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-20 10:39:04 -05:00
Cole Robinson
d70d4e6e7a devices: tpm: Rework defaults
The code previously was just encoding the same defaults as libvirt,
which doesn't really add anything.

Instead, let's prefer type='emulator' model='tpm-crb', which
gives the most modern virtualization friendly config. When we don't
know if that will work, we mostly leave things up to libvirt to fill
in.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-19 08:36:28 -05:00
Cole Robinson
db8305ad01 guest: Default to 16 pcie root ports for q35
Add extra PCIe root ports to enable q35 device hotplug to work out
of the box. A typical modern linux guest has 7-8 PCI devices added
by default, so this gives plenty of wiggle room.

The smart thing to do would be to count the attached PCI devices
and add 4-5 extra, but that takes more work and isn't trivial.

The number can be overridden on the cli with:

  --controller q35_pcie_root_ports=X

Use =0 to go back to the old behavior.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-16 14:09:33 -05:00
Cole Robinson
26ecf8a5e3 virt-install: Make missing --osinfo fatal for most cases
This was previously discussed here:
https://listman.redhat.com/archives/virt-tools-list/2020-September/msg00017.html

For the x86 + hvm case, failure to specify an --osinfo/--os-variant
OS, and failure to detect an OS from install media, will now throw
a big error:

```
--os-variant/--osinfo OS name is required, but no value was
set or detected.

This is now a fatal error. Specifying an OS name is required
for modern, performant, and secure virtual machine defaults.

If you expected virt-install to detect an OS name from the
install media, you can set a fallback OS name with:

  --osinfo detect=on,name=OSNAME

You can see a full list of possible OS name values with:

   virt-install --osinfo list

If your Linux distro is not listed, try one of generic values
such as: linux2020, linux2018, linux2016

If you just need to get the old behavior back, you can use:

  --osinfo detect=on,require=off

Or export VIRTINSTALL_OSINFO_DISABLE_REQUIRE=1
```

The thread goes into more detail, but basically, for x86 VMs at least,
it's unlikely you will _ever_ want the default 'generic' behavior,
which gives gives no virtio, no PCIe, no usb3, IDE disks, slow
network devices, etc.

Many people use virt-install in scripts and CI, and this may now
cause breakage. The environment variable is there to help them
get things back to normal as quick as possible, but it will still
noisy up their logs with the warning to hopefully get them to make
a useful change to their virt-install invocations.

This is limited to x86, since that's where most of our defaults
historically differ, and where we can depend on libosinfo to give
the most accurate device info. This may be relevant to change for
other KVM architectures in the future.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-16 12:25:13 -05:00
Cole Robinson
e7249fa79f virt-install: Warn about performance for --osinfo generic too
Currently we skip the warning if the user explicitly requests
`--osinfo generic`. Upcoming changes to the defaults here will make
it tempting to specify `--osinfo generic` just to make things work,
and we want to dissuade that, so enable the warning for that case too.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-12 12:51:01 -05:00
Cole Robinson
9c54c116fa cli: Recommend --osinfo more over --os-variant
We are about to change the some defaults around os handling. Let's
start recommending the nicer named --osinfo more, since new error
messages are going to promote it a bit as well

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-12 11:53:09 -05:00
Cole Robinson
c2fb5ad402 tests: Add grep= annotation for every invalid test
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-12 11:53:09 -05:00
Cole Robinson
96a40b1143 cli: Add --os-variant list option to print OS name values
The canonical tool for this is `osinfo-query os`, which we still
reference in the man pages and in the list output.

However, we are about to make missing --os-variant fatal for common
usage, and I don't want to force users to install an extra tool just
to figure out what an acceptable --os-variant value is.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-12 11:53:09 -05:00
Cole Robinson
6baa327d67 cli: Add --tpm active_pcr_banks support
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-03 16:33:08 -05:00
Cole Robinson
16fecb482a cli: Add --memdev target.{current,block,requested}
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-27 09:57:20 -05:00
Cole Robinson
a489d69dc6 cli: Add virtio option driver.page_per_vq=on
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-26 17:11:56 -05:00
Cole Robinson
01f52fed97 cli: Add --launchSecurity kernelHashes=yes|no
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-26 17:08:27 -05:00
Cole Robinson
245e89ac38 guest: Rework set/get_uefi entry points
This replaces the pattern:

  Guest.set_uefi_path(Guest.get_uefi_path())

With a single entrypoint

  Guest.enable_uefi()

to immediately change the guest config to use UEFI, using our
default logic.

This will make it easier to change that logic in the future, like
using <os firmware='efi'> instead of hardcoded paths

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-26 11:59:42 -05:00
Cole Robinson
dfef112b2a virt-xml: Fix device lookup by integer properties
We were not correctly accounting for the internal representation of
some fields, and just trying to a string comparison. We need to be
a bit smarter than that

Fixes: https://github.com/virt-manager/virt-manager/issues/356

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 13:43:58 -05:00
Cole Robinson
f13c8d87fb guest: Remove the hyperv + uefi workaround for win7 + win2k8r2
Both these windows versions are now longer supported, and UEFI isn't
the default, so I don't think this hack is much needed anymore

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 12:05:45 -05:00
Daniel P. Berrangé
eb58c09f48 virtinst/guest: enable a TPM by default if UEFI is present
The bare metal world is moving to a situation where UEFI is going to be
the only supported firmware and there will be a strong expectation for
TPM and SecureBoot support.

With this in mind, if we're enabling UEFI on a VM, it makes sense to
also provide a TPM alongside it.

Since this requires swtpm to be installed we can't do this
unconditionally. The forthcoming libvirt release expands the domain
capabilities to report whether TPMs are supported, so we check that.

The user can disable the default TPM by requesting --tpm none

https://github.com/virt-manager/virt-manager/issues/310
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-21 17:49:15 -05:00
Cole Robinson
7e1f886aa9 cli: Clean up nodedev address functions a bit
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-21 13:20:46 -05:00
Cole Robinson
7986ffa80b nodedev: Move the CLI string format lookup to cli.py
This address string decomposing is strictly and virt-* cli feature.
Move it to cli.py to make that explicit

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-21 13:20:46 -05:00
Daniel P. Berrangé
95eb8dda9b virtinst: add missing 'dies' parameter for --vcpus
Although using --cpu topology.XXX is the preferred way to set topology,
it is still possible via the --vcpus parameter. For consistency, this
should support the full set of parameters, so dies needs to be added.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-20 14:16:38 -05:00
Jonathon Jongsma
9766beea04 cli: add 'ioapic.driver' to --features
Add the ability to set the ioapic driver using the --features argument:

    $ virt-install --features ioapic.driver=qemu ...

This results in the following xml:

  <features>
    ...
    <ioapic driver="qemu"/>
  </features>

This is required in order to install a guest with >255 cpus. Such a
configuration requires an iommu with extended interrupt mode enabled,
which in turn requires IOMMU interrupt remapping to be enabled, which in
turn requires a split I/O APIC.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
2022-01-11 18:26:06 -05:00
lisongmin
7da5daff92 cli: --cloud-init add network-config option 2021-10-04 16:31:39 -04:00
Cole Robinson
79da19ad07 Fix some pylint, exclude some new warnings
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2021-10-04 16:04:33 -04:00
Hugues Fafard
cb97f6001b cli: --cpu: code cleanup & reordering
Shuffling bits of code around, adding comments and grouping CLI options
to make the code easier to read and understand at a glance.

Brings the ordering of XML options in line with libvirt's own output as
implemented in `src/conf/cpu_conf.c` and `src/conf/numa_conf.c`.
2021-10-04 15:10:10 -04:00
Hugues Fafard
6a2bc142eb cli: --cpu: add support for NUMA interconnects
This includes support for the following options:
* numa.interconnects.latency[0-9]*.initiator
* numa.interconnects.latency[0-9]*.target
* numa.interconnects.latency[0-9]*.cache
* numa.interconnects.latency[0-9]*.type
* numa.interconnects.latency[0-9]*.value
* numa.interconnects.latency[0-9]*.unit
* The same suboptions for `numa.interconnects.bandwith[0-9]*`

Note that the cache= attribute is only explicitly defined for <latency>
nodes in the documentation. However, since <latency> and <bandwidth>
nodes are otherwise identical, the docs also don't explicitly forbid it
for <bandwidth> nodes, and libvirt happily accepts XML that does specify
it for for <bandwidth> nodes, this implements the cache= attribute for
<bandwidth> elements as well.
2021-10-04 15:08:39 -04:00
Hugues Fafard
fbcb7539c3 cli: --cpu: add support for NUMA caches
This includes support for the following options:
* numa.cell[0-9]*.cache[0-9]*.level
* numa.cell[0-9]*.cache[0-9]*.associativity
* numa.cell[0-9]*.cache[0-9]*.policy
* numa.cell[0-9]*.cache[0-9]*.size.value
* numa.cell[0-9]*.cache[0-9]*.size.unit
* numa.cell[0-9]*.cache[0-9]*.line.value
* numa.cell[0-9]*.cache[0-9]*.line.unit
2021-10-04 15:08:38 -04:00
Hugues Fafard
42bb522f0d cli: --cpu: make numa.cell[0-9]*.discard an on/off type option 2021-10-04 15:08:38 -04:00
Hugues Fafard
bf3bd824c1 cli: --cpu: add support for unit of NUMA memory size
This adds support for the `numa.cell[0-9]*.unit` option.
2021-10-04 15:08:38 -04:00
Hugues Fafard
7d49d95a0f cli: --cpu: add support for specifying dies in topology
This adds support for the `topology.dies` option.
2021-10-04 15:08:38 -04:00