From patchwork Sun May 8 17:49:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 67324 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1246066qge; Sun, 8 May 2016 10:52:51 -0700 (PDT) X-Received: by 10.28.63.148 with SMTP id m142mr6884101wma.85.1462729970715; Sun, 08 May 2016 10:52:50 -0700 (PDT) Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com. [209.132.183.24]) by mx.google.com with ESMTPS id b5si29436775wji.96.2016.05.08.10.52.49 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 08 May 2016 10:52:50 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u48Ho1du006718; Sun, 8 May 2016 13:50:01 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.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 u48HnBsv010772 for ; Sun, 8 May 2016 13:49:11 -0400 Received: from colepc.redhat.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u48HnA6k030897; Sun, 8 May 2016 13:49:10 -0400 From: Cole Robinson To: libvirt-list@redhat.com Date: Sun, 8 May 2016 13:49:04 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/5] domaincaps: Report graphics type enum 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 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com Requires adding the plumbing for Wire it up for qemu too --- I stuck the element between and to match the ordering in XML docs/formatdomaincaps.html.in | 30 +++++++++++++++++++++- docs/schemas/domaincaps.rng | 8 ++++++ src/conf/domain_capabilities.c | 13 ++++++++++ src/conf/domain_capabilities.h | 8 ++++++ src/qemu/qemu_capabilities.c | 22 +++++++++++++++- tests/domaincapsschemadata/domaincaps-basic.xml | 1 + tests/domaincapsschemadata/domaincaps-full.xml | 9 +++++++ .../domaincaps-qemu_1.6.50-1.xml | 7 +++++ .../domaincaps-qemu_2.6.0-1.xml | 7 +++++ .../domaincaps-qemu_2.6.0-2.xml | 6 +++++ .../domaincaps-qemu_2.6.0-3.xml | 6 +++++ .../domaincaps-qemu_2.6.0-4.xml | 6 +++++ .../domaincaps-qemu_2.6.0-5.xml | 6 +++++ tests/domaincapstest.c | 4 +++ 14 files changed, 131 insertions(+), 2 deletions(-) -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/docs/formatdomaincaps.html.in b/docs/formatdomaincaps.html.in index edbb948..52e4463 100644 --- a/docs/formatdomaincaps.html.in +++ b/docs/formatdomaincaps.html.in @@ -175,7 +175,7 @@ floppy, or lun.

Hard drives, floppy disks, CDROMs

-

Disk capabilities are exposed under disk element. For +

Disk capabilities are exposed under the disk element. For instance:

@@ -216,6 +216,34 @@
       element for a <disk/>.
     
 
+
+    

Graphical framebuffers

+

Graphics device capabilities are exposed under the + graphics element. For instance:

+ +
+<domainCapabilities>
+  ...
+  <devices>
+    <graphics supported='yes'>
+      <enum name='type'>
+        <value>sdl</value>
+        <value>vnc</value>
+        <value>spice</value>
+      </enum>
+    </graphics>
+    ...
+  </devices>
+</domainCapabilities>
+
+ +
+
type
+
Options for the type attribute of the <graphics/> + element.
+
+ +

Host device assignment

Some host devices can be passed through to a guest (e.g. USB, PCI and SCSI). Well, only if the following is enabled:

