From nobody Sat Apr 27 23:39:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612992826; cv=none; d=zohomail.com; s=zohoarc; b=IfNbHDtFITEGb6NUtHBe3WRWby3cIZmhvRvQs+QadCkUUNHSWlV4v+WFs6Jtvw7DgiS14jsm1zhFevj9lhBSmuBRlF/1Koe/IW1UrCt842CPxpDWGPrTrAx5GTq7RyRzxBWKDmoVvv3S89ZVxtbSWRQ0pm1/2+I8UfV4u0kPy0I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612992826; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=uXzvKEUmEadFxrgX1ZOxy1u6mdumnjTnEzQTtA/cy9A=; b=OzRAgjCCLaAT9fqdl7YqhP2kQBwjBpsvkviNRTzztiYvKCu7MHDZyJdLPdmmF79dbMo45JSlTOajAmMklikQGcqqC4JhSZi2wQ6CcDjLmU1HkZ7HEhOpn/cMgWq6gZtPWIkyBJx+DYqH+lp6/TVJLnEtlqgenAoS0QA3qlNzPHE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612992825841695.5037598211736; Wed, 10 Feb 2021 13:33:45 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-411-Aw0j1E78PWyVK9Vljq6Edg-1; Wed, 10 Feb 2021 16:33:42 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CD8EF801976; Wed, 10 Feb 2021 21:33:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 71C2F5C1BD; Wed, 10 Feb 2021 21:33:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4BDC657DFC; Wed, 10 Feb 2021 21:33:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11ALXQ0v018534 for ; Wed, 10 Feb 2021 16:33:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id CE90319CBF; Wed, 10 Feb 2021 21:33:26 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-48.phx2.redhat.com [10.3.112.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9486019809 for ; Wed, 10 Feb 2021 21:33:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612992824; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=uXzvKEUmEadFxrgX1ZOxy1u6mdumnjTnEzQTtA/cy9A=; b=hQacDAu8HG8TyHDfWcLxuL1rmwwFEfGmK4xDZSk8NuntwgXwg+iwFeuaInSpzdCvAfax8a pM1So2THh+AnmVH8F1R8JrXuTDaqIx5I50awirZtKwN0wej/mm9cBfJOm755H7wnwqvlAl fLF/YN+RmlYQkXAMlg4UqLqQYMGFwxE= X-MC-Unique: Aw0j1E78PWyVK9Vljq6Edg-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH] qemu: match alias when looking for proper to detach. Date: Wed, 10 Feb 2021 16:33:21 -0500 Message-Id: <20210210213321.76804-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" 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 --- 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) 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, virDomain= NetDefPtr net) &net->info.addr.ccw)) continue; =20 + if (net->info.alias && + STRNEQ_NULLABLE(def->nets[i]->info.alias, net->info.alias)) { + continue; + } + if (matchidx >=3D 0) { /* there were multiple matches on mac address, and no * qualifying guest-side PCI/CCW address was given, so we must --=20 2.29.2