From nobody Tue May 21 04:42:48 2024 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=1620136979; cv=none; d=zohomail.com; s=zohoarc; b=YHVBnrZNz2dec9BBCNNaUcs/AFFBdx0Y9fnkjNU3lLvTCXZ0XfyY1QHjTEbO7sJxvfxn5z6ySif2KcEbYhNZMvUt/77ULSuwIiE0QWb2/E4OtS8iZo+huHFOjT8ZI9TrAjZbAOR8jUgOo4UqOO8GFV1/NW7feaCfa2+Is0KL57c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620136979; 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=1SKSc3eFpYaYQN0b4i9nO90iwn+67p0EieBZgZAAfJQ=; b=hvWbAfuorNwVjwlbis/CMeJf/kNejEhfANLBipFVEQXsLZrsRRIK+nlyLHHd5qsaB/T4xSCCaGFbGZtI8u6TWqRWgkR7EfYDIU68VuxXTQrKON+zDC/Z0dx3XreBNRKBUfp6byJp083x/nZ38YxgQeq/dlLPavOiulkk8QIyen0= 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 162013697956213.96649423147835; Tue, 4 May 2021 07:02:59 -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-296-GWnK6nllOOWQYPQgUL8auQ-1; Tue, 04 May 2021 10:02:53 -0400 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 B9017802B7A; Tue, 4 May 2021 14:02:46 +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 914A35C238; Tue, 4 May 2021 14:02:46 +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 53E125534C; Tue, 4 May 2021 14:02:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 144E2gRl013120 for ; Tue, 4 May 2021 10:02:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 574D81895D; Tue, 4 May 2021 14:02:42 +0000 (UTC) Received: from work.redhat.com (ovpn-115-86.ams2.redhat.com [10.36.115.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E1DA60C0F; Tue, 4 May 2021 14:02:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620136976; 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=1SKSc3eFpYaYQN0b4i9nO90iwn+67p0EieBZgZAAfJQ=; b=Za2WAxSeQrvdjCcDwzfrmKgMnuTS0KSrdnqiyis2xr4d1NBkTabh24YnnWPq58pxG6ASME Kh9VI9fnePdIFpAM9Zo/x8E5DW4kypfHdMvo2dE9orZYY0DY/dIF/vrK+dY1TJJULM1Zum J2YrNDlB8H59G2vxkpUrPBTD7DegaSc= X-MC-Unique: GWnK6nllOOWQYPQgUL8auQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 01/10] virDomainRedirFilterUSBDevDefParseXML: Use g_auto* Date: Tue, 4 May 2021 16:02:26 +0200 Message-Id: <20210504140235.132300-2-twiederh@redhat.com> In-Reply-To: <20210504140235.132300-1-twiederh@redhat.com> References: <20210504140235.132300-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0050b952f3..5822f3d85a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14689,7 +14689,7 @@ virDomainRedirFilterUSBVersionHelper(const char *ve= rsion, static virDomainRedirFilterUSBDevDef * virDomainRedirFilterUSBDevDefParseXML(xmlNodePtr node) { - virDomainRedirFilterUSBDevDef *def; + g_autofree virDomainRedirFilterUSBDevDef *def =3D NULL; g_autofree char *version =3D NULL; virTristateBool allow; =20 @@ -14697,42 +14697,38 @@ virDomainRedirFilterUSBDevDefParseXML(xmlNodePtr = node) =20 def->usbClass =3D -1; if (virXMLPropInt(node, "class", 0, VIR_XML_PROP_NONE, &def->usbClass)= < 0) - goto error; + return NULL; =20 if (def->usbClass !=3D -1 && def->usbClass &~ 0xFF) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid USB Class code 0x%x"), def->usbClass); - goto error; + return NULL; } =20 def->vendor =3D -1; if (virXMLPropInt(node, "vendor", 0, VIR_XML_PROP_NONE, &def->vendor) = < 0) - goto error; + return NULL; =20 def->product =3D -1; if (virXMLPropInt(node, "product", 0, VIR_XML_PROP_NONE, &def->product= ) < 0) - goto error; + return NULL; =20 version =3D virXMLPropString(node, "version"); if (version) { if (STREQ(version, "-1")) def->version =3D -1; else if ((virDomainRedirFilterUSBVersionHelper(version, def)) < 0) - goto error; + return NULL; } else { def->version =3D -1; } =20 if (virXMLPropTristateBool(node, "allow", VIR_XML_PROP_REQUIRED, &allo= w) < 0) - goto error; + return NULL; =20 def->allow =3D allow =3D=3D VIR_TRISTATE_BOOL_YES; =20 - return def; - - error: - VIR_FREE(def); - return NULL; + return g_steal_pointer(&def); } =20 static virDomainRedirFilterDef * --=20 2.26.3 From nobody Tue May 21 04:42:48 2024 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=1620136978; cv=none; d=zohomail.com; s=zohoarc; b=AAdlBI/an6IcoywZIDgrLW8JzFHPPp3cUdDM2RxtFdX2O2SzStc/bnKdm+KPZYhcW1TgrcWHK4dC2s6IsXq1Kzn4aOwqSyfrHklMowQv4GqIAnsWpD0y335w+eb0aZCzKYi3a2J7fvK5HzMsam9lN0B5Yv3K7bNTJ6rDqnjrT84= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620136978; 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=L6jBRQc4qbQlnlKYo7BF+t5GIUV4Thoq4QZJpgOz7BI=; b=Q8C16lSeB/ZfPZg8dfq/dec9YzexHntSKkYJZRvE5n6m21yjqkgdmum0jemJbx3/DI5pgr7F8G0OIV93w2Y67bWhtY/E4P5V491IRbB+Rhc1/Iw4b1f+69BLmsrwwo+JSzqtpa653aa4hUK0x4FLw3CEQY0bO0hTCsMKF4qpRog= 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 1620136978616479.63065578319663; Tue, 4 May 2021 07:02:58 -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-482-JK_zu3MnMQ25Gaoudo_mCQ-1; Tue, 04 May 2021 10:02:52 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B5691006C8F; Tue, 4 May 2021 14:02:45 +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 28C9A60C4A; Tue, 4 May 2021 14:02:45 +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 DC63B180B464; Tue, 4 May 2021 14:02:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 144E2hjW013130 for ; Tue, 4 May 2021 10:02:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 66C2E60C0F; Tue, 4 May 2021 14:02:43 +0000 (UTC) Received: from work.redhat.com (ovpn-115-86.ams2.redhat.com [10.36.115.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACB161895D; Tue, 4 May 2021 14:02:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620136974; 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=L6jBRQc4qbQlnlKYo7BF+t5GIUV4Thoq4QZJpgOz7BI=; b=XoBRFtNrdXBWjrW6V3sxm7GAWImQwxLucwRwyuiJHW5/DHvpUom/OFWvD8Y4BXehIEpSb6 /kkf34RLVDFWNh8Utf2U0T0KbW9p/7M78BidftuihFdY6ZtA+RymB4YSCtrlAjWhkATA/I zLPb+hyF6Tuwwe+IuDvF+Y6m/kXFmyc= X-MC-Unique: JK_zu3MnMQ25Gaoudo_mCQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 02/10] virDomainPerfEventDefParseXML: Use virXMLProp* Date: Tue, 4 May 2021 16:02:27 +0200 Message-Id: <20210504140235.132300-3-twiederh@redhat.com> In-Reply-To: <20210504140235.132300-1-twiederh@redhat.com> References: <20210504140235.132300-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.12 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 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 33 +++++++++------------------------ 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5822f3d85a..8930dc33ce 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14813,39 +14813,24 @@ static int virDomainPerfEventDefParseXML(virDomainPerfDef *perf, xmlNodePtr node) { - int event; - g_autofree char *name =3D NULL; - g_autofree char *enabled =3D NULL; - - if (!(name =3D virXMLPropString(node, "name"))) { - virReportError(VIR_ERR_XML_ERROR, "%s", _("missing perf event name= ")); - return -1; - } + virPerfEventType name; + virTristateBool enabled; =20 - if ((event =3D virPerfEventTypeFromString(name)) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("'unsupported perf event '%s'"), name); + if (virXMLPropEnum(node, "name", virPerfEventTypeFromString, + VIR_XML_PROP_REQUIRED, &name) < 0) return -1; - } =20 - if (perf->events[event] !=3D VIR_TRISTATE_BOOL_ABSENT) { - virReportError(VIR_ERR_XML_ERROR, - _("perf event '%s' was already specified"), name); + if (virXMLPropTristateBool(node, "enabled", VIR_XML_PROP_REQUIRED, &en= abled) < 0) return -1; - } =20 - if (!(enabled =3D virXMLPropString(node, "enabled"))) { + if (perf->events[name] !=3D VIR_TRISTATE_BOOL_ABSENT) { virReportError(VIR_ERR_XML_ERROR, - _("missing state of perf event '%s'"), name); + _("perf event '%s' was already specified"), + virPerfEventTypeToString(name)); return -1; } =20 - if ((perf->events[event] =3D virTristateBoolTypeFromString(enabled)) <= 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid state '%s' of perf event '%s'"), - enabled, name); - return -1; - } + perf->events[name] =3D enabled; =20 return 0; } --=20 2.26.3 From nobody Tue May 21 04:42: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=1620137291; cv=none; d=zohomail.com; s=zohoarc; b=VWUqKZbIqnMMlLmnTmZRc4iUU9K006a1dHiOvNr6UqoKsfiIC2SH7sG7z8tP56dT7HTrLwlybOy6jjwJWV/IJMiXvlBCqqFrOFPZltb720ThkYE//pS0hRzP/3z3U0pdCe12f2Qwh4EyED0Q+7TNYTcNS/Js64WTd+cZTEo2AZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620137291; 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=Q+V44DQ5HBq2iFrQJ1M7k7p9wKWHtZoQTS23MTJNQeM=; b=TzgJ9jRHKrImvmHsVRHxxMpTsfUsVsc9JXL8qNuJkr9ogpUGLyjCzqz8c0m1HTs6c8MqpLaoYhZo1UNOinNdA7rOXmWFNFp/cq19to0AspyIDQtNLRer5oVI92r9iFaGYuZ5054CWJanL1jAQIzRxoeTXnesqok3LMVKYWQMGHg= 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 SMTP id 1620137291719447.2585163185481; Tue, 4 May 2021 07:08:11 -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-133-QFppy3GzPeSFyUGhN0pgQg-1; Tue, 04 May 2021 10:03:02 -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 E3C748042BD; Tue, 4 May 2021 14:02:49 +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 B7C2D1001901; Tue, 4 May 2021 14:02:49 +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 77B0155350; Tue, 4 May 2021 14:02:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 144E2iSB013135 for ; Tue, 4 May 2021 10:02:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4D34F190E8; Tue, 4 May 2021 14:02:44 +0000 (UTC) Received: from work.redhat.com (ovpn-115-86.ams2.redhat.com [10.36.115.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA27160C0F; Tue, 4 May 2021 14:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620136986; 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=Q+V44DQ5HBq2iFrQJ1M7k7p9wKWHtZoQTS23MTJNQeM=; b=GnqB4L1OA7yRwSBLV/8cmj1ei6iflwt+GhlTx5EkwgHqRH057x+/uopP0bCaEzHsFxfx2R 48IxGps+oNIxPpJbmRMzE4oG9UjwdHpcR/WIesTPNkyUwlwtx1rUh7/Fxuq5wVeq9j/bkV E0oTIpS75KmKI/5OOC0TegNP7pXnNfk= X-MC-Unique: QFppy3GzPeSFyUGhN0pgQg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 03/10] virDomainMemoryDefParseXML: Use virXMLProp* Date: Tue, 4 May 2021 16:02:28 +0200 Message-Id: <20210504140235.132300-4-twiederh@redhat.com> In-Reply-To: <20210504140235.132300-1-twiederh@redhat.com> References: <20210504140235.132300-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8930dc33ce..b8ac399f5c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15040,48 +15040,24 @@ virDomainMemoryDefParseXML(virDomainXMLOption *xm= lopt, VIR_XPATH_NODE_AUTORESTORE(ctxt) xmlNodePtr node; virDomainMemoryDef *def; - int val; g_autofree char *tmp =3D NULL; =20 def =3D g_new0(virDomainMemoryDef, 1); =20 ctxt->node =3D memdevNode; =20 - if (!(tmp =3D virXMLPropString(memdevNode, "model"))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("missing memory model")); + if (virXMLPropEnum(memdevNode, "model", virDomainMemoryModelTypeFromSt= ring, + VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO, + &def->model) < 0) goto error; - } =20 - if ((val =3D virDomainMemoryModelTypeFromString(tmp)) <=3D 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid memory model '%s'"), tmp); + if (virXMLPropEnum(memdevNode, "access", virDomainMemoryAccessTypeFrom= String, + VIR_XML_PROP_NONZERO, &def->access) < 0) goto error; - } - VIR_FREE(tmp); - def->model =3D val; - - if ((tmp =3D virXMLPropString(memdevNode, "access"))) { - if ((val =3D virDomainMemoryAccessTypeFromString(tmp)) <=3D 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid access mode '%s'"), tmp); - goto error; - } =20 - def->access =3D val; - } - VIR_FREE(tmp); - - if ((tmp =3D virXMLPropString(memdevNode, "discard"))) { - if ((val =3D virTristateBoolTypeFromString(tmp)) <=3D 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid discard value '%s'"), tmp); - goto error; - } - - def->discard =3D val; - } - VIR_FREE(tmp); + if (virXMLPropTristateBool(memdevNode, "discard", VIR_XML_PROP_NONE, + &def->discard) < 0) + goto error; =20 /* Extract NVDIMM UUID. */ if (def->model =3D=3D VIR_DOMAIN_MEMORY_MODEL_NVDIMM && @@ -15094,7 +15070,6 @@ virDomainMemoryDefParseXML(virDomainXMLOption *xmlo= pt, goto error; } } - VIR_FREE(tmp); =20 /* source */ if ((node =3D virXPathNode("./source", ctxt)) && --=20 2.26.3 From nobody Tue May 21 04:42:48 2024 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=1620136989; cv=none; d=zohomail.com; s=zohoarc; b=PfkX2aTrUW0W+bDqy6nSgf96eo2Dl/mJopBBSt6qQDyT/TWqAlA7TQVNEXNPlVGYTk4zRvDFw6Bke+b4yT1CBikiY87Mq30HwyvjVuFOKRqJAtsaA9i3Wnv173u7n/ZDQNUyiur0kEa4JQG4TxxpywfcIN0WYjQLMOu20emSxjE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620136989; 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=RHnvRFDD+p2XRyTSTTsUyK7EUnD5znGkd8yzw6T+Voc=; b=R6EGR1CeCiKcnrsyIPd/kcf5IlnnDTWg3TAfjIAJ1NS2dXFKrnC7JqcaOxfBn14wMuu3FT1tY+xH5DldJyfi6YYnqa+pZSmC05DWO0S9d/q0Ij6qJK2oyPpuY+aDJVbQzU2ODhyIIJVAGeTN7ZG98TRVD2JcmvGjKbo0wOBs9mE= 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 1620136989339630.4120984834889; Tue, 4 May 2021 07:03:09 -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-464-6OMJ0Tg-Mmu7-_Srl1Rumg-1; Tue, 04 May 2021 10:02:56 -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 64DA0107ACE6; Tue, 4 May 2021 14:02:48 +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 39BC510016F8; Tue, 4 May 2021 14:02:48 +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 F28951800FFC; Tue, 4 May 2021 14:02:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 144E2jQ4013141 for ; Tue, 4 May 2021 10:02:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 561E917A7B; Tue, 4 May 2021 14:02:45 +0000 (UTC) Received: from work.redhat.com (ovpn-115-86.ams2.redhat.com [10.36.115.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DDFA60C0F; Tue, 4 May 2021 14:02:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620136986; 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=RHnvRFDD+p2XRyTSTTsUyK7EUnD5znGkd8yzw6T+Voc=; b=YfrGpalMRrcxRF+cap6UV056dPOlt6d3UGDAlrV13k5OqGPm4JdPGPEdOTvkJ5783ntKDR 3SohTC/ycNkbCCcn3bTck5qoLP26AfaR9HDXVVo7lRu+nTFtEhjLrlkju5Wl//tMAxDBYC vdrH5NQ2s2Sh4sdS1ZXoVARmaIV+3A0= X-MC-Unique: 6OMJ0Tg-Mmu7-_Srl1Rumg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 04/10] virDomainVcpuPinDefParseXML: Use virXMLProp* Date: Tue, 4 May 2021 16:02:29 +0200 Message-Id: <20210504140235.132300-5-twiederh@redhat.com> In-Reply-To: <20210504140235.132300-1-twiederh@redhat.com> References: <20210504140235.132300-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b8ac399f5c..e95be17989 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17273,17 +17273,8 @@ virDomainVcpuPinDefParseXML(virDomainDef *def, unsigned int vcpuid; g_autofree char *tmp =3D NULL; =20 - if (!(tmp =3D virXMLPropString(node, "vcpu"))) { - virReportError(VIR_ERR_XML_ERROR, "%s", _("missing vcpu id in vcpu= pin")); + if (virXMLPropUInt(node, "vcpu", 10, VIR_XML_PROP_REQUIRED, &vcpuid) <= 0) return -1; - } - - if (virStrToLong_uip(tmp, NULL, 10, &vcpuid) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid setting for vcpu '%s'"), tmp); - return -1; - } - VIR_FREE(tmp); =20 if (!(vcpu =3D virDomainDefGetVcpu(def, vcpuid))) { VIR_WARN("Ignoring vcpupin for missing vcpus"); --=20 2.26.3 From nobody Tue May 21 04:42: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=1620137004; cv=none; d=zohomail.com; s=zohoarc; b=PhNXWqXK9ZJmMlHiATtsh4Aecue2f2rEy/muqRcN1u+D7yPaB4bIEqZe8c2wefGU161cSalJSEmLl/HXRIxsjZSAzGJ7AcwCb33jhfuC7PjBT1vOJL+z0OVy6z1TAyAqAKQLPGIHnmcPqgDCMAxY1rCzfzwe5Rs5sKO75zO4ZLM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620137004; 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=DZ6oFpoFRDhjdjghOELM+oMguDYq/r0aIDjfUEELPHc=; b=HAjZjkJ2tr2lISpNVfGx79kqr6MvfMfi2QdAPahxl/PGIDnNOdUYbdi2S4ZVJ3vaA6IVzQo0N8DvLWVfpe3qfM6YLjLLQ3yiJWsEyLOgsn5S3fYy7lqW0tDScB5h4zfPHHV1s/ANdRVghNPrpM0u8d9LOVSsfQ4qpxZAB82r21o= 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 1620137004028929.680883223195; Tue, 4 May 2021 07:03:24 -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-356-jYPCSa_VNISy2MA15NcVtw-1; Tue, 04 May 2021 10:02:59 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9764E1074642; Tue, 4 May 2021 14:02:51 +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 72E3A5D9DD; Tue, 4 May 2021 14:02:51 +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 1AAE3180C69B; Tue, 4 May 2021 14:02:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 144E2krL013161 for ; Tue, 4 May 2021 10:02:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6551760C4A; Tue, 4 May 2021 14:02:46 +0000 (UTC) Received: from work.redhat.com (ovpn-115-86.ams2.redhat.com [10.36.115.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id A950A60C0F; Tue, 4 May 2021 14:02:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620137001; 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=DZ6oFpoFRDhjdjghOELM+oMguDYq/r0aIDjfUEELPHc=; b=Cx5ovkqHjQTpZxAC7yvpEkRavpf12AKd5Ey82Yt0B1XRbbpbFJI44kwoNj3w/xRcyouKsy BkBgUF/fUAkakQkITJbdMGz24h9XluDjI//l24nj4IZanIe+Cjfci+7PVwh4x2NXYt5oB4 ZDF3KzHQk6LDffsoAlc8p+xJ0kHKXXg= X-MC-Unique: jYPCSa_VNISy2MA15NcVtw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 05/10] virDomainIOThreadPinDefParseXML: Use virXMLProp* Date: Tue, 4 May 2021 16:02:30 +0200 Message-Id: <20210504140235.132300-6-twiederh@redhat.com> In-Reply-To: <20210504140235.132300-1-twiederh@redhat.com> References: <20210504140235.132300-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.14 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 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e95be17989..d7cef00246 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17319,24 +17319,10 @@ virDomainIOThreadPinDefParseXML(xmlNodePtr node, g_autofree char *tmp =3D NULL; g_autoptr(virBitmap) cpumask =3D NULL; =20 - if (!(tmp =3D virXMLPropString(node, "iothread"))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("missing iothread id in iothreadpin")); - return -1; - } - - if (virStrToLong_uip(tmp, NULL, 10, &iothreadid) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid setting for iothread '%s'"), tmp); - return -1; - } - VIR_FREE(tmp); - - if (iothreadid =3D=3D 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("zero is an invalid iothread id value")); + if (virXMLPropUInt(node, "iothread", 10, + VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO, + &iothreadid) < 0) return -1; - } =20 if (!(iothrid =3D virDomainIOThreadIDFind(def, iothreadid))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, --=20 2.26.3 From nobody Tue May 21 04:42:48 2024 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=1620136981; cv=none; d=zohomail.com; s=zohoarc; b=l3iuBSJaZhaHHMr3+Q5AtjSagsJxVKAgpOfwRazznC8p79scWS2jqdA3b3of5nBUir3nWqzC4uAYvOm31BSP8lvEhW/WSzMiVYjpy4Qm0ELT5MfVmuO11fiqrZjOIvX+yfEWIuWucZvTrbQKoGWO4aS4XJ7FtVgPBLhbJYsIK6Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620136981; 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=mWcoClqg7KdF0sLS0EFRipJQuC77ymXSdHJgvGe4qPo=; b=ErLAzwFKPdKyewBUAC7tEdatGrGpBt/c4DGN4coEMFcBMjtpY1BB+cktBpZ/sWJt5Stz6JGDYuQPfBQvdckgWX7ODfCBnakUMtRkV8fzpR/wSfp5sNUl/iuJF5R0nNWP8JkhoYhOWe6im+ShpdKn1Eka1E7emc6r8nHQIDCbjYU= 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 1620136981346315.2172713116297; Tue, 4 May 2021 07:03:01 -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-552-eUH8SWWXONCe1zVicc5GSw-1; Tue, 04 May 2021 10:02:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E363F809DEC; Tue, 4 May 2021 14:02:48 +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 C2AAD5D6CF; Tue, 4 May 2021 14:02:48 +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 89ECF180B464; Tue, 4 May 2021 14:02:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 144E2l4d013171 for ; Tue, 4 May 2021 10:02:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 733A560C4A; Tue, 4 May 2021 14:02:47 +0000 (UTC) Received: from work.redhat.com (ovpn-115-86.ams2.redhat.com [10.36.115.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA7B560C0F; Tue, 4 May 2021 14:02:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620136978; 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=mWcoClqg7KdF0sLS0EFRipJQuC77ymXSdHJgvGe4qPo=; b=SzbRlfxHzVwNdIvyridf+kIhp+FRPNFVH9QYT74Rp1bhPjl5a3cRLTbA4vQWL/MYsoQbOi L3S4SX0uS5HrCiFIZUwijTzFWyCaMnb/Urd4rHLS9URFow4HqaDUyzGhrB61oO+mH3/SWY GR8sYkD7ITSY8Us5ZUAEedWWmNR+q9U= X-MC-Unique: eUH8SWWXONCe1zVicc5GSw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 06/10] virDomainSchedulerParseCommonAttrs: Use virXMLProp* Date: Tue, 4 May 2021 16:02:31 +0200 Message-Id: <20210504140235.132300-7-twiederh@redhat.com> In-Reply-To: <20210504140235.132300-1-twiederh@redhat.com> References: <20210504140235.132300-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.15 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 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d7cef00246..8f4fd0e3bc 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18054,37 +18054,15 @@ virDomainSchedulerParseCommonAttrs(xmlNodePtr nod= e, virProcessSchedPolicy *policy, int *priority) { - int pol =3D 0; - g_autofree char *tmp =3D NULL; - - if (!(tmp =3D virXMLPropString(node, "scheduler"))) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Missing scheduler attribute")); - return -1; - } - - if ((pol =3D virProcessSchedPolicyTypeFromString(tmp)) <=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid scheduler attribute: '%s'"), tmp); + if (virXMLPropEnum(node, "scheduler", virProcessSchedPolicyTypeFromStr= ing, + VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO, + policy) < 0) return -1; - } - *policy =3D pol; =20 - VIR_FREE(tmp); - - if (pol =3D=3D VIR_PROC_POLICY_FIFO || - pol =3D=3D VIR_PROC_POLICY_RR) { - if (!(tmp =3D virXMLPropString(node, "priority"))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing scheduler priority")); - return -1; - } - - if (virStrToLong_i(tmp, NULL, 10, priority) < 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Invalid value for element priority")); + if (*policy =3D=3D VIR_PROC_POLICY_FIFO || *policy =3D=3D VIR_PROC_POL= ICY_RR) { + if (virXMLPropInt(node, "priority", 10, VIR_XML_PROP_REQUIRED, + priority) < 0) return -1; - } } =20 return 0; --=20 2.26.3 From nobody Tue May 21 04:42:48 2024 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=1620137067; cv=none; d=zohomail.com; s=zohoarc; b=Xv8PSnaljx/AVu1+csnldhj808DcKKcB9uKNJe6RAKVy7ujXPSK8d6Upduji93B7ajQ4JGsv723Seq1faty5G5gnQe1+gbRusRskqcKRheR5F53ZV3yyIXvrYk1/asyyxYF1EuQtjc6f+qwrb+NlTCLvfSfAZDtz05bTQgNUB2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620137067; 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=pWOOtUG70wOdU3g/VZW9rBoisip3LYLx0L40OFyUOUg=; b=ehEenxFhHJxECE0jHtnAhXeY4JnVl5FpkFpjeJz5umtj99ke3V9HPr0rregqokXRry2MR6VSKIu16F69Eb7fZ7z8ZW3kJcC83UXSHIv5il9YHYkHFYzqY+QBJglY3M/IE8NAc5MUKWJxgSATpVAGDkP2AsGL8lFngcqkxQO0TCE= 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 SMTP id 1620137067638956.1805423238795; Tue, 4 May 2021 07:04:27 -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-126-KL4CgUhGP_eXZVxKbJKnkA-1; Tue, 04 May 2021 10:03:10 -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 55274192296B; Tue, 4 May 2021 14:02:54 +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 2AD861001901; Tue, 4 May 2021 14:02:54 +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 E596D1801263; Tue, 4 May 2021 14:02:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 144E2mdH013178 for ; Tue, 4 May 2021 10:02:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7DB8E60C0F; Tue, 4 May 2021 14:02:48 +0000 (UTC) Received: from work.redhat.com (ovpn-115-86.ams2.redhat.com [10.36.115.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id C7A4617A7B; Tue, 4 May 2021 14:02:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620137050; 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=pWOOtUG70wOdU3g/VZW9rBoisip3LYLx0L40OFyUOUg=; b=dhIFETH2sY3wmg3nwxUWz3C+hZIYagD+Yh+1HVWarglA/s4KfebZYAs9DPkxGFUsHTU1VC aKRkz7/vWonpNwJUDtkZwUOyWiwL8YrZSi7HKj/2YQKru47yFMCqdDTz2aRlMe6Zgi2X78 uRz07arWV5b2dSRhf7rk5KU+QFvAw0k= X-MC-Unique: KL4CgUhGP_eXZVxKbJKnkA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 07/10] virDomainDef: Change type of placement_mode to virDomainCpuPlacementMode Date: Tue, 4 May 2021 16:02:32 +0200 Message-Id: <20210504140235.132300-8-twiederh@redhat.com> In-Reply-To: <20210504140235.132300-1-twiederh@redhat.com> References: <20210504140235.132300-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 4 +++- src/conf/domain_conf.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8f4fd0e3bc..20cf987176 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18241,13 +18241,15 @@ virDomainVcpuParse(virDomainDef *def, =20 tmp =3D virXMLPropString(vcpuNode, "placement"); if (tmp) { - if ((def->placement_mode =3D + int placement_mode; + if ((placement_mode =3D virDomainCpuPlacementModeTypeFromString(tmp)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported CPU placement mode '%s'"), tmp); return -1; } + def->placement_mode =3D placement_mode; VIR_FREE(tmp); } else { def->placement_mode =3D VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 8133d19fca..1022f5b114 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2716,7 +2716,7 @@ struct _virDomainDef { size_t maxvcpus; /* set if the vcpu definition was specified individually */ bool individualvcpus; - int placement_mode; + virDomainCpuPlacementMode placement_mode; virBitmap *cpumask; =20 size_t niothreadids; --=20 2.26.3 From nobody Tue May 21 04:42: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=1620136995; cv=none; d=zohomail.com; s=zohoarc; b=XWcuKN+nYZvYZ7aRQfRginJs8JTHixUUc1sQGnffoO+2z4KJsY/1hWmuUUonFAwyy2oEa2DeteOJa2k0S3RGScqVH/Mjo6Ksob3532cQyUyUKUQ3RX3k4amazrWZMsvWcv3aQ31cxrLTocpnK5aBi+SLPy2ccaVUKNn67J51DVc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620136995; 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=Fpn3jwJ8BFblSQDS/FFBw5KIlf3NcwpDWOig/cG2zjk=; b=jk2k5nO+/Bbk/QVDGIPwyDR08uVOaJqG9Gs7TEwNWuY1me+1xqGTxETUKy7UczVSEB5Ukv3uWahscNk6rgVplJR2qDUQm4gfCugTNvVOa/b2HU3LFlLftBy51HMJH/MCzBL/3ruDJOfmKVNQ7tymUNPIaSyYh/ZNBRnPPyrJgIE= 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 1620136995128888.2466705425504; Tue, 4 May 2021 07:03:15 -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-269-2Y2aWgB8NKGaMliM49sZIA-1; Tue, 04 May 2021 10:03:07 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E84E280ED8E; Tue, 4 May 2021 14:02:54 +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 CA4995D703; Tue, 4 May 2021 14:02:54 +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 944D91801267; Tue, 4 May 2021 14:02:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 144E2qmD013208 for ; Tue, 4 May 2021 10:02:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id C647D2AE8A; Tue, 4 May 2021 14:02:52 +0000 (UTC) Received: from work.redhat.com (ovpn-115-86.ams2.redhat.com [10.36.115.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id D005D60C0F; Tue, 4 May 2021 14:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620136992; 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=Fpn3jwJ8BFblSQDS/FFBw5KIlf3NcwpDWOig/cG2zjk=; b=DU4YdQ1gWio4GjELlR89MoOrxKW6zanuyVcMq3OBytZfIT57j0YD/aQBqLZfGfDZZlOoSp 0cWa9vr3PDAR18XpR3q7XiqHlocNZLR2obqIB0bDeZhD4t5OtIKsRKw+1Sw3KulrGOUV40 2R8Gb23fSCuALyB6ZzuJzv9ksaop27s= X-MC-Unique: 2Y2aWgB8NKGaMliM49sZIA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 08/10] virDomainVcpuParse: Use virXMLProp* Date: Tue, 4 May 2021 16:02:33 +0200 Message-Id: <20210504140235.132300-9-twiederh@redhat.com> In-Reply-To: <20210504140235.132300-1-twiederh@redhat.com> References: <20210504140235.132300-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.15 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 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 84 ++++++++++-------------------------------- 1 file changed, 20 insertions(+), 64 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 20cf987176..52d12bfb43 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18228,32 +18228,16 @@ virDomainVcpuParse(virDomainDef *def, } VIR_FREE(tmp); =20 - if ((tmp =3D virXMLPropString(vcpuNode, "current"))) { - if (virStrToLong_ui(tmp, NULL, 10, &vcpus) < 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("current vcpus count must be an integer")= ); - return -1; - } - VIR_FREE(tmp); - } else { - vcpus =3D maxvcpus; - } + vcpus =3D maxvcpus; =20 - tmp =3D virXMLPropString(vcpuNode, "placement"); - if (tmp) { - int placement_mode; - if ((placement_mode =3D - virDomainCpuPlacementModeTypeFromString(tmp)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported CPU placement mode '%s'"), - tmp); - return -1; - } - def->placement_mode =3D placement_mode; - VIR_FREE(tmp); - } else { - def->placement_mode =3D VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC; - } + if (virXMLPropUInt(vcpuNode, "current", 10, VIR_XML_PROP_NONE, &vc= pus) < 0) + return -1; + + def->placement_mode =3D VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC; + if (virXMLPropEnum(vcpuNode, "placement", + virDomainCpuPlacementModeTypeFromString, + VIR_XML_PROP_NONE, &def->placement_mode) < 0) + return -1; =20 if (def->placement_mode !=3D VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) { tmp =3D virXMLPropString(vcpuNode, "cpuset"); @@ -18284,18 +18268,11 @@ virDomainVcpuParse(virDomainDef *def, =20 for (i =3D 0; i < n; i++) { virDomainVcpuDef *vcpu; - int state; + virTristateBool state; unsigned int id; - unsigned int order; =20 - if (!(tmp =3D virXMLPropString(nodes[i], "id")) || - virStrToLong_uip(tmp, NULL, 10, &id) < 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("missing or invalid vcpu id")); + if (virXMLPropUInt(nodes[i], "id", 10, VIR_XML_PROP_REQUIRED, = &id) < 0) return -1; - } - - VIR_FREE(tmp); =20 if (id >=3D def->maxvcpus) { virReportError(VIR_ERR_XML_ERROR, @@ -18306,41 +18283,20 @@ virDomainVcpuParse(virDomainDef *def, =20 vcpu =3D virDomainDefGetVcpu(def, id); =20 - if (!(tmp =3D virXMLPropString(nodes[i], "enabled"))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("missing vcpu enabled state")); - return -1; - } - - if ((state =3D virTristateBoolTypeFromString(tmp)) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid vcpu 'enabled' value '%s'"), tmp= ); + if (virXMLPropTristateBool(nodes[i], "enabled", + VIR_XML_PROP_REQUIRED, &state) < 0) return -1; - } - VIR_FREE(tmp); =20 vcpu->online =3D state =3D=3D VIR_TRISTATE_BOOL_YES; =20 - if ((tmp =3D virXMLPropString(nodes[i], "hotpluggable"))) { - int hotpluggable; - if ((hotpluggable =3D virTristateBoolTypeFromString(tmp)) = < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("invalid vcpu 'hotpluggable' value '%= s'"), tmp); - return -1; - } - vcpu->hotpluggable =3D hotpluggable; - VIR_FREE(tmp); - } + if (virXMLPropTristateBool(nodes[i], "hotpluggable", + VIR_XML_PROP_NONE, + &vcpu->hotpluggable) < 0) + return -1; =20 - if ((tmp =3D virXMLPropString(nodes[i], "order"))) { - if (virStrToLong_uip(tmp, NULL, 10, &order) < 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("invalid vcpu order")); - return -1; - } - vcpu->order =3D order; - VIR_FREE(tmp); - } + if (virXMLPropUInt(nodes[i], "order", 10, VIR_XML_PROP_NONE, + &vcpu->order) < 0) + return -1; } } else { if (virDomainDefSetVcpus(def, vcpus) < 0) --=20 2.26.3 From nobody Tue May 21 04:42:48 2024 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=1620136995; cv=none; d=zohomail.com; s=zohoarc; b=YQjG1S2IrfdKSdE3FMKJRvaf9dGeg1I6XPye28rZuQ1a8uN2tW+8MaPyI4YovY183Zzpb4OBCxysF6GOY4m/MK/758Wk2T8csXgog0tzyeqPBbx7QTtE0ZkCUTrD1+fvZWKxo0MXeRLeXImNrd20dP1fR9fs20R4mKBrZisjlYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620136995; 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=MwNywsjPOXv1PxtGN3HjZEzKzjUJLeVQOUs4KX9LPmU=; b=TSleaao48JaT/Jt8CulUIG2msIA3+kZE2jff2NljPXCbwPCLMZsssLGyi3IBSL6czzgwuqdbnxMZYH4hqc+eN9qy5LSX9Anch9NGjcSnG3fa2ZM4STxJ1AmxDaDmBZnp9np1kAXrqYgS0o0duyaWJJCCJedp3SadFC518CrdYQs= 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 1620136995148285.2317585218792; Tue, 4 May 2021 07:03:15 -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-140-2pNhuri3PYGbYwAPbSiNIw-1; Tue, 04 May 2021 10:03:09 -0400 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 50048824FA7; Tue, 4 May 2021 14:03:02 +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 2B34F5C1B4; Tue, 4 May 2021 14:03:02 +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 E6008180102A; Tue, 4 May 2021 14:03:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 144E316I013220 for ; Tue, 4 May 2021 10:03:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 44CE518966; Tue, 4 May 2021 14:03:01 +0000 (UTC) Received: from work.redhat.com (ovpn-115-86.ams2.redhat.com [10.36.115.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 588EA60C0F; Tue, 4 May 2021 14:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620136992; 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=MwNywsjPOXv1PxtGN3HjZEzKzjUJLeVQOUs4KX9LPmU=; b=MNQt+nKfxgz2uhBkq7H7BrwcXW/aUXGNOB9dTIJL9BoBBHXcU79MmZjjQqL2wRt3KdG67m 0I+4FQw3aS+aEYwoNmW1eem5ySJ3HgKDPdm5Lph6tE43q7049Mj9657OKBNNKCsKfN0IkZ /9BPDHy5jlwcexnlgezYX1qveybfbc8= X-MC-Unique: 2pNhuri3PYGbYwAPbSiNIw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 09/10] virDomainCachetuneDefParseCache: Use virXMLProp* Date: Tue, 4 May 2021 16:02:34 +0200 Message-Id: <20210504140235.132300-10-twiederh@redhat.com> In-Reply-To: <20210504140235.132300-1-twiederh@redhat.com> References: <20210504140235.132300-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 43 +++++------------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 52d12bfb43..483df91880 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18625,53 +18625,20 @@ virDomainCachetuneDefParseCache(xmlXPathContextPt= r ctxt, VIR_XPATH_NODE_AUTORESTORE(ctxt) unsigned int level; unsigned int cache; - int type; + virCacheType type; unsigned long long size; - g_autofree char *tmp =3D NULL; =20 ctxt->node =3D node; =20 - tmp =3D virXMLPropString(node, "id"); - if (!tmp) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing cachetune attribute 'id'")); + if (virXMLPropUInt(node, "id", 10, VIR_XML_PROP_REQUIRED, &cache) < 0) return -1; - } - if (virStrToLong_uip(tmp, NULL, 10, &cache) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid cachetune attribute 'id' value '%s'"), - tmp); - return -1; - } - VIR_FREE(tmp); =20 - tmp =3D virXMLPropString(node, "level"); - if (!tmp) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing cachetune attribute 'level'")); + if (virXMLPropUInt(node, "level", 10, VIR_XML_PROP_REQUIRED, &level) <= 0) return -1; - } - if (virStrToLong_uip(tmp, NULL, 10, &level) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid cachetune attribute 'level' value '%s'"), - tmp); - return -1; - } - VIR_FREE(tmp); =20 - tmp =3D virXMLPropString(node, "type"); - if (!tmp) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing cachetune attribute 'type'")); - return -1; - } - type =3D virCacheTypeFromString(tmp); - if (type < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid cachetune attribute 'type' value '%s'"), - tmp); + if (virXMLPropEnum(node, "type", virCacheTypeFromString, + VIR_XML_PROP_REQUIRED, &type) < 0) return -1; - } =20 if (virParseScaledValue("./@size", "./@unit", ctxt, &size, 1024, --=20 2.26.3 From nobody Tue May 21 04:42:48 2024 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=1620137002; cv=none; d=zohomail.com; s=zohoarc; b=AZGk4f2cIsoRyezfoaHqezlglliQ8ebU43W643+0d/3gApNb/CNxDi4YwA0tKHt04L9Idr+4JvI+byH4tyGH9RCv5XQaJ6f0JiJSroVX1t1D3CnXsfaM2fcL1ItsOfH6SgFBZPTgQpWySalBVdvDGlaaIELRr/mY/slF480irfU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1620137002; 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=NcpjdUGEI3qDcdkaDPB+4Nkx30KAwZsWCv4i9S1omiI=; b=a44K1XNcU6hm8+InF7NZIAy8Grdi4ZNmJ+OHc1/O+0Z3ANZMVS5fqBETjnkpTT+pVNL3F5O1fMf25zR+fqhPdPp3rFWtlHzxPG8XNaLyXwvgiaaI+gfwJa7mbUeU8ycq60tSa4qFUw3FqcK1seZEoP1Q5GavimAxeoakt9GTYb8= 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 1620137002456983.3513536738211; Tue, 4 May 2021 07:03:22 -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-374-HiMDqKGrOgOOqQQIot369w-1; Tue, 04 May 2021 10:03:16 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E181480ED8D; Tue, 4 May 2021 14:03:09 +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 BB5DF5D9DD; Tue, 4 May 2021 14:03:09 +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 8148555353; Tue, 4 May 2021 14:03:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 144E38fm013306 for ; Tue, 4 May 2021 10:03:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 74B5018B15; Tue, 4 May 2021 14:03:08 +0000 (UTC) Received: from work.redhat.com (ovpn-115-86.ams2.redhat.com [10.36.115.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85D1B60C0F; Tue, 4 May 2021 14:03:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620136999; 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=NcpjdUGEI3qDcdkaDPB+4Nkx30KAwZsWCv4i9S1omiI=; b=I7YEI1zq36Zpv6DVmACBimmy+lX3JUHNuGnMzVxdTBCPw2NeGkw9+phahtyA1dSgBPcwh0 sCr4dgJE//E/+cnv6W18+/YRfDC0/PTCBmtmZmcAAdxFa6F0PYqusurZo0nEhRNCuU6GtV FCt1gcPMp/wLuTI5GY2aI+xWpkFQFgo= X-MC-Unique: HiMDqKGrOgOOqQQIot369w-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 10/10] virDomainResctrlMonDefParse: Use virXMLProp* Date: Tue, 4 May 2021 16:02:35 +0200 Message-Id: <20210504140235.132300-11-twiederh@redhat.com> In-Reply-To: <20210504140235.132300-1-twiederh@redhat.com> References: <20210504140235.132300-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.14 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 Reviewed-by: Michal Privoznik --- src/conf/domain_conf.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 483df91880..b3ef2db3fa 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -18764,19 +18764,9 @@ virDomainResctrlMonDefParse(virDomainDef *def, } =20 if (tag =3D=3D VIR_RESCTRL_MONITOR_TYPE_CACHE) { - tmp =3D virXMLPropString(nodes[i], "level"); - if (!tmp) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("Missing monitor attribute 'level'")); + if (virXMLPropUInt(nodes[i], "level", 10, VIR_XML_PROP_REQUIRE= D, + &level) < 0) goto cleanup; - } - - if (virStrToLong_uip(tmp, NULL, 10, &level) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid monitor attribute 'level' value = '%s'"), - tmp); - goto cleanup; - } =20 if (level !=3D VIR_DOMAIN_RESCTRL_MONITOR_CACHELEVEL) { virReportError(VIR_ERR_XML_ERROR, @@ -18784,8 +18774,6 @@ virDomainResctrlMonDefParse(virDomainDef *def, level); goto cleanup; } - - VIR_FREE(tmp); } =20 if (virDomainResctrlParseVcpus(def, nodes[i], &domresmon->vcpus) <= 0) --=20 2.26.3