diff --git a/docs/schemas/domaincaps.rng b/docs/schemas/domaincaps.rng index 0d2777b..3e82b57 100644 --- a/docs/schemas/domaincaps.rng +++ b/docs/schemas/domaincaps.rng @@ -72,6 +72,7 @@ + @@ -84,6 +85,13 @@ + + + + + + + diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index eb880ae..232acd5 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -247,6 +247,18 @@ virDomainCapsDeviceDiskFormat(virBufferPtr buf, static void +virDomainCapsDeviceGraphicsFormat(virBufferPtr buf, + virDomainCapsDeviceGraphicsPtr const graphics) +{ + FORMAT_PROLOGUE(graphics); + + ENUM_PROCESS(graphics, type, virDomainGraphicsTypeToString); + + FORMAT_EPILOGUE(graphics); +} + + +static void virDomainCapsDeviceHostdevFormat(virBufferPtr buf, virDomainCapsDeviceHostdevPtr const hostdev) { @@ -314,6 +326,7 @@ virDomainCapsFormatInternal(virBufferPtr buf, virBufferAdjustIndent(buf, 2); virDomainCapsDeviceDiskFormat(buf, &caps->disk); + virDomainCapsDeviceGraphicsFormat(buf, &caps->graphics); virDomainCapsDeviceHostdevFormat(buf, &caps->hostdev); virBufferAdjustIndent(buf, -2); diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h index 95afe5e..545ada7 100644 --- a/src/conf/domain_capabilities.h +++ b/src/conf/domain_capabilities.h @@ -69,6 +69,13 @@ struct _virDomainCapsDeviceDisk { /* add new fields here */ }; +typedef struct _virDomainCapsDeviceGraphics virDomainCapsDeviceGraphics; +typedef virDomainCapsDeviceGraphics *virDomainCapsDeviceGraphicsPtr; +struct _virDomainCapsDeviceGraphics { + bool supported; + virDomainCapsEnum type; /* virDomainGraphicsType */ +}; + typedef struct _virDomainCapsDeviceHostdev virDomainCapsDeviceHostdev; typedef virDomainCapsDeviceHostdev *virDomainCapsDeviceHostdevPtr; struct _virDomainCapsDeviceHostdev { @@ -101,6 +108,7 @@ struct _virDomainCaps { virDomainCapsOS os; virDomainCapsDeviceDisk disk; + virDomainCapsDeviceGraphics graphics; virDomainCapsDeviceHostdev hostdev; /* add new domain devices here */ diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 30dc33a..c675f9f 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4171,6 +4171,23 @@ virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr qemuCaps, static int +virQEMUCapsFillDomainDeviceGraphicsCaps(virQEMUCapsPtr qemuCaps, + virDomainCapsDeviceGraphicsPtr dev) +{ + dev->supported = true; + + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SDL)) + VIR_DOMAIN_CAPS_ENUM_SET(dev->type, VIR_DOMAIN_GRAPHICS_TYPE_SDL); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VNC)) + VIR_DOMAIN_CAPS_ENUM_SET(dev->type, VIR_DOMAIN_GRAPHICS_TYPE_VNC); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE)) + VIR_DOMAIN_CAPS_ENUM_SET(dev->type, VIR_DOMAIN_GRAPHICS_TYPE_SPICE); + + return 0; +} + + +static int virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps, virDomainCapsDeviceHostdevPtr hostdev) { @@ -4281,13 +4298,16 @@ virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps, virDomainCapsOSPtr os = &domCaps->os; virDomainCapsDeviceDiskPtr disk = &domCaps->disk; virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev; + virDomainCapsDeviceGraphicsPtr graphics = &domCaps->graphics; int maxvcpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, domCaps->machine); domCaps->maxvcpus = maxvcpus; if (virQEMUCapsFillDomainOSCaps(qemuCaps, os, loader, nloader) < 0 || - virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps, domCaps->machine, disk) < 0 || + virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps, + domCaps->machine, disk) < 0 || + virQEMUCapsFillDomainDeviceGraphicsCaps(qemuCaps, graphics) < 0 || virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0 || virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps) < 0) return -1; diff --git a/tests/domaincapsschemadata/domaincaps-basic.xml b/tests/domaincapsschemadata/domaincaps-basic.xml index 6587d56..f0f0864 100644 --- a/tests/domaincapsschemadata/domaincaps-basic.xml +++ b/tests/domaincapsschemadata/domaincaps-basic.xml @@ -6,6 +6,7 @@ + diff --git a/tests/domaincapsschemadata/domaincaps-full.xml b/tests/domaincapsschemadata/domaincaps-full.xml index d4f91fa..b3b8855 100644 --- a/tests/domaincapsschemadata/domaincaps-full.xml +++ b/tests/domaincapsschemadata/domaincaps-full.xml @@ -39,6 +39,15 @@ sd + + + sdl + vnc + rdp + desktop + spice + + subsystem diff --git a/tests/domaincapsschemadata/domaincaps-qemu_1.6.50-1.xml b/tests/domaincapsschemadata/domaincaps-qemu_1.6.50-1.xml index 1e73ff1..147424d 100644 --- a/tests/domaincapsschemadata/domaincaps-qemu_1.6.50-1.xml +++ b/tests/domaincapsschemadata/domaincaps-qemu_1.6.50-1.xml @@ -34,6 +34,13 @@ usb + + + sdl + vnc + spice + + subsystem diff --git a/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-1.xml b/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-1.xml index 244700a..f8f7465 100644 --- a/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-1.xml +++ b/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-1.xml @@ -34,6 +34,13 @@ usb + + + sdl + vnc + spice + + subsystem diff --git a/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-2.xml b/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-2.xml index 411c6b7..7913703 100644 --- a/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-2.xml +++ b/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-2.xml @@ -34,6 +34,12 @@ usb + + + sdl + vnc + + subsystem diff --git a/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-3.xml b/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-3.xml index 21c59a8..6f30819 100644 --- a/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-3.xml +++ b/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-3.xml @@ -34,6 +34,12 @@ usb + + + sdl + vnc + + subsystem diff --git a/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-4.xml b/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-4.xml index c972d5e..6845e92 100644 --- a/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-4.xml +++ b/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-4.xml @@ -34,6 +34,12 @@ usb + + + sdl + vnc + + subsystem diff --git a/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-5.xml b/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-5.xml index e4b8c3a..68d88d1 100644 --- a/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-5.xml +++ b/tests/domaincapsschemadata/domaincaps-qemu_2.6.0-5.xml @@ -32,6 +32,12 @@ usb + + + sdl + vnc + + subsystem diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index ee78555..6bef682 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -61,6 +61,7 @@ fillAllCaps(virDomainCapsPtr domCaps) virDomainCapsOSPtr os = &domCaps->os; virDomainCapsLoaderPtr loader = &os->loader; virDomainCapsDeviceDiskPtr disk = &domCaps->disk; + virDomainCapsDeviceGraphicsPtr graphics = &domCaps->graphics; virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev; domCaps->maxvcpus = 255; @@ -79,6 +80,9 @@ fillAllCaps(virDomainCapsPtr domCaps) SET_ALL_BITS(disk->diskDevice); SET_ALL_BITS(disk->bus); + graphics->supported = true; + SET_ALL_BITS(graphics->type); + hostdev->supported = true; SET_ALL_BITS(hostdev->mode); SET_ALL_BITS(hostdev->startupPolicy);