From nobody Wed Apr 24 03:37:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1498675789282340.19773544713246; Wed, 28 Jun 2017 11:49:49 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 30D15883B1; Wed, 28 Jun 2017 18:49:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B1AB6183A8; Wed, 28 Jun 2017 18:49: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 8CF693FADE; Wed, 28 Jun 2017 18:49:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5SIngrn031241 for ; Wed, 28 Jun 2017 14:49:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 19F1B173A7; Wed, 28 Jun 2017 18:49:42 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-116-174.phx2.redhat.com [10.3.116.174]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7237962930; Wed, 28 Jun 2017 18:49:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 30D15883B1 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 30D15883B1 From: Cole Robinson To: libvir-list@redhat.com Date: Wed, 28 Jun 2017 14:49:27 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/8] qemu: parse: drop redundant video config 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 28 Jun 2017 18:49:47 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The ram/vram =3D 0 bits aren't needed, and PostParse will fill in the needed QXL default Signed-off-by: Cole Robinson Reviewed-by: John Ferlan --- src/qemu/qemu_command.c | 4 ---- src/qemu/qemu_parse_command.c | 11 +---------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c53ab97b9..ebf9c63bc 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7264,10 +7264,6 @@ qemuBuildObsoleteAccelArg(virCommandPtr cmd, } break; =20 - case VIR_DOMAIN_VIRT_XEN: - /* XXX better check for xenner */ - break; - default: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("the QEMU binary does not support %s"), diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index af9063c02..60c81f0ca 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -2608,16 +2608,7 @@ qemuParseCommandLine(virCapsPtr caps, virDomainVideoDefPtr vid; if (VIR_ALLOC(vid) < 0) goto error; - if (def->virtType =3D=3D VIR_DOMAIN_VIRT_XEN) - vid->type =3D VIR_DOMAIN_VIDEO_TYPE_XEN; - else - vid->type =3D video; - if (vid->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_QXL) { - vid->vgamem =3D QEMU_QXL_VGAMEM_DEFAULT; - } else { - vid->ram =3D 0; - vid->vgamem =3D 0; - } + vid->type =3D video; vid->heads =3D 1; =20 if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, vid) < 0) { --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 03:37:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 149867578876477.08923939391445; Wed, 28 Jun 2017 11:49:48 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id E751A4E4CB; Wed, 28 Jun 2017 18:49: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 A303A60462; Wed, 28 Jun 2017 18:49: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 69DA21853E30; Wed, 28 Jun 2017 18:49:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5SIngJv031247 for ; Wed, 28 Jun 2017 14:49:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9BA3F62930; Wed, 28 Jun 2017 18:49:42 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-116-174.phx2.redhat.com [10.3.116.174]) by smtp.corp.redhat.com (Postfix) with ESMTP id 406B75D6A6; Wed, 28 Jun 2017 18:49:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E751A4E4CB Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E751A4E4CB From: Cole Robinson To: libvir-list@redhat.com Date: Wed, 28 Jun 2017 14:49:28 -0400 Message-Id: <139fc7181b50d7909d7ac7f4296f4edaf1f22275.1498675591.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/8] qemu: domain: Move some validation out of DeviceDefPostParse 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 28 Jun 2017 18:49:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" And into DeviceDefValidate which is the expected place Signed-off-by: Cole Robinson Reviewed-by: John Ferlan --- src/qemu/qemu_domain.c | 55 +++++++++++++++++++++++++++-------------------= ---- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 8e7404da6..90f489840 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3191,6 +3191,33 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef= *dev, } } =20 + /* forbid capabilities mode hostdev in this kind of hypervisor */ + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_HOSTDEV && + dev->data.hostdev->mode =3D=3D VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIE= S) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("hostdev mode 'capabilities' is not " + "supported in %s"), + virDomainVirtTypeToString(def->virtType)); + goto cleanup; + } + + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_VIDEO) { + if (dev->data.video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_QXL && + dev->data.video->vgamem) { + if (dev->data.video->vgamem < 1024) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("value for 'vgamem' must be at least 1 Mi= B " + "(1024 KiB)")); + goto cleanup; + } + if (dev->data.video->vgamem !=3D VIR_ROUND_UP_POWER_OF_TWO(dev= ->data.video->vgamem)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("value for 'vgamem' must be power of two"= )); + goto cleanup; + } + } + } + ret =3D 0; cleanup: virObjectUnref(cfg); @@ -3551,31 +3578,9 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr d= ev, goto cleanup; } =20 - /* forbid capabilities mode hostdev in this kind of hypervisor */ - if (dev->type =3D=3D VIR_DOMAIN_DEVICE_HOSTDEV && - dev->data.hostdev->mode =3D=3D VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIE= S) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("hostdev mode 'capabilities' is not " - "supported in %s"), - virDomainVirtTypeToString(def->virtType)); - goto cleanup; - } - - if (dev->type =3D=3D VIR_DOMAIN_DEVICE_VIDEO && - dev->data.video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_QXL) { - if (dev->data.video->vgamem) { - if (dev->data.video->vgamem < 1024) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("value for 'vgamem' must be at least 1 Mi= B " - "(1024 KiB)")); - goto cleanup; - } - if (dev->data.video->vgamem !=3D VIR_ROUND_UP_POWER_OF_TWO(dev= ->data.video->vgamem)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("value for 'vgamem' must be power of two"= )); - goto cleanup; - } - } else { + if (dev->type =3D=3D VIR_DOMAIN_DEVICE_VIDEO) { + if (dev->data.video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_QXL && + !dev->data.video->vgamem) { dev->data.video->vgamem =3D QEMU_QXL_VGAMEM_DEFAULT; } } --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 03:37:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1498675813354847.3823724262019; Wed, 28 Jun 2017 11:50:13 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 8A20561D36; Wed, 28 Jun 2017 18:50:11 +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 4E0C717B73; Wed, 28 Jun 2017 18:50:11 +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 00D1B1853E36; Wed, 28 Jun 2017 18:50:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5SInhFO031254 for ; Wed, 28 Jun 2017 14:49:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 29E82173A7; Wed, 28 Jun 2017 18:49:43 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-116-174.phx2.redhat.com [10.3.116.174]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3A475D6A6; Wed, 28 Jun 2017 18:49:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8A20561D36 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8A20561D36 From: Cole Robinson To: libvir-list@redhat.com Date: Wed, 28 Jun 2017 14:49:29 -0400 Message-Id: <3192e26e04a4415ed01fb1a06b4e07e4ca102dbc.1498675591.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/8] qemu: annotate some VIDEO_TYPE enum switch 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 28 Jun 2017 18:50:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" For the ram/vram monitor wrappers, just add a default: clause... seems like it should be rarely extended so this saves every committer from needing to update For the validation switch, fill in the missing values Signed-off-by: Cole Robinson --- src/qemu/qemu_domain.c | 3 ++- src/qemu/qemu_monitor_json.c | 16 ++++------------ src/qemu/qemu_process.c | 7 ++----- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 90f489840..ac1bc1a1e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2950,10 +2950,11 @@ qemuDomainDefValidateVideo(const virDomainDef *def) for (i =3D 0; i < def->nvideos; i++) { video =3D def->videos[i]; =20 - switch (video->type) { + switch ((virDomainVideoType) video->type) { case VIR_DOMAIN_VIDEO_TYPE_XEN: case VIR_DOMAIN_VIDEO_TYPE_VBOX: case VIR_DOMAIN_VIDEO_TYPE_PARALLELS: + case VIR_DOMAIN_VIDEO_TYPE_GOP: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("video type '%s' is not supported with QEMU"), virDomainVideoTypeToString(video->type)); diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 5ddc09ca6..2afc03329 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1565,7 +1565,7 @@ qemuMonitorJSONUpdateVideoMemorySize(qemuMonitorPtr m= on, {0} }; =20 - switch (video->type) { + switch ((virDomainVideoType) video->type) { case VIR_DOMAIN_VIDEO_TYPE_VGA: if (qemuMonitorJSONGetObjectProperty(mon, path, "vgamem_mb", &prop= ) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -1608,10 +1608,7 @@ qemuMonitorJSONUpdateVideoMemorySize(qemuMonitorPtr = mon, } video->vram =3D prop.val.ul * 1024; break; - case VIR_DOMAIN_VIDEO_TYPE_CIRRUS: - case VIR_DOMAIN_VIDEO_TYPE_XEN: - case VIR_DOMAIN_VIDEO_TYPE_VBOX: - case VIR_DOMAIN_VIDEO_TYPE_LAST: + default: break; } =20 @@ -1635,7 +1632,7 @@ qemuMonitorJSONUpdateVideoVram64Size(qemuMonitorPtr m= on, {0} }; =20 - switch (video->type) { + switch ((virDomainVideoType) video->type) { case VIR_DOMAIN_VIDEO_TYPE_QXL: if (video->vram64 !=3D 0) { if (qemuMonitorJSONGetObjectProperty(mon, path, @@ -1648,12 +1645,7 @@ qemuMonitorJSONUpdateVideoVram64Size(qemuMonitorPtr = mon, video->vram64 =3D prop.val.ul * 1024; } break; - case VIR_DOMAIN_VIDEO_TYPE_VGA: - case VIR_DOMAIN_VIDEO_TYPE_VMVGA: - case VIR_DOMAIN_VIDEO_TYPE_CIRRUS: - case VIR_DOMAIN_VIDEO_TYPE_XEN: - case VIR_DOMAIN_VIDEO_TYPE_VBOX: - case VIR_DOMAIN_VIDEO_TYPE_LAST: + default: break; } =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index d669dfb32..fb6e2c82b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2605,7 +2605,7 @@ qemuProcessUpdateVideoRamSize(virQEMUDriverPtr driver, for (i =3D 0; i < vm->def->nvideos; i++) { video =3D vm->def->videos[i]; =20 - switch (video->type) { + switch ((virDomainVideoType) video->type) { case VIR_DOMAIN_VIDEO_TYPE_VGA: if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VGA_VGAMEM)) { if (qemuMonitorUpdateVideoMemorySize(priv->mon, video, "VG= A") < 0) @@ -2642,10 +2642,7 @@ qemuProcessUpdateVideoRamSize(virQEMUDriverPtr drive= r, goto error; } break; - case VIR_DOMAIN_VIDEO_TYPE_CIRRUS: - case VIR_DOMAIN_VIDEO_TYPE_XEN: - case VIR_DOMAIN_VIDEO_TYPE_VBOX: - case VIR_DOMAIN_VIDEO_TYPE_LAST: + default: break; } =20 --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 03:37:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1498675805963856.2248594455853; Wed, 28 Jun 2017 11:50:05 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 329A4C04B329; Wed, 28 Jun 2017 18:50:04 +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 EE4EF81F37; Wed, 28 Jun 2017 18:50:03 +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 99DE41853E34; Wed, 28 Jun 2017 18:50:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5SInhLO031259 for ; Wed, 28 Jun 2017 14:49:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id A737C62930; Wed, 28 Jun 2017 18:49:43 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-116-174.phx2.redhat.com [10.3.116.174]) by smtp.corp.redhat.com (Postfix) with ESMTP id 510E75D6A6; Wed, 28 Jun 2017 18:49:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 329A4C04B329 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 329A4C04B329 From: Cole Robinson To: libvir-list@redhat.com Date: Wed, 28 Jun 2017 14:49:30 -0400 Message-Id: <661a663f7482b57c85f3c590bbe2d714bb992b8d.1498675591.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/8] conf: add virDomainVideoDefNew 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 28 Jun 2017 18:50:04 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" To handle setting a default heads value. Convert callers that were doing it by hand Signed-off-by: Cole Robinson Reviewed-by: John Ferlan --- src/conf/domain_conf.c | 21 ++++++++++++++++----- src/conf/domain_conf.h | 1 + src/libvirt_private.syms | 1 + src/qemu/qemu_parse_command.c | 3 +-- src/vz/vz_sdk.c | 3 +-- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c3149f976..47b668dc1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2351,6 +2351,20 @@ void virDomainShmemDefFree(virDomainShmemDefPtr def) VIR_FREE(def); } =20 + +virDomainVideoDefPtr +virDomainVideoDefNew(void) +{ + virDomainVideoDefPtr def; + + if (VIR_ALLOC(def) < 0) + return NULL; + + def->heads =3D 1; + return def; +} + + void virDomainVideoDefFree(virDomainVideoDefPtr def) { if (!def) @@ -13660,7 +13674,7 @@ virDomainVideoDefParseXML(xmlNodePtr node, =20 ctxt->node =3D node; =20 - if (VIR_ALLOC(def) < 0) + if (!(def =3D virDomainVideoDefNew())) return NULL; =20 cur =3D node->children; @@ -13754,8 +13768,6 @@ virDomainVideoDefParseXML(xmlNodePtr node, _("cannot parse video heads '%s'"), heads); goto error; } - } else { - def->heads =3D 1; } =20 if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) @@ -20944,7 +20956,7 @@ virDomainDefAddImplicitVideo(virDomainDefPtr def) if (def->ngraphics =3D=3D 0 || def->nvideos > 0) return 0; =20 - if (VIR_ALLOC(video) < 0) + if (!(video =3D virDomainVideoDefNew())) goto cleanup; video->type =3D virDomainVideoDefaultType(def); if (video->type < 0) { @@ -20952,7 +20964,6 @@ virDomainDefAddImplicitVideo(virDomainDefPtr def) _("cannot determine default video type")); goto cleanup; } - video->heads =3D 1; if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, video) < 0) goto cleanup; =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 964bc02f9..db89ffa97 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2683,6 +2683,7 @@ void virDomainSoundDefFree(virDomainSoundDefPtr def); void virDomainMemballoonDefFree(virDomainMemballoonDefPtr def); void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def); void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def); +virDomainVideoDefPtr virDomainVideoDefNew(void); void virDomainVideoDefFree(virDomainVideoDefPtr def); virDomainHostdevDefPtr virDomainHostdevDefAlloc(virDomainXMLOptionPtr xmlo= pt); void virDomainHostdevDefClear(virDomainHostdevDefPtr def); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 888412ac7..248237c4a 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -528,6 +528,7 @@ virDomainUSBDeviceDefForeach; virDomainVideoDefaultRAM; virDomainVideoDefaultType; virDomainVideoDefFree; +virDomainVideoDefNew; virDomainVideoTypeFromString; virDomainVideoTypeToString; virDomainVideoVGAConfTypeFromString; diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index 60c81f0ca..6751868a6 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -2606,10 +2606,9 @@ qemuParseCommandLine(virCapsPtr caps, =20 if (def->ngraphics) { virDomainVideoDefPtr vid; - if (VIR_ALLOC(vid) < 0) + if (!(vid =3D virDomainVideoDefNew())) goto error; vid->type =3D video; - vid->heads =3D 1; =20 if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, vid) < 0) { virDomainVideoDefFree(vid); diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index a62b31079..950eeaa34 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -552,12 +552,11 @@ prlsdkAddDomainVideoInfoCt(virDomainDefPtr def) if (def->ngraphics =3D=3D 0) return 0; =20 - if (VIR_ALLOC(video) < 0) + if (!(video =3D virDomainVideoDefNew())) goto cleanup; =20 video->type =3D VIR_DOMAIN_VIDEO_TYPE_PARALLELS; video->vram =3D 0; - video->heads =3D 1; =20 if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, video) < 0) goto cleanup; --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 03:37:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1498675810018295.3287269898674; Wed, 28 Jun 2017 11:50:10 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 019148553F; Wed, 28 Jun 2017 18:50:08 +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 CE9EE17D4A; Wed, 28 Jun 2017 18:50:07 +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 74F6E1853E36; Wed, 28 Jun 2017 18:50:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v5SIni7K031264 for ; Wed, 28 Jun 2017 14:49:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 313E062930; Wed, 28 Jun 2017 18:49:44 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-116-174.phx2.redhat.com [10.3.116.174]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF64B5D6A6; Wed, 28 Jun 2017 18:49:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 019148553F Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 019148553F From: Cole Robinson To: libvir-list@redhat.com Date: Wed, 28 Jun 2017 14:49:31 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/8] conf: domain: add VIDEO_TYPE_DEFAULT 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 28 Jun 2017 18:50:08 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Will be needed for future patches to pull the default video type setting out of XML parsing routines. Signed-off-by: Cole Robinson Reviewed-by: John Ferlan --- src/conf/domain_conf.c | 1 + src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 3 +++ src/qemu/qemu_domain.c | 1 + src/qemu/qemu_domain_address.c | 1 + tests/domaincapsschemadata/full.xml | 1 + 6 files changed, 8 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 47b668dc1..984d15abf 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -550,6 +550,7 @@ VIR_ENUM_IMPL(virDomainPanicModel, VIR_DOMAIN_PANIC_MOD= EL_LAST, "s390") =20 VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, + "default", "vga", "cirrus", "vmvga", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index db89ffa97..dc1516b91 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1345,6 +1345,7 @@ struct _virDomainWatchdogDef { =20 =20 typedef enum { + VIR_DOMAIN_VIDEO_TYPE_DEFAULT, VIR_DOMAIN_VIDEO_TYPE_VGA, VIR_DOMAIN_VIDEO_TYPE_CIRRUS, VIR_DOMAIN_VIDEO_TYPE_VMVGA, diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index ebf9c63bc..cf5e9092b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -96,6 +96,7 @@ VIR_ENUM_IMPL(qemuDiskCacheV2, VIR_DOMAIN_DISK_CACHE_LAST, "unsafe"); =20 VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, + "", /* default value, we shouldn't see this */ "std", "cirrus", "vmware", @@ -109,6 +110,7 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, VIR_ENUM_DECL(qemuDeviceVideo) =20 VIR_ENUM_IMPL(qemuDeviceVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, + "", /* default value, we shouldn't see this */ "VGA", "cirrus-vga", "vmware-svga", @@ -122,6 +124,7 @@ VIR_ENUM_IMPL(qemuDeviceVideo, VIR_DOMAIN_VIDEO_TYPE_LA= ST, VIR_ENUM_DECL(qemuDeviceVideoSecondary) =20 VIR_ENUM_IMPL(qemuDeviceVideoSecondary, VIR_DOMAIN_VIDEO_TYPE_LAST, + "", /* default value, we shouldn't see this */ "", /* no secondary device for VGA */ "", /* no secondary device for cirrus-vga */ "", /* no secondary device for vmware-svga */ diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ac1bc1a1e..387dade8f 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2955,6 +2955,7 @@ qemuDomainDefValidateVideo(const virDomainDef *def) case VIR_DOMAIN_VIDEO_TYPE_VBOX: case VIR_DOMAIN_VIDEO_TYPE_PARALLELS: case VIR_DOMAIN_VIDEO_TYPE_GOP: + case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("video type '%s' is not supported with QEMU"), virDomainVideoTypeToString(video->type)); diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index b5b863fe4..8f19ab824 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -752,6 +752,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic= eDefPtr dev, case VIR_DOMAIN_VIDEO_TYPE_PARALLELS: return pciFlags; =20 + case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: case VIR_DOMAIN_VIDEO_TYPE_GOP: case VIR_DOMAIN_VIDEO_TYPE_LAST: return 0; diff --git a/tests/domaincapsschemadata/full.xml b/tests/domaincapsschemada= ta/full.xml index 82a92322e..ab6ef9f2e 100644 --- a/tests/domaincapsschemadata/full.xml +++ b/tests/domaincapsschemadata/full.xml @@ -62,6 +62,7 @@