From nobody Tue Feb 10 01:19:28 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=1620919961; cv=none; d=zohomail.com; s=zohoarc; b=c0XHRvxCLxKig4BmDE6N8922a+EeKhMwXzRiCPgAhK7mdLne4rczwyz1T8JL9IKK940oyFjfgtongJBbjxpqGiebr2wt3dLEHfJ8q5LGPX+G5H6hy7N0lfUSJsnSRxDXX1KDOYBlaEfyvpC6aIOivV52IvKxb7PT6toQfnxZkfs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620919961; 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=qnYMJoDO/Wfjo4VFkE/7E7j0F/PB8U/RvY8V/Xs78hU=; b=Ih/Q6pNo/JHLXXN7LrN82t5K7/krBi8ZHCVeC1j7LutYBEhbdaE64rrPpzSGm/0KejuXneZIQuM309WaTP8+tG0PHJaIvdNTEv6s1Zgy1aHGFuQYRXVcpjUAfU/EOP/iziJv8Q67rnzCM7cE8J9fzz6INDTXWJrFhOTEhm5yJ1E= 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 1620919961709947.9162679056687; Thu, 13 May 2021 08:32:41 -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-478-_gEirSHlMR-S4Z58bhauNQ-1; Thu, 13 May 2021 11:32:37 -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 B1A23107ACF3; Thu, 13 May 2021 15:32:32 +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 94CF5687E7; Thu, 13 May 2021 15:32:32 +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 5FC9A180B463; Thu, 13 May 2021 15:32:32 +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 14DFWDbc026188 for ; Thu, 13 May 2021 11:32:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0FBF3189C4; Thu, 13 May 2021 15:32:13 +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 57E2D19C95; Thu, 13 May 2021 15:32:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620919960; 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=qnYMJoDO/Wfjo4VFkE/7E7j0F/PB8U/RvY8V/Xs78hU=; b=giGixMGKz8GJPkedcXFFK32VMKgc0w4feZ7yO9wG7thu/YR3xJCBDfHnscwrRIIJUgkyqD YjUDyKl/zTCjZP5G54Ld1RyEGCfbuHWx1Pi17+c7xGU4fZWbW3IszLJcQv4x1uRwetdQWt tJo5bTjSjZINdGlmTtjEItF9RE62q9I= X-MC-Unique: _gEirSHlMR-S4Z58bhauNQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 2/6] virDomainNumatuneNodeParseXML: Use virXMLProp* Date: Thu, 13 May 2021 17:31:57 +0200 Message-Id: <20210513153201.20407-3-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.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) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/conf/numa_conf.c | 45 +++++++++++++------------------------------- 1 file changed, 13 insertions(+), 32 deletions(-) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index 932af4a185..bae59ac7b8 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -186,25 +186,13 @@ virDomainNumatuneNodeParseXML(virDomainNuma *numa, } =20 for (i =3D 0; i < n; i++) { - int mode =3D 0; unsigned int cellid =3D 0; virDomainNumaNode *mem_node =3D NULL; xmlNodePtr cur_node =3D nodes[i]; =20 - tmp =3D virXMLPropString(cur_node, "cellid"); - if (!tmp) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing required cellid attribute " - "in memnode element")); + if (virXMLPropUInt(cur_node, "cellid", 10, VIR_XML_PROP_REQUIRED, + &cellid) < 0) goto cleanup; - } - if (virStrToLong_uip(tmp, NULL, 10, &cellid) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid cellid attribute in memnode element:= %s"), - tmp); - goto cleanup; - } - VIR_FREE(tmp); =20 if (cellid >=3D numa->nmem_nodes) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -222,25 +210,18 @@ virDomainNumatuneNodeParseXML(virDomainNuma *numa, goto cleanup; } =20 - tmp =3D virXMLPropString(cur_node, "mode"); - if (!tmp) { - mem_node->mode =3D VIR_DOMAIN_NUMATUNE_MEM_STRICT; - } else { - if ((mode =3D virDomainNumatuneMemModeTypeFromString(tmp)) < 0= ) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Invalid mode attribute in memnode elemen= t")); - goto cleanup; - } + if (virXMLPropEnumDefault(cur_node, "mode", + virDomainNumatuneMemModeTypeFromString, + VIR_XML_PROP_NONE, &mem_node->mode, + VIR_DOMAIN_NUMATUNE_MEM_STRICT) < 0) + goto cleanup; =20 - if (numa->memory.mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTI= VE && - mode !=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("'restrictive' mode is required in memnod= e element " - "when mode is 'restrictive' in memory ele= ment")); - goto cleanup; - } - VIR_FREE(tmp); - mem_node->mode =3D mode; + if (numa->memory.mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE && + mem_node->mode !=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("'restrictive' mode is required in memnode el= ement " + "when mode is 'restrictive' in memory element= ")); + goto cleanup; } =20 tmp =3D virXMLPropString(cur_node, "nodeset"); --=20 2.26.3