On 10/13/22 01:24, Jim Fehlig wrote:
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(a)suse.com>
---
docs/formatdomaincaps.rst | 24 +++++++++++++++++++
src/conf/domain_capabilities.c | 13 ++++++++++
src/conf/domain_capabilities.h | 8 +++++++
src/conf/schemas/domaincaps.rng | 10 ++++++++
src/qemu/qemu_capabilities.c | 16 +++++++++++++
src/qemu/qemu_capabilities.h | 3 +++
.../domaincapsdata/qemu_4.2.0-q35.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_4.2.0-tcg.x86_64.xml | 7 ++++++
.../qemu_4.2.0-virt.aarch64.xml | 6 +++++
tests/domaincapsdata/qemu_4.2.0.aarch64.xml | 6 +++++
tests/domaincapsdata/qemu_4.2.0.ppc64.xml | 6 +++++
tests/domaincapsdata/qemu_4.2.0.s390x.xml | 6 +++++
tests/domaincapsdata/qemu_4.2.0.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_5.0.0-q35.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_5.0.0-tcg.x86_64.xml | 7 ++++++
.../qemu_5.0.0-virt.aarch64.xml | 6 +++++
tests/domaincapsdata/qemu_5.0.0.aarch64.xml | 6 +++++
tests/domaincapsdata/qemu_5.0.0.ppc64.xml | 6 +++++
tests/domaincapsdata/qemu_5.0.0.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_5.1.0-q35.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_5.1.0-tcg.x86_64.xml | 7 ++++++
tests/domaincapsdata/qemu_5.1.0.sparc.xml | 7 ++++++
tests/domaincapsdata/qemu_5.1.0.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_5.2.0-q35.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_5.2.0-tcg.x86_64.xml | 7 ++++++
.../qemu_5.2.0-virt.aarch64.xml | 6 +++++
tests/domaincapsdata/qemu_5.2.0.aarch64.xml | 6 +++++
tests/domaincapsdata/qemu_5.2.0.ppc64.xml | 6 +++++
tests/domaincapsdata/qemu_5.2.0.s390x.xml | 6 +++++
tests/domaincapsdata/qemu_5.2.0.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_6.0.0-q35.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_6.0.0-tcg.x86_64.xml | 7 ++++++
.../qemu_6.0.0-virt.aarch64.xml | 6 +++++
tests/domaincapsdata/qemu_6.0.0.aarch64.xml | 6 +++++
tests/domaincapsdata/qemu_6.0.0.s390x.xml | 6 +++++
tests/domaincapsdata/qemu_6.0.0.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_6.1.0-q35.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_6.1.0-tcg.x86_64.xml | 7 ++++++
tests/domaincapsdata/qemu_6.1.0.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_6.2.0-q35.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_6.2.0-tcg.x86_64.xml | 7 ++++++
.../qemu_6.2.0-virt.aarch64.xml | 7 ++++++
tests/domaincapsdata/qemu_6.2.0.aarch64.xml | 7 ++++++
tests/domaincapsdata/qemu_6.2.0.ppc64.xml | 6 +++++
tests/domaincapsdata/qemu_6.2.0.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_7.0.0-q35.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_7.0.0-tcg.x86_64.xml | 7 ++++++
.../qemu_7.0.0-virt.aarch64.xml | 7 ++++++
tests/domaincapsdata/qemu_7.0.0.aarch64.xml | 7 ++++++
tests/domaincapsdata/qemu_7.0.0.ppc64.xml | 6 +++++
tests/domaincapsdata/qemu_7.0.0.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_7.1.0-q35.x86_64.xml | 7 ++++++
.../domaincapsdata/qemu_7.1.0-tcg.x86_64.xml | 7 ++++++
tests/domaincapsdata/qemu_7.1.0.x86_64.xml | 7 ++++++
.../caps_4.2.0.x86_64.xml | 1 +
.../caps_5.0.0.riscv64.xml | 1 +
.../caps_5.0.0.x86_64.xml | 1 +
.../qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 +
.../caps_5.1.0.x86_64.xml | 1 +
.../caps_5.2.0.riscv64.xml | 1 +
.../caps_5.2.0.x86_64.xml | 1 +
.../caps_6.0.0.x86_64.xml | 1 +
.../caps_6.1.0.x86_64.xml | 1 +
.../caps_6.2.0.aarch64.xml | 1 +
.../caps_6.2.0.x86_64.xml | 1 +
.../caps_7.0.0.aarch64.xml | 1 +
.../caps_7.0.0.x86_64.xml | 1 +
.../caps_7.1.0.x86_64.xml | 1 +
68 files changed, 408 insertions(+)
diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst
index 93d36f2702..f95d3a7083 100644
--- a/docs/formatdomaincaps.rst
+++ b/docs/formatdomaincaps.rst
@@ -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
~~~~~~~~
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index f8b2f88376..a7f256e4ec 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -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");
diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
index ba7c2a5e42..e0cfa75531 100644
--- a/src/conf/domain_capabilities.h
+++ b/src/conf/domain_capabilities.h
@@ -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;
diff --git a/src/conf/schemas/domaincaps.rng b/src/conf/schemas/domaincaps.rng
index cf7a1d1d89..a6747b20ef 100644
--- a/src/conf/schemas/domaincaps.rng
+++ b/src/conf/schemas/domaincaps.rng
@@ -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>
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 5a664ec628..98849daf4c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1392,6 +1392,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "s390-pv-guest", QEMU_CAPS_S390_PV_GUEST },
{ "virtio-mem-pci", QEMU_CAPS_DEVICE_VIRTIO_MEM_PCI },
{ "virtio-iommu-pci", QEMU_CAPS_DEVICE_VIRTIO_IOMMU_PCI },
+ { "chardev-spicevmc", X_QEMU_CAPS_CHARDEV_SPICEVMC },
The X_ prefix means that the capability was retired beause we are sure
QEMU has it, always. Or another capability reflects the same. In this
specific case I'd say QEMU_CAPS_SPICE is sufficient.
};
Michal