From nobody Mon Feb 9 19:52:22 2026 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=1620919960; cv=none; d=zohomail.com; s=zohoarc; b=n56QWyLGUg4LPNFL90GreOR2YOMMmXK+H4hhkpEn12r+FchCH4O3gJKJyuOrFd0Y/BgY0jGLVKXbSCfxCMj0/g4YvbDWGog5biY7Tbn/dyx/Tb1ANEzqsA46J/Ls3I2jgwNUH6Ga/bf5LG1k/dkb2klksm/KXubnbHRHt4OQY8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620919960; 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=/9UsthooWqXf/puA4s0ctRkUKkrGJtcOmN0F5J3R0GE=; b=b5yRR/YC+Pw0wzKlgq0rMNPsL9tPyh2k+mxIFAKESvqjbXbgQwlFA8w5C1J1GHrpqTwr+Cn7vsj79wXbVPHYoK5jyjXei0AmIrWLzpjBO3hrZncickxwy5WKFKdW9HjXI2G8M3BY5yhzOdoZGxsyQuZAOGyOwJVRC1v9Y5O2vGY= 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 1620919960513242.86356001718718; Thu, 13 May 2021 08:32:40 -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-411-fCYiKbGcMTCP4QSDKAsShA-1; Thu, 13 May 2021 11:32:36 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D93C1801817; Thu, 13 May 2021 15:32:29 +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 B14971002F12; Thu, 13 May 2021 15:32:29 +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 764AA180B463; Thu, 13 May 2021 15:32:29 +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 14DFWFT2026208 for ; Thu, 13 May 2021 11:32:15 -0400 Received: by smtp.corp.redhat.com (Postfix) id 27D49189A5; Thu, 13 May 2021 15:32:15 +0000 (UTC) Received: from work.redhat.com (ovpn-112-97.ams2.redhat.com [10.36.112.97]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6DDA039A66; Thu, 13 May 2021 15:32:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620919959; 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=/9UsthooWqXf/puA4s0ctRkUKkrGJtcOmN0F5J3R0GE=; b=LiWUotZaIyVW82MJO22D3okSNtWUBZutbmkTiTNSsHt1ycB7hdHp+g4LQfLdYIeMwb7Omo D9IH3B96xdvJlmjLaE+eaTeqRB0htrR1EJogl1LmM4CuWt03lSC1z8Hl1K9DC4QTna1Lhf z0rTaXbmcUiIY44SxaRs5B2pUUchBnw= X-MC-Unique: fCYiKbGcMTCP4QSDKAsShA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 4/6] virDomainNumaDefNodeDistanceParseXML: Use virXMLProp* Date: Thu, 13 May 2021 17:31:59 +0200 Message-Id: <20210513153201.20407-5-twiederh@redhat.com> In-Reply-To: <20210513153201.20407-1-twiederh@redhat.com> References: <20210513153201.20407-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.84 on 10.5.11.22 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" Signed-off-by: Tim Wiederhake --- src/conf/numa_conf.c | 42 ++++-------------------------------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index 15bfda3aa1..60cd7767ef 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -742,7 +742,6 @@ virDomainNumaDefNodeDistanceParseXML(virDomainNuma *def, { int ret =3D -1; int sibling; - char *tmp =3D NULL; xmlNodePtr *nodes =3D NULL; size_t i, ndistances =3D def->nmem_nodes; =20 @@ -764,24 +763,9 @@ virDomainNumaDefNodeDistanceParseXML(virDomainNuma *de= f, virDomainNumaDistance *rdist; unsigned int sibling_id, sibling_value; =20 - /* siblings are in order of parsing or explicitly numbered */ - if (!(tmp =3D virXMLPropString(nodes[i], "id"))) { - virReportError(VIR_ERR_XML_ERROR, - _("Missing 'id' attribute in NUMA " - "distances under 'cell id %d'"), - cur_cell); - goto cleanup; - } - - /* The "id" needs to be applicable */ - if (virStrToLong_uip(tmp, NULL, 10, &sibling_id) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid 'id' attribute in NUMA " - "distances for sibling: '%s'"), - tmp); + if (virXMLPropUInt(nodes[i], "id", 10, VIR_XML_PROP_REQUIRED, + &sibling_id) < 0) goto cleanup; - } - VIR_FREE(tmp); =20 /* The "id" needs to be within numa/cell range */ if (sibling_id >=3D ndistances) { @@ -792,26 +776,9 @@ virDomainNumaDefNodeDistanceParseXML(virDomainNuma *de= f, goto cleanup; } =20 - /* We need a locality value. Check and correct - * distance to local and distance to remote node. - */ - if (!(tmp =3D virXMLPropString(nodes[i], "value"))) { - virReportError(VIR_ERR_XML_ERROR, - _("Missing 'value' attribute in NUMA distances " - "under 'cell id %d' for 'sibling id %d'"), - cur_cell, sibling_id); - goto cleanup; - } - - /* The "value" needs to be applicable */ - if (virStrToLong_uip(tmp, NULL, 10, &sibling_value) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("'value %s' is invalid for " - "'sibling id %d' under NUMA 'cell id %d'"), - tmp, sibling_id, cur_cell); + if (virXMLPropUInt(nodes[i], "value", 10, VIR_XML_PROP_REQUIRED, + &sibling_value) < 0) goto cleanup; - } - VIR_FREE(tmp); =20 /* Assure LOCAL_DISTANCE <=3D "value" <=3D UNREACHABLE * and correct LOCAL_DISTANCE setting if such applies. @@ -866,7 +833,6 @@ virDomainNumaDefNodeDistanceParseXML(virDomainNuma *def, def->mem_nodes[i].ndistances =3D 0; } VIR_FREE(nodes); - VIR_FREE(tmp); =20 return ret; } --=20 2.26.3