mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
domaincaps: Report graphics type enum
Requires adding the plumbing for <device><graphics> Wire it up for qemu too
This commit is contained in:
parent
4e8b81e5c4
commit
6da27ad1b5
@ -175,7 +175,7 @@
|
||||
<code>floppy</code>, or <code>lun</code>.</p>
|
||||
|
||||
<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>
|
||||
|
||||
<pre>
|
||||
@ -216,6 +216,34 @@
|
||||
element for a <disk/>.</dd>
|
||||
</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>
|
||||
<domainCapabilities>
|
||||
...
|
||||
<devices>
|
||||
<graphics supported='yes'>
|
||||
<enum name='type'>
|
||||
<value>sdl</value>
|
||||
<value>vnc</value>
|
||||
<value>spice</value>
|
||||
</enum>
|
||||
</graphics>
|
||||
...
|
||||
</devices>
|
||||
</domainCapabilities>
|
||||
</pre>
|
||||
|
||||
<dl>
|
||||
<dt><code>type</code></dt>
|
||||
<dd>Options for the <code>type</code> attribute of the <graphics/>
|
||||
element.</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
<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
|
||||
SCSI). Well, only if the following is enabled:</p>
|
||||
|
@ -72,6 +72,7 @@
|
||||
<element name='devices'>
|
||||
<interleave>
|
||||
<ref name='disk'/>
|
||||
<ref name='graphics'/>
|
||||
<ref name='hostdev'/>
|
||||
</interleave>
|
||||
</element>
|
||||
@ -84,6 +85,13 @@
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='graphics'>
|
||||
<element name='graphics'>
|
||||
<ref name='supported'/>
|
||||
<ref name='enum'/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
<define name='hostdev'>
|
||||
<element name='hostdev'>
|
||||
<ref name='supported'/>
|
||||
|
@ -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
|
||||
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);
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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
|
||||
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;
|
||||
|
@ -6,6 +6,7 @@
|
||||
<os supported='no'/>
|
||||
<devices>
|
||||
<disk supported='no'/>
|
||||
<graphics supported='no'/>
|
||||
<hostdev supported='no'/>
|
||||
</devices>
|
||||
<features>
|
||||
|
@ -39,6 +39,15 @@
|
||||
<value>sd</value>
|
||||
</enum>
|
||||
</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'>
|
||||
<enum name='mode'>
|
||||
<value>subsystem</value>
|
||||
|
@ -34,6 +34,13 @@
|
||||
<value>usb</value>
|
||||
</enum>
|
||||
</disk>
|
||||
<graphics supported='yes'>
|
||||
<enum name='type'>
|
||||
<value>sdl</value>
|
||||
<value>vnc</value>
|
||||
<value>spice</value>
|
||||
</enum>
|
||||
</graphics>
|
||||
<hostdev supported='yes'>
|
||||
<enum name='mode'>
|
||||
<value>subsystem</value>
|
||||
|
@ -34,6 +34,13 @@
|
||||
<value>usb</value>
|
||||
</enum>
|
||||
</disk>
|
||||
<graphics supported='yes'>
|
||||
<enum name='type'>
|
||||
<value>sdl</value>
|
||||
<value>vnc</value>
|
||||
<value>spice</value>
|
||||
</enum>
|
||||
</graphics>
|
||||
<hostdev supported='yes'>
|
||||
<enum name='mode'>
|
||||
<value>subsystem</value>
|
||||
|
@ -34,6 +34,12 @@
|
||||
<value>usb</value>
|
||||
</enum>
|
||||
</disk>
|
||||
<graphics supported='yes'>
|
||||
<enum name='type'>
|
||||
<value>sdl</value>
|
||||
<value>vnc</value>
|
||||
</enum>
|
||||
</graphics>
|
||||
<hostdev supported='yes'>
|
||||
<enum name='mode'>
|
||||
<value>subsystem</value>
|
||||
|
@ -34,6 +34,12 @@
|
||||
<value>usb</value>
|
||||
</enum>
|
||||
</disk>
|
||||
<graphics supported='yes'>
|
||||
<enum name='type'>
|
||||
<value>sdl</value>
|
||||
<value>vnc</value>
|
||||
</enum>
|
||||
</graphics>
|
||||
<hostdev supported='yes'>
|
||||
<enum name='mode'>
|
||||
<value>subsystem</value>
|
||||
|
@ -34,6 +34,12 @@
|
||||
<value>usb</value>
|
||||
</enum>
|
||||
</disk>
|
||||
<graphics supported='yes'>
|
||||
<enum name='type'>
|
||||
<value>sdl</value>
|
||||
<value>vnc</value>
|
||||
</enum>
|
||||
</graphics>
|
||||
<hostdev supported='yes'>
|
||||
<enum name='mode'>
|
||||
<value>subsystem</value>
|
||||
|
@ -32,6 +32,12 @@
|
||||
<value>usb</value>
|
||||
</enum>
|
||||
</disk>
|
||||
<graphics supported='yes'>
|
||||
<enum name='type'>
|
||||
<value>sdl</value>
|
||||
<value>vnc</value>
|
||||
</enum>
|
||||
</graphics>
|
||||
<hostdev supported='yes'>
|
||||
<enum name='mode'>
|
||||
<value>subsystem</value>
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user