From nobody Wed May 15 01:13:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1644527625; cv=none; d=zohomail.com; s=zohoarc; b=a+1om2MOlqqd5er10NYJLxeeHM7E/tbyUfe5szQ28fSeS1vP9Z+KBdN+iX1SBqoJwTzyvvOaJRmpQxqRz42Tntt2PJd0mr600ADDIZvmtNBNWzzhEGzId2ApfCOJN/hH0kADgzyKMOGcU0s43sEsuTuIkuvcAeW1mt1gttiROJQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644527625; h=Content-Type:Content-Transfer-Encoding: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=mZ6UK0VxRG+6eh+DWJVt86EqUkeX7yvxeBdMiIcND6Q=; b=FjkHM0WfygwIoon1OBPO7adFYLEruH1uKG0QmTC9G6vzfeXJzniZckdmF5EV6s+Fc9Byl4FpmxF3uEbnTtlNS/gXi5PuFPd2+n4lSMc7rGIav8V4fs5RBfkkv0OWwM78qwxk+VDj5TNFRj4kF9PpIkPt8WAes8C0CO23I1f2XnY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1644527625021991.3708301437324; Thu, 10 Feb 2022 13:13:45 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-121-Q91jvZw_OMid-lK54mLzjQ-1; Thu, 10 Feb 2022 16:13:38 -0500 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 0292C190D340; Thu, 10 Feb 2022 21:13:33 +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 86EFC101E7E1; Thu, 10 Feb 2022 21:13: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 125254CA93; Thu, 10 Feb 2022 21:13:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21ALDSFa009446 for ; Thu, 10 Feb 2022 16:13:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id B2502101E818; Thu, 10 Feb 2022 21:13:28 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.19.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 66CB8101E7E1 for ; Thu, 10 Feb 2022 21:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644527624; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=mZ6UK0VxRG+6eh+DWJVt86EqUkeX7yvxeBdMiIcND6Q=; b=aV+0RuI8A7todjQAO0Y0T+FGv4cRTVxEwAbulUYJDeiJBCtlVkB7x7DsOmTUJkDgF2QWtX D7kbQsPUTaxdKpQSCRyWSLvyqN4UQyE/gvBGMHy7kgQaxaTa4rhOI7YHE6xn+incwESA3K PJ5W7VhfvkgPJflFyjBiZ/me0ygnO5s= X-MC-Unique: Q91jvZw_OMid-lK54mLzjQ-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 1/4] conf: Refactor video model parsing Date: Thu, 10 Feb 2022 15:13:23 -0600 Message-Id: <20220210211326.2577126-2-jjongsma@redhat.com> In-Reply-To: <20220210211326.2577126-1-jjongsma@redhat.com> References: <20220210211326.2577126-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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) X-ZM-MESSAGEID: 1644527626874100001 Content-Type: text/plain; charset="utf-8" Factor out a separate function to parse out the element for video devices. Signed-off-by: Jonathon Jongsma --- src/conf/domain_conf.c | 95 ++++++++++++++++++++++++++---------------- 1 file changed, 59 insertions(+), 36 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ab8f2a52cc..25771dde15 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14067,17 +14067,13 @@ virDomainVideoDriverDefParseXML(xmlNodePtr node, return g_steal_pointer(&def); } =20 -static virDomainVideoDef * -virDomainVideoDefParseXML(virDomainXMLOption *xmlopt, - xmlNodePtr node, - xmlXPathContextPtr ctxt, - unsigned int flags) +static int +virDomainVideoModelDefParseXML(virDomainVideoDef *def, + xmlNodePtr node, + xmlXPathContextPtr ctxt) { - g_autoptr(virDomainVideoDef) def =3D NULL; - xmlNodePtr driver; xmlNodePtr accel_node; xmlNodePtr res_node; - VIR_XPATH_NODE_AUTORESTORE(ctxt) g_autofree char *type =3D NULL; g_autofree char *heads =3D NULL; g_autofree char *vram =3D NULL; @@ -14086,81 +14082,108 @@ virDomainVideoDefParseXML(virDomainXMLOption *xm= lopt, g_autofree char *vgamem =3D NULL; g_autofree char *primary =3D NULL; =20 - if (!(def =3D virDomainVideoDefNew(xmlopt))) - return NULL; - + VIR_XPATH_NODE_AUTORESTORE(ctxt); ctxt->node =3D node; =20 - if ((primary =3D virXPathString("string(./model/@primary)", ctxt)) != =3D NULL) + if ((primary =3D virXPathString("string(./@primary)", ctxt)) !=3D NULL) ignore_value(virStringParseYesNo(primary, &def->primary)); =20 - if ((accel_node =3D virXPathNode("./model/acceleration", ctxt)) && + if ((accel_node =3D virXPathNode("./acceleration", ctxt)) && (def->accel =3D virDomainVideoAccelDefParseXML(accel_node)) =3D=3D= NULL) - return NULL; + return -1; =20 - if ((res_node =3D virXPathNode("./model/resolution", ctxt)) && + if ((res_node =3D virXPathNode("./resolution", ctxt)) && (def->res =3D virDomainVideoResolutionDefParseXML(res_node)) =3D= =3D NULL) - return NULL; + return -1; =20 - if ((driver =3D virXPathNode("./driver", ctxt))) { - if (virXMLPropEnum(driver, "name", - virDomainVideoBackendTypeFromString, - VIR_XML_PROP_NONZERO, &def->backend) < 0) - return NULL; - if (virDomainVirtioOptionsParseXML(driver, &def->virtio) < 0) - return NULL; - } =20 - if ((type =3D virXPathString("string(./model/@type)", ctxt))) { + + if ((type =3D virXPathString("string(./@type)", ctxt))) { if ((def->type =3D virDomainVideoTypeFromString(type)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unknown video model '%s'"), type); - return NULL; + return -1; } } else { def->type =3D VIR_DOMAIN_VIDEO_TYPE_DEFAULT; } =20 - if ((ram =3D virXPathString("string(./model/@ram)", ctxt))) { + if ((ram =3D virXPathString("string(./@ram)", ctxt))) { if (virStrToLong_uip(ram, NULL, 10, &def->ram) < 0) { virReportError(VIR_ERR_XML_ERROR, _("cannot parse video ram '%s'"), ram); - return NULL; + return -1; } } =20 - if ((vram =3D virXPathString("string(./model/@vram)", ctxt))) { + if ((vram =3D virXPathString("string(./@vram)", ctxt))) { if (virStrToLong_uip(vram, NULL, 10, &def->vram) < 0) { virReportError(VIR_ERR_XML_ERROR, _("cannot parse video vram '%s'"), vram); - return NULL; + return -1; } } =20 - if ((vram64 =3D virXPathString("string(./model/@vram64)", ctxt))) { + if ((vram64 =3D virXPathString("string(./@vram64)", ctxt))) { if (virStrToLong_uip(vram64, NULL, 10, &def->vram64) < 0) { virReportError(VIR_ERR_XML_ERROR, _("cannot parse video vram64 '%s'"), vram64); - return NULL; + return -1; } } =20 - if ((vgamem =3D virXPathString("string(./model/@vgamem)", ctxt))) { + if ((vgamem =3D virXPathString("string(./@vgamem)", ctxt))) { if (virStrToLong_uip(vgamem, NULL, 10, &def->vgamem) < 0) { virReportError(VIR_ERR_XML_ERROR, _("cannot parse video vgamem '%s'"), vgamem); - return NULL; + return -1; } } =20 - if ((heads =3D virXPathString("string(./model/@heads)", ctxt))) { + if ((heads =3D virXPathString("string(./@heads)", ctxt))) { if (virStrToLong_uip(heads, NULL, 10, &def->heads) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot parse video heads '%s'"), heads); - return NULL; + return -1; } } =20 + return 0; +} + +static virDomainVideoDef * +virDomainVideoDefParseXML(virDomainXMLOption *xmlopt, + xmlNodePtr node, + xmlXPathContextPtr ctxt, + unsigned int flags) +{ + g_autoptr(virDomainVideoDef) def =3D NULL; + xmlNodePtr driver; + xmlNodePtr model; + + VIR_XPATH_NODE_AUTORESTORE(ctxt) + + if (!(def =3D virDomainVideoDefNew(xmlopt))) + return NULL; + + ctxt->node =3D node; + + if ((model =3D virXPathNode("./model", ctxt))) { + if (virDomainVideoModelDefParseXML(def, model, ctxt) < 0) + return NULL; + } else { + def->type =3D VIR_DOMAIN_VIDEO_TYPE_DEFAULT; + } + + if ((driver =3D virXPathNode("./driver", ctxt))) { + if (virXMLPropEnum(driver, "name", + virDomainVideoBackendTypeFromString, + VIR_XML_PROP_NONZERO, &def->backend) < 0) + return NULL; + if (virDomainVirtioOptionsParseXML(driver, &def->virtio) < 0) + return NULL; + } + if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &def->info, flags)= < 0) return NULL; =20 --=20 2.34.1 From nobody Wed May 15 01:13:23 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=1644527621; cv=none; d=zohomail.com; s=zohoarc; b=YsS7sEmT9/RgnK8C7RgbYda1bOYZM4OvILTIJiGeooYfUv2+cwE+D29h4pexJBx39jKq8n/7uRWLJRRPVLPeTDUdXKBV7jGsKnUgL+s3Mr+NMzKqo3ssoR8Dw6i3kT0hTiC5ZtYqau/g82I6hs8d6MaxqQ2O+vpnrd0exjPxSNs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644527621; h=Content-Type:Content-Transfer-Encoding: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=wcdprZzgo2170PXBfGNRNXqOYDxJAwjlUVmcBZAs7Lg=; b=VBDqvrVGNHo0HokApzphnutYAtl4bhIy0aCxCtubk9ud7AcASgCPlYD5rANy+vVRrKSRbWbIMNGkOaAl0boIB5u3xuDdKKqexaD3EFxYon2lumLv4rfDm4BcIOKjXzb3nuBJAN+WQGp/khRbevCs8n9PPV0G52Nt+4tOLBL2hYA= 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) 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 164452762108654.939690580021875; Thu, 10 Feb 2022 13:13:41 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-256-EZcvLt7HOAKnjnsMIia5Qw-1; Thu, 10 Feb 2022 16:13:38 -0500 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 17A181091DA1; Thu, 10 Feb 2022 21:13:33 +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 E9D39E2DF; Thu, 10 Feb 2022 21:13: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 C37EE1809CB9; Thu, 10 Feb 2022 21:13:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21ALDTBA009452 for ; Thu, 10 Feb 2022 16:13:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3BE17101E818; Thu, 10 Feb 2022 21:13:29 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.19.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E2C19101E7E1 for ; Thu, 10 Feb 2022 21:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644527620; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=wcdprZzgo2170PXBfGNRNXqOYDxJAwjlUVmcBZAs7Lg=; b=c9RjfgG3/c+omPRdVdLEEIcs9csc3eUHFxgywBepkB37LMI+mLLy0xONXABO3aDJK2LUXY 3ONYBxbUiqfpkOypv9FTIjGjXTY4NHHEVt5skQdDR1q+9/mx0Bl2aX/u3TmKfJIfIgoYy9 Cq6HqRNcHfzZ+6LRqtiZMxBdC1DQyi0= X-MC-Unique: EZcvLt7HOAKnjnsMIia5Qw-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 2/4] conf: switch to virXMLProp* functions Date: Thu, 10 Feb 2022 15:13:24 -0600 Message-Id: <20220210211326.2577126-3-jjongsma@redhat.com> In-Reply-To: <20220210211326.2577126-1-jjongsma@redhat.com> References: <20220210211326.2577126-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644527622274100003 Content-Type: text/plain; charset="utf-8" In virDomainVideoModelDefParseXML(), use the virXMLProp* functions rather than reimplementing them with virXPath* functions. Signed-off-by: Jonathon Jongsma --- src/conf/domain_conf.c | 78 +++++++++++++----------------------------- 1 file changed, 23 insertions(+), 55 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 25771dde15..547a39c0bb 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14074,19 +14074,15 @@ virDomainVideoModelDefParseXML(virDomainVideoDef = *def, { xmlNodePtr accel_node; xmlNodePtr res_node; - g_autofree char *type =3D NULL; - g_autofree char *heads =3D NULL; - g_autofree char *vram =3D NULL; - g_autofree char *vram64 =3D NULL; - g_autofree char *ram =3D NULL; - g_autofree char *vgamem =3D NULL; - g_autofree char *primary =3D NULL; + virDomainVideoType type; + virTristateBool primary; + int rc =3D 0; =20 VIR_XPATH_NODE_AUTORESTORE(ctxt); ctxt->node =3D node; =20 - if ((primary =3D virXPathString("string(./@primary)", ctxt)) !=3D NULL) - ignore_value(virStringParseYesNo(primary, &def->primary)); + if (virXMLPropTristateBool(node, "primary", VIR_XML_PROP_NONE, &primar= y) >=3D 0) + def->primary =3D (primary =3D=3D VIR_TRISTATE_BOOL_YES); =20 if ((accel_node =3D virXPathNode("./acceleration", ctxt)) && (def->accel =3D virDomainVideoAccelDefParseXML(accel_node)) =3D=3D= NULL) @@ -14096,57 +14092,29 @@ virDomainVideoModelDefParseXML(virDomainVideoDef = *def, (def->res =3D virDomainVideoResolutionDefParseXML(res_node)) =3D= =3D NULL) return -1; =20 + if (virXMLPropEnumDefault(node, "type", + virDomainVideoTypeFromString, + VIR_XML_PROP_NONE, &type, + VIR_DOMAIN_VIDEO_TYPE_DEFAULT) < 0) + return -1; + def->type =3D type; =20 + if (virXMLPropUInt(node, "ram", 10, VIR_XML_PROP_NONE, &def->ram) < 0) + return -1; =20 - if ((type =3D virXPathString("string(./@type)", ctxt))) { - if ((def->type =3D virDomainVideoTypeFromString(type)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown video model '%s'"), type); - return -1; - } - } else { - def->type =3D VIR_DOMAIN_VIDEO_TYPE_DEFAULT; - } - - if ((ram =3D virXPathString("string(./@ram)", ctxt))) { - if (virStrToLong_uip(ram, NULL, 10, &def->ram) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("cannot parse video ram '%s'"), ram); - return -1; - } - } - - if ((vram =3D virXPathString("string(./@vram)", ctxt))) { - if (virStrToLong_uip(vram, NULL, 10, &def->vram) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("cannot parse video vram '%s'"), vram); - return -1; - } - } + if (virXMLPropUInt(node, "vram", 10, VIR_XML_PROP_NONE, &def->vram) < = 0) + return -1; =20 - if ((vram64 =3D virXPathString("string(./@vram64)", ctxt))) { - if (virStrToLong_uip(vram64, NULL, 10, &def->vram64) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("cannot parse video vram64 '%s'"), vram64); - return -1; - } - } + if (virXMLPropUInt(node, "vram64", 10, VIR_XML_PROP_NONE, &def->vram64= ) < 0) + return -1; =20 - if ((vgamem =3D virXPathString("string(./@vgamem)", ctxt))) { - if (virStrToLong_uip(vgamem, NULL, 10, &def->vgamem) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("cannot parse video vgamem '%s'"), vgamem); - return -1; - } - } + if (virXMLPropUInt(node, "vgamem", 10, VIR_XML_PROP_NONE, &def->vgamem= ) < 0) + return -1; =20 - if ((heads =3D virXPathString("string(./@heads)", ctxt))) { - if (virStrToLong_uip(heads, NULL, 10, &def->heads) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse video heads '%s'"), heads); - return -1; - } - } + if ((rc =3D virXMLPropUInt(node, "heads", 10, VIR_XML_PROP_NONE, &def-= >heads)) < 0) + return -1; + else if (rc =3D=3D 0) + def->heads =3D 1; =20 return 0; } --=20 2.34.1 From nobody Wed May 15 01:13:23 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=1644527636; cv=none; d=zohomail.com; s=zohoarc; b=X1J2AhK5vVd5zxi3LI6Nat/EuXRA0Qj2QbK8d+OJkUfckkhBnbcqcPKeKBW+hq/BDYH00bA/TIvHTtKxFMfs/ZnCviZaOXFrZeoBR+9XDHotitcNBaR2NGGFKdyMp28icy+1lF/VtsEWv7SUzmzPsM69q+j26PSnSQ/+VtCP+uM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644527636; h=Content-Type:Content-Transfer-Encoding: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=iYQnuAkAXrIKHqVx0+/a8JhGl+fJ+WwkixMq3pL+L8s=; b=AJL03qhgTGTx1BGQK4tyEEqB5aTWYY/YRF3WGoK653IS5+iIlIygZI8rPbqpc40f5MuZGzNBrbfrc4bXCHxyrGP+mf7G5VDtPKfv283UgpU2D2wYCMfBmB5dii/bKnv+oM/XJHSb2AqZqXHj9/hSNFOUtQFJXTklRM8E/ys7vzQ= 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) 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 1644527636226318.76665051722523; Thu, 10 Feb 2022 13:13:56 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-580-nYWCkQOSO1CTKT7DH5yo2w-1; Thu, 10 Feb 2022 16:13:50 -0500 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 ACFF683DD23; Thu, 10 Feb 2022 21:13: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 8C9184E2B2; Thu, 10 Feb 2022 21:13: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 5C3351809CBA; Thu, 10 Feb 2022 21:13:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21ALDTDF009464 for ; Thu, 10 Feb 2022 16:13:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id B8C9F101E818; Thu, 10 Feb 2022 21:13:29 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.19.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6EB01101E7E1 for ; Thu, 10 Feb 2022 21:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644527633; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=iYQnuAkAXrIKHqVx0+/a8JhGl+fJ+WwkixMq3pL+L8s=; b=hPdhNmTjBHhdV3Fhnqg/kJPYggRgoMKQmdZfo8nj88X+LDBsJRDT9eFjBuDVAm3yyPHhBW yu2rg14IjNy7X/RklUNalj23kzKNH9QvuJERlUvoZgyrcqBiXLZuvoP/8ty7GrU9KbpnhO CVsdFKVD5Xz3hPTF8UNUW3EfGvoAYNI= X-MC-Unique: nYWCkQOSO1CTKT7DH5yo2w-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 3/4] conf: use enum variable for video type Date: Thu, 10 Feb 2022 15:13:25 -0600 Message-Id: <20220210211326.2577126-4-jjongsma@redhat.com> In-Reply-To: <20220210211326.2577126-1-jjongsma@redhat.com> References: <20220210211326.2577126-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1644527639097100005 Content-Type: text/plain; charset="utf-8" Rather than storing the video type as an integer, use the proper enum type within the struct. Signed-off-by: Jonathon Jongsma --- src/conf/domain_conf.c | 4 +--- src/conf/domain_conf.h | 2 +- src/libxl/libxl_conf.c | 10 ++++++++++ src/libxl/libxl_domain.c | 11 +++++++++++ src/qemu/qemu_monitor_json.c | 16 +++++++++++++++- src/qemu/qemu_process.c | 7 +++++++ 6 files changed, 45 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 547a39c0bb..3d25d4f184 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14074,7 +14074,6 @@ virDomainVideoModelDefParseXML(virDomainVideoDef *d= ef, { xmlNodePtr accel_node; xmlNodePtr res_node; - virDomainVideoType type; virTristateBool primary; int rc =3D 0; =20 @@ -14094,10 +14093,9 @@ virDomainVideoModelDefParseXML(virDomainVideoDef *= def, =20 if (virXMLPropEnumDefault(node, "type", virDomainVideoTypeFromString, - VIR_XML_PROP_NONE, &type, + VIR_XML_PROP_NONE, &def->type, VIR_DOMAIN_VIDEO_TYPE_DEFAULT) < 0) return -1; - def->type =3D type; =20 if (virXMLPropUInt(node, "ram", 10, VIR_XML_PROP_NONE, &def->ram) < 0) return -1; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b2922e8cff..46e5c6b7c7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1727,7 +1727,7 @@ struct _virDomainVideoDriverDef { struct _virDomainVideoDef { virObject *privateData; =20 - int type; /* enum virDomainVideoType */ + virDomainVideoType type; unsigned int ram; /* kibibytes (multiples of 1024) */ unsigned int vram; /* kibibytes (multiples of 1024) */ unsigned int vram64; /* kibibytes (multiples of 1024) */ diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index f062f8e958..8d6d1c5b7b 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -2368,6 +2368,16 @@ libxlMakeVideo(virDomainDef *def, libxl_domain_confi= g *d_config) } break; =20 + case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: + case VIR_DOMAIN_VIDEO_TYPE_VMVGA: + case VIR_DOMAIN_VIDEO_TYPE_VBOX: + case VIR_DOMAIN_VIDEO_TYPE_PARALLELS: + case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: + case VIR_DOMAIN_VIDEO_TYPE_GOP: + case VIR_DOMAIN_VIDEO_TYPE_NONE: + case VIR_DOMAIN_VIDEO_TYPE_BOCHS: + case VIR_DOMAIN_VIDEO_TYPE_RAMFB: + case VIR_DOMAIN_VIDEO_TYPE_LAST: default: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("video type %s is not supported by libxl"), diff --git a/src/libxl/libxl_domain.c b/src/libxl/libxl_domain.c index b995f20a64..f6b09f9824 100644 --- a/src/libxl/libxl_domain.c +++ b/src/libxl/libxl_domain.c @@ -331,6 +331,17 @@ libxlDomainDeviceDefPostParse(virDomainDeviceDef *dev, if (dev->data.video->vram =3D=3D 0) dev->data.video->vram =3D 128 * 1024; break; + case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: + case VIR_DOMAIN_VIDEO_TYPE_VMVGA: + case VIR_DOMAIN_VIDEO_TYPE_VBOX: + case VIR_DOMAIN_VIDEO_TYPE_PARALLELS: + case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: + case VIR_DOMAIN_VIDEO_TYPE_GOP: + case VIR_DOMAIN_VIDEO_TYPE_NONE: + case VIR_DOMAIN_VIDEO_TYPE_BOCHS: + case VIR_DOMAIN_VIDEO_TYPE_RAMFB: + case VIR_DOMAIN_VIDEO_TYPE_LAST: + break; } } } diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 8e1501d91f..6827ab4e4f 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1918,9 +1918,16 @@ qemuMonitorJSONUpdateVideoMemorySize(qemuMonitor *mo= n, } video->vram =3D prop.val.ul * 1024; break; + case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: case VIR_DOMAIN_VIDEO_TYPE_CIRRUS: case VIR_DOMAIN_VIDEO_TYPE_XEN: case VIR_DOMAIN_VIDEO_TYPE_VBOX: + case VIR_DOMAIN_VIDEO_TYPE_PARALLELS: + case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: + case VIR_DOMAIN_VIDEO_TYPE_GOP: + case VIR_DOMAIN_VIDEO_TYPE_NONE: + case VIR_DOMAIN_VIDEO_TYPE_BOCHS: + case VIR_DOMAIN_VIDEO_TYPE_RAMFB: case VIR_DOMAIN_VIDEO_TYPE_LAST: break; } @@ -1958,11 +1965,18 @@ qemuMonitorJSONUpdateVideoVram64Size(qemuMonitor *m= on, video->vram64 =3D prop.val.ul * 1024; } break; + case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: case VIR_DOMAIN_VIDEO_TYPE_VGA: - case VIR_DOMAIN_VIDEO_TYPE_VMVGA: case VIR_DOMAIN_VIDEO_TYPE_CIRRUS: + case VIR_DOMAIN_VIDEO_TYPE_VMVGA: case VIR_DOMAIN_VIDEO_TYPE_XEN: case VIR_DOMAIN_VIDEO_TYPE_VBOX: + case VIR_DOMAIN_VIDEO_TYPE_PARALLELS: + case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: + case VIR_DOMAIN_VIDEO_TYPE_GOP: + case VIR_DOMAIN_VIDEO_TYPE_NONE: + case VIR_DOMAIN_VIDEO_TYPE_BOCHS: + case VIR_DOMAIN_VIDEO_TYPE_RAMFB: case VIR_DOMAIN_VIDEO_TYPE_LAST: break; } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 24873f6fb7..b56ef9fe70 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3092,9 +3092,16 @@ qemuProcessUpdateVideoRamSize(virQEMUDriver *driver, goto error; } break; + case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: case VIR_DOMAIN_VIDEO_TYPE_CIRRUS: case VIR_DOMAIN_VIDEO_TYPE_XEN: case VIR_DOMAIN_VIDEO_TYPE_VBOX: + case VIR_DOMAIN_VIDEO_TYPE_PARALLELS: + case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: + case VIR_DOMAIN_VIDEO_TYPE_GOP: + case VIR_DOMAIN_VIDEO_TYPE_NONE: + case VIR_DOMAIN_VIDEO_TYPE_BOCHS: + case VIR_DOMAIN_VIDEO_TYPE_RAMFB: case VIR_DOMAIN_VIDEO_TYPE_LAST: break; } --=20 2.34.1 From nobody Wed May 15 01:13:23 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1644527636; cv=none; d=zohomail.com; s=zohoarc; b=F4Kr4Q/VMqKq9jJWbrveZxbtr3oHaJ+hnfcus6/SPse1Vd6Q6PPbcUakX/R7WR55YrGZmO19VEMBdhTPnyk31qamGQuhJJJlu1rARQ1/+H7apUZUayi99g9jFQv6M/ERt6WfWAvll9E3PNTUqio9YenKMpFWvPvJzUhXMq9dBSE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644527636; h=Content-Type:Content-Transfer-Encoding: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=1MHYs+rWLpzAWjLj0s71YwPNSyLEI1UDRihBdDld4CY=; b=kshvfn3MsTj4uNFwO+rRMuplB1utDxeKC/HQZq+qLtYBdc/xznn+3Ne/J+shTiyPC7FdTGkuKbOEAkC/GoOGiEltxqukxXJWwDxp2+I1BnzvkhW4j6vb/D8zPK8bSO2NTdbYGEaYexhxclN/oc2//3b8dhnaVaXPwxdR9ZeBpfE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1644527636474864.9169414167642; Thu, 10 Feb 2022 13:13:56 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-639-WDTkkWkENMy_Yi1SsNZpBQ-1; Thu, 10 Feb 2022 16:13:53 -0500 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 74E174686B; Thu, 10 Feb 2022 21:13: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 5618C452E9; Thu, 10 Feb 2022 21:13: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 28C0918077BC; Thu, 10 Feb 2022 21:13:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21ALDUAN009472 for ; Thu, 10 Feb 2022 16:13:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6E819101E818; Thu, 10 Feb 2022 21:13:30 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.19.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E99F0101E7E1 for ; Thu, 10 Feb 2022 21:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644527635; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=1MHYs+rWLpzAWjLj0s71YwPNSyLEI1UDRihBdDld4CY=; b=OIDenEtwnD9NvlIaxsefSfZLPHjsezSpQZiuEwaLxqa2Gk0DXr8RcyR52iH0to+61daZcT DZLdq30JQ1aaAlWZOY0F8rfdFOZmX71icHOiV+6CifkwhcIbmDkfSYKRslV7JEUSJb/VYU nTmNfZ8fpn909fsiHH82HecclOUDA8o= X-MC-Unique: WDTkkWkENMy_Yi1SsNZpBQ-1 From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH 4/4] conf: add support for 'blob' in virtio-vga/virtio-gpu Date: Thu, 10 Feb 2022 15:13:26 -0600 Message-Id: <20220210211326.2577126-5-jjongsma@redhat.com> In-Reply-To: <20220210211326.2577126-1-jjongsma@redhat.com> References: <20220210211326.2577126-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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) X-ZM-MESSAGEID: 1644527638815100003 Content-Type: text/plain; charset="utf-8" Add the ability to specify the 'blob=3Don/off' option to qemu for the virtio-vga/virtio-gpu device. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2032406 Signed-off-by: Jonathon Jongsma --- docs/schemas/domaincommon.rng | 5 +++ src/conf/domain_conf.c | 6 +++ src/conf/domain_conf.h | 1 + src/conf/domain_validate.c | 13 ++++-- src/qemu/qemu_command.c | 3 ++ .../video-virtio-blob-absent.args | 34 +++++++++++++++ .../video-virtio-blob-absent.xml | 33 +++++++++++++++ .../video-virtio-blob-off.args | 34 +++++++++++++++ .../video-virtio-blob-off.xml | 33 +++++++++++++++ .../video-virtio-blob-on.args | 34 +++++++++++++++ .../qemuxml2argvdata/video-virtio-blob-on.xml | 33 +++++++++++++++ .../video-virtio-vga-blob-on.args | 34 +++++++++++++++ .../video-virtio-vga-blob-on.xml | 33 +++++++++++++++ tests/qemuxml2argvtest.c | 9 ++++ .../video-virtio-blob-absent.xml | 41 +++++++++++++++++++ .../video-virtio-blob-off.xml | 41 +++++++++++++++++++ .../video-virtio-blob-on.xml | 41 +++++++++++++++++++ .../video-virtio-vga-blob-on.xml | 41 +++++++++++++++++++ tests/qemuxml2xmltest.c | 9 ++++ 19 files changed, 475 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/video-virtio-blob-absent.args create mode 100644 tests/qemuxml2argvdata/video-virtio-blob-absent.xml create mode 100644 tests/qemuxml2argvdata/video-virtio-blob-off.args create mode 100644 tests/qemuxml2argvdata/video-virtio-blob-off.xml create mode 100644 tests/qemuxml2argvdata/video-virtio-blob-on.args create mode 100644 tests/qemuxml2argvdata/video-virtio-blob-on.xml create mode 100644 tests/qemuxml2argvdata/video-virtio-vga-blob-on.args create mode 100644 tests/qemuxml2argvdata/video-virtio-vga-blob-on.xml create mode 100644 tests/qemuxml2xmloutdata/video-virtio-blob-absent.xml create mode 100644 tests/qemuxml2xmloutdata/video-virtio-blob-off.xml create mode 100644 tests/qemuxml2xmloutdata/video-virtio-blob-on.xml create mode 100644 tests/qemuxml2xmloutdata/video-virtio-vga-blob-on.xml diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 964b0c9e2f..372376820a 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4191,6 +4191,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3d25d4f184..6a0b7e773b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -14114,6 +14114,9 @@ virDomainVideoModelDefParseXML(virDomainVideoDef *d= ef, else if (rc =3D=3D 0) def->heads =3D 1; =20 + if (virXMLPropTristateSwitch(node, "blob", VIR_XML_PROP_NONE, &def->bl= ob) < 0) + return -1; + return 0; } =20 @@ -26000,6 +26003,9 @@ virDomainVideoDefFormat(virBuffer *buf, virBufferAsprintf(buf, " heads=3D'%u'", def->heads); if (def->primary) virBufferAddLit(buf, " primary=3D'yes'"); + if (def->blob !=3D VIR_TRISTATE_SWITCH_ABSENT) + virBufferAsprintf(buf, " blob=3D'%s'", + virTristateSwitchTypeToString(def->blob)); if (def->accel || def->res) { virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 46e5c6b7c7..49bb420882 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1736,6 +1736,7 @@ struct _virDomainVideoDef { bool primary; virDomainVideoAccelDef *accel; virDomainVideoResolutionDef *res; + virTristateSwitch blob; virDomainVideoDriverDef *driver; virDomainDeviceInfo info; virDomainVirtioOptions *virtio; diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index f0b8aa2655..9384c5afbb 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -226,9 +226,16 @@ virDomainVideoDefValidate(const virDomainVideoDef *vid= eo, } } =20 - if (video->type !=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && - (virDomainCheckVirtioOptionsAreAbsent(video->virtio) < 0)) - return -1; + if (video->type !=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO) { + if (virDomainCheckVirtioOptionsAreAbsent(video->virtio) < 0) + return -1; + if (video->blob !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("video type '%s' doesn't support blob"), + virDomainVideoTypeToString(video->type)); + return -1; + } + } =20 return 0; } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 9713467aa8..a936c3eaae 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4960,6 +4960,9 @@ qemuBuildDeviceVideoCmd(virCommand *cmd, "p:vgamem", video->vram * 1024, NULL) < 0) return -1; + } else if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO) { + if (virJSONValueObjectAdd(&props, "T:blob", video->blob, NULL) < 0) + return -1; } =20 if (video->res) { diff --git a/tests/qemuxml2argvdata/video-virtio-blob-absent.args b/tests/q= emuxml2argvdata/video-virtio-blob-absent.args new file mode 100644 index 0000000000..36a5b9bba8 --- /dev/null +++ b/tests/qemuxml2argvdata/video-virtio-blob-absent.args @@ -0,0 +1,34 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i386 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,file=3D/tmp/lib/domain--1-QEMU= Guest1/master-key.aes \ +-machine pc,usb=3Doff,dump-guest-core=3Doff \ +-accel tcg \ +-m 1024 \ +-realtime mlock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-usb \ +-drive file=3D/var/lib/libvirt/images/QEMUGuest1,format=3Dqcow2,if=3Dnone,= id=3Ddrive-ide0-0-0,cache=3Dnone \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ +-device virtio-gpu-pci,id=3Dvideo0,max_outputs=3D1,bus=3Dpci.0,addr=3D0x2 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/video-virtio-blob-absent.xml b/tests/qe= muxml2argvdata/video-virtio-blob-absent.xml new file mode 100644 index 0000000000..a9354d77a2 --- /dev/null +++ b/tests/qemuxml2argvdata/video-virtio-blob-absent.xml @@ -0,0 +1,33 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1048576 + 1048576 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i386 + + + + +
+ + + + + + + + + + diff --git a/tests/qemuxml2argvdata/video-virtio-blob-off.args b/tests/qemu= xml2argvdata/video-virtio-blob-off.args new file mode 100644 index 0000000000..eadae278ce --- /dev/null +++ b/tests/qemuxml2argvdata/video-virtio-blob-off.args @@ -0,0 +1,34 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i386 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,file=3D/tmp/lib/domain--1-QEMU= Guest1/master-key.aes \ +-machine pc,usb=3Doff,dump-guest-core=3Doff \ +-accel tcg \ +-m 1024 \ +-realtime mlock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-usb \ +-drive file=3D/var/lib/libvirt/images/QEMUGuest1,format=3Dqcow2,if=3Dnone,= id=3Ddrive-ide0-0-0,cache=3Dnone \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ +-device virtio-gpu-pci,id=3Dvideo0,max_outputs=3D1,blob=3Doff,bus=3Dpci.0,= addr=3D0x2 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/video-virtio-blob-off.xml b/tests/qemux= ml2argvdata/video-virtio-blob-off.xml new file mode 100644 index 0000000000..7b51762e9a --- /dev/null +++ b/tests/qemuxml2argvdata/video-virtio-blob-off.xml @@ -0,0 +1,33 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1048576 + 1048576 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i386 + + + + +
+ + + + + + + + + + diff --git a/tests/qemuxml2argvdata/video-virtio-blob-on.args b/tests/qemux= ml2argvdata/video-virtio-blob-on.args new file mode 100644 index 0000000000..6fbb0d5bb2 --- /dev/null +++ b/tests/qemuxml2argvdata/video-virtio-blob-on.args @@ -0,0 +1,34 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i386 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,file=3D/tmp/lib/domain--1-QEMU= Guest1/master-key.aes \ +-machine pc,usb=3Doff,dump-guest-core=3Doff \ +-accel tcg \ +-m 1024 \ +-realtime mlock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-usb \ +-drive file=3D/var/lib/libvirt/images/QEMUGuest1,format=3Dqcow2,if=3Dnone,= id=3Ddrive-ide0-0-0,cache=3Dnone \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ +-device virtio-gpu-pci,id=3Dvideo0,max_outputs=3D1,blob=3Don,bus=3Dpci.0,a= ddr=3D0x2 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/video-virtio-blob-on.xml b/tests/qemuxm= l2argvdata/video-virtio-blob-on.xml new file mode 100644 index 0000000000..187347fac0 --- /dev/null +++ b/tests/qemuxml2argvdata/video-virtio-blob-on.xml @@ -0,0 +1,33 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1048576 + 1048576 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i386 + + + + +
+ + + + + + + + + + diff --git a/tests/qemuxml2argvdata/video-virtio-vga-blob-on.args b/tests/q= emuxml2argvdata/video-virtio-vga-blob-on.args new file mode 100644 index 0000000000..8b7085e1a3 --- /dev/null +++ b/tests/qemuxml2argvdata/video-virtio-vga-blob-on.args @@ -0,0 +1,34 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i386 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,file=3D/tmp/lib/domain--1-QEMU= Guest1/master-key.aes \ +-machine pc,usb=3Doff,dump-guest-core=3Doff \ +-accel tcg \ +-m 1024 \ +-realtime mlock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,server=3Don,wait=3Doff \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-usb \ +-drive file=3D/var/lib/libvirt/images/QEMUGuest1,format=3Dqcow2,if=3Dnone,= id=3Ddrive-ide0-0-0,cache=3Dnone \ +-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b= ootindex=3D1 \ +-device virtio-vga,id=3Dvideo0,max_outputs=3D1,blob=3Don,bus=3Dpci.0,addr= =3D0x2 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/video-virtio-vga-blob-on.xml b/tests/qe= muxml2argvdata/video-virtio-vga-blob-on.xml new file mode 100644 index 0000000000..00aed31d28 --- /dev/null +++ b/tests/qemuxml2argvdata/video-virtio-vga-blob-on.xml @@ -0,0 +1,33 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1048576 + 1048576 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i386 + + + + +
+ + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 6cf35a0ebf..7c0ba970af 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2532,6 +2532,15 @@ mymain(void) DO_TEST("video-virtio-vga", QEMU_CAPS_DEVICE_VIRTIO_GPU, QEMU_CAPS_DEVICE_VIRTIO_VGA); + DO_TEST("video-virtio-blob-on", + QEMU_CAPS_DEVICE_VIRTIO_GPU); + DO_TEST("video-virtio-vga-blob-on", + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIRTIO_VGA); + DO_TEST("video-virtio-blob-off", + QEMU_CAPS_DEVICE_VIRTIO_GPU); + DO_TEST("video-virtio-blob-absent", + QEMU_CAPS_DEVICE_VIRTIO_GPU); DO_TEST_CAPS_LATEST("video-virtio-vga-gpu-gl"); DO_TEST_CAPS_LATEST("video-bochs-display-device"); DO_TEST_CAPS_LATEST("video-ramfb-display-device"); diff --git a/tests/qemuxml2xmloutdata/video-virtio-blob-absent.xml b/tests/= qemuxml2xmloutdata/video-virtio-blob-absent.xml new file mode 100644 index 0000000000..827ed19153 --- /dev/null +++ b/tests/qemuxml2xmloutdata/video-virtio-blob-absent.xml @@ -0,0 +1,41 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1048576 + 1048576 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i386 + + + + +
+ + +
+ + +
+ + + + +