]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: support use of <audio> elements
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 23 Feb 2021 18:32:25 +0000 (18:32 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Tue, 9 Mar 2021 22:58:26 +0000 (22:58 +0000)
Currently the QEMU driver secretly sets the QEMU_AUDIO_DRV env variable
depending on how <graphics> are configured.

This introduces support for configuring audio backends from the <audio>
elements in the XML config.

The existing default behaviour is now only used if no <audio> element is
present.

All except the 'jack' audio driver are supported via QEMU's old env
variable config.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
39 files changed:
src/libvirt_private.syms
src/qemu/qemu_command.c
src/qemu/qemu_validate.c
tests/qemuxml2argvdata/audio-alsa-minimal.args [new file with mode: 0644]
tests/qemuxml2argvdata/audio-alsa-minimal.xml [new file with mode: 0644]
tests/qemuxml2argvdata/audio-coreaudio-minimal.args [new file with mode: 0644]
tests/qemuxml2argvdata/audio-coreaudio-minimal.xml [new file with mode: 0644]
tests/qemuxml2argvdata/audio-file-minimal.args [new file with mode: 0644]
tests/qemuxml2argvdata/audio-file-minimal.xml [new file with mode: 0644]
tests/qemuxml2argvdata/audio-jack-minimal.err [new file with mode: 0644]
tests/qemuxml2argvdata/audio-jack-minimal.xml [new file with mode: 0644]
tests/qemuxml2argvdata/audio-many-backends.err [new file with mode: 0644]
tests/qemuxml2argvdata/audio-many-backends.xml [new file with mode: 0644]
tests/qemuxml2argvdata/audio-none-minimal.args [new file with mode: 0644]
tests/qemuxml2argvdata/audio-none-minimal.xml [new file with mode: 0644]
tests/qemuxml2argvdata/audio-oss-best.args [new file with mode: 0644]
tests/qemuxml2argvdata/audio-oss-best.xml [new file with mode: 0644]
tests/qemuxml2argvdata/audio-oss-minimal.args [new file with mode: 0644]
tests/qemuxml2argvdata/audio-oss-minimal.xml [new file with mode: 0644]
tests/qemuxml2argvdata/audio-pulseaudio-minimal.args [new file with mode: 0644]
tests/qemuxml2argvdata/audio-pulseaudio-minimal.xml [new file with mode: 0644]
tests/qemuxml2argvdata/audio-sdl-best.args [new file with mode: 0644]
tests/qemuxml2argvdata/audio-sdl-best.xml [new file with mode: 0644]
tests/qemuxml2argvdata/audio-sdl-minimal.args [new file with mode: 0644]
tests/qemuxml2argvdata/audio-sdl-minimal.xml [new file with mode: 0644]
tests/qemuxml2argvdata/audio-spice-minimal.args [new file with mode: 0644]
tests/qemuxml2argvdata/audio-spice-minimal.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c
tests/qemuxml2xmloutdata/audio-alsa-minimal.xml [new symlink]
tests/qemuxml2xmloutdata/audio-coreaudio-minimal.xml [new symlink]
tests/qemuxml2xmloutdata/audio-file-minimal.xml [new symlink]
tests/qemuxml2xmloutdata/audio-none-minimal.xml [new symlink]
tests/qemuxml2xmloutdata/audio-oss-best.xml [new symlink]
tests/qemuxml2xmloutdata/audio-oss-minimal.xml [new symlink]
tests/qemuxml2xmloutdata/audio-pulseaudio-minimal.xml [new symlink]
tests/qemuxml2xmloutdata/audio-sdl-best.xml [new symlink]
tests/qemuxml2xmloutdata/audio-sdl-minimal.xml [new symlink]
tests/qemuxml2xmloutdata/audio-spice-minimal.xml [new symlink]
tests/qemuxml2xmltest.c

index 580c03e796f5c5f1e8cbcf8eef666f27034d13b8..1d837dd34a0790054bac8c7f678d64058d0d7df1 100644 (file)
@@ -226,6 +226,8 @@ virDiskNameParse;
 virDiskNameToBusDeviceIndex;
 virDiskNameToIndex;
 virDomainActualNetDefFree;
+virDomainAudioSDLDriverTypeFromString;
+virDomainAudioSDLDriverTypeToString;
 virDomainAudioTypeTypeFromString;
 virDomainAudioTypeTypeToString;
 virDomainBlockedReasonTypeFromString;
index e64d966222071bcc7d01e7e86cb77b52eeaecabb..abbf4bc8cd471c097a2984b489214d9e71528eb9 100644 (file)
@@ -177,6 +177,21 @@ VIR_ENUM_IMPL(qemuNumaPolicy,
               "interleave",
 );
 
+VIR_ENUM_DECL(qemuAudioDriver);
+VIR_ENUM_IMPL(qemuAudioDriver,
+              VIR_DOMAIN_AUDIO_TYPE_LAST,
+              "none",
+              "alsa",
+              "coreaudio",
+              "jack",
+              "oss",
+              "pa",
+              "sdl",
+              "spice",
+              "wav",
+);
+
+
 
 /**
  * qemuBuildMasterKeyCommandLine:
@@ -7543,11 +7558,91 @@ qemuBuildMemoryDeviceCommandLine(virCommandPtr cmd,
     return 0;
 }
 
+static void
+qemuBuildAudioOSSEnv(virCommandPtr cmd,
+                     const char *prefix,
+                     virDomainAudioIOOSSPtr def)
+{
+    if (def->dev)
+        virCommandAddEnvFormat(cmd, "%sDEV=%s",
+                               prefix, def->dev);
+}
+
+static int
+qemuBuildAudioCommandLineEnv(virCommandPtr cmd,
+                             virDomainDefPtr def)
+{
+    virDomainAudioDefPtr audio;
+    if (def->naudios != 1)
+        return 0;
+
+    audio = def->audios[0];
+    virCommandAddEnvPair(cmd, "QEMU_AUDIO_DRV",
+                         qemuAudioDriverTypeToString(audio->type));
+
+    switch ((virDomainAudioType)audio->type) {
+    case VIR_DOMAIN_AUDIO_TYPE_NONE:
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_ALSA:
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_COREAUDIO:
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_JACK:
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_OSS:
+        qemuBuildAudioOSSEnv(cmd, "QEMU_OSS_ADC_", &audio->backend.oss.input);
+        qemuBuildAudioOSSEnv(cmd, "QEMU_OSS_DAC_", &audio->backend.oss.output);
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_PULSEAUDIO:
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_SDL:
+        if (audio->backend.sdl.driver) {
+            /*
+             * Some SDL audio driver names are different on SDL 1.2
+             * vs 2.0.  Given how old SDL 1.2 is, we're not going
+             * make any attempt to support it here as it is unlikely
+             * to have an real world users. We can assume libvirt
+             * driver name strings match SDL 2.0 names.
+             */
+            virCommandAddEnvPair(cmd, "SDL_AUDIODRIVER",
+                                 virDomainAudioSDLDriverTypeToString(
+                                     audio->backend.sdl.driver));
+        }
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_SPICE:
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_FILE:
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_LAST:
+    default:
+        virReportEnumRangeError(virDomainAudioType, audio->type);
+        return -1;
+    }
+    return 0;
+}
+
+static int
+qemuBuildAudioCommandLine(virCommandPtr cmd,
+                          virDomainDefPtr def)
+{
+    return qemuBuildAudioCommandLineEnv(cmd, def);
+}
+
 
 static int
 qemuBuildGraphicsSDLCommandLine(virQEMUDriverConfigPtr cfg G_GNUC_UNUSED,
                                 virCommandPtr cmd,
                                 virQEMUCapsPtr qemuCaps G_GNUC_UNUSED,
+                                virDomainDefPtr def,
                                 virDomainGraphicsDefPtr graphics)
 {
     g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
@@ -7559,12 +7654,14 @@ qemuBuildGraphicsSDLCommandLine(virQEMUDriverConfigPtr cfg G_GNUC_UNUSED,
     if (graphics->data.sdl.fullscreen)
         virCommandAddArg(cmd, "-full-screen");
 
-    /* If using SDL for video, then we should just let it
-     * use QEMU's host audio drivers, possibly SDL too
-     * User can set these two before starting libvirtd
-     */
-    virCommandAddEnvPass(cmd, "QEMU_AUDIO_DRV");
-    virCommandAddEnvPass(cmd, "SDL_AUDIODRIVER");
+    if (def->naudios == 0) {
+        /* If using SDL for video, then we should just let it
+         * use QEMU's host audio drivers, possibly SDL too
+         * User can set these two before starting libvirtd
+         */
+        virCommandAddEnvPass(cmd, "QEMU_AUDIO_DRV");
+        virCommandAddEnvPass(cmd, "SDL_AUDIODRIVER");
+    }
 
     virCommandAddArg(cmd, "-display");
     virBufferAddLit(&opt, "sdl");
@@ -7583,6 +7680,7 @@ static int
 qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
                                 virCommandPtr cmd,
                                 virQEMUCapsPtr qemuCaps,
+                                virDomainDefPtr def,
                                 virDomainGraphicsDefPtr graphics)
 {
     g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
@@ -7709,14 +7807,16 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
     if (graphics->data.vnc.keymap)
         virCommandAddArgList(cmd, "-k", graphics->data.vnc.keymap, NULL);
 
-    /* Unless user requested it, set the audio backend to none, to
-     * prevent it opening the host OS audio devices, since that causes
-     * security issues and might not work when using VNC.
-     */
-    if (cfg->vncAllowHostAudio)
-        virCommandAddEnvPass(cmd, "QEMU_AUDIO_DRV");
-    else
-        virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=none");
+    if (def->naudios == 0) {
+        /* Unless user requested it, set the audio backend to none, to
+         * prevent it opening the host OS audio devices, since that causes
+         * security issues and might not work when using VNC.
+         */
+        if (cfg->vncAllowHostAudio)
+            virCommandAddEnvPass(cmd, "QEMU_AUDIO_DRV");
+        else
+            virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=none");
+    }
 
     return 0;
 }
@@ -7725,6 +7825,7 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
 static int
 qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
                                   virCommandPtr cmd,
+                                  virDomainDefPtr def,
                                   virDomainGraphicsDefPtr graphics)
 {
     g_auto(virBuffer) opt = VIR_BUFFER_INITIALIZER;
@@ -7922,10 +8023,13 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
     if (graphics->data.spice.keymap)
         virCommandAddArgList(cmd, "-k",
                              graphics->data.spice.keymap, NULL);
-    /* SPICE includes native support for tunnelling audio, so we
-     * set the audio backend to point at SPICE's own driver
-     */
-    virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=spice");
+
+    if (def->naudios == 0) {
+        /* SPICE includes native support for tunnelling audio, so we
+         * set the audio backend to point at SPICE's own driver
+         */
+        virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=spice");
+    }
 
     return 0;
 }
