libvirt-10.0.0-4.el9
- Set stubDriverName from hostdev driver model attribute during pci device setup (RHEL-25858) - qemuMigrationDstPrepareStorage: Use 'switch' statement to include all storage types (RHEL-24825) - qemuMigrationDstPrepareStorage: Properly consider path for 'vdpa' devices (RHEL-24825) - domain_validate: Account for NVDIMM label size properly when checking for memory conflicts (RHEL-4452) Resolves: RHEL-24825, RHEL-25858, RHEL-4452
This commit is contained in:
		
							parent
							
								
									9ea8eed2bd
								
							
						
					
					
						commit
						f956802388
					
				| @ -0,0 +1,44 @@ | ||||
| From 676946491ea25cacc4f6fd11f27bd9989b84767d Mon Sep 17 00:00:00 2001 | ||||
| Message-ID: <676946491ea25cacc4f6fd11f27bd9989b84767d.1708614745.git.jdenemar@redhat.com> | ||||
| From: Laine Stump <laine@redhat.com> | ||||
| Date: Fri, 16 Feb 2024 12:43:59 -0500 | ||||
| Subject: [PATCH] Set stubDriverName from hostdev driver model attribute during | ||||
|  pci device setup | ||||
| 
 | ||||
| commit v9.10.0-129-g8b93d78c83 (first appearing in libvirt-10.0.0) was | ||||
| supposed to allow forcing a PCI hostdev to be bound to a particular | ||||
| driver by adding <driver model='blah'/> to the XML for the | ||||
| device. Unfortunately, a single line was missed during the final | ||||
| changes to the patch prior to pushing, and the result was that the | ||||
| driver model could be set to *anything* and it would be accepted but | ||||
| just ignored. | ||||
| 
 | ||||
| This patch adds the missing line, which will set the stubDriverName | ||||
| field of the virPCIDevice object from the hostdev object as the | ||||
| virPCIDevice is being created. This ends up being used by | ||||
| virPCIDeviceBindToStub() as the driver that it binds the device to. | ||||
| 
 | ||||
| Fixes: 8b93d78c8325f1fba5db98848350f3db43f5e7d5 | ||||
| Signed-off-by: Laine Stump <laine@redhat.com> | ||||
| Reviewed-by: Reviewed-by: Michal Privoznik <mprivozn@redhat.com> | ||||
| (cherry picked from commit 41fe8524870facae02be067097ea494c475d77f0) | ||||
| 
 | ||||
| https://issues.redhat.com/browse/RHEL-25858 [9.4.0] | ||||
| ---
 | ||||
|  src/hypervisor/virhostdev.c | 1 + | ||||
|  1 file changed, 1 insertion(+) | ||||
| 
 | ||||
| diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c
 | ||||
| index 40f8a4bc2c..185ec2ca50 100644
 | ||||
| --- a/src/hypervisor/virhostdev.c
 | ||||
| +++ b/src/hypervisor/virhostdev.c
 | ||||
| @@ -242,6 +242,7 @@ virHostdevGetPCIHostDevice(const virDomainHostdevDef *hostdev,
 | ||||
|          return -1; | ||||
|   | ||||
|      virPCIDeviceSetManaged(actual, hostdev->managed); | ||||
| +    virPCIDeviceSetStubDriverName(actual, pcisrc->driver.model);
 | ||||
|   | ||||
|      if (pcisrc->driver.name == VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO) { | ||||
|          virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_VFIO); | ||||
| -- 
 | ||||
| 2.43.2 | ||||
| @ -0,0 +1,123 @@ | ||||
| From 8d48d5fe02c0afcf5bbe68e0a182ee11f9a108dc Mon Sep 17 00:00:00 2001 | ||||
| Message-ID: <8d48d5fe02c0afcf5bbe68e0a182ee11f9a108dc.1708614745.git.jdenemar@redhat.com> | ||||
| From: Michal Privoznik <mprivozn@redhat.com> | ||||
| Date: Mon, 19 Feb 2024 15:37:16 +0100 | ||||
| Subject: [PATCH] domain_validate: Account for NVDIMM label size properly when | ||||
|  checking for memory conflicts | ||||
| 
 | ||||
| As of v9.8.0-rc1~7 we check whether two <memory/> devices don't | ||||
| overlap (since we allow setting where a <memory/> device should | ||||
| be mapped to). We do this pretty straightforward, by comparing | ||||
| start and end address of each <memory/> device combination. | ||||
| But since only the start address is given (an exposed in the | ||||
| XML), the end address is computed trivially as: | ||||
| 
 | ||||
|   start + mem->size * 1024 | ||||
| 
 | ||||
| And for majority of memory device types this works. Except for | ||||
| NVDIMMs. For them the <memory/> device consists of two separate | ||||
| regions: 1) actual memory device, and 2) label. | ||||
| 
 | ||||
