
On Fri, Jan 21, 2011 at 05:53:08PM -0500, Cole Robinson wrote:
@@ -3817,11 +3842,29 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArgList(cmd, "-soundhw", "pcspk", NULL); } else { virCommandAddArg(cmd, "-device"); - if (!(str = qemuBuildSoundDevStr(sound))) goto error;
virCommandAddArg(cmd, str); + + if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6) { + char *codecstr = NULL; + if (!(qemuCmdFlags & QEMUD_CMD_FLAG_HDA_DUPLEX)) { + qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU binary lacks hda support")); + goto error; + } + + virCommandAddArg(cmd, "-device"); + if (!(codecstr = qemuBuildSoundCodecStr(sound, + "hda-duplex"))) { + goto error; + } + + virCommandAddArg(cmd, codecstr); + VIR_FREE(codecstr); + } + VIR_FREE(str); } } @@ -3833,13 +3876,19 @@ qemuBuildCommandLine(virConnectPtr conn,
for (i = 0 ; i < def->nsounds && size > 0 ; i++) { virDomainSoundDefPtr sound = def->sounds[i]; - const char *model = virDomainSoundModelTypeToString(sound->model); - if (!model) { - VIR_FREE(modstr); + const char *model = "hda"; + + if (sound->model != VIR_DOMAIN_SOUND_MODEL_ICH6 && + !(model = virDomainSoundModelTypeToString(sound->model))) { qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("invalid sound model")); + } + + if (!model) { + VIR_FREE(modstr); goto error; } + strncat(modstr, model, size); size -= strlen(model); if (i < (def->nsounds - 1))
I'm not sure the logic here is correct. This is the code branch that is taken when '-device' does not exist. If this branch is taken then the "hda" device doesn't exist either, so I think this branch ought to be unchanged, except for raising CONFIG_UNSUPPORTED for HDA device types Daniel