提交 6da27ad1 编写于 作者: C Cole Robinson

domaincaps: Report graphics type enum

Requires adding the plumbing for <device><graphics>
Wire it up for qemu too
上级 4e8b81e5
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
<code>floppy</code>, or <code>lun</code>.</p> <code>floppy</code>, or <code>lun</code>.</p>
<h4><a name="elementsDisks">Hard drives, floppy disks, CDROMs</a></h4> <h4><a name="elementsDisks">Hard drives, floppy disks, CDROMs</a></h4>
<p>Disk capabilities are exposed under <code>disk</code> element. For <p>Disk capabilities are exposed under the <code>disk</code> element. For
instance:</p> instance:</p>
<pre> <pre>
...@@ -216,6 +216,34 @@ ...@@ -216,6 +216,34 @@
element for a &lt;disk/&gt;.</dd> element for a &lt;disk/&gt;.</dd>
</dl> </dl>
<h4><a name="elementsGraphics">Graphical framebuffers</a></h4>
<p>Graphics device capabilities are exposed under the
<code>graphics</code> element. For instance:</p>
<pre>
&lt;domainCapabilities&gt;
...
&lt;devices&gt;
&lt;graphics supported='yes'&gt;
&lt;enum name='type'&gt;
&lt;value&gt;sdl&lt;/value&gt;
&lt;value&gt;vnc&lt;/value&gt;
&lt;value&gt;spice&lt;/value&gt;
&lt;/enum&gt;
&lt;/graphics&gt;
...
&lt;/devices&gt;
&lt;/domainCapabilities&gt;
</pre>
<dl>
<dt><code>type</code></dt>
<dd>Options for the <code>type</code> attribute of the &lt;graphics/&gt;
element.</dd>
</dl>
<h4><a name="elementsHostDev">Host device assignment</a></h4> <h4><a name="elementsHostDev">Host device assignment</a></h4>
<p>Some host devices can be passed through to a guest (e.g. USB, PCI and <p>Some host devices can be passed through to a guest (e.g. USB, PCI and
SCSI). Well, only if the following is enabled:</p> SCSI). Well, only if the following is enabled:</p>
......
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
<element name='devices'> <element name='devices'>
<interleave> <interleave>
<ref name='disk'/> <ref name='disk'/>
<ref name='graphics'/>
<ref name='hostdev'/> <ref name='hostdev'/>
</interleave> </interleave>
</element> </element>
...@@ -84,6 +85,13 @@ ...@@ -84,6 +85,13 @@
</element> </element>
</define> </define>
<define name='graphics'>
<element name='graphics'>
<ref name='supported'/>
<ref name='enum'/>
</element>
</define>
<define name='hostdev'> <define name='hostdev'>
<element name='hostdev'> <element name='hostdev'>
<ref name='supported'/> <ref name='supported'/>
......
...@@ -246,6 +246,18 @@ virDomainCapsDeviceDiskFormat(virBufferPtr buf, ...@@ -246,6 +246,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 static void
virDomainCapsDeviceHostdevFormat(virBufferPtr buf, virDomainCapsDeviceHostdevFormat(virBufferPtr buf,
virDomainCapsDeviceHostdevPtr const hostdev) virDomainCapsDeviceHostdevPtr const hostdev)
...@@ -314,6 +326,7 @@ virDomainCapsFormatInternal(virBufferPtr buf, ...@@ -314,6 +326,7 @@ virDomainCapsFormatInternal(virBufferPtr buf,
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
virDomainCapsDeviceDiskFormat(buf, &caps->disk); virDomainCapsDeviceDiskFormat(buf, &caps->disk);
virDomainCapsDeviceGraphicsFormat(buf, &caps->graphics);
virDomainCapsDeviceHostdevFormat(buf, &caps->hostdev); virDomainCapsDeviceHostdevFormat(buf, &caps->hostdev);
virBufferAdjustIndent(buf, -2); virBufferAdjustIndent(buf, -2);
......
...@@ -69,6 +69,13 @@ struct _virDomainCapsDeviceDisk { ...@@ -69,6 +69,13 @@ struct _virDomainCapsDeviceDisk {
/* add new fields here */ /* add new fields here */
}; };
typedef struct _virDomainCapsDeviceGraphics virDomainCapsDeviceGraphics;
typedef virDomainCapsDeviceGraphics *virDomainCapsDeviceGraphicsPtr;
struct _virDomainCapsDeviceGraphics {
bool supported;
virDomainCapsEnum type; /* virDomainGraphicsType */
};
typedef struct _virDomainCapsDeviceHostdev virDomainCapsDeviceHostdev; typedef struct _virDomainCapsDeviceHostdev virDomainCapsDeviceHostdev;
typedef virDomainCapsDeviceHostdev *virDomainCapsDeviceHostdevPtr; typedef virDomainCapsDeviceHostdev *virDomainCapsDeviceHostdevPtr;
struct _virDomainCapsDeviceHostdev { struct _virDomainCapsDeviceHostdev {
...@@ -101,6 +108,7 @@ struct _virDomainCaps { ...@@ -101,6 +108,7 @@ struct _virDomainCaps {
virDomainCapsOS os; virDomainCapsOS os;
virDomainCapsDeviceDisk disk; virDomainCapsDeviceDisk disk;
virDomainCapsDeviceGraphics graphics;
virDomainCapsDeviceHostdev hostdev; virDomainCapsDeviceHostdev hostdev;
/* add new domain devices here */ /* add new domain devices here */
......
...@@ -4170,6 +4170,23 @@ virQEMUCapsFillDomainDeviceDiskCaps(virQEMUCapsPtr qemuCaps, ...@@ -4170,6 +4170,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 static int
virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps, virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps,
virDomainCapsDeviceHostdevPtr hostdev) virDomainCapsDeviceHostdevPtr hostdev)
...@@ -4281,13 +4298,16 @@ virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps, ...@@ -4281,13 +4298,16 @@ virQEMUCapsFillDomainCaps(virDomainCapsPtr domCaps,
virDomainCapsOSPtr os = &domCaps->os; virDomainCapsOSPtr os = &domCaps->os;
virDomainCapsDeviceDiskPtr disk = &domCaps->disk; virDomainCapsDeviceDiskPtr disk = &domCaps->disk;
virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev; virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev;
virDomainCapsDeviceGraphicsPtr graphics = &domCaps->graphics;
int maxvcpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, domCaps->machine); int maxvcpus = virQEMUCapsGetMachineMaxCpus(qemuCaps, domCaps->machine);
domCaps->maxvcpus = maxvcpus; domCaps->maxvcpus = maxvcpus;
if (virQEMUCapsFillDomainOSCaps(qemuCaps, os, if (virQEMUCapsFillDomainOSCaps(qemuCaps, os,
loader, nloader) < 0 || loader, nloader) < 0 ||
virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps, domCaps->machine, disk) < 0 || virQEMUCapsFillDomainDeviceDiskCaps(qemuCaps,
domCaps->machine, disk) < 0 ||
virQEMUCapsFillDomainDeviceGraphicsCaps(qemuCaps, graphics) < 0 ||
virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0 || virQEMUCapsFillDomainDeviceHostdevCaps(qemuCaps, hostdev) < 0 ||
virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps) < 0) virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps) < 0)
return -1; return -1;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
<os supported='no'/> <os supported='no'/>
<devices> <devices>
<disk supported='no'/> <disk supported='no'/>
<graphics supported='no'/>
<hostdev supported='no'/> <hostdev supported='no'/>
</devices> </devices>
<features> <features>
......
...@@ -39,6 +39,15 @@ ...@@ -39,6 +39,15 @@
<value>sd</value> <value>sd</value>
</enum> </enum>
</disk> </disk>
<graphics supported='yes'>
<enum name='type'>
<value>sdl</value>
<value>vnc</value>
<value>rdp</value>
<value>desktop</value>
<value>spice</value>
</enum>
</graphics>
<hostdev supported='yes'> <hostdev supported='yes'>
<enum name='mode'> <enum name='mode'>
<value>subsystem</value> <value>subsystem</value>
......
...@@ -34,6 +34,13 @@ ...@@ -34,6 +34,13 @@
<value>usb</value> <value>usb</value>
</enum> </enum>
</disk> </disk>
<graphics supported='yes'>
<enum name='type'>
<value>sdl</value>
<value>vnc</value>
<value>spice</value>
</enum>
</graphics>
<hostdev supported='yes'> <hostdev supported='yes'>
<enum name='mode'> <enum name='mode'>
<value>subsystem</value> <value>subsystem</value>
......
...@@ -34,6 +34,13 @@ ...@@ -34,6 +34,13 @@
<value>usb</value> <value>usb</value>
</enum> </enum>
</disk> </disk>
<graphics supported='yes'>
<enum name='type'>
<value>sdl</value>
<value>vnc</value>
<value>spice</value>
</enum>
</graphics>
<hostdev supported='yes'> <hostdev supported='yes'>
<enum name='mode'> <enum name='mode'>
<value>subsystem</value> <value>subsystem</value>
......
...@@ -34,6 +34,12 @@ ...@@ -34,6 +34,12 @@
<value>usb</value> <value>usb</value>
</enum> </enum>
</disk> </disk>
<graphics supported='yes'>
<enum name='type'>
<value>sdl</value>
<value>vnc</value>
</enum>
</graphics>
<hostdev supported='yes'> <hostdev supported='yes'>
<enum name='mode'> <enum name='mode'>
<value>subsystem</value> <value>subsystem</value>
......
...@@ -34,6 +34,12 @@ ...@@ -34,6 +34,12 @@
<value>usb</value> <value>usb</value>
</enum> </enum>
</disk> </disk>
<graphics supported='yes'>
<enum name='type'>
<value>sdl</value>
<value>vnc</value>
</enum>
</graphics>
<hostdev supported='yes'> <hostdev supported='yes'>
<enum name='mode'> <enum name='mode'>
<value>subsystem</value> <value>subsystem</value>
......
...@@ -34,6 +34,12 @@ ...@@ -34,6 +34,12 @@
<value>usb</value> <value>usb</value>
</enum> </enum>
</disk> </disk>
<graphics supported='yes'>
<enum name='type'>
<value>sdl</value>
<value>vnc</value>
</enum>
</graphics>
<hostdev supported='yes'> <hostdev supported='yes'>
<enum name='mode'> <enum name='mode'>
<value>subsystem</value> <value>subsystem</value>
......
...@@ -32,6 +32,12 @@ ...@@ -32,6 +32,12 @@
<value>usb</value> <value>usb</value>
</enum> </enum>
</disk> </disk>
<graphics supported='yes'>
<enum name='type'>
<value>sdl</value>
<value>vnc</value>
</enum>
</graphics>
<hostdev supported='yes'> <hostdev supported='yes'>
<enum name='mode'> <enum name='mode'>
<value>subsystem</value> <value>subsystem</value>
......
...@@ -61,6 +61,7 @@ fillAllCaps(virDomainCapsPtr domCaps) ...@@ -61,6 +61,7 @@ fillAllCaps(virDomainCapsPtr domCaps)
virDomainCapsOSPtr os = &domCaps->os; virDomainCapsOSPtr os = &domCaps->os;
virDomainCapsLoaderPtr loader = &os->loader; virDomainCapsLoaderPtr loader = &os->loader;
virDomainCapsDeviceDiskPtr disk = &domCaps->disk; virDomainCapsDeviceDiskPtr disk = &domCaps->disk;
virDomainCapsDeviceGraphicsPtr graphics = &domCaps->graphics;
virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev; virDomainCapsDeviceHostdevPtr hostdev = &domCaps->hostdev;
domCaps->maxvcpus = 255; domCaps->maxvcpus = 255;
...@@ -79,6 +80,9 @@ fillAllCaps(virDomainCapsPtr domCaps) ...@@ -79,6 +80,9 @@ fillAllCaps(virDomainCapsPtr domCaps)
SET_ALL_BITS(disk->diskDevice); SET_ALL_BITS(disk->diskDevice);
SET_ALL_BITS(disk->bus); SET_ALL_BITS(disk->bus);
graphics->supported = true;
SET_ALL_BITS(graphics->type);
hostdev->supported = true; hostdev->supported = true;
SET_ALL_BITS(hostdev->mode); SET_ALL_BITS(hostdev->mode);
SET_ALL_BITS(hostdev->startupPolicy); SET_ALL_BITS(hostdev->startupPolicy);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册