[libvirt] [PATCH 2/4] conf: Adding XML support for 'xres' and 'yres'
Han Han
hhan at redhat.com
Mon Aug 5 02:38:23 UTC 2019
On Mon, Aug 5, 2019 at 9:25 AM <jcfaracco at gmail.com> wrote:
> From: Julio Faracco <jcfaracco at gmail.com>
>
> XML need to support both properties together. This commit adds XML
> support for QXL model if they are set. Domain configuration is able to
> parse this properties.
>
> Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
> ---
> src/conf/domain_conf.c | 26 ++++++++++++++++++++++++++
> src/conf/domain_conf.h | 2 ++
> 2 files changed, 28 insertions(+)
>
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 441eb1a5a2..120c6ccf5f 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -15360,6 +15360,8 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr
> xmlopt,
> VIR_AUTOFREE(char *) ram = NULL;
> VIR_AUTOFREE(char *) vgamem = NULL;
> VIR_AUTOFREE(char *) primary = NULL;
> + VIR_AUTOFREE(char *) xres = NULL;
> + VIR_AUTOFREE(char *) yres = NULL;
>
> if (!(def = virDomainVideoDefNew()))
> return NULL;
> @@ -15377,6 +15379,8 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr
> xmlopt,
> vram64 = virXMLPropString(cur, "vram64");
> vgamem = virXMLPropString(cur, "vgamem");
> heads = virXMLPropString(cur, "heads");
> + xres = virXMLPropString(cur, "xres");
> + yres = virXMLPropString(cur, "yres");
>
> if ((primary = virXMLPropString(cur, "primary")) != NULL)
> {
> if (STREQ(primary, "yes"))
> @@ -15459,6 +15463,24 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr
> xmlopt,
> }
> }
>
> + if (xres && yres) {
> + if (def->type != VIR_DOMAIN_VIDEO_TYPE_QXL) {
> + virReportError(VIR_ERR_XML_ERROR, "%s",
> + _("xres and yres attribute only supported for
> type of qxl"));
>
The error msg is not right here. Not only qxl type support xres&yres, bus
also VGA, virtio, bochs types.
How about a write a general function for qemu hypervisor driver to verify
if a video type support xres&yres,
and then add xres&yres attribute to all the supported video types?
BTW, there is a bug to track this feature:
https://bugzilla.redhat.com/show_bug.cgi?id=1485793
Please mention the bug in your commit msg. Thank you
> + goto error;
> + }
> + if (virStrToLong_uip(xres, NULL, 10, &def->xres) < 0) {
> + virReportError(VIR_ERR_XML_ERROR,
> + _("cannot parse video xres '%s'"), xres);
> + goto error;
> + }
> + if (virStrToLong_uip(yres, NULL, 10, &def->yres) < 0) {
> + virReportError(VIR_ERR_XML_ERROR,
> + _("cannot parse video yres '%s'"), yres);
> + goto error;
> + }
> + }
> +
> if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0)
> goto error;
>
> @@ -26427,6 +26449,10 @@ virDomainVideoDefFormat(virBufferPtr buf,
> virBufferAsprintf(buf, " vgamem='%u'", def->vgamem);
> if (def->heads)
> virBufferAsprintf(buf, " heads='%u'", def->heads);
> + if (def->xres)
> + virBufferAsprintf(buf, " xres='%u'", def->xres);
> + if (def->yres)
> + virBufferAsprintf(buf, " yres='%u'", def->yres);
> if (def->primary)
> virBufferAddLit(buf, " primary='yes'");
> if (def->accel) {
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 8a4425df64..bfee86efcf 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -1419,6 +1419,8 @@ struct _virDomainVideoDef {
> unsigned int vram64; /* kibibytes (multiples of 1024) */
> unsigned int vgamem; /* kibibytes (multiples of 1024) */
> unsigned int heads;
> + unsigned int xres;
> + unsigned int yres;
> bool primary;
> virDomainVideoAccelDefPtr accel;
> virDomainVideoDriverDefPtr driver;
> --
> 2.20.1
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>
--
Best regards,
-----------------------------------
Han Han
Quality Engineer
Redhat.
Email: hhan at redhat.com
Phone: +861065339333
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190805/69de64f1/attachment-0001.htm>
More information about the libvir-list
mailing list