From: Marc-André Lureau <marcandre.lureau(a)redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau(a)redhat.com>
---
docs/schemas/domaincommon.rng | 29 ++++++++++++
src/bhyve/bhyve_command.c | 1 +
src/conf/domain_conf.c | 34 +++++++++++---
src/conf/domain_conf.h | 2 +
src/qemu/qemu_command.c | 7 +++
src/qemu/qemu_validate.c | 3 ++
.../qemuxml2argvdata/graphics-dbus-audio.xml | 45 +++++++++++++++++++
.../graphics-dbus-audio.xml | 1 +
tests/qemuxml2xmltest.c | 4 ++
9 files changed, 121 insertions(+), 5 deletions(-)
create mode 100644 tests/qemuxml2argvdata/graphics-dbus-audio.xml
create mode 120000 tests/qemuxml2xmloutdata/graphics-dbus-audio.xml
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 29a506cff86a..5938f0d5acd3 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -4032,6 +4032,13 @@
</optional>
</element>
</optional>
+ <optional>
+ <element name="audio">
+ <attribute name="id">
+ <ref name="uint8"/>
+ </attribute>
+ </element>
+ </optional>
</interleave>
</group>
<group>
@@ -4844,6 +4851,11 @@
<ref name="audiocommonchild"/>
</define>
+ <define name="audiodbus">
+ <ref name="audiocommonattr"/>
+ <ref name="audiocommonchild"/>
+ </define>
+
<define name="audio">
<element name="audio">
<attribute name="id">
@@ -4872,6 +4884,23 @@
</optional>
</interleave>
</group>
+ <group>
+ <attribute name="type">
+ <value>dbus</value>
+ </attribute>
+ <interleave>
+ <optional>
+ <element name="input">
+ <ref name="audiodbus"/>
+ </element>
+ </optional>
+ <optional>
+ <element name="output">
+ <ref name="audiodbus"/>
+ </element>
+ </optional>
+ </interleave>
+ </group>
<group>
<attribute name="type">
<value>alsa</value>
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index 3368d20a042c..95bba738fe5d 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -551,6 +551,7 @@ bhyveBuildSoundArgStr(const virDomainDef *def G_GNUC_UNUSED,
case VIR_DOMAIN_AUDIO_TYPE_SDL:
case VIR_DOMAIN_AUDIO_TYPE_SPICE:
case VIR_DOMAIN_AUDIO_TYPE_FILE:
+ case VIR_DOMAIN_AUDIO_TYPE_DBUS:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unsupported audio backend '%s'"),
virDomainAudioTypeTypeToString(audio->type));
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1b44513d3415..791df66ff024 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -764,6 +764,7 @@ VIR_ENUM_IMPL(virDomainAudioType,
"sdl",
"spice",
"file",
+ "dbus",
);
VIR_ENUM_IMPL(virDomainAudioSDLDriver,
@@ -3032,6 +3033,7 @@ virDomainAudioDefFree(virDomainAudioDef *def)
g_free(def->backend.file.path);
break;
+ case VIR_DOMAIN_AUDIO_TYPE_DBUS:
case VIR_DOMAIN_AUDIO_TYPE_LAST:
break;
}
@@ -12908,6 +12910,14 @@ virDomainGraphicsDefParseXMLDBus(virDomainGraphicsDef *def,
return -1;
}
+ cur = virXPathNode("./audio", ctxt);
+ if (cur) {
+ if (virXMLPropUInt(cur, "id", 10,
+ VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
+ &def->data.dbus.audioId) < 0)
+ return -1;
+ }
+
return 0;
}
@@ -13398,6 +13408,9 @@ virDomainAudioDefParseXML(virDomainXMLOption *xmlopt
G_GNUC_UNUSED,
def->backend.file.path = virXMLPropString(node, "path");
break;
+ case VIR_DOMAIN_AUDIO_TYPE_DBUS:
+ break;
+
case VIR_DOMAIN_AUDIO_TYPE_LAST:
default:
virReportEnumRangeError(virDomainAudioType, def->type);
@@ -25816,6 +25829,9 @@ virDomainAudioDefFormat(virBuffer *buf,
virBufferEscapeString(&attrBuf, " path='%s'",
def->backend.file.path);
break;
+ case VIR_DOMAIN_AUDIO_TYPE_DBUS:
+ break;
+
case VIR_DOMAIN_AUDIO_TYPE_LAST:
default:
virReportEnumRangeError(virDomainAudioType, def->type);
@@ -26750,7 +26766,7 @@ virDomainGraphicsDefFormat(virBuffer *buf,
virBufferAsprintf(buf, " address='%s'",
def->data.dbus.address);
- if (!def->data.dbus.gl)
+ if (!def->data.dbus.gl && def->data.dbus.audioId <= 0)
break;
if (!children) {
@@ -26759,10 +26775,17 @@ virDomainGraphicsDefFormat(virBuffer *buf,
children = true;
}
- virBufferAsprintf(buf, "<gl enable='%s'",
- virTristateBoolTypeToString(def->data.dbus.gl));
- virBufferEscapeString(buf, " rendernode='%s'",
def->data.dbus.rendernode);
- virBufferAddLit(buf, "/>\n");
+ if (def->data.dbus.gl) {
+ virBufferAsprintf(buf, "<gl enable='%s'",
+ virTristateBoolTypeToString(def->data.dbus.gl));
+ virBufferEscapeString(buf, " rendernode='%s'",
def->data.dbus.rendernode);
+ virBufferAddLit(buf, "/>\n");
+ }
+
+ if (def->data.dbus.audioId > 0)
+ virBufferAsprintf(buf, "<audio id='%d'/>\n",
+ def->data.dbus.audioId);
+
break;
case VIR_DOMAIN_GRAPHICS_TYPE_LAST:
break;
@@ -30112,6 +30135,7 @@ virDomainAudioBackendIsEqual(virDomainAudioDef *this,
case VIR_DOMAIN_AUDIO_TYPE_FILE:
return STREQ_NULLABLE(this->backend.file.path, that->backend.file.path);
+ case VIR_DOMAIN_AUDIO_TYPE_DBUS:
case VIR_DOMAIN_AUDIO_TYPE_LAST:
default:
return false;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index cd219df0ac3c..f15917c49500 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1512,6 +1512,7 @@ typedef enum {
VIR_DOMAIN_AUDIO_TYPE_SDL,
VIR_DOMAIN_AUDIO_TYPE_SPICE,
VIR_DOMAIN_AUDIO_TYPE_FILE,
+ VIR_DOMAIN_AUDIO_TYPE_DBUS,
VIR_DOMAIN_AUDIO_TYPE_LAST
} virDomainAudioType;
@@ -1930,6 +1931,7 @@ struct _virDomainGraphicsDef {
char *address;
char *rendernode;
virTristateBool gl;
+ unsigned int audioId;
bool fromConfig; /* true if the @address is config file originated */
} dbus;
} data;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 12197cfdb7b2..2524abb1e971 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -142,6 +142,7 @@ VIR_ENUM_IMPL(qemuAudioDriver,
"sdl",
"spice",
"wav",
+ "dbus",
);
@@ -7979,6 +7980,9 @@ qemuBuildAudioCommandLineArg(virCommand *cmd,
return -1;
break;
+ case VIR_DOMAIN_AUDIO_TYPE_DBUS:
+ break;
+
case VIR_DOMAIN_AUDIO_TYPE_LAST:
default:
virReportEnumRangeError(virDomainAudioType, def->type);
@@ -8183,6 +8187,9 @@ qemuBuildAudioCommandLineEnv(virCommand *cmd,
audio->backend.file.path);
break;
+ case VIR_DOMAIN_AUDIO_TYPE_DBUS:
+ break;
+
case VIR_DOMAIN_AUDIO_TYPE_LAST:
default:
virReportEnumRangeError(virDomainAudioType, audio->type);
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 1001e44693f5..50253e9009b9 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -4455,6 +4455,9 @@ qemuValidateDomainDeviceDefAudio(virDomainAudioDef *audio,
case VIR_DOMAIN_AUDIO_TYPE_FILE:
break;
+ case VIR_DOMAIN_AUDIO_TYPE_DBUS:
+ break;
+
case VIR_DOMAIN_AUDIO_TYPE_LAST:
default:
virReportEnumRangeError(virDomainAudioType, audio->type);
diff --git a/tests/qemuxml2argvdata/graphics-dbus-audio.xml
b/tests/qemuxml2argvdata/graphics-dbus-audio.xml
new file mode 100644
index 000000000000..b1304e3f6ff8
--- /dev/null
+++ b/tests/qemuxml2argvdata/graphics-dbus-audio.xml
@@ -0,0 +1,45 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219100</memory>
+ <currentMemory unit='KiB'>219100</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-i386</emulator>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <graphics type='dbus' p2p='yes'>
+ <audio id='1'/>
+ </graphics>
+ <audio id='1' type='dbus'>
+ <input mixingEngine='no'/>
+ <output mixingEngine='no'/>
+ </audio>
+ <video>
+ <model type='cirrus' vram='16384' heads='1'
primary='yes'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x02' function='0x0'/>
+ </video>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/graphics-dbus-audio.xml
b/tests/qemuxml2xmloutdata/graphics-dbus-audio.xml
new file mode 120000
index 000000000000..fe0f4a81d9e4
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/graphics-dbus-audio.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/graphics-dbus-audio.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 00635cfd657e..276cb8bcc274 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -383,6 +383,10 @@ mymain(void)
DO_TEST("graphics-dbus-p2p",
QEMU_CAPS_DEVICE_CIRRUS_VGA,
QEMU_CAPS_DISPLAY_DBUS);
+ DO_TEST("graphics-dbus-audio",
+ QEMU_CAPS_DEVICE_CIRRUS_VGA,
+ QEMU_CAPS_DISPLAY_DBUS,
+ QEMU_CAPS_AUDIODEV);
DO_TEST_CAPS_ARCH_LATEST("default-video-type-aarch64",
"aarch64");
DO_TEST_CAPS_ARCH_LATEST("default-video-type-ppc64", "ppc64");
--
2.34.1.8.g35151cf07204