Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dirkmueller:acdc:as_python3_module
libvirt.16761
4b299843-qemu-Refactor-the-max-memlock-routine....
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 4b299843-qemu-Refactor-the-max-memlock-routine.patch of Package libvirt.16761
commit 4b2998432a7ed9ed16116f1a157763d4a1b20620 Author: Eric Farman <farman@linux.ibm.com> Date: Tue Sep 3 22:09:46 2019 +0200 qemu: Refactor the max memlock routine Let's pull this hunk out into a function, so it can be reused in another codepath that needs to do the same thing. Signed-off-by: Eric Farman <farman@linux.ibm.com> Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com> Index: libvirt-5.1.0/src/qemu/qemu_domain.c =================================================================== --- libvirt-5.1.0.orig/src/qemu/qemu_domain.c +++ libvirt-5.1.0/src/qemu/qemu_domain.c @@ -10559,6 +10559,36 @@ qemuDomainAdjustMaxMemLock(virDomainObjP return ret; } + +/** + * qemuDomainAdjustMaxMemLockHostdev: + * @vm: domain + * @hostdev: device + * + * Temporarily add the hostdev to the domain definition. This is needed + * because qemuDomainAdjustMaxMemLock() requires the hostdev to be already + * part of the domain definition, but other functions like + * qemuAssignDeviceHostdevAlias() expect it *not* to be there. + * A better way to handle this would be nice + * + * Returns: 0 on success, <0 on failure + */ +int +qemuDomainAdjustMaxMemLockHostdev(virDomainObjPtr vm, + virDomainHostdevDefPtr hostdev) +{ + int ret = 0; + + vm->def->hostdevs[vm->def->nhostdevs++] = hostdev; + if (qemuDomainAdjustMaxMemLock(vm) < 0) + ret = -1; + + vm->def->hostdevs[--(vm->def->nhostdevs)] = NULL; + + return ret; +} + + /** * qemuDomainHasVcpuPids: * @vm: Domain object Index: libvirt-5.1.0/src/qemu/qemu_domain.h =================================================================== --- libvirt-5.1.0.orig/src/qemu/qemu_domain.h +++ libvirt-5.1.0/src/qemu/qemu_domain.h @@ -854,6 +854,8 @@ void qemuDomainUpdateCurrentMemorySize(v unsigned long long qemuDomainGetMemLockLimitBytes(virDomainDefPtr def); int qemuDomainAdjustMaxMemLock(virDomainObjPtr vm); +int qemuDomainAdjustMaxMemLockHostdev(virDomainObjPtr vm, + virDomainHostdevDefPtr hostdev); int qemuDomainDefValidateMemoryHotplug(const virDomainDef *def, virQEMUCapsPtr qemuCaps, Index: libvirt-5.1.0/src/qemu/qemu_hotplug.c =================================================================== --- libvirt-5.1.0.orig/src/qemu/qemu_hotplug.c +++ libvirt-5.1.0/src/qemu/qemu_hotplug.c @@ -1725,17 +1725,8 @@ qemuDomainAttachHostPCIDevice(virQEMUDri break; } - /* Temporarily add the hostdev to the domain definition. This is needed - * because qemuDomainAdjustMaxMemLock() requires the hostdev to be already - * part of the domain definition, but other functions like - * qemuAssignDeviceHostdevAlias() used below expect it *not* to be there. - * A better way to handle this would be nice */ - vm->def->hostdevs[vm->def->nhostdevs++] = hostdev; - if (qemuDomainAdjustMaxMemLock(vm) < 0) { - vm->def->hostdevs[--(vm->def->nhostdevs)] = NULL; + if (qemuDomainAdjustMaxMemLockHostdev(vm, hostdev) < 0) goto error; - } - vm->def->hostdevs[--(vm->def->nhostdevs)] = NULL; if (qemuDomainNamespaceSetupHostdev(vm, hostdev) < 0) goto error;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor