Commit Graph

8271 Commits

Author SHA1 Message Date
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
Daniel P. Berrangé 883419c214 virtinst: allow to force create topology from scratch
When setting CPU defaults we want to force create the topology even if
the user has not specified anything. In particular this allows for
overriding the QEMU defaults, to expose vCPUs as cores instead of
sockets which is a much saner default for Windows.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-20 14:16:39 -05:00
Daniel P. Berrangé 9a578e1ac5 virtinst: prefer cores when exposing topology to the guest
In real world silicon though it is rare to have high socket/die counts,
but common to have huge core counts.

Some OS will even refuse to use sockets over a certain count.

Thus we prefer to expose cores to the guest rather than sockets as the
default for missing fields.

This matches a recent change made in QEMU for new machine types

  commit 4a0af2930a4e4f64ce551152fdb4b9e7be106408
  Author: Yanan Wang <wangyanan55@huawei.com>
  Date:   Wed Sep 29 10:58:09 2021 +0800

    machine: Prefer cores over sockets in smp parsing since 6.2

Closes: https://github.com/virt-manager/virt-manager/issues/155
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-20 14:16:38 -05:00
Daniel P. Berrangé e1c8866163 virtinst: validate that the CPU topology is sane
The product of sockets * dies * cores * threads must be equal to the
vCPU count. While libvirt and QEMU will report this error scenario,
it makes sense to catch it in virt-install, so we can test our local
logic for setting defaults for topology.

This exposes some inconsistent configurations in the test suite.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-20 14:16:38 -05:00
Daniel P. Berrangé 552759bef4 tests: re-arrange CPU topology test for clarity
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-20 14:16:38 -05:00
Daniel P. Berrangé 609007c9ca virtinst: make CPU topology defaulting take account of dies
Any missing values in the topology need to be calculated based on the
other values which are set.

We can take account of fact that 'total_vcpus' treats any unset values
as being 1 to simplify the way we set topology defaults.

This ensures that topology defaulting takes account of dies.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-20 14:16:38 -05:00
Daniel P. Berrangé 9bb86f5186 virtinst: move method for calculating vCPU count from topology
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-20 14:16:38 -05:00
Daniel P. Berrangé c1491ae142 virtinst: set dies in topology to 1
It is always permitted to set dies==1 regardless of architecture or
machine type. The only constraint is around setting values > 1, for
archs/machines that don't support the dies concept.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-20 14:16:38 -05:00
Daniel P. Berrangé 7b68fe1a5e virtinst: take account of 'dies' when calc vcpu count from topology
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-20 14:16:38 -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
Shalini Chellathurai Saroja ca8950f0ed virtManager: change MDEV display names
The MDEV devices listed in the "Add New Virtual Hardware" page, are a
concatenation of parent device name and MDEV device name, eg:
css_0_0_0014 mdev_b204c698_6731_4f25_b5f4_894614a05ec0_0_0_0014. The
parent name is duplicated in here, as the MDEV device name itself includes
a part of the parent name in libvirt version 7.8.0 and later. So, this patch
changes the MDEVs listed in "Add New Virtual Hardware" page to only display
the MDEV device
name(eg:mdev_b204c698_6731_4f25_b5f4_894614a05ec0_0_0_0014), when the
new naming convention is used.

Signed-off-by: Shalini Chellathurai Saroja <shalini@linux.ibm.com>
2022-01-19 14:24:14 -05:00
Cole Robinson 9e133de21a diskbackend: Restrict format->driver_type even more
We should only be returning a driver_type value for volumes that
report support_format(), meaning they support file type formats like
qcow2. Any other reported format should be ignored

Dropping the check for 'unknown' value changes one test case a bit,
but it hardcodes raw which is what libvirt gives us anyways, so it's
okay

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-19 14:21:48 -05:00
Simon Kobyda 2676640979 Disk pool volumes should be always attached as "raw" disks
Usually, when storage volume is attached as a disk and disk xml is filled with
default values, the "<driver type=...>" value is copied from volume's
"<format type=...>".  This makes sense for volumes of storage pool of type
"dir", where format types include "raw, qcow2...".

However, the same approach cannot be used for the storage pool of type "disk".
In that case, format types include "none, linux, fat16, fat32...". Such formats
cannot be used for disk's "<driver type=...>".

Therefore, when generating disk XML for volume of storage pool type "disk",
driver type should always be "raw".
2022-01-19 14:11:46 -05:00
Simon Kobyda 59e24f6bb9 tests: Introduce disk attachment from pool of type 'disk' 2022-01-19 14:09:47 -05:00
Cole Robinson 45eb83f93a osdict: Remove outdated 'no cover' annotation
The test suite does cover this line

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-19 13:45:46 -05:00
Daniel P. Berrangé d9044419ac virtinst: fix return type in guess_os_by_iso
Accidentally changed in

  commit 302ef1f096
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Fri Nov 26 18:51:49 2021 +0000

    virtinst/osdict: add a property for the OsinfoDb object

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-19 13:44:54 -05:00
Cole Robinson acaca061be uitests: top off test coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-17 17:11:18 -05:00
Cole Robinson 4f02ccd7b5 uitests: Mock virtBootstrap
It's historically flakey to keep it + skopeo + virt-sandbox
all working, let's just mock it

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-17 15:13:12 -05:00
Cole Robinson 92c0c4e1a7 tests: Fix test coverage after osdict changes
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-17 14:51:36 -05:00
Cole Robinson 06dbac540f tests: Fix hyperv @mode handling on libvirt 8.0.0
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2022-01-17 14:51:36 -05:00
Daniel P. Berrangé 9423f6680a virtinst/osdict: remove internal cache of OS objects
Now that we've removed all internal aliases, there is no longer any
reason to keep a cache of OS objects internally. We can directly
query the DB when we need it.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-17 14:51:36 -05:00
Daniel P. Berrangé 6b584b183f virtinst/osdict: refactor setup of generic fallback OsinfoOs
Introduce a property for accessing the generic fallback Os object, which
will be useful in future refactoring.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-17 14:51:36 -05:00
Daniel P. Berrangé 302ef1f096 virtinst/osdict: add a property for the OsinfoDb object
This simplies the code a little bit by avoiding visible indirection
via the loader every time.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-17 14:51:36 -05:00
Daniel P. Berrangé 35ef83d628 virtinst/osdict: remove osinfo legacy aliases
The code comment suggests removing the aliases after a year. It has
now been three years, so it is time for them to go.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2022-01-17 14:51:36 -05:00