From nobody Fri Oct 18 06:14:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 171880018964246.83011142870123; Wed, 19 Jun 2024 05:29:49 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 624F786C; Wed, 19 Jun 2024 08:29:48 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 2C489CA1; Wed, 19 Jun 2024 08:29:27 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E207DC7A; Wed, 19 Jun 2024 08:29:23 -0400 (EDT) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5ED43BD0 for ; Wed, 19 Jun 2024 08:29:23 -0400 (EDT) Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45JBPWQs003419 for ; Wed, 19 Jun 2024 12:29:22 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yuwsb0a3n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 19 Jun 2024 12:29:22 +0000 (GMT) Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45JCTHn1002075 for ; Wed, 19 Jun 2024 12:29:22 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yuwsb0a3j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 12:29:22 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45JBHaDs006226; Wed, 19 Jun 2024 12:29:21 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ysn9uvk6w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 12:29:21 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45JCTHdE53346618 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2024 12:29:19 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AF5052004B; Wed, 19 Jun 2024 12:29:17 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 930F12006A; Wed, 19 Jun 2024 12:29:17 +0000 (GMT) Received: from fiuczyvm.. (unknown [9.152.222.239]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 19 Jun 2024 12:29:17 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=pp1; bh=RtquyTm9kUQB4 SedBONznwL+q2nTPYd3Zkv2MF6MYSo=; b=o//MtjNuOvjFdAWVQyWcsBR8ULUbf Qm5U1y4m1VBmsQaRdPJ2O8bpLDmBH2SapK8bzp3+Og5681xcGb3OGNiy9nCyTA2q MTTcbV7eRNoLnSQVbUSzkR+GWB2dy7r6jQ15Y+SlVJ7xK8KepiqFQu1oFfIpbsTG uSDoX4cws4bKGTf01uzfjrugGUTpcU5CNHlHZyea0ocb61qMjqN6DRp3Xj6iAn0K rxTzTNttMNmceoUsf0hnjjl6BNHBHXuS6zR/OuinlV+in5eBxuJgIa9Mhcv7gMPe DLm8pqL2helqdD7e6kAvvHNUW4IF3zlbgTBhED3CFmC+1zVDUboLs3xBg== From: Boris Fiuczynski To: devel@lists.libvirt.org Subject: [PATCH 1/4] nodedev: refactor storage type fixup Date: Wed, 19 Jun 2024 14:29:14 +0200 Message-ID: <20240619122917.45827-2-fiuczy@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240619122917.45827-1-fiuczy@linux.ibm.com> References: <20240619122917.45827-1-fiuczy@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: pi9qEutjiQJmc1EXGxRvGY13_AsQNGWk X-Proofpoint-GUID: TiDR_ytbVOPQYt3FmA1PBX909TCGB_e- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-19_02,2024-06-19_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 bulkscore=0 spamscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=969 adultscore=0 mlxscore=0 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406190092 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: EFG77RPNSC6DOKFYWVJCUAUY62LBXFWE X-Message-ID-Hash: EFG77RPNSC6DOKFYWVJCUAUY62LBXFWE X-MailFrom: fiuczy@linux.ibm.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: jjongsma@redhat.com, mhartmay@linux.ibm.com, mprivozn@redhat.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1718800191717100001 Content-Type: text/plain; charset="utf-8" Refactor the storage type fixup into a reusable method. Reviewed-by: Marc Hartmayer Signed-off-by: Boris Fiuczynski Reviewed-by: Michal Privoznik --- src/node_device/node_device_udev.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 3b85db00da..15e31d522a 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -962,6 +962,21 @@ udevProcessDASD(struct udev_device *device, } =20 =20 +static int +udevFixupStorageType(virNodeDeviceDef *def, const char *prefix, const char= *subst) +{ + if (STRPREFIX(def->caps->data.storage.block, prefix)) { + def->caps->data.storage.drive_type =3D g_strdup(subst); + VIR_DEBUG("Found storage type '%s' for device with sysfs path '%s'= ", + def->caps->data.storage.drive_type, + def->sysfs_path); + return 1; + } + + return 0; +} + + /* This function exists to deal with the case in which a driver does * not provide a device type in the usual place, but udev told us it's * a storage device, and we can make a good guess at what kind of @@ -994,13 +1009,8 @@ udevKludgeStorageType(virNodeDeviceDef *def) def->sysfs_path); =20 for (i =3D 0; i < G_N_ELEMENTS(fixups); i++) { - if (STRPREFIX(def->caps->data.storage.block, fixups[i].prefix)) { - def->caps->data.storage.drive_type =3D g_strdup(fixups[i].subs= t); - VIR_DEBUG("Found storage type '%s' for device with sysfs path = '%s'", - def->caps->data.storage.drive_type, - def->sysfs_path); + if (udevFixupStorageType(def, fixups[i].prefix, fixups[i].subst)) return 0; - } } =20 VIR_DEBUG("Could not determine storage type " --=20 2.45.0 From nobody Fri Oct 18 06:14:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1718800272228148.2814841119433; Wed, 19 Jun 2024 05:31:12 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 19321B24; Wed, 19 Jun 2024 08:31:11 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id C936081F; Wed, 19 Jun 2024 08:29:35 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 793BCBD0; Wed, 19 Jun 2024 08:29:26 -0400 (EDT) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id CB2A9AE1 for ; Wed, 19 Jun 2024 08:29:25 -0400 (EDT) Received: from pps.filterd (m0353726.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45JBudmg008833 for ; Wed, 19 Jun 2024 12:29:25 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yuv9p8g7k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 19 Jun 2024 12:29:24 +0000 (GMT) Received: from m0353726.ppops.net (m0353726.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45JCTOYS026130 for ; Wed, 19 Jun 2024 12:29:24 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yuv9p8g7h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 12:29:24 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45JB8seg009478; Wed, 19 Jun 2024 12:29:23 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ysqgmuyar-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 12:29:23 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45JCTJIL44368296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2024 12:29:21 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D18302004E; Wed, 19 Jun 2024 12:29:17 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B683820063; Wed, 19 Jun 2024 12:29:17 +0000 (GMT) Received: from fiuczyvm.. (unknown [9.152.222.239]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 19 Jun 2024 12:29:17 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:mime-version; s=pp1; bh=o87+zMnhz5yze RKbTiY9OCYTv0MuNvNUzhdDlzMYaR4=; b=mR3S3FcZIX9FpVq0JidWhD0eRKQQa y2KCzpzmNFMEOhLAdQL5Dai1Lg7ixG5CZ4aOGUPi3R5V30P8Ssxofcy0V0fewWiu KgIo9B6lRKwKozH/I/3Lkb/SZI5HNw62svy1yN2Iu9grBO+axz2wSov/Qs32Z8f6 Cp/+X2YPtGzuMMYVPk3/3uyeN7M3qLyWVkClRJPtWyZ7/Vwpigjpll1s91UqU2Be F7VIrMxU7YZy575IGZ45gEuqjDFwePjUykRfkQpseafleer/b2xCQYQlwpFwwAkr ctWp0hsbV1GYLld5eWKQoUQBWL0VTSRRBu3Ffh1/qBP47GMqKiomSWlJg== From: Boris Fiuczynski To: devel@lists.libvirt.org Subject: [PATCH 2/4] nodedev: improve DASD detection Date: Wed, 19 Jun 2024 14:29:15 +0200 Message-ID: <20240619122917.45827-3-fiuczy@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240619122917.45827-1-fiuczy@linux.ibm.com> References: <20240619122917.45827-1-fiuczy@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 1nXBSeLKhSwt7nKXHVP7NHFWYZRaytdy X-Proofpoint-ORIG-GUID: z6dfqvdgbrbdfPxInhsbTQCHhs_g9DdR X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-19_02,2024-06-19_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxscore=0 phishscore=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 clxscore=1015 priorityscore=1501 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406190092 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: GEQ2A4DSVPSSMS3NA7NQCHCBJABILMEY X-Message-ID-Hash: GEQ2A4DSVPSSMS3NA7NQCHCBJABILMEY X-MailFrom: fiuczy@linux.ibm.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: jjongsma@redhat.com, mhartmay@linux.ibm.com, mprivozn@redhat.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1718800274207100001 Content-Type: text/plain; charset="utf-8" In newer DASD driver versions the ID_TYPE tag is supported. This tag is missing after a system reboot but when the ccw device is set offline and online the tag is included. To fix this version independently we need to check if devices detected as type disk is actually a DASD to maintain the node object consistency and not end up with multiple node objects for DASDs. Resolves: https://issues.redhat.com/browse/RHEL-39497 Reviewed-by: Marc Hartmayer Signed-off-by: Boris Fiuczynski Reviewed-by: Michal Privoznik --- src/node_device/node_device_udev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index 15e31d522a..c0e258fe9c 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1065,6 +1065,10 @@ udevProcessStorage(struct udev_device *device, storage->drive_type =3D g_strdup("sd"); else if (udevKludgeStorageType(def) !=3D 0) goto cleanup; + } else { + /* A detected disk might be a DASD */ + if (STREQ(def->caps->data.storage.drive_type, "disk")) + udevFixupStorageType(def, "/dev/dasd", "dasd"); } =20 if (STREQ(def->caps->data.storage.drive_type, "cd") || --=20 2.45.0 From nobody Fri Oct 18 06:14:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1718800254955223.05625703877206; Wed, 19 Jun 2024 05:30:54 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E136E121E; Wed, 19 Jun 2024 08:30:53 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id F28971253; Wed, 19 Jun 2024 08:29:32 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 808E2AE1; Wed, 19 Jun 2024 08:29:25 -0400 (EDT) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id EC46EC68 for ; Wed, 19 Jun 2024 08:29:24 -0400 (EDT) Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45JCTObk027829 for ; Wed, 19 Jun 2024 12:29:24 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yuyc4g01k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 19 Jun 2024 12:29:23 +0000 (GMT) Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45JCTNMa027819 for ; Wed, 19 Jun 2024 12:29:23 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yuyc4g01f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 12:29:23 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45JBgsjA019506; Wed, 19 Jun 2024 12:29:22 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3ysnp1cfe6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 12:29:22 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45JCTIbf16384476 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2024 12:29:20 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F3A7B20063; Wed, 19 Jun 2024 12:29:17 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D88FA2006A; Wed, 19 Jun 2024 12:29:17 +0000 (GMT) Received: from fiuczyvm.. (unknown [9.152.222.239]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 19 Jun 2024 12:29:17 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:mime-version; s=pp1; bh=aaMHmnv2UCPAe GuHq7GWCadMSyMQl0bMa9m+mQQUeuQ=; b=KB8zz7xZ4il1yWWCVu6VujO9RO9Wa jviqj51X1etDqYtvLccwuv27VYP7YH1ANtM/tKi8S6qbOTxiNtLLFaIzNOvAG/2B abZbJAQ2pck6Z1WgAA8UV2HiPNXXvys+PreOd+cryh2FDd/bj0nmWNZ4gtIb2Ay+ 1lT9tJ862OssomGsctLaqZCPfzrV52lnahU9IxqwLfiSSljS1pp21tLlaPq/1JpB 8FB4cKT0y9EfZIZ7e0oLeR9Od1HLiyPv5oZwdlJYgxQ5JirdyV10A8RuefwziSXx cS6FZ/Pp9rqqGRvkqbHsskq4v3bHBKyT1inmxsDmicVxChlr9MESngxyQ== From: Boris Fiuczynski To: devel@lists.libvirt.org Subject: [PATCH 3/4] nodedev: prevent invalid DASD node object creation Date: Wed, 19 Jun 2024 14:29:16 +0200 Message-ID: <20240619122917.45827-4-fiuczy@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240619122917.45827-1-fiuczy@linux.ibm.com> References: <20240619122917.45827-1-fiuczy@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 0Pduen5DcJnMSQLWBO-mwGwJuIC4QA7h X-Proofpoint-ORIG-GUID: rjidEsRtbxJ5nfjzSFmZIMCLJaliJMuP X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-19_02,2024-06-19_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 mlxlogscore=925 mlxscore=0 phishscore=0 adultscore=0 malwarescore=0 spamscore=0 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406190092 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: CHK225NOYD7LCM77QGMB7CXT7VUBGZBA X-Message-ID-Hash: CHK225NOYD7LCM77QGMB7CXT7VUBGZBA X-MailFrom: fiuczy@linux.ibm.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: jjongsma@redhat.com, mhartmay@linux.ibm.com, mprivozn@redhat.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1718800255970100001 Content-Type: text/plain; charset="utf-8" Prevent the creation of a new DASD node object when the device does not exist. Resolves: https://issues.redhat.com/browse/RHEL-39497 Reviewed-by: Marc Hartmayer Signed-off-by: Boris Fiuczynski Reviewed-by: Michal Privoznik --- src/node_device/node_device_udev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index c0e258fe9c..ad994ef0b2 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -958,6 +958,9 @@ udevProcessDASD(struct udev_device *device, =20 udevGetStringSysfsAttr(device, "device/uid", &storage->serial); =20 + if (!storage->serial) + return -1; + return udevProcessDisk(device, def); } =20 --=20 2.45.0 From nobody Fri Oct 18 06:14:58 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1718800214674907.3598408761356; Wed, 19 Jun 2024 05:30:14 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9CAE29E4; Wed, 19 Jun 2024 08:30:13 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 18D0911B5; Wed, 19 Jun 2024 08:29:29 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 3E094AE1; Wed, 19 Jun 2024 08:29:24 -0400 (EDT) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id A9C1EC68 for ; Wed, 19 Jun 2024 08:29:23 -0400 (EDT) Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45J9QrJE006689 for ; Wed, 19 Jun 2024 12:29:23 GMT Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yuvf20edr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 19 Jun 2024 12:29:23 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45JCPsF7012887 for ; Wed, 19 Jun 2024 12:29:22 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yuvf20edn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 12:29:22 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45JB9BjT013488; Wed, 19 Jun 2024 12:29:21 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ysr03uxby-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Jun 2024 12:29:21 +0000 Received: from smtpav01.fra02v.mail.ibm.com (smtpav01.fra02v.mail.ibm.com [10.20.54.100]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45JCTIU819464626 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Jun 2024 12:29:20 GMT Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 236DC2006A; Wed, 19 Jun 2024 12:29:18 +0000 (GMT) Received: from smtpav01.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 07B0B20071; Wed, 19 Jun 2024 12:29:18 +0000 (GMT) Received: from fiuczyvm.. (unknown [9.152.222.239]) by smtpav01.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 19 Jun 2024 12:29:17 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:mime-version; s=pp1; bh=rixi0BPceqbZ2 N+ClUv2ZqditljV3rpae/0jclTatQo=; b=ANNAXUKm8jetbJpZOlyqgRq0ZMJnV x1cfW6wjSKlnpz41sVVyiffSTQf0+Q4xZuie5/e/mrSHSWRx4Dojj//kAuYRD6Id aUpj+1rT+cQ6OGQ09QlOWNFwfKppUnRTUaZDwlLWeeREDBzDGKhA+NY4ijugSNOW sfFJWNuFL0XW5SenxTyPFCFB6Bk04xCvNyXUFza3HLyrDFEaP0u5vZOWk2Hpk/aC fwKFq7IR9kISs6a8ckQBrLtvGiVr48+/53JxVFxE6w0F9afcCZs7mzC6/PWqF8xu eaO8n5sCIPsL1YForKDmVDQbkJ7qYn2M0Wmvl5evX/nGiRX9xsmbmoADQ== From: Boris Fiuczynski To: devel@lists.libvirt.org Subject: [PATCH 4/4] nodedev: add ccw device state and remove fencing Date: Wed, 19 Jun 2024 14:29:17 +0200 Message-ID: <20240619122917.45827-5-fiuczy@linux.ibm.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240619122917.45827-1-fiuczy@linux.ibm.com> References: <20240619122917.45827-1-fiuczy@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: hKgNEdptRZkDcSq_-D8piBWA42clQ9PJ X-Proofpoint-GUID: vuVea2yw6HPP5D_uI8paV52TSGQls-NM X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-19_02,2024-06-19_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 priorityscore=1501 mlxscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 spamscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406190092 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: BEDM43PU2VKQ4ODUVANX5LYRNRAOPLUH X-Message-ID-Hash: BEDM43PU2VKQ4ODUVANX5LYRNRAOPLUH X-MailFrom: fiuczy@linux.ibm.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: jjongsma@redhat.com, mhartmay@linux.ibm.com, mprivozn@redhat.com X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1718800215865100001 Content-Type: text/plain; charset="utf-8" Instead of fencing offline ccw devices add the state to the ccw capability. Resolves: https://issues.redhat.com/browse/RHEL-39497 Signed-off-by: Boris Fiuczynski Reviewed-by: Michal Privoznik --- src/conf/node_device_conf.c | 24 ++++++++++++++++++++++++ src/conf/node_device_conf.h | 11 +++++++++++ src/conf/schemas/nodedev.rng | 8 ++++++++ src/node_device/node_device_udev.c | 27 ++++++++++++++++++++++++--- 4 files changed, 67 insertions(+), 3 deletions(-) diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 416238bec1..08a89942ba 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -86,6 +86,12 @@ VIR_ENUM_IMPL(virNodeDevDRM, "render", ); =20 +VIR_ENUM_IMPL(virNodeDevCCWState, + VIR_NODE_DEV_CCW_STATE_LAST, + "offline", + "online", +); + static int virNodeDevCapsDefParseString(const char *xpath, xmlXPathContextPtr ctxt, @@ -743,6 +749,10 @@ virNodeDeviceDefFormat(const virNodeDeviceDef *def, un= signed int flags) virNodeDeviceCapMdevDefFormat(&buf, data, inactive_state); break; case VIR_NODE_DEV_CAP_CCW_DEV: + if (data->ccw_dev.state !=3D VIR_NODE_DEV_CCW_STATE_LAST) { + const char *state =3D virNodeDevCCWStateTypeToString(data-= >ccw_dev.state); + virBufferEscapeString(&buf, "%s\n", state); + } virNodeDeviceCapCCWDefFormat(&buf, data); break; case VIR_NODE_DEV_CAP_CSS_DEV: @@ -1189,9 +1199,23 @@ virNodeDevCapCCWParseXML(xmlXPathContextPtr ctxt, { VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autofree virCCWDeviceAddress *ccw_addr =3D NULL; + g_autofree char *state =3D NULL; + int val; =20 ctxt->node =3D node; =20 + /* state is optional */ + ccw_dev->state =3D VIR_NODE_DEV_CCW_STATE_LAST; + + if ((state =3D virXPathString("string(./state[1])", ctxt))) { + if ((val =3D virNodeDevCCWStateTypeFromString(state)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown state '%1$s' for '%2$s'"), state, de= f->name); + return -1; + } + ccw_dev->state =3D val; + } + ccw_addr =3D g_new0(virCCWDeviceAddress, 1); =20 if (virNodeDevCCWDeviceAddressParseXML(ctxt, node, def->name, ccw_addr= ) < 0) diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index 4b82636af7..32a8a5884b 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -112,6 +112,16 @@ typedef enum { VIR_NODE_DEV_CAP_FLAG_CSS_MDEV =3D (1 << 0), } virNodeDevCCWCapFlags; =20 +typedef enum { + /* Keep in sync with VIR_ENUM_IMPL in node_device_conf.c */ + VIR_NODE_DEV_CCW_STATE_OFFLINE =3D 0, + VIR_NODE_DEV_CCW_STATE_ONLINE, + + VIR_NODE_DEV_CCW_STATE_LAST +} virNodeDevCCWStateType; + +VIR_ENUM_DECL(virNodeDevCCWState); + typedef enum { VIR_NODE_DEV_CAP_FLAG_AP_MATRIX_MDEV =3D (1 << 0), } virNodeDevAPMatrixCapFlags; @@ -279,6 +289,7 @@ struct _virNodeDevCapCCW { virMediatedDeviceType **mdev_types; size_t nmdev_types; virCCWDeviceAddress *channel_dev_addr; + virNodeDevCCWStateType state; }; =20 typedef struct _virNodeDevCapVDPA virNodeDevCapVDPA; diff --git a/src/conf/schemas/nodedev.rng b/src/conf/schemas/nodedev.rng index ff07313968..42a0cdcfd9 100644 --- a/src/conf/schemas/nodedev.rng +++ b/src/conf/schemas/nodedev.rng @@ -673,6 +673,14 @@ ccw + + + + online + offline + + + =20 diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_devi= ce_udev.c index ad994ef0b2..9d11261b88 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1199,13 +1199,34 @@ udevGetCCWAddress(const char *sysfs_path, =20 =20 static int -udevProcessCCW(struct udev_device *device, - virNodeDeviceDef *def) +udevCCWGetState(struct udev_device *device, + virNodeDevCapData *data) { int online =3D 0; =20 + if (udevGetIntSysfsAttr(device, "online", &online, 0) < 0 || online < = 0) + return -1; + + switch (online) { + case VIR_NODE_DEV_CCW_STATE_OFFLINE: + case VIR_NODE_DEV_CCW_STATE_ONLINE: + data->ccw_dev.state =3D online; + break; + default: + data->ccw_dev.state =3D VIR_NODE_DEV_CCW_STATE_LAST; + break; + } + + return 0; +} + + +static int +udevProcessCCW(struct udev_device *device, + virNodeDeviceDef *def) +{ /* process only online devices to keep the list sane */ - if (udevGetIntSysfsAttr(device, "online", &online, 0) < 0 || online != =3D 1) + if (udevCCWGetState(device, &def->caps->data) < 0) return -1; =20 if (udevGetCCWAddress(def->sysfs_path, &def->caps->data) < 0) --=20 2.45.0