@@ -7967,19 +8071,19 @@ qemuBuildGraphicsCommandLine(virQEMUDriverConfigPtr cfg,
         switch (graphics->type) {
         case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
             if (qemuBuildGraphicsSDLCommandLine(cfg, cmd,
-                                                qemuCaps, graphics) < 0)
+                                                qemuCaps, def, graphics) < 0)
                 return -1;
 
             break;
         case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
             if (qemuBuildGraphicsVNCCommandLine(cfg, cmd,
-                                                qemuCaps, graphics) < 0)
+                                                qemuCaps, def, graphics) < 0)
                 return -1;
 
             break;
         case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
             if (qemuBuildGraphicsSPICECommandLine(cfg, cmd,
-                                                  graphics) < 0)
+                                                  def, graphics) < 0)
                 return -1;
 
             break;
@@ -9978,10 +10082,12 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
         virCommandAddArg(cmd, "-display");
         virCommandAddArg(cmd, "none");
 
-        if (cfg->nogfxAllowHostAudio)
-            virCommandAddEnvPass(cmd, "QEMU_AUDIO_DRV");
-        else
-            virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=none");
+        if (def->naudios == 0) {
+            if (cfg->nogfxAllowHostAudio)
+                virCommandAddEnvPass(cmd, "QEMU_AUDIO_DRV");
+            else
+                virCommandAddEnvString(cmd, "QEMU_AUDIO_DRV=none");
+        }
     }
 
     /* Disable global config files and default devices */