| Label is where NVDIMM stores some additional information like | ||||
| namespaces partition and so on. But it's not mapped into the | ||||
| guest the same way as actual memory device. In fact, mem->size is | ||||
| a sum of both actual memory device and label sizes. And to make | ||||
| things a bit worse, both sizes are subject to alignment (either | ||||
| the alignsize value specified in XML, or system page size if not | ||||
| specified in XML). | ||||
| 
 | ||||
| Therefore, to get the size of actual memory device we need to | ||||
| take mem->size and substract label size rounded up to alignment. | ||||
| 
 | ||||
| If we don't do this we report there's an overlap between two | ||||
| NVDIMMs even when in reality there's none. | ||||
| 
 | ||||
| Fixes: 3fd64fb0e236fc80ffa2cc977c0d471f11fc39bf | ||||
| Fixes: 91f9a9fb4fc0d34ed8d7a869de3d9f87687c3618 | ||||
| Resolves: https://issues.redhat.com/browse/RHEL-4452?focusedId=23805174#comment-23805174 | ||||
| Signed-off-by: Michal Privoznik <mprivozn@redhat.com> | ||||
| Reviewed-by: Martin Kletzander <mkletzan@redhat.com> | ||||
| (cherry picked from commit 4545f313c23e7000451d1cec793ebc8da1a2c25f) | ||||
| Signed-off-by: Michal Privoznik <mprivozn@redhat.com> | ||||
| ---
 | ||||
|  src/conf/domain_validate.c | 51 ++++++++++++++++++++++++++++++++++++-- | ||||
|  1 file changed, 49 insertions(+), 2 deletions(-) | ||||
| 
 | ||||
| diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
 | ||||
| index 46479f10f2..faa7659f07 100644
 | ||||
| --- a/src/conf/domain_validate.c
 | ||||
| +++ b/src/conf/domain_validate.c
 | ||||
| @@ -2225,6 +2225,53 @@ virDomainHostdevDefValidate(const virDomainHostdevDef *hostdev)
 | ||||
|  } | ||||
|   | ||||
|   | ||||
| +/**
 | ||||
| + * virDomainMemoryGetMappedSize:
 | ||||
| + * @mem: memory device definition
 | ||||
| + *
 | ||||
| + * For given memory device definition (@mem) calculate size mapped into
 | ||||
| + * the guest. This is usually mem->size, except for NVDIMM where its
 | ||||
| + * label is mapped elsewhere.
 | ||||
| + *
 | ||||
| + * Returns: Number of bytes a memory device takes when mapped into a
 | ||||
| + * guest.
 | ||||
| + */
 | ||||
| +static unsigned long long
 | ||||
| +virDomainMemoryGetMappedSize(const virDomainMemoryDef *mem)
 | ||||
