From nobody Mon Feb 9 09:33:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1568028845; cv=none; d=zoho.com; s=zohoarc; b=XOOa1rFj4b8jUHEyb5vajbcpf6uuuXEJYi9S65amkAPg/0/mgGHQyK+vXxLI0Km5osvo8aMEN53OPM3ou4F9ADKMlrLVYvu55Q2IQXa8soOYBcNMESOFRxO7rfn5VncTJ1cCoWhYBWxTn/tBM9CRiKlnphfdRaSR1O3PF+zzfhI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568028845; 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:ARC-Authentication-Results; bh=Jab2+jYdWNlPt/+6tKb3X3XSqWByx8tswL3Aom0tjl4=; b=P41szfkOrNSF2zKHBQwvERmIqzw9EZMHB6ldHz8I2ScaHhxijuLXHGPCahBEZLtbYC6S0EJIJmsfIRC0LcflaaKI5LgnTOhLrWgDKSg7UwvwfRbkDqPrQqJw5+dQspXAJx50V+jTp/EWU7E7tA99NQo5Y3fNW2Xtwtx4Rbdwyog= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1568028845466333.46240811991856; Mon, 9 Sep 2019 04:34:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CAA7118C428B; Mon, 9 Sep 2019 11:34:02 +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 96B616012A; Mon, 9 Sep 2019 11:34:02 +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 4E61C24F33; Mon, 9 Sep 2019 11:34:02 +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 x89BXr70013726 for ; Mon, 9 Sep 2019 07:33:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 877E46012E; Mon, 9 Sep 2019 11:33:53 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7EE4D6017E for ; Mon, 9 Sep 2019 11:33:51 +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 0A37A2F366E for ; Mon, 9 Sep 2019 11:33:50 +0000 (UTC) Received: from [172.16.24.106] (helo=shiny.sw.ru) by relay.sw.ru with esmtp (Exim 4.92) (envelope-from ) id 1i7HvY-0002RT-Ew; Mon, 09 Sep 2019 14:33:48 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Mon, 9 Sep 2019 14:33:12 +0300 Message-Id: <20190909113314.22362-10-nshirokovskiy@virtuozzo.com> In-Reply-To: <20190909113314.22362-1-nshirokovskiy@virtuozzo.com> References: <20190909113314.22362-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.29]); Mon, 09 Sep 2019 11:33:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Sep 2019 11:33:50 +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.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza Subject: [libvirt] [PATCH v2 09/11] 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Mon, 09 Sep 2019 11:34:03 +0000 (UTC) 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 b646642c99..fe5fd94ac5 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5337,6 +5337,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->vendor =3D=3D data->vendor && usbsrc->product =3D=3D d= ata->product) @@ -5392,6 +5396,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 /* don't mess with devices that don't use stable host addressing diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 8bec36fe2c..d87fb637ac 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3769,6 +3769,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