From nobody Mon Feb 9 22:18:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1620745597; cv=none; d=zohomail.com; s=zohoarc; b=nNZ68bhY+kX6jgjcmSyCg3nfJFUV/jsjMWWOXKmPu8BlJ840tU2PNuOWewkaZ9uV8S+9VWA39kWMvea61Tk29AaeM5ub04gcIOSh5J6EG3zIWsAMmL9j7zvzn5cDGEuqh34rbJ2fMAv2W3AV1YLyT1lQpCk+zoFMnHBAJgvlR2s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620745597; 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=MYZUjyapQjyazUQoNO6RXNzgjtOPQKCVl9yBi0zpcto=; b=LqdUKON4F3O0nWrX4Ga6PjLi7AmjoOrgaoKi/60oGftYUpgQQwzj5OuAvfC+d7/moxHP3IrZ09wrly1Pb8wiFYTrS6d5BWudQ9gjeYhPi0HGYEqcJ9JcCEp99J+8/qmJyl+LhlXciL80+0Es0X2Nb2dawggWdGftYXWGwcpXCFs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 162074559701823.288500315308966; Tue, 11 May 2021 08:06:37 -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-408-N4xqVgtsNdeTpLMJ7tG2aA-1; Tue, 11 May 2021 11:02:31 -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 BAF198186F0; Tue, 11 May 2021 15:02:23 +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 982FC50E2F; Tue, 11 May 2021 15:02:23 +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 5F73B1801263; Tue, 11 May 2021 15:02:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14BF23AA005506 for ; Tue, 11 May 2021 11:02:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 10F512B0B1; Tue, 11 May 2021 15:02:03 +0000 (UTC) Received: from work.redhat.com (ovpn-113-41.ams2.redhat.com [10.36.113.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5929D614EB; Tue, 11 May 2021 15:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620745354; 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=MYZUjyapQjyazUQoNO6RXNzgjtOPQKCVl9yBi0zpcto=; b=iYCCJW7iCyMVY5wprx6J2wW/5PHzy7mX/KE0vzCfqjjjGl1UqdvhcYWqaWWoIYI5FvtqJz 0fJU+YpKN8lmJFD9ZgFke0E8049q1yZBzQlpqhuxP2t8Dw9zZAlDTgrg29NvQ9dbhbRviL BsdYsPoYpT3N2k17cZNTizuVN3AdB+c= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620745596; 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=MYZUjyapQjyazUQoNO6RXNzgjtOPQKCVl9yBi0zpcto=; b=Q26l64G3DOcIn/Pwq3RFZJxtGbwxfvuAAfVDwHVK7CDZYFwCqwStSVCZ6158YmQDh+NcLe DuIgtMZmFeI9nmCYwW1oSJ6U+hy5d31Zm08GY2Bvm4l64epejOzsnVZ73K0h5+xsguM9N4 ZeiN7RdZPJ8J8OIlhMvSe5LssulF3K0= X-MC-Unique: N4xqVgtsNdeTpLMJ7tG2aA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 04/10] virDomainNumaDefNodeDistanceParseXML: Use virXMLProp* Date: Tue, 11 May 2021 17:01:51 +0200 Message-Id: <20210511150157.26027-5-twiederh@redhat.com> In-Reply-To: <20210511150157.26027-1-twiederh@redhat.com> References: <20210511150157.26027-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) (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 531bdc6eba..e631bfa341 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -743,7 +743,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 @@ -765,24 +764,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) { @@ -793,26 +777,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. @@ -867,7 +834,6 @@ virDomainNumaDefNodeDistanceParseXML(virDomainNuma *def, def->mem_nodes[i].ndistances =3D 0; } VIR_FREE(nodes); - VIR_FREE(tmp); =20 return ret; } --=20 2.26.3