| +{
 | ||||
| +    unsigned long long ret = mem->size;
 | ||||
| +
 | ||||
| +    if (mem->model == VIR_DOMAIN_MEMORY_MODEL_NVDIMM) {
 | ||||
| +        unsigned long long alignsize = mem->source.nvdimm.alignsize;
 | ||||
| +        unsigned long long labelsize = 0;
 | ||||
| +
 | ||||
| +        /* For NVDIMM the situation is a bit more complicated. Firstly,
 | ||||
| +         * its <label/> is not mapped as a part of memory device, so we
 | ||||
| +         * must subtract label size from NVDIMM size. Secondly,
 | ||||
| +         * remaining memory is then aligned again (rounded down). But
 | ||||
| +         * for our purposes we might just round label size up and
 | ||||
| +         * achieve the same (numeric) result. */
 | ||||
| +
 | ||||
| +        if (alignsize == 0) {
 | ||||
| +            long pagesize = virGetSystemPageSizeKB();
 | ||||
| +
 | ||||
| +            /* If no alignment is specified in the XML, fallback to
 | ||||
| +             * system page size alignment. */
 | ||||
| +            if (pagesize > 0)
 | ||||
| +                alignsize = pagesize;
 | ||||
| +        }
 | ||||
| +
 | ||||
| +        if (alignsize > 0) {
 | ||||
| +            labelsize = VIR_ROUND_UP(mem->target.nvdimm.labelsize, alignsize);
 | ||||
| +
 | ||||
| +            ret -= labelsize;
 | ||||
| +        }
 | ||||
| +    }
 | ||||
| +
 | ||||
| +    return ret * 1024;
 | ||||
| +}
 | ||||
| +
 | ||||
| +
 | ||||
|  static int | ||||
|  virDomainMemoryDefCheckConflict(const virDomainMemoryDef *mem, | ||||
|                                  const virDomainDef *def) | ||||
| @@ -2259,7 +2306,7 @@ virDomainMemoryDefCheckConflict(const virDomainMemoryDef *mem,
 | ||||
|      } | ||||
|   | ||||
|      /* thisStart and thisEnd are in bytes, mem->size in kibibytes */ | ||||
| -    thisEnd = thisStart + mem->size * 1024;
 | ||||
| +    thisEnd = thisStart + virDomainMemoryGetMappedSize(mem);
 | ||||
