conf: Add channel devices to domain capabilities

As qemu becomes more modularized, it is important for libvirt to advertise
availability of the modularized functionality through capabilities. This
change adds channel devices to domain capabilities, allowing clients such
as virt-install to avoid using spicevmc channel devices when not supported
by the target qemu.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Jim Fehlig 2022-09-02 16:22:31 -06:00
parent 2cf14c311b
commit 71d9836ca1
55 changed files with 399 additions and 0 deletions

View File

@ -565,6 +565,30 @@ USB redirdev device capabilities are exposed under the ``redirdev`` element. For
``bus``
Options for the ``bus`` attribute of the ``<redirdev/>`` element.
Channel device
^^^^^^^^^^^^^^
Channel device capabilities are exposed under the ``channel`` element. For instance:
::
<domainCapabilities>
...
<devices>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel
...
</devices>
</domainCapabilities>
``type``
Options for the ``type`` attribute of the ``<channel/>`` element.
Features
~~~~~~~~

View File

@ -574,6 +574,18 @@ virDomainCapsDeviceRedirdevFormat(virBuffer *buf,
}
static void
virDomainCapsDeviceChannelFormat(virBuffer *buf,
const virDomainCapsDeviceChannel *channel)
{
FORMAT_PROLOGUE(channel);
ENUM_PROCESS(channel, type, virDomainChrTypeToString);
FORMAT_EPILOGUE(channel);
}
/**
* virDomainCapsFeatureGICFormat:
* @buf: target buffer
@ -688,6 +700,7 @@ virDomainCapsFormat(const virDomainCaps *caps)
virDomainCapsDeviceFilesystemFormat(&buf, &caps->filesystem);
virDomainCapsDeviceTPMFormat(&buf, &caps->tpm);
virDomainCapsDeviceRedirdevFormat(&buf, &caps->redirdev);
virDomainCapsDeviceChannelFormat(&buf, &caps->channel);
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</devices>\n");

View File

@ -137,6 +137,13 @@ struct _virDomainCapsDeviceRedirdev {
virDomainCapsEnum bus; /* virDomainRedirdevBus */
};
STATIC_ASSERT_ENUM(VIR_DOMAIN_CHR_TYPE_LAST);
typedef struct _virDomainCapsDeviceChannel virDomainCapsDeviceChannel;
struct _virDomainCapsDeviceChannel {
virTristateBool supported;
virDomainCapsEnum type; /* virDomainChrType */
};
STATIC_ASSERT_ENUM(VIR_DOMAIN_FS_DRIVER_TYPE_LAST);
typedef struct _virDomainCapsDeviceFilesystem virDomainCapsDeviceFilesystem;
struct _virDomainCapsDeviceFilesystem {
@ -234,6 +241,7 @@ struct _virDomainCaps {
virDomainCapsDeviceFilesystem filesystem;
virDomainCapsDeviceTPM tpm;
virDomainCapsDeviceRedirdev redirdev;
virDomainCapsDeviceChannel channel;
/* add new domain devices here */
virDomainCapsFeatureGIC gic;

View File

@ -201,6 +201,9 @@
<optional>
<ref name="redirdev"/>
</optional>
<optional>
<ref name="channel"/>
</optional>
</element>
</define>
@ -260,6 +263,13 @@
</element>
</define>
<define name="channel">
<element name="channel">
<ref name="supported"/>
<ref name="enum"/>
</element>
</define>
<define name="features">
<element name="features">
<optional>

View File

@ -6347,6 +6347,19 @@ virQEMUCapsFillDomainDeviceRedirdevCaps(virQEMUCaps *qemuCaps,
}
void
virQEMUCapsFillDomainDeviceChannelCaps(virQEMUCaps *qemuCaps,
virDomainCapsDeviceChannel *channel)
{
channel->supported = VIR_TRISTATE_BOOL_YES;
channel->type.report = true;
VIR_DOMAIN_CAPS_ENUM_SET(channel->type,
VIR_DOMAIN_CHR_TYPE_PTY, VIR_DOMAIN_CHR_TYPE_UNIX);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SPICE))
VIR_DOMAIN_CAPS_ENUM_SET(channel->type, VIR_DOMAIN_CHR_TYPE_SPICEVMC);
}
/**
* virQEMUCapsSupportsGICVersion:
@ -6484,6 +6497,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps,
virDomainCapsDeviceFilesystem *filesystem = &domCaps->filesystem;
virDomainCapsDeviceTPM *tpm = &domCaps->tpm;
virDomainCapsDeviceRedirdev *redirdev = &domCaps->redirdev;
virDomainCapsDeviceChannel *channel = &domCaps->channel;
virDomainCapsMemoryBacking *memoryBacking = &domCaps->memoryBacking;
virQEMUCapsFillDomainFeaturesFromQEMUCaps(qemuCaps, domCaps);
@ -6517,6 +6531,7 @@ virQEMUCapsFillDomainCaps(virQEMUCaps *qemuCaps,
virQEMUCapsFillDomainDeviceFSCaps(qemuCaps, filesystem);
virQEMUCapsFillDomainDeviceTPMCaps(qemuCaps, tpm);
virQEMUCapsFillDomainDeviceRedirdevCaps(qemuCaps, redirdev);
virQEMUCapsFillDomainDeviceChannelCaps(qemuCaps, channel);
virQEMUCapsFillDomainFeatureGICCaps(qemuCaps, domCaps);
virQEMUCapsFillDomainFeatureSEVCaps(qemuCaps, domCaps);
virQEMUCapsFillDomainFeatureS390PVCaps(qemuCaps, domCaps);

View File

@ -833,6 +833,9 @@ void virQEMUCapsFillDomainDeviceTPMCaps(virQEMUCaps *qemuCaps,
void virQEMUCapsFillDomainDeviceRedirdevCaps(virQEMUCaps *qemuCaps,
virDomainCapsDeviceRedirdev *redirdev);
void virQEMUCapsFillDomainDeviceChannelCaps(virQEMUCaps *qemuCaps,
virDomainCapsDeviceChannel *channel);
bool virQEMUCapsGuestIsNative(virArch host,
virArch guest);

View File

@ -221,6 +221,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -236,6 +236,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -166,6 +166,12 @@
</filesystem>
<tpm supported='no'/>
<redirdev supported='no'/>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='yes'>

View File

@ -164,6 +164,12 @@
</filesystem>
<tpm supported='no'/>
<redirdev supported='no'/>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -137,6 +137,12 @@
</enum>
</tpm>
<redirdev supported='no'/>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -243,6 +243,12 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -221,6 +221,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -223,6 +223,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -238,6 +238,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -178,6 +178,12 @@
</enum>
</tpm>
<redirdev supported='no'/>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='yes'>

View File

@ -176,6 +176,12 @@
</enum>
</tpm>
<redirdev supported='no'/>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -143,6 +143,12 @@
</enum>
</tpm>
<redirdev supported='no'/>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -223,6 +223,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -224,6 +224,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -238,6 +238,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -110,6 +110,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -224,6 +224,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -224,6 +224,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -238,6 +238,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -178,6 +178,12 @@
</enum>
</tpm>
<redirdev supported='no'/>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='yes'>

View File

@ -176,6 +176,12 @@
</enum>
</tpm>
<redirdev supported='no'/>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -143,6 +143,12 @@
</enum>
</tpm>
<redirdev supported='no'/>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -245,6 +245,12 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -224,6 +224,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -226,6 +226,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -240,6 +240,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -180,6 +180,12 @@
</enum>
</tpm>
<redirdev supported='no'/>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='yes'>

View File

@ -178,6 +178,12 @@
</enum>
</tpm>
<redirdev supported='no'/>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -246,6 +246,12 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -226,6 +226,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -227,6 +227,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -240,6 +240,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -227,6 +227,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -227,6 +227,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -241,6 +241,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -186,6 +186,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='yes'>

View File

@ -184,6 +184,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -142,6 +142,12 @@
</enum>
</tpm>
<redirdev supported='no'/>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -227,6 +227,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -228,6 +228,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -242,6 +242,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -185,6 +185,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='yes'>

View File

@ -183,6 +183,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -147,6 +147,12 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -228,6 +228,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -227,6 +227,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -240,6 +240,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -140,6 +140,12 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>

View File

@ -227,6 +227,13 @@
<value>usb</value>
</enum>
</redirdev>
<channel supported='yes'>
<enum name='type'>
<value>pty</value>
<value>unix</value>
<value>spicevmc</value>
</enum>
</channel>
</devices>
<features>
<gic supported='no'/>