@@ -10056,6 +10162,9 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
     if (qemuBuildInputCommandLine(cmd, def, qemuCaps) < 0)
         return NULL;
 
+    if (qemuBuildAudioCommandLine(cmd, def) < 0)
+        return NULL;
+
     if (qemuBuildGraphicsCommandLine(cfg, cmd, def, qemuCaps) < 0)
         return NULL;
 
index 23f5363dd0cfb74aa6823fe83827d86b6d59f9b9..7577fa5c8c7c56f77a3f0650a0d5310ab0c4e175 100644 (file)
@@ -1228,6 +1228,12 @@ qemuValidateDomainDef(const virDomainDef *def,
         return -1;
     }
 
+    if (def->naudios > 1) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("only one audio backend is supported with this QEMU binary"));
+        return -1;
+    }
+
     return 0;
 }
 
@@ -4165,6 +4171,50 @@ qemuValidateDomainDeviceDefFS(virDomainFSDefPtr fs,
 }
 
 
+static int
+qemuValidateDomainDeviceDefAudio(virDomainAudioDefPtr audio,
+                                 virQEMUCapsPtr qemuCaps G_GNUC_UNUSED)
+{
+    switch ((virDomainAudioType)audio->type) {
+    case VIR_DOMAIN_AUDIO_TYPE_NONE:
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_ALSA:
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_COREAUDIO:
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_JACK:
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("'jack' audio backend is not supported with this QEMU"));
+        return -1;
+
+    case VIR_DOMAIN_AUDIO_TYPE_OSS:
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_PULSEAUDIO:
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_SDL:
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_SPICE:
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_FILE:
+        break;
+
+    case VIR_DOMAIN_AUDIO_TYPE_LAST:
+    default:
+        virReportEnumRangeError(virDomainAudioType, audio->type);
+        return -1;
+    }
+
+    return 0;
+}
+
+
 static int
 qemuSoundCodecTypeToCaps(int type)
 {
@@ -4858,9 +4908,12 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev,
         ret = qemuValidateDomainDeviceDefShmem(dev->data.shmem, qemuCaps);
         break;
 
+    case VIR_DOMAIN_DEVICE_AUDIO:
+        ret = qemuValidateDomainDeviceDefAudio(dev->data.audio, qemuCaps);
+        break;
+
     case VIR_DOMAIN_DEVICE_LEASE:
     case VIR_DOMAIN_DEVICE_PANIC:
-    case VIR_DOMAIN_DEVICE_AUDIO:
     case VIR_DOMAIN_DEVICE_NONE:
     case VIR_DOMAIN_DEVICE_LAST:
         break;
diff --git a/tests/qemuxml2argvdata/audio-alsa-minimal.args b/tests/qemuxml2argvdata/audio-alsa-minimal.args
new file mode 100644 (file)
index 0000000..01fe6e2
--- /dev/null
@@ -0,0 +1,29 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=alsa \
+/usr/bin/qemu-system-i386 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-drive file=/dev/cdrom,format=raw,if=none,id=drive-ide0-1-0,readonly=on \
+-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1
diff --git a/tests/qemuxml2argvdata/audio-alsa-minimal.xml b/tests/qemuxml2argvdata/audio-alsa-minimal.xml
new file mode 100644 (file)
index 0000000..ab26688
--- /dev/null
@@ -0,0 +1,36 @@
+<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='cdrom'/>
+  </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='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' 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'/>
+    <audio id='1' type='alsa'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/audio-coreaudio-minimal.args b/tests/qemuxml2argvdata/audio-coreaudio-minimal.args
new file mode 100644 (file)
index 0000000..c4d502b
--- /dev/null
@@ -0,0 +1,29 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=coreaudio \
+/usr/bin/qemu-system-i386 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-drive file=/dev/cdrom,format=raw,if=none,id=drive-ide0-1-0,readonly=on \
+-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1
diff --git a/tests/qemuxml2argvdata/audio-coreaudio-minimal.xml b/tests/qemuxml2argvdata/audio-coreaudio-minimal.xml
new file mode 100644 (file)
index 0000000..f271e99
--- /dev/null
@@ -0,0 +1,36 @@
+<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='cdrom'/>
+  </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='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' 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'/>
+    <audio id='1' type='coreaudio'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/audio-file-minimal.args b/tests/qemuxml2argvdata/audio-file-minimal.args
new file mode 100644 (file)
index 0000000..fd504f5
--- /dev/null
@@ -0,0 +1,29 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=wav \
+/usr/bin/qemu-system-i386 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-drive file=/dev/cdrom,format=raw,if=none,id=drive-ide0-1-0,readonly=on \
+-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1
diff --git a/tests/qemuxml2argvdata/audio-file-minimal.xml b/tests/qemuxml2argvdata/audio-file-minimal.xml
new file mode 100644 (file)
index 0000000..3091b94
--- /dev/null
@@ -0,0 +1,36 @@
+<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='cdrom'/>
+  </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='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' 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'/>
+    <audio id='1' type='file'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/audio-jack-minimal.err b/tests/qemuxml2argvdata/audio-jack-minimal.err
new file mode 100644 (file)
index 0000000..0747113
--- /dev/null
@@ -0,0 +1 @@
+unsupported configuration: 'jack' audio backend is not supported with this QEMU
diff --git a/tests/qemuxml2argvdata/audio-jack-minimal.xml b/tests/qemuxml2argvdata/audio-jack-minimal.xml
new file mode 100644 (file)
index 0000000..d88d066
--- /dev/null
@@ -0,0 +1,36 @@
+<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='cdrom'/>
+  </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='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' 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'/>
+    <audio id='1' type='jack'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/audio-many-backends.err b/tests/qemuxml2argvdata/audio-many-backends.err
new file mode 100644 (file)
index 0000000..19b69e8
--- /dev/null
@@ -0,0 +1 @@
+unsupported configuration: only one audio backend is supported with this QEMU binary
diff --git a/tests/qemuxml2argvdata/audio-many-backends.xml b/tests/qemuxml2argvdata/audio-many-backends.xml
new file mode 100644 (file)
index 0000000..86eef90
--- /dev/null
@@ -0,0 +1,60 @@
+<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='cdrom'/>
+  </os>
+  <cpu mode='custom' match='exact' check='none'>
+    <model fallback='forbid'>qemu64</model>
+  </cpu>
+  <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='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0' model='piix3-uhci'>
+      <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='vnc' port='-1' autoport='yes'>
+      <listen type='address'/>
+      <audio id='2'/>
+    </graphics>
+    <sound model='ac97'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </sound>
+    <sound model='ich6'>
+      <audio id='2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </sound>
+    <sound model='es1370'>
+      <audio id='3'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </sound>
+    <audio id='1' type='none'/>
+    <audio id='2' type='alsa'/>
+    <audio id='3' type='pulseaudio'/>
+    <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/qemuxml2argvdata/audio-none-minimal.args b/tests/qemuxml2argvdata/audio-none-minimal.args
new file mode 100644 (file)
index 0000000..00c6e37
--- /dev/null
@@ -0,0 +1,29 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-i386 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-drive file=/dev/cdrom,format=raw,if=none,id=drive-ide0-1-0,readonly=on \
+-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1
diff --git a/tests/qemuxml2argvdata/audio-none-minimal.xml b/tests/qemuxml2argvdata/audio-none-minimal.xml
new file mode 100644 (file)
index 0000000..4729eda
--- /dev/null
@@ -0,0 +1,36 @@
+<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='cdrom'/>
+  </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='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' 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'/>
+    <audio id='1' type='none'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/audio-oss-best.args b/tests/qemuxml2argvdata/audio-oss-best.args
new file mode 100644 (file)
index 0000000..e6a7bb4
--- /dev/null
@@ -0,0 +1,31 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=oss \
+QEMU_OSS_ADC_DEV=/dev/dsp0 \
+QEMU_OSS_DAC_DEV=/dev/dsp1 \
+/usr/bin/qemu-system-i386 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-drive file=/dev/cdrom,format=raw,if=none,id=drive-ide0-1-0,readonly=on \
+-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1
diff --git a/tests/qemuxml2argvdata/audio-oss-best.xml b/tests/qemuxml2argvdata/audio-oss-best.xml
new file mode 100644 (file)
index 0000000..0947bd6
--- /dev/null
@@ -0,0 +1,39 @@
+<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='cdrom'/>
+  </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='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' 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'/>
+    <audio id='1' type='oss'>
+      <input dev='/dev/dsp0'/>
+      <output dev='/dev/dsp1'/>
+    </audio>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/audio-oss-minimal.args b/tests/qemuxml2argvdata/audio-oss-minimal.args
new file mode 100644 (file)
index 0000000..53c632e
--- /dev/null
@@ -0,0 +1,29 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=oss \
+/usr/bin/qemu-system-i386 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-drive file=/dev/cdrom,format=raw,if=none,id=drive-ide0-1-0,readonly=on \
+-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1
diff --git a/tests/qemuxml2argvdata/audio-oss-minimal.xml b/tests/qemuxml2argvdata/audio-oss-minimal.xml
new file mode 100644 (file)
index 0000000..abddc1a
--- /dev/null
@@ -0,0 +1,36 @@
+<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='cdrom'/>
+  </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='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' 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'/>
+    <audio id='1' type='oss'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/audio-pulseaudio-minimal.args b/tests/qemuxml2argvdata/audio-pulseaudio-minimal.args
new file mode 100644 (file)
index 0000000..af274e4
--- /dev/null
@@ -0,0 +1,29 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=pa \
+/usr/bin/qemu-system-i386 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-drive file=/dev/cdrom,format=raw,if=none,id=drive-ide0-1-0,readonly=on \
+-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1
diff --git a/tests/qemuxml2argvdata/audio-pulseaudio-minimal.xml b/tests/qemuxml2argvdata/audio-pulseaudio-minimal.xml
new file mode 100644 (file)
index 0000000..013b708
--- /dev/null
@@ -0,0 +1,36 @@
+<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='cdrom'/>
+  </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='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' 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'/>
+    <audio id='1' type='pulseaudio'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/audio-sdl-best.args b/tests/qemuxml2argvdata/audio-sdl-best.args
new file mode 100644 (file)
index 0000000..6aca703
--- /dev/null
@@ -0,0 +1,30 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=sdl \
+SDL_AUDIODRIVER=pulseaudio \
+/usr/bin/qemu-system-i386 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-drive file=/dev/cdrom,format=raw,if=none,id=drive-ide0-1-0,readonly=on \
+-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1
diff --git a/tests/qemuxml2argvdata/audio-sdl-best.xml b/tests/qemuxml2argvdata/audio-sdl-best.xml
new file mode 100644 (file)
index 0000000..d6835a2
--- /dev/null
@@ -0,0 +1,36 @@
+<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='cdrom'/>
+  </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='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' 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'/>
+    <audio id='1' type='sdl' driver='pulseaudio'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/audio-sdl-minimal.args b/tests/qemuxml2argvdata/audio-sdl-minimal.args
new file mode 100644 (file)
index 0000000..126c36b
--- /dev/null
@@ -0,0 +1,29 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=sdl \
+/usr/bin/qemu-system-i386 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-drive file=/dev/cdrom,format=raw,if=none,id=drive-ide0-1-0,readonly=on \
+-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1
diff --git a/tests/qemuxml2argvdata/audio-sdl-minimal.xml b/tests/qemuxml2argvdata/audio-sdl-minimal.xml
new file mode 100644 (file)
index 0000000..223e061
--- /dev/null
@@ -0,0 +1,36 @@
+<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='cdrom'/>
+  </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='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' 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'/>
+    <audio id='1' type='sdl'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/audio-spice-minimal.args b/tests/qemuxml2argvdata/audio-spice-minimal.args
new file mode 100644 (file)
index 0000000..a7a8595
--- /dev/null
@@ -0,0 +1,29 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=spice \
+/usr/bin/qemu-system-i386 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off \
+-m 214 \
+-realtime mlock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-drive file=/dev/cdrom,format=raw,if=none,id=drive-ide0-1-0,readonly=on \
+-device ide-cd,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0,bootindex=1
diff --git a/tests/qemuxml2argvdata/audio-spice-minimal.xml b/tests/qemuxml2argvdata/audio-spice-minimal.xml
new file mode 100644 (file)
index 0000000..eecae5a
--- /dev/null
@@ -0,0 +1,36 @@
+<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='cdrom'/>
+  </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='cdrom'>
+      <driver name='qemu' type='raw'/>
+      <source dev='/dev/cdrom'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <address type='drive' controller='0' bus='1' 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'/>
+    <audio id='1' type='spice'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
index 608bafcab4465899a72c17a93ded14b499e86bbb..c90bd341a9c2dbd153d37e5a0680955ee9380826 100644 (file)
@@ -1043,6 +1043,24 @@ mymain(void)
             QEMU_CAPS_BOOT_STRICT,
             QEMU_CAPS_VIRTIO_BLK_SCSI);
 
