From nobody Fri Apr 19 03:45:48 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=1605617792; cv=none; d=zohomail.com; s=zohoarc; b=GqybLNa+DU9REd+tc4v/bkxyrvA9pNY1yvBi5u/av7CCRvifeQtcWHNLP6GCyvquyzv3a+Ivp1QAfs4DBHetCVB4VwMrJrbX4pw22vKlCRPTloJuOj4R0FGk+4JUKI/JqjDPx2gb4XglZQxcVL0+sjkggojEY8xv+EYN40+nVYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605617792; h=Content-Type:Content-Transfer-Encoding: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=erbNP6GjEi7x8mW+e2UaRld+kaFSnhElv0SHZ5pAi4I=; b=oEMJ5UHRdwZj+R+z90JHZvPiOwxBsodMql0dIjn5H1nyVu4uMenrMS9i7W3/2vSNRJ8OsshLA1xMYRSqBtR6Nds8zyvgtSEJbwm3yjLVcMn4jLzKF/y/Wfirl1fM9bOPd6NdydE56XDuvoEWuX+5m8GDo5rgfikWz45Sbn6Pap8= 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 1605617792936202.48400654133638; Tue, 17 Nov 2020 04:56:32 -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-431-vz1XEA87P_WYN5yXVCzIWg-1; Tue, 17 Nov 2020 07:56:28 -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 CDDCC1017DC9; Tue, 17 Nov 2020 12:56:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C88905C1D0; Tue, 17 Nov 2020 12:56:21 +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 89F1D180B657; Tue, 17 Nov 2020 12:56:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AHCuJDc004674 for ; Tue, 17 Nov 2020 07:56:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id A02B25C1DA; Tue, 17 Nov 2020 12:56:19 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-10.ams2.redhat.com [10.36.115.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id EAF6E5C1CF; Tue, 17 Nov 2020 12:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605617791; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=erbNP6GjEi7x8mW+e2UaRld+kaFSnhElv0SHZ5pAi4I=; b=iX+tCGSxigoP0K+xL99npK/9k1egua5UkxjcoEZQ5b+VygxQGSYhmRPMtR+CBiN7GmY9lF Wuhj0yVYKYl/PFZ74228La+pZHjyZX/TE2eZ9ZhpsppXseAhAQYXQGWPgYhLZwBepgeY2s gAaiFhbP94K0jt8UsycABqXQNpKXmHg= X-MC-Unique: vz1XEA87P_WYN5yXVCzIWg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/4] nodedev: improve debugging logs from udev device/event processing Date: Tue, 17 Nov 2020 12:56:05 +0000 Message-Id: <20201117125608.177278-2-berrange@redhat.com> In-Reply-To: <20201117125608.177278-1-berrange@redhat.com> References: <20201117125608.177278-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Laine Stump --- src/node_device/node_device_udev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 65f312d8f4..b1b1886c54 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -141,8 +141,9 @@ udevGetDeviceProperty(struct udev_device *udev_device, =20 ret =3D udev_device_get_property_value(udev_device, property_key); =20 - VIR_DEBUG("Found property key '%s' value '%s' for device with sysname = '%s'", - property_key, NULLSTR(ret), udev_device_get_sysname(udev_dev= ice)); + VIR_DEBUG("Found property key '%s' value '%s' for device with sysname = '%s' errno=3D'%s'", + property_key, NULLSTR(ret), udev_device_get_sysname(udev_dev= ice), + ret ? "" : g_strerror(errno)); =20 return ret; } @@ -1609,7 +1610,7 @@ udevHandleOneDevice(struct udev_device *device) { const char *action =3D udev_device_get_action(device); =20 - VIR_DEBUG("udev action: '%s'", action); + VIR_DEBUG("udev action: '%s': %s", action, udev_device_get_syspath(dev= ice)); =20 if (STREQ(action, "add") || STREQ(action, "change")) return udevAddOneDevice(device); --=20 2.28.0 From nobody Fri Apr 19 03:45:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1605617797; cv=none; d=zohomail.com; s=zohoarc; b=aHexvoEVgkZ/LkhA/VkfRbodMXQ+a0Pt1Q0aFqF8aLJmTNSEv6gXUarQ+gbPdUcUGtB+E4Uas4wqBllu2Jqz6hyTUoPxTmLaRyGdixeNt5X96D/L1+c1Ng/cqhMaG3EiUnwqKgdAjuLD/hUYrpQD3PfcHe8utpK1CYyXPhx/Qf8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605617797; h=Content-Type:Content-Transfer-Encoding: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=xXPEfz8haGq163NwmbyKxxmwTZ1GPxdTv7rubnP96Bg=; b=AxkDvDJYhUtNEk55D3c6Bf4f3caGcKo4DhwSWupN2oxBUQObKCYLfKaMiNpY7OK3GQOlLocdYRHVvRKQP3QecgI56gWgRDt9WcUbjhnnDgpqfGx8ibaXdA9DEzB/Fct+LykBqnORdrY7LpnA0FjMqh72mJ7VxuYRzP8w7UsM6x8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1605617797075432.27701314962303; Tue, 17 Nov 2020 04:56:37 -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-308-OPnSLxN1OlW3rvLy0abB6A-1; Tue, 17 Nov 2020 07:56:32 -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 779888030C8; Tue, 17 Nov 2020 12:56:26 +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 4A3845C1D7; Tue, 17 Nov 2020 12:56:26 +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 D5DCF5813E; Tue, 17 Nov 2020 12:56:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AHCuKgL004684 for ; Tue, 17 Nov 2020 07:56:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id E72F75C1D7; Tue, 17 Nov 2020 12:56:20 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-10.ams2.redhat.com [10.36.115.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E9445C1CF; Tue, 17 Nov 2020 12:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605617795; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=xXPEfz8haGq163NwmbyKxxmwTZ1GPxdTv7rubnP96Bg=; b=Bm7/nLQfIBNCupoOU/TKhOHR1RKCueooBOygdp7BOD6U4HjbOM/bBy2nIeeUz3fj083j5I ciNDlq9/JRbmFPp1eASV8ku4u5L2q7RUCwAMTdy63o4DnkEmMQbSDkjMupe2sILlPJ7AID Q5awuVWUZKo4UtZcEWPuhtIfCo02C/Y= X-MC-Unique: OPnSLxN1OlW3rvLy0abB6A-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 2/4] nodedev: dont rely on ignoring errors on missing properties Date: Tue, 17 Nov 2020 12:56:06 +0000 Message-Id: <20201117125608.177278-3-berrange@redhat.com> In-Reply-To: <20201117125608.177278-1-berrange@redhat.com> References: <20201117125608.177278-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The udevProcessStorage method relies on udevGetIntProperty ignoring errors about non-existant properties and instead setting the value to zero. In theory when seeing ID_CDROM=3D1, you might expect that devices which are not CDs will get ID_CDROM=3D0, but that's not what happens in practice. Instead the property simply won't get set at all. IOW, the code does not need to care about the value of the property, merely whether it exists or not. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Laine Stump --- src/node_device/node_device_udev.c | 35 ++++++------------------------ 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index b1b1886c54..e48e62dab8 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -962,37 +962,16 @@ udevProcessStorage(struct udev_device *device, =20 if (!storage->drive_type || STREQ(def->caps->data.storage.drive_type, "generic")) { - int val =3D 0; - const char *str =3D NULL; - /* All floppy drives have the ID_DRIVE_FLOPPY prop. This is * needed since legacy floppies don't have a drive_type */ - if (udevGetIntProperty(device, "ID_DRIVE_FLOPPY", &val, 0) < 0) + if (udevHasDeviceProperty(device, "ID_DRIVE_FLOPPY")) + storage->drive_type =3D g_strdup("floppy"); + else if (udevHasDeviceProperty(device, "ID_CDROM")) + storage->drive_type =3D g_strdup("cd"); + else if (udevHasDeviceProperty(device, "ID_DRIVE_FLASH_SD")) + storage->drive_type =3D g_strdup("sd"); + else if (udevKludgeStorageType(def) !=3D 0) goto cleanup; - else if (val =3D=3D 1) - str =3D "floppy"; - - if (!str) { - if (udevGetIntProperty(device, "ID_CDROM", &val, 0) < 0) - goto cleanup; - else if (val =3D=3D 1) - str =3D "cd"; - } - - if (!str) { - if (udevGetIntProperty(device, "ID_DRIVE_FLASH_SD", &val, 0) <= 0) - goto cleanup; - if (val =3D=3D 1) - str =3D "sd"; - } - - if (str) { - storage->drive_type =3D g_strdup(str); - } else { - /* If udev doesn't have it, perhaps we can guess it. */ - if (udevKludgeStorageType(def) !=3D 0) - goto cleanup; - } } =20 if (STREQ(def->caps->data.storage.drive_type, "cd")) { --=20 2.28.0 From nobody Fri Apr 19 03:45:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1605617830; cv=none; d=zohomail.com; s=zohoarc; b=eAhUCoSZJ0pqDtntAnYmCmNAgSoatodYwG3/Q4UNsfK0hzEP1Lz6YU0CvxTSX4QbG/HDB9l8fMtM0ZM/nTP2rZwAqN5wyNO473JkDW+Uth6v92XsYf50lrf2NONkXOlJw8nR3T/XgiIqY8Tp9PoQQ8EdzNWRrKAM9ieyLix1qY8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605617830; h=Content-Type:Content-Transfer-Encoding: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=9WH9hExfWz2+GU6r1eyIvXiRGA4lGDsmkyHbSERj6Go=; b=SUD/aOic1KG7sifYuv38tMkjcTfjBg6YOboTubdO1Hfm2O/X+jikdUDBjno+EnC5BJNQ2dVMXv7IohcAXDvocW5wSTwwhhE5wNcj0y4M/rv/jTkxrtTDe+gaAtKY6jNckXcKpgEqC6SvJiAiDfkj3J8f4noMmVEwwejl8Prfr8E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1605617830132135.31657392692694; Tue, 17 Nov 2020 04:57:10 -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-32-WMXt90gqOxaiqxeT_z6yfQ-1; Tue, 17 Nov 2020 07:57:06 -0500 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 AF75C87315B; Tue, 17 Nov 2020 12:57:00 +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 8E4E76B8E9; Tue, 17 Nov 2020 12:57:00 +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 569D058133; Tue, 17 Nov 2020 12:57:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AHCuMW9004695 for ; Tue, 17 Nov 2020 07:56:22 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2D4AC5C1D7; Tue, 17 Nov 2020 12:56:22 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-10.ams2.redhat.com [10.36.115.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4DD9A5C1CF; Tue, 17 Nov 2020 12:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605617828; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=9WH9hExfWz2+GU6r1eyIvXiRGA4lGDsmkyHbSERj6Go=; b=HyIOJ0Wvj6j3MgUvGmqpGCjrLggkBL5jzcrZyEhlA+PwEP5IVeJ2P0gUG3N5bS6MbwCJux laaBB0Tzdk7eVTrBc+0plcP7jKauXt0Iens9xlR8T9BvhSKqZ6K+GfrWD4CNvA+5mnIOAh qvhAOYrym1x0sDRG/2WKy0hW3TWtucM= X-MC-Unique: WMXt90gqOxaiqxeT_z6yfQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 3/4] nodedev: drop DKD_MEDIA_AVAILABLE property check Date: Tue, 17 Nov 2020 12:56:07 +0000 Message-Id: <20201117125608.177278-4-berrange@redhat.com> In-Reply-To: <20201117125608.177278-1-berrange@redhat.com> References: <20201117125608.177278-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.13 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The access of DKD_MEDIA_AVAILABLE for floppy disks, is mistakenly protected by a check for ID_CDROM_MEDIA, introduced in: commit 10427db77983edfaafec74ec13cc5015bab6aa95 Author: J=C3=A1n Tomko Date: Fri Jun 3 16:10:21 2016 +0200 Only return two values in udevGetUintProperty Thus the check of DKD_MEDIA_AVAILABLE never run. In practice this didn't matter since this property is set by the DeviceKit-Disks daemon which was only around for 3 Fedora releases before being killed off around F13. Thus we can just remove this legacy property. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Laine Stump --- src/node_device/node_device_udev.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index e48e62dab8..a25babcf0d 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -837,11 +837,7 @@ udevProcessFloppy(struct udev_device *device, { int has_media =3D 0; =20 - if (udevHasDeviceProperty(device, "ID_CDROM_MEDIA")) { - /* USB floppy */ - if (udevGetIntProperty(device, "DKD_MEDIA_AVAILABLE", &has_media, = 0) < 0) - return -1; - } else if (udevHasDeviceProperty(device, "ID_FS_LABEL")) { + if (udevHasDeviceProperty(device, "ID_FS_LABEL")) { /* Legacy floppy */ has_media =3D 1; } --=20 2.28.0 From nobody Fri Apr 19 03:45:48 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=1605617833; cv=none; d=zohomail.com; s=zohoarc; b=JJ8ChkYpUlBW7ctQETepT1XEo04i1/xOyrG1I+fCFX08CmadPTdVO5I483HJ3jVeZKa8YERP8JCetrIwVP4iLc9TKnjX06AjePpX1xUAu5pw68PQUn962I87vs5d3J2VOnM3bxNQnt5LJz+O0q5pvpayaVeI2MZQChcrPhk+pMg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605617833; h=Content-Type:Content-Transfer-Encoding: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=B9EZJWpUu7RtahNzWaYLThF0zbKwGkhPhyZhLifxW4k=; b=YeNQZ0W0YIdAx51bcChTDADk5cl6bKGot5Zc9eyb9m7xACoOvVbn8/YuspwJ/sCX6rPKBEMNiiDgm6IjlnIPNCgoJlEnCHtx3+No0F5+dqOxXmfFsxULTVeMjfNFkgCeVLQF76euhPXDQ0JH0JFVOUkg5iiBqNEtpUrvsUPdWSQ= 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 1605617833186625.0735223130696; Tue, 17 Nov 2020 04:57:13 -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-45-6yeIdbUhPm-wEVaAWQyhbg-1; Tue, 17 Nov 2020 07:57:09 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 74CA3879520; Tue, 17 Nov 2020 12:57:03 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 513C95B4B6; Tue, 17 Nov 2020 12:57:03 +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 1FADD180B657; Tue, 17 Nov 2020 12:57:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0AHCuTBo004721 for ; Tue, 17 Nov 2020 07:56:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 42E4F5C1D7; Tue, 17 Nov 2020 12:56:29 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-115-10.ams2.redhat.com [10.36.115.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E7E05C1D0; Tue, 17 Nov 2020 12:56:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605617832; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=B9EZJWpUu7RtahNzWaYLThF0zbKwGkhPhyZhLifxW4k=; b=Vz+WrIs4RxNaX9y+/hboDiFFrOA5j434D2+e9yJLYvhcL/D4CFatt+zHpsznSrKus+ofhM LIQxNnbFGDTdpQzkVzV1Ve4kbzv3g9eKSh/0zxTsnB3RHKMGubipomKRo4PfnpBsRWik4s 7AKehjHAOLVUWZQtOlG1JOpvHnS1CC4= X-MC-Unique: 6yeIdbUhPm-wEVaAWQyhbg-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 4/4] nodedev: report errors about missing integer properties Date: Tue, 17 Nov 2020 12:56:08 +0000 Message-Id: <20201117125608.177278-5-berrange@redhat.com> In-Reply-To: <20201117125608.177278-1-berrange@redhat.com> References: <20201117125608.177278-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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.11 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) The helper methods for getting integer properties ignore a missing property setting its value to zero. This lack of error reporting resulted in missing the regression handling hotplug of USB devices with the vendor and model IDs getting set to zero silently. The few callers which relied on this silent defaulting have been fixed, so now we can report fatal errors immediately. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Laine Stump --- src/node_device/node_device_udev.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index a25babcf0d..86b0ece5c0 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -169,10 +169,17 @@ udevGetIntProperty(struct udev_device *udev_device, const char *str =3D NULL; =20 str =3D udevGetDeviceProperty(udev_device, property_key); + if (!str) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing udev property '%s' on '%s'"), + property_key, udev_device_get_sysname(udev_device)); + return -1; + } =20 - if (str && virStrToLong_i(str, NULL, base, value) < 0) { + if (virStrToLong_i(str, NULL, base, value) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to convert '%s' to int"), str); + _("Failed to parse int '%s' from udev property '%s'= on '%s'"), + str, property_key, udev_device_get_sysname(udev_dev= ice)); return -1; } return 0; @@ -188,10 +195,17 @@ udevGetUintProperty(struct udev_device *udev_device, const char *str =3D NULL; =20 str =3D udevGetDeviceProperty(udev_device, property_key); + if (!str) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Missing udev property '%s' on '%s'"), + property_key, udev_device_get_sysname(udev_device)); + return -1; + } =20 - if (str && virStrToLong_ui(str, NULL, base, value) < 0) { + if (virStrToLong_ui(str, NULL, base, value) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to convert '%s' to int"), str); + _("Failed to parse uint '%s' from udev property '%s= ' on '%s'"), + str, property_key, udev_device_get_sysname(udev_dev= ice)); return -1; } return 0; --=20 2.28.0