[libvirt] [RFC v2 04/16] domain: add "vhost-user" video type

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Tue Aug 28 21:39:22 UTC 2018


From: Marc-André Lureau <marcandre.lureau at redhat.com>

Learn to accept "vhost-user" model type:
  <video>
    <model type='vhost-user'/>
  </video>

(fill the required enum and switches to compile successfully)

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 docs/formatdomain.html.in           | 3 ++-
 docs/schemas/domaincommon.rng       | 1 +
 src/conf/domain_conf.c              | 4 +++-
 src/conf/domain_conf.h              | 1 +
 src/qemu/qemu_command.c             | 9 ++++++---
 src/qemu/qemu_domain.c              | 1 +
 src/qemu/qemu_domain_address.c      | 1 +
 tests/domaincapsschemadata/full.xml | 1 +
 8 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index ca656c9f7e..587ea98993 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6775,7 +6775,8 @@ qemu-kvm -net nic,model=? /dev/null
           "vbox", "qxl" (<span class="since">since 0.8.6</span>),
           "virtio" (<span class="since">since 1.3.0</span>),
           "gop" (<span class="since">since 3.2.0</span>), or
-          "none" (<span class="since">since 4.6.0</span>)
+          "none" (<span class="since">since 4.6.0</span>), or
+          "vhost-user" (<span class="since">since 4.8.0</span>)
           depending on the hypervisor features available.
           The purpose of the type <code>none</code> is to instruct libvirt not
           to add a default video device in the guest (see the paragraph above).
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 04d7b69dd7..76475a5c69 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3495,6 +3495,7 @@
                 <value>virtio</value>
                 <value>gop</value>
                 <value>none</value>
+                <value>vhost-user</value>
               </choice>
             </attribute>
             <group>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b3a1158e75..6afc5099f5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -595,7 +595,8 @@ VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
               "parallels",
               "virtio",
               "gop",
-              "none")
+              "none",
+              "vhost-user")
 
 VIR_ENUM_IMPL(virDomainVideoVGAConf, VIR_DOMAIN_VIDEO_VGACONF_LAST,
               "io",
@@ -15257,6 +15258,7 @@ virDomainVideoDefaultRAM(const virDomainDef *def,
     case VIR_DOMAIN_VIDEO_TYPE_VBOX:
     case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
     case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
+    case VIR_DOMAIN_VIDEO_TYPE_VHOST_USER:
     case VIR_DOMAIN_VIDEO_TYPE_GOP:
     case VIR_DOMAIN_VIDEO_TYPE_NONE:
     case VIR_DOMAIN_VIDEO_TYPE_LAST:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index e72b824226..7ac39e2159 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1427,6 +1427,7 @@ typedef enum {
     VIR_DOMAIN_VIDEO_TYPE_VIRTIO,
     VIR_DOMAIN_VIDEO_TYPE_GOP,
     VIR_DOMAIN_VIDEO_TYPE_NONE,
+    VIR_DOMAIN_VIDEO_TYPE_VHOST_USER,
 
     VIR_DOMAIN_VIDEO_TYPE_LAST
 } virDomainVideoType;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 830695a147..824e78c0ec 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -106,7 +106,8 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
               "", /* don't support parallels */
               "", /* no need for virtio */
               "" /* don't support gop */,
-              "" /* 'none' doesn't make sense here */);
+              "" /* 'none' doesn't make sense here */,
+              "", /* no need for virtio */);
 
 VIR_ENUM_DECL(qemuDeviceVideo)
 
@@ -121,7 +122,8 @@ VIR_ENUM_IMPL(qemuDeviceVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
               "", /* don't support parallels */
               "virtio-vga",
               "" /* don't support gop */,
-              "" /* 'none' doesn't make sense here */);
+              "" /* 'none' doesn't make sense here */,
+              "vhost-user-vga");
 
 VIR_ENUM_DECL(qemuDeviceVideoSecondary)
 
@@ -136,7 +138,8 @@ VIR_ENUM_IMPL(qemuDeviceVideoSecondary, VIR_DOMAIN_VIDEO_TYPE_LAST,
               "", /* don't support parallels */
               "virtio-gpu",
               "" /* don't support gop */,
-              "" /* 'none' doesn't make sense here */);
+              "" /* 'none' doesn't make sense here */,
+              "vhost-user-gpu");
 
 VIR_ENUM_DECL(qemuSoundCodec)
 
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d052bf4ca8..c8ba7f9cd9 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4613,6 +4613,7 @@ qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video)
     case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
     case VIR_DOMAIN_VIDEO_TYPE_QXL:
     case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
+    case VIR_DOMAIN_VIDEO_TYPE_VHOST_USER:
     case VIR_DOMAIN_VIDEO_TYPE_LAST:
         break;
     }
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index dda14adeb3..5aaf77028b 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -815,6 +815,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
     case VIR_DOMAIN_DEVICE_VIDEO:
         switch ((virDomainVideoType)dev->data.video->type) {
         case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
+        case VIR_DOMAIN_VIDEO_TYPE_VHOST_USER:
             return virtioFlags;
 
         case VIR_DOMAIN_VIDEO_TYPE_VGA:
diff --git a/tests/domaincapsschemadata/full.xml b/tests/domaincapsschemadata/full.xml
index eafba1ae5b..1a167de4fb 100644
--- a/tests/domaincapsschemadata/full.xml
+++ b/tests/domaincapsschemadata/full.xml
@@ -75,6 +75,7 @@
         <value>virtio</value>
         <value>gop</value>
         <value>none</value>
+        <value>vhost-user</value>
       </enum>
     </video>
     <hostdev supported='yes'>
-- 
2.19.0.rc0.48.gb9dfa238d5




More information about the libvir-list mailing list