+    /* Simplest possible <audio>, all supported with ENV */
+    DO_TEST("audio-none-minimal", NONE);
+    DO_TEST("audio-alsa-minimal", NONE);
+    DO_TEST("audio-coreaudio-minimal", NONE);
+    DO_TEST_PARSE_ERROR("audio-jack-minimal", NONE);
+    DO_TEST("audio-oss-minimal", NONE);
+    DO_TEST("audio-pulseaudio-minimal", NONE);
+    DO_TEST("audio-sdl-minimal", NONE);
+    DO_TEST("audio-spice-minimal", NONE);
+    DO_TEST("audio-file-minimal", NONE);
+
+    /* Best <audio> still compat with old ENV */
+    DO_TEST("audio-oss-best", NONE);
+    DO_TEST("audio-sdl-best", NONE);
+
+    /* Multiple backends not supported with ENV */
+    DO_TEST_PARSE_ERROR("audio-many-backends", NONE);
+
     DO_TEST("reboot-timeout-disabled", QEMU_CAPS_REBOOT_TIMEOUT);
     DO_TEST("reboot-timeout-enabled", QEMU_CAPS_REBOOT_TIMEOUT);
     DO_TEST_PARSE_ERROR("reboot-timeout-enabled", NONE);
diff --git a/tests/qemuxml2xmloutdata/audio-alsa-minimal.xml b/tests/qemuxml2xmloutdata/audio-alsa-minimal.xml
new file mode 120000 (symlink)
index 0000000..c4f64da
--- /dev/null
@@ -0,0 +1 @@
+../qemuxml2argvdata/audio-alsa-minimal.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmloutdata/audio-coreaudio-minimal.xml b/tests/qemuxml2xmloutdata/audio-coreaudio-minimal.xml
new file mode 120000 (symlink)
index 0000000..3d30788
--- /dev/null
@@ -0,0 +1 @@
+../qemuxml2argvdata/audio-coreaudio-minimal.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmloutdata/audio-file-minimal.xml b/tests/qemuxml2xmloutdata/audio-file-minimal.xml
new file mode 120000 (symlink)
index 0000000..0b18700
--- /dev/null
@@ -0,0 +1 @@
+../qemuxml2argvdata/audio-file-minimal.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmloutdata/audio-none-minimal.xml b/tests/qemuxml2xmloutdata/audio-none-minimal.xml
new file mode 120000 (symlink)
index 0000000..ce0a93c
--- /dev/null
@@ -0,0 +1 @@
+../qemuxml2argvdata/audio-none-minimal.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmloutdata/audio-oss-best.xml b/tests/qemuxml2xmloutdata/audio-oss-best.xml
new file mode 120000 (symlink)
index 0000000..e716f61
--- /dev/null
@@ -0,0 +1 @@
+../qemuxml2argvdata/audio-oss-best.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmloutdata/audio-oss-minimal.xml b/tests/qemuxml2xmloutdata/audio-oss-minimal.xml
new file mode 120000 (symlink)
index 0000000..d30a208
--- /dev/null
@@ -0,0 +1 @@
+../qemuxml2argvdata/audio-oss-minimal.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmloutdata/audio-pulseaudio-minimal.xml b/tests/qemuxml2xmloutdata/audio-pulseaudio-minimal.xml
new file mode 120000 (symlink)
index 0000000..9cba6b5
--- /dev/null
@@ -0,0 +1 @@
+../qemuxml2argvdata/audio-pulseaudio-minimal.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmloutdata/audio-sdl-best.xml b/tests/qemuxml2xmloutdata/audio-sdl-best.xml
new file mode 120000 (symlink)
index 0000000..0c90810
--- /dev/null
@@ -0,0 +1 @@
+../qemuxml2argvdata/audio-sdl-best.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmloutdata/audio-sdl-minimal.xml b/tests/qemuxml2xmloutdata/audio-sdl-minimal.xml
new file mode 120000 (symlink)
index 0000000..787b220
--- /dev/null
@@ -0,0 +1 @@
+../qemuxml2argvdata/audio-sdl-minimal.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmloutdata/audio-spice-minimal.xml b/tests/qemuxml2xmloutdata/audio-spice-minimal.xml
new file mode 120000 (symlink)
index 0000000..5f07fd8
--- /dev/null
@@ -0,0 +1 @@
+../qemuxml2argvdata/audio-spice-minimal.xml
\ No newline at end of file
index 01ac5886f2913d7bd5b15345ee5f880795fdd8cd..03ab424e1a0aa2691090e7f80d8271b0ec9ee458 100644 (file)
@@ -1463,6 +1463,20 @@ mymain(void)
     DO_TEST_CAPS_LATEST("virtio-9p-createmode");
     DO_TEST("downscript", NONE);
 
+    /* Simplest possible <audio>, all supported with ENV */
+    DO_TEST("audio-none-minimal", NONE);
+    DO_TEST("audio-alsa-minimal", NONE);
+    DO_TEST("audio-coreaudio-minimal", NONE);
+    DO_TEST("audio-oss-minimal", NONE);
+    DO_TEST("audio-pulseaudio-minimal", NONE);
+    DO_TEST("audio-sdl-minimal", NONE);
+    DO_TEST("audio-spice-minimal", NONE);
+    DO_TEST("audio-file-minimal", NONE);
+
+    /* Best <audio> still compat with old ENV */
+    DO_TEST("audio-oss-best", NONE);
+    DO_TEST("audio-sdl-best", NONE);
+
  cleanup:
     if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
         virFileDeleteTree(fakerootdir);