|   | ||||
|      for (i = 0; i < def->nmems; i++) { | ||||
|          const virDomainMemoryDef *other = def->mems[i]; | ||||
| @@ -2316,7 +2363,7 @@ virDomainMemoryDefCheckConflict(const virDomainMemoryDef *mem,
 | ||||
|          if (thisStart == 0 || otherStart == 0) | ||||
|              continue; | ||||
|   | ||||
| -        otherEnd = otherStart + other->size * 1024;
 | ||||
| +        otherEnd = otherStart + virDomainMemoryGetMappedSize(other);
 | ||||
|   | ||||
|          if ((thisStart <= otherStart && thisEnd > otherStart) || | ||||
|              (otherStart <= thisStart && otherEnd > thisStart)) { | ||||
| -- 
 | ||||
| 2.43.2 | ||||
| @ -0,0 +1,40 @@ | ||||
| From 2087ac009a019ceb206475363113bbe6c2821e2f Mon Sep 17 00:00:00 2001 | ||||
| Message-ID: <2087ac009a019ceb206475363113bbe6c2821e2f.1708614745.git.jdenemar@redhat.com> | ||||
| From: Peter Krempa <pkrempa@redhat.com> | ||||
| Date: Fri, 16 Feb 2024 16:40:20 +0100 | ||||
| Subject: [PATCH] qemuMigrationDstPrepareStorage: Properly consider path for | ||||
|  'vdpa' devices | ||||
| 
 | ||||
| Allow storage migration of VDPA devices by properly checking that they | ||||
| exist on the destionation. Pre-creation is not supported but if the | ||||
| device exists the migration should be able to succeed. | ||||
| 
 | ||||
| Signed-off-by: Peter Krempa <pkrempa@redhat.com> | ||||
| Reviewed-by: Michal Privoznik <mprivozn@redhat.com> | ||||
| (cherry picked from commit 00c0a94ab5f135ea7d9f0a905ff53d13c82761db) | ||||
| https://issues.redhat.com/browse/RHEL-24825 | ||||
| ---
 | ||||
|  src/qemu/qemu_migration.c | 5 ++++- | ||||
|  1 file changed, 4 insertions(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
 | ||||
| index 3e0aae4e7c..5e27cd5dbe 100644
 | ||||
| --- a/src/qemu/qemu_migration.c
 | ||||
| +++ b/src/qemu/qemu_migration.c
 | ||||
| @@ -479,10 +479,13 @@ qemuMigrationDstPrepareStorage(virDomainObj *vm,
 | ||||
|              diskSrcPath = nvmePath; | ||||
|              break; | ||||
|   | ||||
| +        case VIR_STORAGE_TYPE_VHOST_VDPA:
 | ||||
| +            diskSrcPath = disk->src->vdpadev;
 | ||||
| +            break;
 | ||||
| +
 | ||||
|          case VIR_STORAGE_TYPE_NETWORK: | ||||
|          case VIR_STORAGE_TYPE_VOLUME: | ||||
|          case VIR_STORAGE_TYPE_VHOST_USER: | ||||
| -        case VIR_STORAGE_TYPE_VHOST_VDPA:
 | ||||
|          case VIR_STORAGE_TYPE_LAST: | ||||
|          case VIR_STORAGE_TYPE_NONE: | ||||
|              break; | ||||
| -- 
 | ||||
| 2.43.2 | ||||
| @ -0,0 +1,60 @@ | ||||
| From b73313c9679766c493afb91f0c691e437632e4fa Mon Sep 17 00:00:00 2001 | ||||
| Message-ID: <b73313c9679766c493afb91f0c691e437632e4fa.1708614745.git.jdenemar@redhat.com> | ||||
| From: Peter Krempa <pkrempa@redhat.com> | ||||
| Date: Thu, 8 Feb 2024 16:48:25 +0100 | ||||
| Subject: [PATCH] qemuMigrationDstPrepareStorage: Use 'switch' statement to | ||||
|  include all storage types | ||||
| 
 | ||||
| Decrease the likelyhood that addition of a new storage type will be | ||||
| forgotten. | ||||
| 
 | ||||
| This patch also unifies the type check to consult the 'actual' type of | ||||
| the storage in both cases as the NVMe check looked for the XML declared | ||||
| type while virStorageSourceIsLocalStorage() looks for the | ||||
| actual/translated type. | ||||
| 
 | ||||
| Signed-off-by: Peter Krempa <pkrempa@redhat.com> | ||||
| Reviewed-by: Michal Privoznik <mprivozn@redhat.com> | ||||
| (cherry picked from commit e158b523b8522931200c415ef86562641a2a7c8c) | ||||
| https://issues.redhat.com/browse/RHEL-24825 | ||||
| ---
 | ||||
|  src/qemu/qemu_migration.c | 22 +++++++++++++++++++--- | ||||
|  1 file changed, 19 insertions(+), 3 deletions(-) | ||||
| 
 | ||||
| diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
 | ||||
| index 01ab803842..3e0aae4e7c 100644
 | ||||
| --- a/src/qemu/qemu_migration.c
 | ||||
| +++ b/src/qemu/qemu_migration.c
 | ||||
| @@ -465,11 +465,27 @@ qemuMigrationDstPrepareStorage(virDomainObj *vm,
 | ||||
|          if (!qemuMigrationAnyCopyDisk(disk, nmigrate_disks, migrate_disks)) | ||||
|              continue; | ||||
|   | ||||
| -        if (disk->src->type == VIR_STORAGE_TYPE_NVME) {
 | ||||
| +        switch (virStorageSourceGetActualType(disk->src)) {
 | ||||
| +        case VIR_STORAGE_TYPE_FILE:
 | ||||
| +        case VIR_STORAGE_TYPE_BLOCK:
 | ||||
| +        case VIR_STORAGE_TYPE_DIR:
 | ||||
| +            diskSrcPath = virDomainDiskGetSource(disk);
 | ||||
| +            break;
 | ||||
| +
 | ||||
| +        case VIR_STORAGE_TYPE_NVME:
 | ||||
| +            /* While NVMe disks are local, they are not accessible via src->path.
 | ||||
| +             * Therefore, we have to return false here. */
 | ||||
|              virPCIDeviceAddressGetSysfsFile(&disk->src->nvme->pciAddr, &nvmePath); | ||||
|              diskSrcPath = nvmePath; | ||||
| -        } else if (virStorageSourceIsLocalStorage(disk->src)) {
 | ||||
| -            diskSrcPath = virDomainDiskGetSource(disk);
 | ||||
| +            break;
 | ||||
| +
 | ||||
| +        case VIR_STORAGE_TYPE_NETWORK:
 | ||||
| +        case VIR_STORAGE_TYPE_VOLUME:
 | ||||
| +        case VIR_STORAGE_TYPE_VHOST_USER:
 | ||||
| +        case VIR_STORAGE_TYPE_VHOST_VDPA:
 | ||||
| +        case VIR_STORAGE_TYPE_LAST:
 | ||||
| +        case VIR_STORAGE_TYPE_NONE:
 | ||||
| +            break;
 | ||||
|          } | ||||
|   | ||||
|          if (diskSrcPath) { | ||||
| -- 
 | ||||
| 2.43.2 | ||||
							
								
								
									
										12
									
								
								libvirt.spec
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								libvirt.spec
									
									
									
									
									
								
							| @ -270,7 +270,7 @@ | ||||
| Summary: Library providing a simple virtualization API | ||||
| Name: libvirt | ||||
| Version: 10.0.0 | ||||
| Release: 3%{?dist}%{?extra_release} | ||||
| Release: 4%{?dist}%{?extra_release} | ||||
| License: GPL-2.0-or-later AND LGPL-2.1-only AND LGPL-2.1-or-later AND OFL-1.1 | ||||
| URL: https://libvirt.org/ | ||||
| 
 | ||||
| @ -334,6 +334,10 @@ Patch52: libvirt-virPCIVPDParseVPDLargeResourceFields-Refactor-return-logic.patc | ||||
| Patch53: libvirt-virPCIVPDParseVPDLargeResourceFields-Report-proper-errors.patch | ||||
| Patch54: libvirt-virPCIVPDParse-Do-reasonable-error-reporting.patch | ||||
| Patch55: libvirt-virt-admin-Add-warning-when-connection-to-default-daemon-fails.patch | ||||
| Patch56: libvirt-Set-stubDriverName-from-hostdev-driver-model-attribute-during-pci-device-setup.patch | ||||
| Patch57: libvirt-qemuMigrationDstPrepareStorage-Use-switch-statement-to-include-all-storage-types.patch | ||||
| Patch58: libvirt-qemuMigrationDstPrepareStorage-Properly-consider-path-for-vdpa-devices.patch | ||||
| Patch59: libvirt-domain_validate-Account-for-NVDIMM-label-size-properly-when-checking-for-memory-conflicts.patch | ||||
| 
 | ||||
| 
 | ||||
| Requires: libvirt-daemon = %{version}-%{release} | ||||
| @ -2637,6 +2641,12 @@ exit 0 | ||||
| %endif | ||||
| 
 | ||||
| %changelog | ||||
| * Thu Feb 22 2024 Jiri Denemark <jdenemar@redhat.com> - 10.0.0-4 | ||||
| - Set stubDriverName from hostdev driver model attribute during pci device setup (RHEL-25858) | ||||
| - qemuMigrationDstPrepareStorage: Use 'switch' statement to include all storage types (RHEL-24825) | ||||
| - qemuMigrationDstPrepareStorage: Properly consider path for 'vdpa' devices (RHEL-24825) | ||||
| - domain_validate: Account for NVDIMM label size properly when checking for memory conflicts (RHEL-4452) | ||||
| 
 | ||||
| * Thu Feb  8 2024 Jiri Denemark <jdenemar@redhat.com> - 10.0.0-3 | ||||
| - remote_driver: Restore special behavior of remoteDomainGetBlockIoTune() (RHEL-22800) | ||||
| - conf: Introduce dynamicMemslots attribute for virtio-mem (RHEL-15316) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user