From nobody Sat Apr 20 03:27:42 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=1619188780; cv=none; d=zohomail.com; s=zohoarc; b=LkiadD00RVCRexYsz7aj8csF4RofnmreWC52K3evatPAQ0QafEbhXlbw2FtoqDh25ADp73Ch67lzrwt5reB0WR2r+Is+Egu6+H9YnIozM31quf4vTIbAXpg6eUJr1809kWMFTskOZ1AaDOhZRUBdLSP36B621FRNr0cD7RepSsM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619188780; 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=BzTK/mpDrJeXTHq+33CbT+1rim2D50WLke97ewoL394=; b=gtdqf8J8OLUE9eZR4u8fRkNFBlOOhDkkaIIbNkNI1tgsqPPlVK0KurAGFVwFZHtpc+Ed6gLPfVYQpVLnjE1dItZveusfrjB+CYmlOtpo2GCtYFUCJLaHtm5QBXy7SqCZHukNrk4hFW2lwfyihb5QYWm/Pis5VU937vcWF/uZzR0= 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 1619188780273738.0642640081678; Fri, 23 Apr 2021 07:39: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-480-k6hyb8NPOa20MKUu5Fq-Tw-1; Fri, 23 Apr 2021 10:39:36 -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 27FCA107ACED; Fri, 23 Apr 2021 14:39:32 +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 030CF5C3E5; Fri, 23 Apr 2021 14:39: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 BD37444A58; Fri, 23 Apr 2021 14:39:31 +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 13NEdT2J029208 for ; Fri, 23 Apr 2021 10:39:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 35683620DE; Fri, 23 Apr 2021 14:39:29 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4240C60BD8; Fri, 23 Apr 2021 14:39:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619188779; 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=BzTK/mpDrJeXTHq+33CbT+1rim2D50WLke97ewoL394=; b=PIaXske3pQW9Wtuc8zpuLaUUiW3mErdEHVtYe9OK0MlYnrIgkc31FRyjiO879v20PkmfU1 uxkIbuLya5EIgoJ6aObVC3Uf/HtF7lvVYMGJcMG9gIeiYms2vaEXHROxI264L6vQPp64+1 ywJIY2tjSdWnp6rWQur+/UuXyEshLLs= X-MC-Unique: k6hyb8NPOa20MKUu5Fq-Tw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 01/11] virXMLPropEnum: Fix return value Date: Fri, 23 Apr 2021 16:39:12 +0200 Message-Id: <20210423143922.298608-2-twiederh@redhat.com> In-Reply-To: <20210423143922.298608-1-twiederh@redhat.com> References: <20210423143922.298608-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: =?UTF-8?q?J=C3=A1n=20Tomko?= , 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Function incorrectly returns 0 when property was successfully read. Fixes: ab5d2776c925ec45eb54ec5432f5645cebb80c85 Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/util/virxml.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virxml.c b/src/util/virxml.c index b79050db35..01c0114072 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -856,7 +856,7 @@ virXMLPropEnum(xmlNodePtr node, } =20 *result =3D ret; - return 0; + return 1; } =20 /** --=20 2.26.3 From nobody Sat Apr 20 03:27:42 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=1619188786; cv=none; d=zohomail.com; s=zohoarc; b=QNhZwY7ik/DaIr91McGIRStN3gzv3k28sJdbQuDy8VRxhXsWtIQ4IGGKXmD/2jCQeM5mlmZWBnAu/Fc05q+N9q5Y8eP4VKLiVNA8tyULJPIlZucaYzfceA8PV36bf0HNkO9nTn/uiVwPJRdyCXCcUhs6Hw7EzFj2SostiF3it6s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619188786; 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=Fv2r07bUFHXl0PrBZco30aMAG0GDbBPYyfParSaV4Ew=; b=Hguhms3b0fS5fHfW7j5quWt0Gfwk8cYZDmw/xHsXo2Fw2jWN2hy6C3/1Y4hjDxgqF2fwHiYAa7RvAojfApWMDs+0qUxTvS5yiAMO/059SudSnbyn00m24Err4lvAjBfMxLGTHzAqcNQa8ajANfe5Z+lTXCFctM+GhpXuQ+yilNk= 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 1619188786947311.52027260773286; Fri, 23 Apr 2021 07:39:46 -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-325-6OuM6sxcNlSUz1g_PXwRUQ-1; Fri, 23 Apr 2021 10:39:43 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F20B11008072; Fri, 23 Apr 2021 14:39:34 +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 C66221992D; Fri, 23 Apr 2021 14:39:34 +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 858F61806D20; Fri, 23 Apr 2021 14:39:34 +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 13NEdUr0029216 for ; Fri, 23 Apr 2021 10:39:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7FB3560BD8; Fri, 23 Apr 2021 14:39:30 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C3D51349A; Fri, 23 Apr 2021 14:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619188785; 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=Fv2r07bUFHXl0PrBZco30aMAG0GDbBPYyfParSaV4Ew=; b=TnVgQaSJpbpCYYHXPnCrnlWcTIMMmFZgv4LCK8fBczsrLQ7UeryXgCR14+gazmxtM556Yl zTnKGrJyOh8C86J/mm4AvVLlQSqyPy/RJ5zrGb31SKY9l32qRyWQLbLBNfhAS4Plu6k+MO b3Q0nMVEY3RD2a7ZtMc74HStq1WzH94= X-MC-Unique: 6OuM6sxcNlSUz1g_PXwRUQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 02/11] virDomainControllerDef: Change type of ioeventfd to virTristateSwitch Date: Fri, 23 Apr 2021 16:39:13 +0200 Message-Id: <20210423143922.298608-3-twiederh@redhat.com> In-Reply-To: <20210423143922.298608-1-twiederh@redhat.com> References: <20210423143922.298608-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: =?UTF-8?q?J=C3=A1n=20Tomko?= , 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.23 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 13 ++++++++----- src/conf/domain_conf.h | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 24c0943d62..4ed7c0ef83 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9619,11 +9619,14 @@ virDomainControllerDefParseXML(virDomainXMLOption *= xmlopt, return NULL; } =20 - if (ioeventfd && - (def->ioeventfd =3D virTristateSwitchTypeFromString(ioeventfd)) < = 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Malformed 'ioeventfd' value %s"), ioeventfd); - return NULL; + if (ioeventfd) { + int value; + if ((value =3D virTristateSwitchTypeFromString(ioeventfd)) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("Malformed 'ioeventfd' value %s"), ioeventfd); + return NULL; + } + def->ioeventfd =3D value; } =20 if (iothread) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index a7cad31896..d4344a7158 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -763,7 +763,7 @@ struct _virDomainControllerDef { unsigned int queues; unsigned int cmd_per_lun; unsigned int max_sectors; - int ioeventfd; /* enum virTristateSwitch */ + virTristateSwitch ioeventfd; unsigned int iothread; /* unused =3D 0, > 0 specific thread # */ union { virDomainVirtioSerialOpts vioserial; --=20 2.26.3 From nobody Sat Apr 20 03:27:42 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=1619188781; cv=none; d=zohomail.com; s=zohoarc; b=M1w6eqDE6Tx/+8Xh1jnG0CDsaP9aomi8AlYhtbPJkYqL7+fe7mDIRmikOHOuEC81OJKTJSl6UyW0PoNGUuqMNnJevOL84lSXBBXPdeMw6C7yGoKMBNniwx1gCjUDPMP5whuH6JeEees7OURXVxp9DWpaa1FmBxmhjJJNXjj2hdk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619188781; 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=lgEV/qbqM3mMLj5pTpc3gUitFQS/K4fThFIhkaFYuF4=; b=jrsCHWVsQxFcY0pUGIHEqV2y/jjh5LLdVgZSjZhczZI3KfmSu6t5FCsZfSLg1fdZqkcjs5i1by7ap3BIQw0T4rHrJciOEX6sjf+k+pL88Q4QSwHXRno0cmgwX/HtwY2ZQLHYOWTtrFbn9nK1HvMl8RmL2d4fEjMc1TgIzJJyc5U= 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 1619188781614315.741264028935; Fri, 23 Apr 2021 07:39: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-34-6nTEJ8jsP2mZf4QLfFAEPw-1; Fri, 23 Apr 2021 10:39:37 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 843651008065; Fri, 23 Apr 2021 14:39: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 680DD1349A; Fri, 23 Apr 2021 14:39: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 37FC51806D1C; Fri, 23 Apr 2021 14:39: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 13NEdVHf029228 for ; Fri, 23 Apr 2021 10:39:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id CC1FE620DE; Fri, 23 Apr 2021 14:39:31 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA89263BA7; Fri, 23 Apr 2021 14:39:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619188780; 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=lgEV/qbqM3mMLj5pTpc3gUitFQS/K4fThFIhkaFYuF4=; b=bLgMOFKChHjh+0i35Mh1hLP+HvNkM4fVT9qWnTbGLzTWgO0f3WmWP5LDplJr7B0cO2Y1Rz msu5V3cVIskqW/5aXZsMuIOzyQ8oymbvFyjfSwRlt492qMalOhiDEyHPRtYFp2ChXFbc7E CwRW1Aja4py1kC2M6ijj29t9sbI2uq8= X-MC-Unique: 6nTEJ8jsP2mZf4QLfFAEPw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 03/11] virDomainPCIControllerOpts: Change type of modelName to virDomainControllerPCIModelName Date: Fri, 23 Apr 2021 16:39:14 +0200 Message-Id: <20210423143922.298608-4-twiederh@redhat.com> In-Reply-To: <20210423143922.298608-1-twiederh@redhat.com> References: <20210423143922.298608-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: =?UTF-8?q?J=C3=A1n=20Tomko?= , 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.11 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 16 +++++++++------- src/conf/domain_conf.h | 2 +- src/qemu/qemu_domain_address.c | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4ed7c0ef83..33e79b20e6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9722,13 +9722,15 @@ virDomainControllerDefParseXML(virDomainXMLOption *= xmlopt, /* Other controller models don't require extra checks */ break; } - if (modelName && - (def->opts.pciopts.modelName - =3D virDomainControllerPCIModelNameTypeFromString(modelName))= <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown PCI controller model name '%s'"), - modelName); - return NULL; + if (modelName) { + int value; + if ((value =3D virDomainControllerPCIModelNameTypeFromString(m= odelName)) <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unknown PCI controller model name '%s'"), + modelName); + return NULL; + } + def->opts.pciopts.modelName =3D value; } if (chassisNr) { if (virStrToLong_i(chassisNr, NULL, 0, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index d4344a7158..336b76aa5c 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -724,7 +724,7 @@ struct _virDomainPCIControllerOpts { * * ... */ - int modelName; /* the exact name of the device in hypervisor */ + virDomainControllerPCIModelName modelName; =20 /* the following items are attributes of the "target" subelement * of controller type=3D'pci'. They are bits of configuration that diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 1ee75b8f2e..a73f30ddcb 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -2456,7 +2456,7 @@ qemuDomainPCIControllerSetDefaultModelName(virDomainC= ontrollerDef *cont, virDomainDef *def, virQEMUCaps *qemuCaps) { - int *modelName =3D &cont->opts.pciopts.modelName; + virDomainControllerPCIModelName *modelName =3D &cont->opts.pciopts.mod= elName; =20 /* make sure it's not already set */ if (*modelName !=3D VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_NONE) --=20 2.26.3 From nobody Sat Apr 20 03:27:42 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=1619188786; cv=none; d=zohomail.com; s=zohoarc; b=LtwTcQtd7MGIN/BLF4USjvxulfYVVZfyai/f7aeEwVaBBxesb4+ty64W8rrVc0HBA5VxYrrfvZD+Rt/h98NkobLB5SojDohCJCtdEYIg+xzmECx5WTmLJyfTap8yeOGsZiclJy8RFI0p/LP/6OUZttF6OCHtujVCaqc78bWj7X8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619188786; 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=04NXF6dUCS3ZE8FvO+1Fa8GozuHD+3JKIbXEpM+UBdw=; b=gExw2HEYnzSDE3UghXarjxiKdFGRdBQR7WEyVm8mEEZ1DEcm0aVTDiYlf44obXTlBmEcH5REUM25MFBJ1vns97KoBZvX6Yt9mVGGLJAS1x0A+m32tx2ClM/LVYOSWUQNqPFyr6WIbpuUVU8NB+B81YOm3iJVO01osH8AQGhwRn0= 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 1619188786374362.7796867991274; Fri, 23 Apr 2021 07:39:46 -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-514-hemacHZqMrm6a9gXKfyiDQ-1; Fri, 23 Apr 2021 10:39:42 -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 C711A1927807; Fri, 23 Apr 2021 14:39:37 +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 A16AB5C233; Fri, 23 Apr 2021 14:39:37 +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 6BFF644A5E; Fri, 23 Apr 2021 14:39:37 +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 13NEdXa9029233 for ; Fri, 23 Apr 2021 10:39:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5125E1349A; Fri, 23 Apr 2021 14:39:33 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 30FF360BD8; Fri, 23 Apr 2021 14:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619188785; 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=04NXF6dUCS3ZE8FvO+1Fa8GozuHD+3JKIbXEpM+UBdw=; b=JZJkMEAX/LojtgRvWgkFy0amUFxZRLNfXTK169VdKRzyqielIT94bAwQ0PdsZmGmL4mBuH JtHShFs6B0SaTQEBUsBFqPDsHR95s9cX4wMYgATnZGaWIoF7FTj8tlapxK4cIx4HOzHDhN nKfulygXQjkEUAaDP2ngSdM/lYHz2Rw= X-MC-Unique: hemacHZqMrm6a9gXKfyiDQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 04/11] virDomainControllerDefParseXML: Use virXMLProp* Date: Fri, 23 Apr 2021 16:39:15 +0200 Message-Id: <20210423143922.298608-5-twiederh@redhat.com> In-Reply-To: <20210423143922.298608-1-twiederh@redhat.com> References: <20210423143922.298608-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: =?UTF-8?q?J=C3=A1n=20Tomko?= , 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 275 +++++++++++++++-------------------------- 1 file changed, 101 insertions(+), 174 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 33e79b20e6..46b3f03d99 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9491,7 +9491,7 @@ virDomainControllerDefParseXML(virDomainXMLOption *xm= lopt, unsigned int flags) { g_autoptr(virDomainControllerDef) def =3D NULL; - int type =3D 0; + virDomainControllerType type =3D 0; xmlNodePtr cur =3D NULL; bool processedModel =3D false; bool processedTarget =3D false; @@ -9499,33 +9499,14 @@ virDomainControllerDefParseXML(virDomainXMLOption *= xmlopt, int ports =3D -1; VIR_XPATH_NODE_AUTORESTORE(ctxt) int rc; - g_autofree char *typeStr =3D NULL; g_autofree char *idx =3D NULL; g_autofree char *model =3D NULL; - g_autofree char *queues =3D NULL; - g_autofree char *cmd_per_lun =3D NULL; - g_autofree char *max_sectors =3D NULL; - g_autofree char *modelName =3D NULL; - g_autofree char *chassisNr =3D NULL; - g_autofree char *chassis =3D NULL; - g_autofree char *port =3D NULL; - g_autofree char *busNr =3D NULL; - g_autofree char *targetIndex =3D NULL; - g_autofree char *hotplug =3D NULL; - g_autofree char *ioeventfd =3D NULL; - g_autofree char *portsStr =3D NULL; - g_autofree char *iothread =3D NULL; =20 ctxt->node =3D node; =20 - typeStr =3D virXMLPropString(node, "type"); - if (typeStr) { - if ((type =3D virDomainControllerTypeFromString(typeStr)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown controller type '%s'"), typeStr); - return NULL; - } - } + if (virXMLPropEnum(node, "type", virDomainControllerTypeFromString, + VIR_XML_PROP_NONE, &type) < 0) + return NULL; =20 if (!(def =3D virDomainControllerDefNew(type))) return NULL; @@ -9555,11 +9536,26 @@ virDomainControllerDefParseXML(virDomainXMLOption *= xmlopt, while (cur !=3D NULL) { if (cur->type =3D=3D XML_ELEMENT_NODE) { if (virXMLNodeNameEqual(cur, "driver")) { - queues =3D virXMLPropString(cur, "queues"); - cmd_per_lun =3D virXMLPropString(cur, "cmd_per_lun"); - max_sectors =3D virXMLPropString(cur, "max_sectors"); - ioeventfd =3D virXMLPropString(cur, "ioeventfd"); - iothread =3D virXMLPropString(cur, "iothread"); + if (virXMLPropUInt(cur, "queues", 10, VIR_XML_PROP_NONE, + &def->queues) < 0) + return NULL; + + if (virXMLPropUInt(cur, "cmd_per_lun", 10, VIR_XML_PROP_NO= NE, + &def->cmd_per_lun) < 0) + return NULL; + + if (virXMLPropUInt(cur, "max_sectors", 10, VIR_XML_PROP_NO= NE, + &def->max_sectors) < 0) + return NULL; + + if (virXMLPropTristateSwitch(cur, "ioeventfd", + VIR_XML_PROP_NONE, + &def->ioeventfd) < 0) + return NULL; + + if (virXMLPropUInt(cur, "iothread", 10, VIR_XML_PROP_NONE, + &def->iothread) < 0) + return NULL; =20 if (virDomainVirtioOptionsParseXML(cur, &def->virtio) < 0) return NULL; @@ -9570,7 +9566,15 @@ virDomainControllerDefParseXML(virDomainXMLOption *x= mlopt, "controller definition not allowed")); return NULL; } - modelName =3D virXMLPropString(cur, "name"); + + if (def->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI) { + if (virXMLPropEnum(cur, "name", + virDomainControllerPCIModelNameType= FromString, + VIR_XML_PROP_NONE, + &def->opts.pciopts.modelName) < 0) + return NULL; + } + processedModel =3D true; } else if (virXMLNodeNameEqual(cur, "target")) { if (processedTarget) { @@ -9579,12 +9583,39 @@ virDomainControllerDefParseXML(virDomainXMLOption *= xmlopt, "controller definition not allowed")); return NULL; } - chassisNr =3D virXMLPropString(cur, "chassisNr"); - chassis =3D virXMLPropString(cur, "chassis"); - port =3D virXMLPropString(cur, "port"); - busNr =3D virXMLPropString(cur, "busNr"); - hotplug =3D virXMLPropString(cur, "hotplug"); - targetIndex =3D virXMLPropString(cur, "index"); + if (def->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_PCI) { + if (virXMLPropInt(cur, "chassisNr", 0, VIR_XML_PROP_NO= NE, + &def->opts.pciopts.chassisNr) < 0) + return NULL; + + if (virXMLPropInt(cur, "chassis", 0, VIR_XML_PROP_NONE, + &def->opts.pciopts.chassis) < 0) + return NULL; + + if (virXMLPropInt(cur, "port", 0, VIR_XML_PROP_NONE, + &def->opts.pciopts.port) < 0) + return NULL; + + if (virXMLPropInt(cur, "busNr", 0, VIR_XML_PROP_NONE, + &def->opts.pciopts.busNr) < 0) + return NULL; + + if (virXMLPropTristateSwitch(cur, "hotplug", + VIR_XML_PROP_NONE, + &def->opts.pciopts.hotplu= g) < 0) + return NULL; + + if ((rc =3D virXMLPropInt(cur, "index", 0, VIR_XML_PRO= P_NONE, + &def->opts.pciopts.targetIndex)) < 0) + return NULL; + + if ((rc =3D=3D 1) && def->opts.pciopts.targetIndex =3D= =3D -1) { + virReportError(VIR_ERR_XML_ERROR, + _("Invalid target index '%i' in PCI= controller"), + def->opts.pciopts.targetIndex); + } + } + processedTarget =3D true; } } @@ -9601,42 +9632,6 @@ virDomainControllerDefParseXML(virDomainXMLOption *x= mlopt, return NULL; } =20 - if (queues && virStrToLong_ui(queues, NULL, 10, &def->queues) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Malformed 'queues' value '%s'"), queues); - return NULL; - } - - if (cmd_per_lun && virStrToLong_ui(cmd_per_lun, NULL, 10, &def->cmd_pe= r_lun) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Malformed 'cmd_per_lun' value '%s'"), cmd_per_lu= n); - return NULL; - } - - if (max_sectors && virStrToLong_ui(max_sectors, NULL, 10, &def->max_se= ctors) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Malformed 'max_sectors' value %s"), max_sectors); - return NULL; - } - - if (ioeventfd) { - int value; - if ((value =3D virTristateSwitchTypeFromString(ioeventfd)) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Malformed 'ioeventfd' value %s"), ioeventfd); - return NULL; - } - def->ioeventfd =3D value; - } - - if (iothread) { - if (virStrToLong_uip(iothread, NULL, 10, &def->iothread) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid 'iothread' value '%s'"), iothread); - return NULL; - } - } - if (def->type =3D=3D VIR_DOMAIN_CONTROLLER_TYPE_USB && def->model =3D=3D VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE) { VIR_DEBUG("Ignoring device address for none model usb controller"); @@ -9645,30 +9640,28 @@ virDomainControllerDefParseXML(virDomainXMLOption *= xmlopt, return NULL; } =20 - portsStr =3D virXMLPropString(node, "ports"); - if (portsStr) { - int r =3D virStrToLong_i(portsStr, NULL, 10, &ports); - if (r !=3D 0 || ports < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid ports: %s"), portsStr); - return NULL; - } + if ((rc =3D virXMLPropInt(node, "ports", 10, VIR_XML_PROP_NONE, &ports= )) < 0) + return NULL; + if ((rc =3D=3D 1) && ports < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid ports: %i"), ports); + return NULL; } =20 switch (def->type) { case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: { - g_autofree char *vectors =3D virXMLPropString(node, "vectors"); + if ((rc =3D virXMLPropInt(node, "vectors", 10, VIR_XML_PROP_NONE, + &def->opts.vioserial.vectors)) < 0) + return NULL; =20 - def->opts.vioserial.ports =3D ports; - if (vectors) { - int r =3D virStrToLong_i(vectors, NULL, 10, - &def->opts.vioserial.vectors); - if (r !=3D 0 || def->opts.vioserial.vectors < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid vectors: %s"), vectors); - return NULL; - } + if ((rc =3D=3D 1) && def->opts.vioserial.vectors < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid vectors: %i"), + def->opts.vioserial.vectors); + return NULL; } + + def->opts.vioserial.ports =3D ports; break; } case VIR_DOMAIN_CONTROLLER_TYPE_USB: { @@ -9722,98 +9715,32 @@ virDomainControllerDefParseXML(virDomainXMLOption *= xmlopt, /* Other controller models don't require extra checks */ break; } - if (modelName) { - int value; - if ((value =3D virDomainControllerPCIModelNameTypeFromString(m= odelName)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown PCI controller model name '%s'"), - modelName); - return NULL; - } - def->opts.pciopts.modelName =3D value; - } - if (chassisNr) { - if (virStrToLong_i(chassisNr, NULL, 0, - &def->opts.pciopts.chassisNr) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid chassisNr '%s' in PCI controller= "), - chassisNr); - return NULL; - } - } - if (chassis) { - if (virStrToLong_i(chassis, NULL, 0, - &def->opts.pciopts.chassis) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid chassis '%s' in PCI controller"), - chassis); - return NULL; - } - } - if (port) { - if (virStrToLong_i(port, NULL, 0, - &def->opts.pciopts.port) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid port '%s' in PCI controller"), - port); - return NULL; - } - } - if (busNr) { - if (virStrToLong_i(busNr, NULL, 0, - &def->opts.pciopts.busNr) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid busNr '%s' in PCI controller"), - busNr); - return NULL; - } - } - if (targetIndex) { - if (virStrToLong_i(targetIndex, NULL, 0, - &def->opts.pciopts.targetIndex) < 0 || - def->opts.pciopts.targetIndex =3D=3D -1) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid target index '%s' in PCI control= ler"), - targetIndex); - return NULL; - } - } + if (numaNode >=3D 0) def->opts.pciopts.numaNode =3D numaNode; =20 - if (hotplug) { - int val =3D virTristateSwitchTypeFromString(hotplug); - - if (val <=3D 0) { - virReportError(VIR_ERR_XML_ERROR, - _("PCI controller unrecognized hotplug sett= ing '%s'"), - hotplug); - return NULL; - } - def->opts.pciopts.hotplug =3D val; - } break; case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: { - g_autofree char *gntframes =3D virXMLPropString(node, "maxGrantFra= mes"); - g_autofree char *eventchannels =3D virXMLPropString(node, "maxEven= tChannels"); + if ((rc =3D virXMLPropInt(node, "maxGrantFrames", 10, VIR_XML_PROP= _NONE, + &def->opts.xenbusopts.maxGrantFrames)) < 0) + return NULL; =20 - if (gntframes) { - int r =3D virStrToLong_i(gntframes, NULL, 10, - &def->opts.xenbusopts.maxGrantFrames); - if (r !=3D 0 || def->opts.xenbusopts.maxGrantFrames < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid maxGrantFrames: %s"), gntframes); - return NULL; - } + if ((rc =3D=3D 1) && def->opts.xenbusopts.maxGrantFrames < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid maxGrantFrames: %i"), + def->opts.xenbusopts.maxGrantFrames); + return NULL; } - if (eventchannels) { - int r =3D virStrToLong_i(eventchannels, NULL, 10, - &def->opts.xenbusopts.maxEventChannels); - if (r !=3D 0 || def->opts.xenbusopts.maxEventChannels < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Invalid maxEventChannels: %s"), eventcha= nnels); - return NULL; - } + + if ((rc =3D virXMLPropInt(node, "maxEventChannels", 10, VIR_XML_PR= OP_NONE, + &def->opts.xenbusopts.maxEventChannels)) <= 0) + return NULL; + + if ((rc =3D=3D 1) && def->opts.xenbusopts.maxEventChannels < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid maxEventChannels: %i"), + def->opts.xenbusopts.maxEventChannels); + return NULL; } break; } --=20 2.26.3 From nobody Sat Apr 20 03:27:42 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=1619188823; cv=none; d=zohomail.com; s=zohoarc; b=Bb4Op+FtOPQZn5/xHHaQy3IfnTKA3iiK9ZMi3U0QFOZqeciffRbWwC2CWtbUmBti+dfip5fCcGY4tSCn/mvkrd8NgQgws/UwhtwUQHt0QT8LK5vvOD+TydL2HnEMkZcxai4bbONH2bZzNJvN1eVwJUM8Udi0lo+9OMP08pRce9Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619188823; 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=ylt9QouI7dkmRayUVkOQVQS+XC7Ds5w7XG4RyXKI4vg=; b=hDMXrWswR8dax3DhqJ58S1Jezt2fOIRjCvhz8wIkfTxk+N4XCODqdYblZUqN0Mcq3QMHk4a9m8SYobenX1t0p8SrRHDNlVXQbtA4oGIfSyuoPKvyrJ9OD+6gk54csOxy+id28ef2lf4tjxFL6NwVPe3PI99ksbGBUvMhNtvlPX4= 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 1619188823200125.46720361899281; Fri, 23 Apr 2021 07:40:23 -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-129-N9a_efcQMj2dnol4Y6udTw-1; Fri, 23 Apr 2021 10:39:46 -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 6A95381431F; Fri, 23 Apr 2021 14:39:37 +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 43E0B5C3FD; Fri, 23 Apr 2021 14:39:37 +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 DC3CD1806D24; Fri, 23 Apr 2021 14:39:36 +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 13NEdYxw029246 for ; Fri, 23 Apr 2021 10:39:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6FC444F3C6; Fri, 23 Apr 2021 14:39:34 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id A93841349A; Fri, 23 Apr 2021 14:39:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619188822; 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=ylt9QouI7dkmRayUVkOQVQS+XC7Ds5w7XG4RyXKI4vg=; b=Lr96b54Iwu4iWRxfulK2SIIaEahqGLI7bcIwaxANJuQ6FhsqtnxMssaj8hAoc+XmgdTGtp JPUcVLAfHFMaqMoHLAQCGQ928XQ0+kaWAhgmXZO0SZQutQutvnpU6zWQT8k0ULltIYIwG6 gbHDaAYPnttiyZPXmE/jxeTIamM9xfs= X-MC-Unique: N9a_efcQMj2dnol4Y6udTw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 05/11] virDomainControllerDefParseXML: Cosmetic changes Date: Fri, 23 Apr 2021 16:39:16 +0200 Message-Id: <20210423143922.298608-6-twiederh@redhat.com> In-Reply-To: <20210423143922.298608-1-twiederh@redhat.com> References: <20210423143922.298608-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.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: J=C3=A1n Tomko --- src/conf/domain_conf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 46b3f03d99..27d1954692 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9511,8 +9511,7 @@ virDomainControllerDefParseXML(virDomainXMLOption *xm= lopt, if (!(def =3D virDomainControllerDefNew(type))) return NULL; =20 - model =3D virXMLPropString(node, "model"); - if (model) { + if ((model =3D virXMLPropString(node, "model"))) { if ((def->model =3D virDomainControllerModelTypeFromString(def, mo= del)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unknown model type '%s'"), model); @@ -9523,8 +9522,7 @@ virDomainControllerDefParseXML(virDomainXMLOption *xm= lopt, idx =3D virXMLPropString(node, "index"); if (idx) { unsigned int idxVal; - if (virStrToLong_ui(idx, NULL, 10, &idxVal) < 0 || - idxVal > INT_MAX) { + if (virStrToLong_ui(idx, NULL, 10, &idxVal) < 0 || idxVal > INT_MA= X) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Cannot parse controller index %s"), idx); return NULL; --=20 2.26.3 From nobody Sat Apr 20 03:27:42 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=1619188785; cv=none; d=zohomail.com; s=zohoarc; b=fYOs5uNjgxnQGiohNjZ28pWysIaDQa4ILIonCnRUsirymDIbrSLIFWqia9XLbaK3QNv9eGwi9fAGtpdM42IKHpYRw9StFHLBcQ19AkaALEFUpdIxryowlRPAbMyD9TodM02n0JwGzu3zVlgehdQs2awhHBhLfimBSHMFaH0S5YE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619188785; 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=Xb87/tZHFLS7ym7Ctk59k4/aVjuahpROhLYjejqgAWA=; b=nr4dzrow5Rpr/Zj34u40gRPCL4RtXeSW3BWts/NyhDUImaZqzJZWPp90tzBcQO61Esvm8HRlWnxAG5GDTXvllh+SBVEc+SF0IZs0LHv8q/IouSWIcLqETRpNAvveEv1RRXiG2yF6yeNaK0EYyVQ7fm7ZfsPQOGerF67wNPYV6ZU= 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 1619188785929432.34989098813526; Fri, 23 Apr 2021 07:39:45 -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-542-ZRGghjydMmmhkn1hS_6pgQ-1; Fri, 23 Apr 2021 10:39:42 -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 6969F1008068; Fri, 23 Apr 2021 14:39:37 +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 418001037E82; Fri, 23 Apr 2021 14:39:37 +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 D65FF1806D23; Fri, 23 Apr 2021 14:39:36 +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 13NEdZOe029257 for ; Fri, 23 Apr 2021 10:39:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id C161860BD8; Fri, 23 Apr 2021 14:39:35 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB66C620DE; Fri, 23 Apr 2021 14:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619188784; 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=Xb87/tZHFLS7ym7Ctk59k4/aVjuahpROhLYjejqgAWA=; b=iYBcNTNZXREeabR1pt/wIcnwUN7xGNQnvvvnAsYZ/jC8KGSN392FWRuXgTmPqkkJw45Y9P CDHZcIQ6KYvUssmcPBiJYjGGTKBr8LCU2fKTyeb6LPuJxV6mXeyR/pCTMEZ0L/lWcblvf2 V7uhStOddnIcjg8o/NqzxutrNrrS9FQ= X-MC-Unique: ZRGghjydMmmhkn1hS_6pgQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 06/11] virDomainActualNetDef: Change type of type to virDomainNetType Date: Fri, 23 Apr 2021 16:39:17 +0200 Message-Id: <20210423143922.298608-7-twiederh@redhat.com> In-Reply-To: <20210423143922.298608-1-twiederh@redhat.com> References: <20210423143922.298608-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: =?UTF-8?q?J=C3=A1n=20Tomko?= , 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 30 ++++++++++++++++++++++++++---- src/conf/domain_conf.h | 2 +- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 27d1954692..2de1b17f9e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2468,7 +2468,16 @@ virDomainActualNetDefFree(virDomainActualNetDef *def) case VIR_DOMAIN_NET_TYPE_HOSTDEV: virDomainHostdevDefClear(&def->data.hostdev.def); break; - default: + case VIR_DOMAIN_NET_TYPE_USER: + case VIR_DOMAIN_NET_TYPE_ETHERNET: + case VIR_DOMAIN_NET_TYPE_VHOSTUSER: + case VIR_DOMAIN_NET_TYPE_SERVER: + case VIR_DOMAIN_NET_TYPE_CLIENT: + case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_INTERNAL: + case VIR_DOMAIN_NET_TYPE_UDP: + case VIR_DOMAIN_NET_TYPE_VDPA: + case VIR_DOMAIN_NET_TYPE_LAST: break; } =20 @@ -10062,6 +10071,7 @@ virDomainActualNetDefParseXML(xmlNodePtr node, g_autofree char *addrtype =3D NULL; g_autofree char *trustGuestRxFilters =3D NULL; g_autofree char *macTableManager =3D NULL; + int type_value; =20 actual =3D g_new0(virDomainActualNetDef, 1); =20 @@ -10073,11 +10083,12 @@ virDomainActualNetDefParseXML(xmlNodePtr node, _("missing type attribute in interface's e= lement")); goto error; } - if ((actual->type =3D virDomainNetTypeFromString(type)) < 0) { + if ((type_value =3D virDomainNetTypeFromString(type)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown type '%s' in interface's elemen= t"), type); goto error; } + actual->type =3D type_value; if (actual->type !=3D VIR_DOMAIN_NET_TYPE_BRIDGE && actual->type !=3D VIR_DOMAIN_NET_TYPE_DIRECT && actual->type !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV && @@ -30114,9 +30125,20 @@ virDomainNetGetActualVirtPortProfile(const virDoma= inNetDef *iface) case VIR_DOMAIN_NET_TYPE_BRIDGE: case VIR_DOMAIN_NET_TYPE_HOSTDEV: return iface->data.network.actual->virtPortProfile; - default: - return NULL; + case VIR_DOMAIN_NET_TYPE_USER: + case VIR_DOMAIN_NET_TYPE_ETHERNET: + case VIR_DOMAIN_NET_TYPE_VHOSTUSER: + case VIR_DOMAIN_NET_TYPE_SERVER: + case VIR_DOMAIN_NET_TYPE_CLIENT: + case VIR_DOMAIN_NET_TYPE_MCAST: + case VIR_DOMAIN_NET_TYPE_NETWORK: + case VIR_DOMAIN_NET_TYPE_INTERNAL: + case VIR_DOMAIN_NET_TYPE_UDP: + case VIR_DOMAIN_NET_TYPE_VDPA: + case VIR_DOMAIN_NET_TYPE_LAST: + break; } + return NULL; case VIR_DOMAIN_NET_TYPE_USER: case VIR_DOMAIN_NET_TYPE_ETHERNET: case VIR_DOMAIN_NET_TYPE_VHOSTUSER: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 336b76aa5c..cb21ee7872 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -990,7 +990,7 @@ typedef enum { * different versions of libvirt may read the same data file. */ struct _virDomainActualNetDef { - int type; /* enum virDomainNetType */ + virDomainNetType type; union { struct { char *brname; --=20 2.26.3 From nobody Sat Apr 20 03:27:42 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=1619188791; cv=none; d=zohomail.com; s=zohoarc; b=CmhGi17LhG8Vk10/txScolZCG/T7L1ZIdmHQWfBM7Ameb4AD9nfhj7B8Xve/drUJE3cjS68L6Ovk7Kv9GLDtpRzZJE2lLPpaHtpFtW8y1rYVOVisucXr6Ikgo6Dcxn8XFxEakLHeatriuah8tlykwYHDCDVJqIsZsopqtz5DDbc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619188791; 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=ryuDDwMRPxlbnNVpWNRhroO1X2q4BRDmGs0yhQ3P6Mk=; b=PWDBMT05ikNCZmm3Wiot3JSb3/KtooLUUSq7I9kaoMvZtUOn1mC4YGFKEZoPiR4lN/Llzftw/8ZNvt5UUUJ8Q1MkTF3vWdyN/DKkgFGSJqe33hb667+Z7f6ONp4eb0RLK6CTXeWrbJ6vsGcctCli4Ek+lU/90lWfw7XIOz79mF0= 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 1619188791913790.7931884582115; Fri, 23 Apr 2021 07:39:51 -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-604-DU0oHPmgMqmBRcB1ErqydQ-1; Fri, 23 Apr 2021 10:39:46 -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 01BC6107ACCD; Fri, 23 Apr 2021 14:39:42 +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 D3D6A60C13; Fri, 23 Apr 2021 14:39:41 +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 9BE8344A64; Fri, 23 Apr 2021 14:39:41 +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 13NEdb7f029270 for ; Fri, 23 Apr 2021 10:39:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1A51D620DE; Fri, 23 Apr 2021 14:39:37 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 267191349A; Fri, 23 Apr 2021 14:39:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619188790; 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=ryuDDwMRPxlbnNVpWNRhroO1X2q4BRDmGs0yhQ3P6Mk=; b=aM1IJaN2gKLlqQE9psAi5ZIvuo71TzXpUwtHLD2aDOBnx2fpXABGYE9xQeT5AlbodjSVe0 XMqvYnBokuizCVhNi7LexVpo+lllKaXJdYeMviV3osS8m1mDKWzLbnWL/guTAFXiqSsmBI tzup+L8gL8ea8Ulsfj5Qk1LNnCjDImw= X-MC-Unique: DU0oHPmgMqmBRcB1ErqydQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 07/11] virDomainActualNetDefParseXML: Use virXMLProp* Date: Fri, 23 Apr 2021 16:39:18 +0200 Message-Id: <20210423143922.298608-8-twiederh@redhat.com> In-Reply-To: <20210423143922.298608-1-twiederh@redhat.com> References: <20210423143922.298608-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: =?UTF-8?q?J=C3=A1n=20Tomko?= , 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 57 ++++++++++++++---------------------------- 1 file changed, 19 insertions(+), 38 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2de1b17f9e..385d24d2ba 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10066,49 +10066,30 @@ virDomainActualNetDefParseXML(xmlNodePtr node, xmlNodePtr bandwidth_node =3D NULL; xmlNodePtr vlanNode; xmlNodePtr virtPortNode; - g_autofree char *type =3D NULL; - g_autofree char *mode =3D NULL; g_autofree char *addrtype =3D NULL; - g_autofree char *trustGuestRxFilters =3D NULL; g_autofree char *macTableManager =3D NULL; - int type_value; =20 actual =3D g_new0(virDomainActualNetDef, 1); =20 ctxt->node =3D node; =20 - type =3D virXMLPropString(node, "type"); - if (!type) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing type attribute in interface's e= lement")); - goto error; - } - if ((type_value =3D virDomainNetTypeFromString(type)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown type '%s' in interface's elemen= t"), type); + if (virXMLPropEnum(node, "type", virDomainNetTypeFromString, + VIR_XML_PROP_REQUIRED, &actual->type) < 0) goto error; - } - actual->type =3D type_value; + if (actual->type !=3D VIR_DOMAIN_NET_TYPE_BRIDGE && actual->type !=3D VIR_DOMAIN_NET_TYPE_DIRECT && actual->type !=3D VIR_DOMAIN_NET_TYPE_HOSTDEV && actual->type !=3D VIR_DOMAIN_NET_TYPE_NETWORK) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported type '%s' in interface's el= ement"), - type); + virDomainNetTypeToString(actual->type)); goto error; } =20 - if ((trustGuestRxFilters =3D virXMLPropString(node, "trustGuestRxFilte= rs"))) { - int value; - if ((value =3D virTristateBoolTypeFromString(trustGuestRxFilters))= <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown trustGuestRxFilters value '%s'"), - trustGuestRxFilters); - goto error; - } - actual->trustGuestRxFilters =3D value; - } + if (virXMLPropTristateBool(node, "trustGuestRxFilters", VIR_XML_PROP_N= ONE, + &actual->trustGuestRxFilters) < 0) + goto error; =20 virtPortNode =3D virXPathNode("./virtualport", ctxt); if (virtPortNode) { @@ -10127,7 +10108,8 @@ virDomainActualNetDefParseXML(xmlNodePtr node, } else { virReportError(VIR_ERR_INTERNAL_ERROR, _(" element unsupported for type= =3D'%s'" - " in interface's element"), type); + " in interface's element"), + virDomainNetTypeToString(actual->type)); goto error; } } @@ -10136,19 +10118,18 @@ virDomainActualNetDefParseXML(xmlNodePtr node, xmlNodePtr sourceNode =3D virXPathNode("./source[1]", ctxt); =20 if (sourceNode) { + int rc; + virNetDevMacVLanMode mode; + actual->data.direct.linkdev =3D virXMLPropString(sourceNode, "= dev"); =20 - mode =3D virXMLPropString(sourceNode, "mode"); - if (mode) { - int m; - if ((m =3D virNetDevMacVLanModeTypeFromString(mode)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unknown mode '%s' in interface element"), - mode); - goto error; - } - actual->data.direct.mode =3D m; - } + if ((rc =3D virXMLPropEnum(sourceNode, "mode", + virNetDevMacVLanModeTypeFromString, + VIR_XML_PROP_NONE, &mode)) < 0) + goto error; + + if (rc =3D=3D 1) + actual->data.direct.mode =3D mode; } } else if (actual->type =3D=3D VIR_DOMAIN_NET_TYPE_HOSTDEV) { virDomainHostdevDef *hostdev =3D &actual->data.hostdev.def; --=20 2.26.3 From nobody Sat Apr 20 03:27:42 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=1619188789; cv=none; d=zohomail.com; s=zohoarc; b=jjVPSyzZmTrT39zUBOt7vu+xd9DZvcDzRPtB7x8RxxFB+PFdODpLgYSzjTNTfnYdl46wLMLcUEIjKhAb49TtmvvLnmUYxnhN1k8H3R5XDllHw6OdhutJlzYJvz94fVGGiVwmvTSygO0/lk2RYrFYONZUy0GCjwvxgVbqmgHxjjo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619188789; 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=CGZEnAuo4yzWWiHIXVruQAuA3B1fDjAo+l0Yk9K/cGc=; b=hC3SEi+SVcGOZ/k0wjf8XP3oons7cr6v4NkOyn74lKoHG4HcVoroPC0XTofUvYnCa69cdQBO2nQbCHgDshgfcFqqHn8LXzmaS/leCz4CWLo9I0Dd0R4jQ/+o1768OuPxCFLmdJ5l4yjh6ttKs7YMjutlBcbN8BNKb0H7CGHKAx0= 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 1619188789273117.41822599346835; Fri, 23 Apr 2021 07:39:49 -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-596-oW1Q_DBFN6OGKKeg0TyQ0Q-1; Fri, 23 Apr 2021 10:39:46 -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 9DCF5107ACF5; Fri, 23 Apr 2021 14:39:41 +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 7D10D5D719; Fri, 23 Apr 2021 14:39:41 +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 434C244A62; Fri, 23 Apr 2021 14:39:41 +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 13NEdcH3029281 for ; Fri, 23 Apr 2021 10:39:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6DB9B620DE; Fri, 23 Apr 2021 14:39:38 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7687259465; Fri, 23 Apr 2021 14:39:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619188788; 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=CGZEnAuo4yzWWiHIXVruQAuA3B1fDjAo+l0Yk9K/cGc=; b=i4mftOaXnaniW9IgljjQ4zyVEU1WLyVu+xG8oEhHKTXM4DpaNlVNRk5BZ/ueXWeC93qw4X UIP91kZSIBpAp18g/yZqlNij+HvMZMlECZoo8FxzjN6g9E3wYJtqOuE5YD6/Yv3mrtaGpb Kw+YQ2TcKsRpxePLf2nJ2WIh8xeIOn8= X-MC-Unique: oW1Q_DBFN6OGKKeg0TyQ0Q-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 08/11] virDomainNetDefParseXML: Use virXMLProp* Date: Fri, 23 Apr 2021 16:39:19 +0200 Message-Id: <20210423143922.298608-9-twiederh@redhat.com> In-Reply-To: <20210423143922.298608-1-twiederh@redhat.com> References: <20210423143922.298608-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: =?UTF-8?q?J=C3=A1n=20Tomko?= , 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 199 ++++++++++++----------------------------- 1 file changed, 57 insertions(+), 142 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 385d24d2ba..99e05613f7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10329,7 +10329,6 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, g_autofree char *macaddr =3D NULL; g_autofree char *macaddr_type =3D NULL; g_autofree char *macaddr_check =3D NULL; - g_autofree char *type =3D NULL; g_autofree char *network =3D NULL; g_autofree char *portgroup =3D NULL; g_autofree char *portid =3D NULL; @@ -10353,7 +10352,6 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, g_autofree char *queues =3D NULL; g_autofree char *rx_queue_size =3D NULL; g_autofree char *tx_queue_size =3D NULL; - g_autofree char *str =3D NULL; g_autofree char *filter =3D NULL; g_autofree char *internal =3D NULL; g_autofree char *mode =3D NULL; @@ -10363,7 +10361,6 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, g_autofree char *vhostuser_mode =3D NULL; g_autofree char *vhostuser_path =3D NULL; g_autofree char *vhostuser_type =3D NULL; - g_autofree char *trustGuestRxFilters =3D NULL; g_autofree char *vhost_path =3D NULL; const char *prefix =3D xmlopt ? xmlopt->config.netPrefix : NULL; =20 @@ -10372,27 +10369,16 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlop= t, =20 ctxt->node =3D node; =20 - type =3D virXMLPropString(node, "type"); - if (type !=3D NULL) { - if ((int)(def->type =3D virDomainNetTypeFromString(type)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown interface type '%s'"), type); - goto error; - } - } else { + if ((rv =3D virXMLPropEnum(node, "type", virDomainNetTypeFromString, + VIR_XML_PROP_NONE, &def->type)) < 0) + goto error; + + if (rv =3D=3D 0) def->type =3D VIR_DOMAIN_NET_TYPE_USER; - } =20 - if ((trustGuestRxFilters =3D virXMLPropString(node, "trustGuestRxFilte= rs"))) { - int value; - if ((value =3D virTristateBoolTypeFromString(trustGuestRxFilters))= <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown trustGuestRxFilters value '%s'"), - trustGuestRxFilters); - goto error; - } - def->trustGuestRxFilters =3D value; - } + if (virXMLPropTristateBool(node, "trustGuestRxFilters", VIR_XML_PROP_N= ONE, + &def->trustGuestRxFilters) < 0) + goto error; =20 cur =3D node->children; while (cur !=3D NULL) { @@ -10484,7 +10470,8 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _(" element unsupported fo= r" - " "), type); + " "), + virDomainNetTypeToString(def->type)); goto error; } } else if (!address && @@ -10962,128 +10949,56 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlo= pt, } =20 if ((tmpNode =3D virXPathNode("./driver/host", ctxt))) { - if ((str =3D virXMLPropString(tmpNode, "csum"))) { - if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown host csum mode '%s'"), - str); - goto error; - } - def->driver.virtio.host.csum =3D val; - } - VIR_FREE(str); - if ((str =3D virXMLPropString(tmpNode, "gso"))) { - if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown host gso mode '%s'"), - str); - goto error; - } - def->driver.virtio.host.gso =3D val; - } - VIR_FREE(str); - if ((str =3D virXMLPropString(tmpNode, "tso4"))) { - if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown host tso4 mode '%s'"), - str); - goto error; - } - def->driver.virtio.host.tso4 =3D val; - } - VIR_FREE(str); - if ((str =3D virXMLPropString(tmpNode, "tso6"))) { - if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown host tso6 mode '%s'"), - str); - goto error; - } - def->driver.virtio.host.tso6 =3D val; - } - VIR_FREE(str); - if ((str =3D virXMLPropString(tmpNode, "ecn"))) { - if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown host ecn mode '%s'"), - str); - goto error; - } - def->driver.virtio.host.ecn =3D val; - } - VIR_FREE(str); - if ((str =3D virXMLPropString(tmpNode, "ufo"))) { - if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown host ufo mode '%s'"), - str); - goto error; - } - def->driver.virtio.host.ufo =3D val; - } - VIR_FREE(str); - if ((str =3D virXMLPropString(tmpNode, "mrg_rxbuf"))) { - if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown host mrg_rxbuf mode '%s'"), - str); - goto error; - } - def->driver.virtio.host.mrg_rxbuf =3D val; - } - VIR_FREE(str); + if (virXMLPropTristateSwitch(tmpNode, "csum", VIR_XML_PROP_NON= E, + &def->driver.virtio.host.csum) < = 0) + goto error; + + if (virXMLPropTristateSwitch(tmpNode, "gso", VIR_XML_PROP_NONE, + &def->driver.virtio.host.gso) < 0) + goto error; + + if (virXMLPropTristateSwitch(tmpNode, "tso4", VIR_XML_PROP_NON= E, + &def->driver.virtio.host.tso4) < = 0) + goto error; + + if (virXMLPropTristateSwitch(tmpNode, "tso6", VIR_XML_PROP_NON= E, + &def->driver.virtio.host.tso6) < = 0) + goto error; + + if (virXMLPropTristateSwitch(tmpNode, "ecn", VIR_XML_PROP_NONE, + &def->driver.virtio.host.ecn) < 0) + goto error; + + if (virXMLPropTristateSwitch(tmpNode, "ufo", VIR_XML_PROP_NONE, + &def->driver.virtio.host.ufo) < 0) + goto error; + + if (virXMLPropTristateSwitch(tmpNode, "mrg_rxbuf", + VIR_XML_PROP_NONE, + &def->driver.virtio.host.mrg_rxbu= f) < 0) + goto error; } =20 if ((tmpNode =3D virXPathNode("./driver/guest", ctxt))) { - if ((str =3D virXMLPropString(tmpNode, "csum"))) { - if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown guest csum mode '%s'"), - str); - goto error; - } - def->driver.virtio.guest.csum =3D val; - } - VIR_FREE(str); - if ((str =3D virXMLPropString(tmpNode, "tso4"))) { - if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown guest tso4 mode '%s'"), - str); - goto error; - } - def->driver.virtio.guest.tso4 =3D val; - } - VIR_FREE(str); - if ((str =3D virXMLPropString(tmpNode, "tso6"))) { - if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown guest tso6 mode '%s'"), - str); - goto error; - } - def->driver.virtio.guest.tso6 =3D val; - } - VIR_FREE(str); - if ((str =3D virXMLPropString(tmpNode, "ecn"))) { - if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown guest ecn mode '%s'"), - str); - goto error; - } - def->driver.virtio.guest.ecn =3D val; - } - VIR_FREE(str); - if ((str =3D virXMLPropString(tmpNode, "ufo"))) { - if ((val =3D virTristateSwitchTypeFromString(str)) <=3D 0)= { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown guest ufo mode '%s'"), - str); - goto error; - } - def->driver.virtio.guest.ufo =3D val; - } + if (virXMLPropTristateSwitch(tmpNode, "csum", VIR_XML_PROP_NON= E, + &def->driver.virtio.guest.csum) <= 0) + goto error; + + if (virXMLPropTristateSwitch(tmpNode, "tso4", VIR_XML_PROP_NON= E, + &def->driver.virtio.guest.tso4) <= 0) + goto error; + + if (virXMLPropTristateSwitch(tmpNode, "tso6", VIR_XML_PROP_NON= E, + &def->driver.virtio.guest.tso6) <= 0) + goto error; + + if (virXMLPropTristateSwitch(tmpNode, "ecn", VIR_XML_PROP_NONE, + &def->driver.virtio.guest.ecn) < = 0) + goto error; + + if (virXMLPropTristateSwitch(tmpNode, "ufo", VIR_XML_PROP_NONE, + &def->driver.virtio.guest.ufo) < = 0) + goto error; } def->backend.vhost =3D g_steal_pointer(&vhost_path); } --=20 2.26.3 From nobody Sat Apr 20 03:27:42 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=1619188873; cv=none; d=zohomail.com; s=zohoarc; b=ikSL8h5UsMV3kF7hGxmRnMhBalikNo68zZ4cl2vIgKWtnMdT+h0aK8YOAfmmWIFcqdQ6yabbz1IdZ9zGi2d2wZJFrVADzc++2auZIj8c4gYFGss+hfZllMM23+nuzgvdvniryupjBcKJUnB0URRfMTvqDO37Abnj5ehKALB2aS4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619188873; 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=V8WTMiHgzWqlvr76BTsjBBQHR+sWgxHYJTptiJ6kvuQ=; b=MKhIWYCm0bbrkMtXXOxeDRFhvZQekMBU58Kw7pjWL8Rd9mbCsSFcmR94J3+SaAv5FNq0pQzc/oGYKxUWe+6taoxfMujAlksRcJ2XEMAKxZi1JpPy7jiq/dXjThUoiY8l1LbT1BVXK7J8yqwY7DG20m5LBkZ2AcY63TAjAACdljk= 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 1619188873254204.55069602874244; Fri, 23 Apr 2021 07:41:13 -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-qNpWjk61MeaPPxzQ2OV54w-1; Fri, 23 Apr 2021 10:39:49 -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 52CBE1008060; Fri, 23 Apr 2021 14:39:44 +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 33CD82B0A5; Fri, 23 Apr 2021 14:39:44 +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 EF9481806D29; Fri, 23 Apr 2021 14:39:43 +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 13NEdd6L029293 for ; Fri, 23 Apr 2021 10:39:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id B4CA159465; Fri, 23 Apr 2021 14:39:39 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id C832F60BD8; Fri, 23 Apr 2021 14:39:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619188872; 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=V8WTMiHgzWqlvr76BTsjBBQHR+sWgxHYJTptiJ6kvuQ=; b=A8KKK2xYdzD5xyRU2nzf02ABoZR1Cai1JI+XRQz9WAZNVSaO/t6tSJAq+FPFMRDIr23/wg +KefF/F84gXX5t1hs80GqYvyetnqulHGPHuNSieB0RPozQS/iZdK/KOE/2lOmfP/EhE8MG ekdAl/0dGAdi12wKANbPmAkuXpPqi+w= X-MC-Unique: qNpWjk61MeaPPxzQ2OV54w-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 09/11] virDomainGraphicsListenDefParseXML: Use virXMLProp* Date: Fri, 23 Apr 2021 16:39:20 +0200 Message-Id: <20210423143922.298608-10-twiederh@redhat.com> In-Reply-To: <20210423143922.298608-1-twiederh@redhat.com> References: <20210423143922.298608-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: =?UTF-8?q?J=C3=A1n=20Tomko?= , 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 99e05613f7..98335781a6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12439,12 +12439,9 @@ virDomainGraphicsListenDefParseXML(virDomainGraphi= csListenDef *def, { int ret =3D -1; const char *graphicsType =3D virDomainGraphicsTypeToString(graphics->t= ype); - int tmp, typeVal; - g_autofree char *type =3D virXMLPropString(node, "type"); g_autofree char *address =3D virXMLPropString(node, "address"); g_autofree char *network =3D virXMLPropString(node, "network"); g_autofree char *socketPath =3D virXMLPropString(node, "socket"); - g_autofree char *fromConfig =3D virXMLPropString(node, "fromConfig"); g_autofree char *autoGenerated =3D virXMLPropString(node, "autoGenerat= ed"); g_autofree char *addressCompat =3D NULL; g_autofree char *socketCompat =3D NULL; @@ -12454,18 +12451,9 @@ virDomainGraphicsListenDefParseXML(virDomainGraphi= csListenDef *def, socketCompat =3D virXMLPropString(parent, "socket"); } =20 - if (!type) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("graphics listen type must be specified")); - goto error; - } - - if ((typeVal =3D virDomainGraphicsListenTypeFromString(type)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown graphics listen type '%s'"), type); + if (virXMLPropEnum(node, "type", virDomainGraphicsListenTypeFromString, + VIR_XML_PROP_REQUIRED, &def->type) < 0) goto error; - } - def->type =3D typeVal; =20 switch (def->type) { case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET: @@ -12545,14 +12533,10 @@ virDomainGraphicsListenDefParseXML(virDomainGraph= icsListenDef *def, def->socket =3D g_steal_pointer(&socketPath); } =20 - if (fromConfig && - flags & VIR_DOMAIN_DEF_PARSE_STATUS) { - if (virStrToLong_i(fromConfig, NULL, 10, &tmp) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid fromConfig value: %s"), - fromConfig); - goto error; - } + if (flags & VIR_DOMAIN_DEF_PARSE_STATUS) { + int tmp; + if (virXMLPropInt(node, "fromConfig", 10, VIR_XML_PROP_NONE, &tmp)= < 0) + return -1; def->fromConfig =3D tmp !=3D 0; } =20 --=20 2.26.3 From nobody Sat Apr 20 03:27:42 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=1619188807; cv=none; d=zohomail.com; s=zohoarc; b=IfudA5yH0UeqdBKSu4qU2KnOLoZ7725/cJ95AjfJDVcEoYf8kar6NOQM9/NCOWG+sjxBCSU6igYC76PDc+a2WYz1lg7lBvO7z5GREZpW6eIryBc+rgf/xJaaPgUBwdSKYC4OqWErE4JsvchDUUcj9FRANJA04NOk4GFD3J27bPA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619188807; 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=5Qv+LHW5nsshbsV+45xocIbKQLhBdqyILM7QxUhd9w0=; b=Xd5waybNg3jKBCibiUJUPOseOP0n5B0/k18/jJfTeRZzCyD8WwKiSVettjcRWdkGmBgaxFkspueloOOoDShGRtWO5EQIIfu/tjpYWLvmbuGpfyQsZQ5cDz+ofFBpq23VjdAK/TqS083WIPNEFOyxP9C4rvg6qzQBQIdugfJa76U= 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 1619188807229550.4060270570454; Fri, 23 Apr 2021 07:40:07 -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-312-Sj3NNiPUMmKXDlWFLjlsVg-1; Fri, 23 Apr 2021 10:39:49 -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 1FD2E107ACFC; Fri, 23 Apr 2021 14:39: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 ED28E5C541; Fri, 23 Apr 2021 14:39:44 +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 AEE361806D2A; Fri, 23 Apr 2021 14:39:44 +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 13NEdfjJ029299 for ; Fri, 23 Apr 2021 10:39:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1090060BD8; Fri, 23 Apr 2021 14:39:41 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1AAC41349A; Fri, 23 Apr 2021 14:39:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619188806; 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=5Qv+LHW5nsshbsV+45xocIbKQLhBdqyILM7QxUhd9w0=; b=Ra8XMimmYuRw4rW9/pirQs3nD4CL5COJagpGfvSP5A9PgLOlgS50XAFoG0OVW8YBQIqxsn 2PlEhJDmHTWCkVZWGg+AklrYzZcexQEREzDQ394MqdTPd9REwtV9RC93kcCMzkuJBtscIF p0tR6gVL3VKiFt+hTCilautdUzFLZuY= X-MC-Unique: Sj3NNiPUMmKXDlWFLjlsVg-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 10/11] virDomainGraphicsDef: Change type of sharePolicy to virDomainGraphicsVNCSharePolicy Date: Fri, 23 Apr 2021 16:39:21 +0200 Message-Id: <20210423143922.298608-11-twiederh@redhat.com> In-Reply-To: <20210423143922.298608-1-twiederh@redhat.com> References: <20210423143922.298608-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: =?UTF-8?q?J=C3=A1n=20Tomko?= , 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index cb21ee7872..4838687edf 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1834,7 +1834,7 @@ struct _virDomainGraphicsDef { bool autoport; char *keymap; virDomainGraphicsAuthDef auth; - int sharePolicy; + virDomainGraphicsVNCSharePolicy sharePolicy; virTristateBool powerControl; unsigned int audioId; } vnc; --=20 2.26.3 From nobody Sat Apr 20 03:27:42 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=1619188807; cv=none; d=zohomail.com; s=zohoarc; b=FEK9Eq2pM/WaQ1BMrvhXeKwGkKQIpoikD6QfOb5u50DEC7pEcdvkNHuPZba63bcxT6BqLOd6p74f56c6j5u6ziW02LtiKKI+qnqe92wah4eGCMPcZ0VTLsrxHbaQHPtr6Andju49LHOO6THHhckpw46Z1vPv/uXQKuQQ33dJy/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619188807; 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=eYsCtKahzCGsgFK0C70QHKvJOXvTZnlU2eOU6NsKsgA=; b=geHVReUi623M/7pMjRl6cJNkJS82PxpGQwvvt/EgwARvE+0Sk+NRjD6QO3/In06eYmX6oS4RGZ5TicniILdOmYpNc+NK3p5EXj6mlEXN/SVcabwNemg4EL/drBsXOJaUyXRrsZX/Bd8ir46iW2bNFf6GykP63ZD0nZkwJT/HJuw= 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 1619188807032561.2361465976423; Fri, 23 Apr 2021 07:40:07 -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-346-NaRcdfJaNTiL0x963CG0aQ-1; Fri, 23 Apr 2021 10:39:49 -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 2EE1B8030D5; Fri, 23 Apr 2021 14:39:45 +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 0B39C6090F; Fri, 23 Apr 2021 14:39: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 BE6C444A68; Fri, 23 Apr 2021 14:39:44 +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 13NEdgGP029315 for ; Fri, 23 Apr 2021 10:39:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5BDB060BD8; Fri, 23 Apr 2021 14:39:42 +0000 (UTC) Received: from work.redhat.com (ovpn-115-30.ams2.redhat.com [10.36.115.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B7AB620DE; Fri, 23 Apr 2021 14:39:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619188805; 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=eYsCtKahzCGsgFK0C70QHKvJOXvTZnlU2eOU6NsKsgA=; b=NOqE/GExyrhuMlA5wTreTI8JzfkJwGRR3ERH38z6y2dVDuobWk5rLZ5SG5mmEBgWQ0k1Ju qVtM1zYfgNaUUpJMfdnlE478r5XqfpGm3yPRiiq0EdE2q3wZhk+xrGkgMGB6AR9fqW15Cx LCwS97X5MsLjBqlH5mFwJGsFkTl5hqo= X-MC-Unique: NaRcdfJaNTiL0x963CG0aQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH v2 11/11] virDomainGraphicsDefParseXMLVNC: Use virXMLProp* Date: Fri, 23 Apr 2021 16:39:22 +0200 Message-Id: <20210423143922.298608-12-twiederh@redhat.com> In-Reply-To: <20210423143922.298608-1-twiederh@redhat.com> References: <20210423143922.298608-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: =?UTF-8?q?J=C3=A1n=20Tomko?= , 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 59 ++++++++++-------------------------------- 1 file changed, 13 insertions(+), 46 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 98335781a6..5924198900 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12645,11 +12645,8 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphicsD= ef *def, unsigned int flags) { g_autofree char *port =3D virXMLPropString(node, "port"); - g_autofree char *websocket =3D virXMLPropString(node, "websocket"); g_autofree char *websocketGenerated =3D virXMLPropString(node, "websoc= ketGenerated"); - g_autofree char *sharePolicy =3D virXMLPropString(node, "sharePolicy"); g_autofree char *autoport =3D virXMLPropString(node, "autoport"); - g_autofree char *powerControl =3D virXMLPropString(node, "powerControl= "); xmlNodePtr audioNode; VIR_XPATH_NODE_AUTORESTORE(ctxt) =20 @@ -12680,62 +12677,32 @@ virDomainGraphicsDefParseXMLVNC(virDomainGraphics= Def *def, def->data.vnc.port =3D 0; } =20 - if (websocket) { - if (virStrToLong_i(websocket, - NULL, 10, - &def->data.vnc.websocket) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse vnc WebSocket port %s"), websoc= ket); - return -1; - } - } + if (virXMLPropInt(node, "websocket", 10, VIR_XML_PROP_NONE, + &def->data.vnc.websocket) < 0) + return -1; =20 if (websocketGenerated) ignore_value(virStringParseYesNo(websocketGenerated, &def->data.vnc.websocketGenerated)); =20 - if (sharePolicy) { - int policy =3D - virDomainGraphicsVNCSharePolicyTypeFromString(sharePolicy); - - if (policy < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown vnc display sharing policy '%s'"), - sharePolicy); - return -1; - } else { - def->data.vnc.sharePolicy =3D policy; - } - } + if (virXMLPropEnum(node, "sharePolicy", + virDomainGraphicsVNCSharePolicyTypeFromString, + VIR_XML_PROP_NONE, &def->data.vnc.sharePolicy) < 0) + return -1; =20 - if (powerControl) { - int powerControlVal =3D virTristateBoolTypeFromString(powerControl= ); - if (powerControlVal < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse vnc power control '%s'"), power= Control); - return -1; - } - def->data.vnc.powerControl =3D powerControlVal; - } + if ((virXMLPropTristateBool(node, "powerControl", VIR_XML_PROP_NONE, + &def->data.vnc.powerControl)) < 0) + return -1; =20 def->data.vnc.keymap =3D virXMLPropString(node, "keymap"); =20 ctxt->node =3D node; audioNode =3D virXPathNode("./audio", ctxt); if (audioNode) { - g_autofree char *tmp =3D NULL; - tmp =3D virXMLPropString(audioNode, "id"); - if (!tmp) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("missing audio 'id' attribute")); - return -1; - } - if (virStrToLong_ui(tmp, NULL, 10, &def->data.vnc.audioId) < 0 || - def->data.vnc.audioId =3D=3D 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid audio 'id' value '%s'"), tmp); + if (virXMLPropUInt(audioNode, "id", 10, + VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO, + &def->data.vnc.audioId) < 0) return -1; - } } =20 if (virDomainGraphicsAuthDefParseXML(node, &def->data.vnc.auth, --=20 2.26.3