Commit Graph

8044 Commits

Author SHA1 Message Date
Cole Robinson 381aa4050c devices: disk: Set discard=unmap by default for some cases
This recommendation came from an internal discussion. The cases are

* For block storage. This means guest requests are passed through
  to the host device, which seems a more reasonable default than
  ignoring them

* For sparse disk images we will create. discard=unmap helps preserve
  the sparseness of the disk image. If a user requests non-sparse, they
  are likely more concerned with performance than saving disk space,
  so we leave the default as is. We limit this to disk images we will
  create, since that's the easiest case to check, and it's less clear
  if we should change the behavior here for an arbitrary existing
  disk image.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-03 13:42:49 -05:00
Cole Robinson 1ab6dd50be devices: video: Use virtio default more often
This is from Gerd's suggestions here:
https://www.kraxel.org/blog/2019/09/display-devices-in-qemu/

When the guest supports it, we should use virtio. qxl is on the way
out, and the benefits are marginal and add a security and maintenance
burden.

While here, check domcaps that qxl or virtio are actually available.
Modern qemu has device modules, so device support may not be installed.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-03 13:42:49 -05:00
Cole Robinson f291ad2541 devices: video: Clean up default_model a bit
Add comments for most of the cases, and break apart some nesting

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-03 13:42:49 -05:00
Cole Robinson 1498085ff9 domcapabilities: Remove redundant check
get_enum() will always succeed, so the first check is redundant

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-02-03 13:42:43 -05:00
Cole Robinson c3e9db5f3a createvm: Tweaks to new UEFI pref
* Make it clear in code and UI that this is x86 only. Other arches
  either require UEFI (aarch64) or don't support it
* Drop the internal 'bios' values since we don't handle them and may
  not want them anyways, since when win11 support lands we will need
  to explicitly throw an error if the user tries to force bios
* Add UI tests

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-31 14:18:42 -05:00
Charles Arnold 0a1dd8b822 virt-manager: Add firmware preferences for creating a new VM
Possible values are BIOS (default) and UEFI.
The firmware used is determined by libvirt unless a specific firmware is
selected from the Customize dialog.

See https://bugzilla.redhat.com/show_bug.cgi?id=1997882
2022-01-31 13:55:00 -05:00
Cole Robinson f4aea0dca0 ui: Resave all files with latest glade
It creates a lot of churn.

Adjust phantom grid rows + columns while we are at it, not sure why
those counts are suddenly wrong

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-27 13:34:26 -05:00
Cole Robinson 87e0ed5de0 Revert "details: console: drop hardcoding background color as black"
This reverts commit aaabb44ac7.

I figured out how to trigger this: it's when scaling is enabled.
To maintain VM aspect ratio, we have to constrain the size of the
viewer widget. When the widget is smaller than the VM window, the
viewport widget is visible. This change made the viewport the default
theme color, rather than black.

Problem is, in the non-scaling case, we don't shrink the viewer
widget but let it expand to fill the whole area. This is necessary
to get the 'Autoresize VM with window' option to work, but is also
simpler in the cdoe. The viewport widget is not visible, and gtk-vnc
and spice-gtk paint the non VM owned areas as black. AFAICT that's not
configurable in any way.

So after this change we have differing behavior for scaled and
non-scaled cases, which is confusing and visually kinda comes off as
a bug.

