On Wed, Feb 10, 2021 at 04:33:21PM -0500, Laine Stump wrote:
Previously we only checked MAC address and PCI address (or CCW address). This is not enough information in cases where PCI address isn't provided and multiple interfaces have the same MAC address (for example, a virtio + hostdev "teaming" pair - their MAC addresses are always the same). Resolves: https://bugzilla.redhat.com/1926190 Signed-off-by: Laine Stump <laine@xxxxxxxxxx> --- Arguably, it would be nice to overhaul the device matching used for virDomainDeviceDetach for *all* the device types, as they could all be matched by looking at alias (and PCI address, for that matter). On the other hand, for all other device types there are already enough fields being matched to assure a unique match even without looking at alias/PCI address, and this patch is intended to fix a current problem being experienced in the wild, meaning it's likely that it will need to be backported to stable branches, and I'd rather not force backporting a sweeping change to stable branches just to bring in a fix for one corner case)
At first I thought this could be taken into account if and only if there were multiple mac addresses, but it looks like all the other cases that could fail are already taken care of, so it makes sense the way it is written. Reviewed-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
src/conf/domain_conf.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 07e6f39256..8f2207bdf6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -16431,6 +16431,11 @@ virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net) &net->info.addr.ccw)) continue; + if (net->info.alias && + STRNEQ_NULLABLE(def->nets[i]->info.alias, net->info.alias)) { + continue; + } + if (matchidx >= 0) { /* there were multiple matches on mac address, and no * qualifying guest-side PCI/CCW address was given, so we must -- 2.29.2
Attachment:
signature.asc
Description: PGP signature