diff --git a/lib/constants.py b/lib/constants.py index 3b48426ae1a451b31290012c02480dce649ba24c..a5a758d4ce0379a1b79dd4ba5c58142e07d51ecd 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -830,6 +830,7 @@ HV_CPU_WEIGHT = "cpu_weight" HV_CPU_CORES = "cpu_cores" HV_CPU_THREADS = "cpu_threads" HV_CPU_SOCKETS = "cpu_sockets" +HV_SOUNDHW = "soundhw" HVS_PARAMETER_TYPES = { @@ -893,6 +894,7 @@ HVS_PARAMETER_TYPES = { HV_CPU_CORES: VTYPE_INT, HV_CPU_THREADS: VTYPE_INT, HV_CPU_SOCKETS: VTYPE_INT, + HV_SOUNDHW: VTYPE_STRING, } HVS_PARAMETERS = frozenset(HVS_PARAMETER_TYPES.keys()) @@ -1960,6 +1962,7 @@ HVC_DEFAULTS = { HV_CPU_CORES: 0, HV_CPU_THREADS: 0, HV_CPU_SOCKETS: 0, + HV_SOUNDHW: "", }, HT_FAKE: {}, HT_CHROOT: { diff --git a/lib/hypervisor/hv_kvm.py b/lib/hypervisor/hv_kvm.py index 94ce5b19f3389c46c20346056172eec2419195aa..aa629b5c7efd443d3a44dcff21b19ce5ebb7235c 100644 --- a/lib/hypervisor/hv_kvm.py +++ b/lib/hypervisor/hv_kvm.py @@ -535,6 +535,7 @@ class KVMHypervisor(hv_base.BaseHypervisor): constants.HV_CPU_CORES: hv_base.OPT_NONNEGATIVE_INT_CHECK, constants.HV_CPU_THREADS: hv_base.OPT_NONNEGATIVE_INT_CHECK, constants.HV_CPU_SOCKETS: hv_base.OPT_NONNEGATIVE_INT_CHECK, + constants.HV_SOUNDHW: hv_base.NO_CHECK, } _MIGRATION_STATUS_RE = re.compile("Migration\s+status:\s+(\w+)", @@ -1334,6 +1335,10 @@ class KVMHypervisor(hv_base.BaseHypervisor): if hvp[constants.HV_CPU_TYPE]: kvm_cmd.extend(["-cpu", hvp[constants.HV_CPU_TYPE]]) + # As requested by music lovers + if hvp[constants.HV_SOUNDHW]: + kvm_cmd.extend(["-soundhw", hvp[constants.HV_SOUNDHW]]) + # Save the current instance nics, but defer their expansion as parameters, # as we'll need to generate executable temp files for them. kvm_nics = instance.nics diff --git a/man/gnt-instance.rst b/man/gnt-instance.rst index 6e40d37711ad838e604f0b3f13c12c27cfcb7817..9837e5cccc002c8b956b8a1babb0980982ec596f 100644 --- a/man/gnt-instance.rst +++ b/man/gnt-instance.rst @@ -649,6 +649,12 @@ cpu\_sockets Number of emulated CPU sockets. +soundhw + Valid for the KVM hypervisor. + + Comma separated list of emulated sounds cards, or "all" to enable + all the available ones. + The ``-O (--os-parameters)`` option allows customisation of the OS parameters. The actual parameter names and values depends on the OS