From nobody Mon Feb 9 19:30:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1572337142; cv=none; d=zoho.com; s=zohoarc; b=hUk7QxI0FPcZVzlLGqRACanHrEoNqX6Ob3d1DbX+0c9kyk6zXs4SYS80BBH+c2UMjP0ZYKxfdCuRWF9/TdpUBb0TF+HnRCnatDy9QfxMXLfncGBxU3z92nLw0C1VziBeJChSuEsc712Pq24J2xUuEll6RcCBgC7Iir3JDfaNKig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572337142; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kxlcaAfiyYInqluuY7u1Frd/vcl9jrvesNxFseU8Ssk=; b=hdO8YHecIPvv4d6/uRdzkI242XbOhtD1Spux7zw0cY6L26qj7kniz45DafxkPzjY0mxtkFCcQptV6QSCKYW3Ii3qnQHB6XJrsV1fU9PAhfZnspGhi+2EYohkh2he/5plYji0gO5Yuv95d9JWMJLeenXGtHF1Xa8ev0DFI0PJ2iI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1572337142622930.5376867718128; Tue, 29 Oct 2019 01:19:02 -0700 (PDT) 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-424--Jwr6Te3NJm1Gs78lqzKCg-1; Tue, 29 Oct 2019 04:19:00 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 826EE1005510; Tue, 29 Oct 2019 08:18:55 +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 5F3BB60870; Tue, 29 Oct 2019 08:18:55 +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 1005924F30; Tue, 29 Oct 2019 08:18:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9T8IWF1022928 for ; Tue, 29 Oct 2019 04:18:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 341591001DD7; Tue, 29 Oct 2019 08:18:32 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2E0101001B23 for ; Tue, 29 Oct 2019 08:18:31 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 26CAC3083363 for ; Tue, 29 Oct 2019 08:18:29 +0000 (UTC) Received: from [172.16.24.106] (helo=shiny.sw.ru) by relay.sw.ru with esmtp (Exim 4.92.2) (envelope-from ) id 1iPMhv-0003PU-Kb; Tue, 29 Oct 2019 11:18:27 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572337141; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=kxlcaAfiyYInqluuY7u1Frd/vcl9jrvesNxFseU8Ssk=; b=U6McYQLBsGkTnCSRO+H+JF2C4bEOySVE5D8FsjrgpPVdYXrP7BfyjDtikERH3XfSXOch4M laRic81+XWGWPUuGkaKRss+IX6+e1JJJe5CixfMNIqrzds9djJlw9MbPxboLc7PvLL/9tE 73KYozw7qYPVV5e8WACXPh6KU5KspjQ= From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Tue, 29 Oct 2019 11:18:01 +0300 Message-Id: <20191029081803.28274-11-nshirokovskiy@virtuozzo.com> In-Reply-To: <20191029081803.28274-1-nshirokovskiy@virtuozzo.com> References: <20191029081803.28274-1-nshirokovskiy@virtuozzo.com> MIME-Version: 1.0 X-Greylist: Sender passed SPF test, ACL 264 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 29 Oct 2019 08:18:29 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 29 Oct 2019 08:18:29 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: 0 (SPF_HELO_NONE, SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v3 REBASE 2 10/12] qemu: don't mess with non mandatory hostdevs on reattaching 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.13 X-MC-Unique: -Jwr6Te3NJm1Gs78lqzKCg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" First I don't want to add code to handle dummy device that is used when host usb device is not present at the moment of starting/migrating etc. Second supporting non mandatory policies would require to handle races when host usb device is plugged to host and libvirtd starts adding device but if in the meanwhile host usb device it unplugged back then current code will use dummy device which is not desired in this case. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 8 ++++++++ src/qemu/qemu_process.c | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9e35427354..1227072bb8 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5132,6 +5132,10 @@ processUSBAddedEvent(virQEMUDriverPtr driver, if (hostdev->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYP= E_USB) continue; =20 + if (hostdev->startupPolicy =3D=3D VIR_DOMAIN_STARTUP_POLICY_OPTION= AL || + hostdev->startupPolicy =3D=3D VIR_DOMAIN_STARTUP_POLICY_REQUIS= ITE) + continue; + usbsrc =3D &hostdev->source.subsys.u.usb; =20 if (!usbsrc->replug) @@ -5190,6 +5194,10 @@ processUSBRemovedEvent(virQEMUDriverPtr driver, if (hostdev->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYP= E_USB) continue; =20 + if (hostdev->startupPolicy =3D=3D VIR_DOMAIN_STARTUP_POLICY_OPTION= AL || + hostdev->startupPolicy =3D=3D VIR_DOMAIN_STARTUP_POLICY_REQUIS= ITE) + continue; + usbsrc =3D &hostdev->source.subsys.u.usb; =20 if (!usbsrc->replug) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 46f04eff44..881bee79a0 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3747,6 +3747,10 @@ qemuProcessReattachUSBDevices(virQEMUDriverPtr drive= r, if (!usbsrc->vendor || !usbsrc->product) continue; =20 + if (hostdev->startupPolicy =3D=3D VIR_DOMAIN_STARTUP_POLICY_OPTION= AL || + hostdev->startupPolicy =3D=3D VIR_DOMAIN_STARTUP_POLICY_REQUIS= ITE) + continue; + if (!usbsrc->bus && !usbsrc->device) { int num; =20 --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list