diff mbox series

[5/8] conf: domain: add VIDEO_TYPE_DEFAULT

Message ID db530e2058287d49b74810a31f548b425fb9deb4.1498675591.git.crobinso@redhat.com
State Accepted
Commit a2ca7ca52eb624883ac5a7e1d5deebb43981a410
Headers show
Series qemu: Default to video type=virtio for machvirt | expand

Commit Message

Cole Robinson June 28, 2017, 6:49 p.m. UTC
Will be needed for future patches to pull the default video type
setting out of XML parsing routines.

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 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(+)

-- 
2.13.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

John Ferlan July 18, 2017, 10:24 p.m. UTC | #1
On 06/28/2017 02:49 PM, Cole Robinson wrote:
> Will be needed for future patches to pull the default video type

> setting out of XML parsing routines.

> 

> Signed-off-by: Cole Robinson <crobinso@redhat.com>

> ---

>  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(+)

> 


Well, I see why you added patch 3 now...  But I'm still convinced it's
better to have all switch/cases handle every case.

My only concern here would be related to migration, but since it doesn't
appear that "default" can be saved to the XML file I think we're good. I
will guarantee someone in qe will find this default and find some
oddball path that tries to allow it to be defined in some read XML file.

Reviewed-by: John Ferlan <jferlan@redhat.com>


John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox series

Patch

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_MODEL_LAST,
               "s390")
 
 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 {
 
 
 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");
 
 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)
 
 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_LAST,
 VIR_ENUM_DECL(qemuDeviceVideoSecondary)
 
 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(virDomainDeviceDefPtr dev,
         case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
             return pciFlags;
 
+        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/domaincapsschemadata/full.xml
index 82a92322e..ab6ef9f2e 100644
--- a/tests/domaincapsschemadata/full.xml
+++ b/tests/domaincapsschemadata/full.xml
@@ -62,6 +62,7 @@ 
     </graphics>
     <video supported='yes'>
       <enum name='modelType'>
+        <value>default</value>
         <value>vga</value>
         <value>cirrus</value>
         <value>vmvga</value>