Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:GA
libvirt.21389
19d4e467-improve-virDomainVirtioOptionsCheckABI...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 19d4e467-improve-virDomainVirtioOptionsCheckABIStability.patch of Package libvirt.21389
commit 19d4e467707e187f6736f24a35f5a51275d869ce Author: Michal Prívozník <mprivozn@redhat.com> Date: Thu Jan 28 14:13:32 2021 +0100 conf: Improve virDomainVirtioOptionsCheckABIStability() The virDomainVirtioOptionsCheckABIStability() function is called from various ABI stability check functions. Every caller checks if both old and new definitions have virtio options set and only after that they call the function. This is suboptimal because: a) this check can be done in the function itself (making all callers shorter), b) is inherently wrong, because it doesn't catch case where one definition has virtio options set and the other doesn't. Do proper checks at the beginning of the function and simplify its calls. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Index: libvirt-6.0.0/src/conf/domain_conf.c =================================================================== --- libvirt-6.0.0.orig/src/conf/domain_conf.c +++ libvirt-6.0.0/src/conf/domain_conf.c @@ -22017,6 +22017,15 @@ static bool virDomainVirtioOptionsCheckABIStability(virDomainVirtioOptionsPtr src, virDomainVirtioOptionsPtr dst) { + if (!src && !dst) + return true; + + if (!src || !dst) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Target device virtio options don't match the source")); + return false; + } + if (src->iommu != dst->iommu) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Target device iommu option '%s' does not " @@ -22093,8 +22102,7 @@ virDomainDiskDefCheckABIStability(virDom return false; } - if (src->virtio && dst->virtio && - !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) + if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) return false; if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) @@ -22153,8 +22161,7 @@ virDomainControllerDefCheckABIStability( } } - if (src->virtio && dst->virtio && - !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) + if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) return false; if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) @@ -22187,8 +22194,7 @@ virDomainFsDefCheckABIStability(virDomai return false; } - if (src->virtio && dst->virtio && - !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) + if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) return false; if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) @@ -22236,8 +22242,7 @@ virDomainNetDefCheckABIStability(virDoma return false; } - if (src->virtio && dst->virtio && - !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) + if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) return false; if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) @@ -22275,8 +22280,7 @@ virDomainInputDefCheckABIStability(virDo return false; } - if (src->virtio && dst->virtio && - !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) + if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) return false; if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) @@ -22375,8 +22379,7 @@ virDomainVideoDefCheckABIStability(virDo } } - if (src->virtio && dst->virtio && - !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) + if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) return false; if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) @@ -22580,8 +22583,7 @@ virDomainMemballoonDefCheckABIStability( return false; } - if (src->virtio && dst->virtio && - !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) + if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) return false; if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info)) @@ -22603,8 +22605,7 @@ virDomainRNGDefCheckABIStability(virDoma return false; } - if (src->virtio && dst->virtio && - !virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) + if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) return false; if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
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