So this reverts back to the old behavior and explains all this in
a comment.
2022-01-27 11:07:31 -05:00
Cole Robinson 588e5e4f54 DESIGN.md: reference rejected sky high maxmem and maxvcpus
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-27 10:34:26 -05:00
Cole Robinson 7ee01c7eeb setup: Plan for newer setuptools providing distutils back compat
setuptools still doesn't natively provide some infrastructure we
need, but newer versions will keep 'import distutils' working until
those issues are addressed. I think we need to reorder imports to take
advantage of it though. It silences some deprecation warnings at
least

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-27 10:19:43 -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 1a1bbe99f8 cloner: Improve error message about unimplemented rbd support
Fixes: https://github.com/virt-manager/virt-manager/issues/340

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-26 16:58:45 -05:00
Cole Robinson b7e86d2fcc guest: Move uefi check into _add_default_tpm
This is closer to the same pattern used by _add_default_*

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-26 13:23:27 -05:00
Cole Robinson 5003f0432e details: Add os.firmware=efi in the firmware selector UI
Let users choose libvirt's os.firmware=efi setting in the UI, putting
it about the firmware path list, since it's the preferred default
these days.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-26 13:23:27 -05:00
Cole Robinson 3013889727 guest: Use os.firmware=efi for --boot uefi, if it is supported
<os firmware='efi'> is the libvirt official way to do what we
historically implement with `--boot uefi`, and UEFI setup in
virt-manager.

Let's prefer libvirt's official method if the support is advertised
in domcapabilities.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-26 11:59:51 -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 6c3b5def81 netlist: Revive portgroup UI
I removed Portgroup UI in 4c3c53f773 release 3.0.0, but there's been
a steady stream of requests to bring it back. It seems it's commonly
used with some certain openvswitch config.

Maint burden isn't too bad. Let's bring it back

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

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 16:01:17 -05:00
Cole Robinson c6bf106dd3 device: netlist: Rework source row data structure
Put non-UI bits into a class, rather that stuff them into gtk
columns. Simplifies adding bits here

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 15:35:55 -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 9c45f4a2e9 details: Strip back 'Enable shared memory' to only cover memfd
Strip back the logic to:

* Only try to toggle source_type=memfd and access_mode=shared
* Disable the field if guest has any <numa> config
* Disable the field if domcaps does not report virtiofs and memfd

This is the simplest future proof case, though it will exclude some
legit guest configs and some libvirt+qemu back compat.

My feeling is the <numa> stuff in particular is pretty advanced, so if
users have it configured they can toggle shared memory via the XML
without too much trouble.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 12:43:32 -05:00
Cole Robinson 3d915717dd tests: Add domcaps coverage for filesystem checks
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 12:26:14 -05:00
Cole Robinson c9ce3ad84e tests: uitests: Add some coverage for 'Enable shared memory'
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 12:26:14 -05:00
Cole Robinson 51de31499e details: Move 'shared mem' editing and tooltip logic to domain.py
We will eventually want to share this with the addhw wizard, so it
should live in a shared space.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 12:26:14 -05:00
Cole Robinson ab9cdb55e0 details: shared mem UI tweaks
- Change label to 'Enable shared memory'
- Add accelerator
- Tweak table row fill

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 12:26:14 -05:00
Lin Ma b4189a925b details: Add new checkbox to control shared memory access
The virtiofs in domcapabilities is used as a proxy to tell us whether
libvirt is new enough to allow bare memory access mode=shared', So We
enable/disable this checkbox according to it.

When we configure shared memory access, If the 'memfd' is available in
domcaps, We configure VM to use it as memory backend because it doesn't
need addtional host setup for vhost-user devices, Otherwise use 'file'
as backend.

If all of numa nodes explicitly defined memAccess=shared, We mark this
checkbox as checked even if virtiofs isn't exposed in domcapabilities.
In this case:
- It doesn't matter what the value of access mode of memoryBacking is
  because access mode of memoryBacking will be overridden per numa node
  by memAccess attribute.
- Although the checkbox is disabled, the checked checkbox presents actual
  status about shared memory access to users.

Signed-off-by: Lin Ma <lma@suse.com>
2022-01-25 12:26:14 -05:00
Lin Ma b19f973f78 domain: cpu: Add function all_shared_memAccess_cells()
It returns true in case all of numa nodes have the "shared" memAccess
attribute defined explicitly.

Signed-off-by: Lin Ma <lma@suse.com>
2022-01-25 12:26:14 -05:00
Lin Ma f223992934 domain: cpu: Add function has_private_memAccess_cells()
It returns true in case any of numa nodes has the "private" memAccess
attribute.

Signed-off-by: Lin Ma <lma@suse.com>
2022-01-25 12:26:14 -05:00
Lin Ma 0864a9b231 domain: memorybacking: Add function is_shared_access()
It returns true in case the memoryBacking element contains the "shared"
access mode.

Signed-off-by: Lin Ma <lma@suse.com>
2022-01-25 12:26:14 -05:00
Lin Ma c55a5b2d6d domcapabilities: Add supports_memorybacking_memfd()
Linux memfd memory backend doesn't require any host setup, We prefer to
use it as the simplest memory XML adjustments to make virtiofs works.

Signed-off-by: Lin Ma <lma@suse.com>
2022-01-25 12:26:14 -05:00
Lin Ma 546010ff94 domcapabilities: Add supports_filesystem_virtiofs()
Check whether virtiofs is exposed in domcapabilities, We can use it as a
proxy for 'libvirt is new enough to allow bare memory access mode=shared'
as well.

Signed-off-by: Lin Ma <lma@suse.com>
2022-01-25 12:26:14 -05:00
Lin Ma a608a8c710 domcapabilities: Get filesystem devices
Signed-off-by: Lin Ma <lma@suse.com>
2022-01-25 12:26:14 -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
Cole Robinson 8896944d59 tests: Fix missing XML output from some virt-xml tests
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 12:05:45 -05:00
Cole Robinson 11365e6f43 tests: update x86 capabilities data
Using qemu 6.1.0 and libvirt 7.6.0 on Fedora 35

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 12:05:45 -05:00
Cole Robinson b39aa1ea79 tests: Clean up URI building and naming
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 10:32:03 -05:00
Cole Robinson 5444bf32f5 tests: Remove unnecessary KVMIBM data
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 10:22:24 -05:00
Cole Robinson adae7bf1e5 tests: Remove old rhel7 domcaps data
This doesn't hit any code path we care about anymore

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-25 10:22:15 -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
Cole Robinson 6a83eae30f virtManager: nodedev: Handle failure to lookup drm parent
Apparently nodedev drm XML can link to a parent device that we can't
look up?

We shouldn't be trying to do the full address string compare anyways,
so just try the name lookup, which would improve the error here too

Fixes: #328

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-21 13:20:46 -05:00
Cole Robinson d0664bc521 nodedev: Separate out lookupNodedevByName
This will facilitate upcoming cleanups + bugfixes

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-21 13:20:46 -05:00
Cole Robinson 4a933b0223 uitests: Test graphics port fix
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-21 13:19:57 -05:00
Cole Robinson 28af0f02f6 console: Clarify some error labels and debug messages
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-21 11:03:23 -05:00
Cole Robinson bd4ca8a55e console: Add _cb suffix to viewer callback function names
And use _src for the first parameter name, which appeases pylint
but is more descriptive

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-21 11:03:23 -05:00
Cole Robinson 8bb64ad5af console: Don't block console reconnect for non-error
https://listman.redhat.com/archives/virt-tools-list/2022-January/msg00012.html

On xen, a guest reboot will trigger a non-error viewer-disconnected
signal, but we treat it like an error, which makes it difficult to
reconnect to the VM console.

If there's no error message raised, treat the disconnect like a
non-error cases.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-21 11:03:23 -05:00
Cole Robinson 2815b7406e gfxdetails: Fix switching from listen=none to listen=address
... with the 'hypervisor default' address. In this case, we need to
force set port=-1 in the XML, to make the changes actually stick

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-20 16:34:59 -05:00
Daniel P. Berrangé 5622854d8c virtinst: refactor setting of default vcpus count
The sync_vcpus_topology method will sometimes set the self.vcpus prop,
but other times leave it unset. This is confusing an unhelpful
behaviour. Both callers have logic to set the self.vcpus prop
to a default value of sync_vcpus_topology failed to do so. It makes
more sense to just pass this default value in.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-20 14:16:39 -05:00