LGTM, thanks

On Wed, Aug 27, 2014 at 10:17 PM, Yuto KAWAMURA(kawamuray) <
[email protected]> wrote:

> Add the new hvparam lxc_extra_config which is used to specify
> additional LXC container config parameters which are not supported by
> the Ganeti LXC hypervisor natively.
>
> Signed-off-by: Yuto KAWAMURA(kawamuray) <[email protected]>
> ---
>  lib/hypervisor/hv_lxc.py | 11 +++++++++++
>  man/gnt-instance.rst     | 10 ++++++++++
>  src/Ganeti/Constants.hs  |  5 +++++
>  3 files changed, 26 insertions(+)
>
> diff --git a/lib/hypervisor/hv_lxc.py b/lib/hypervisor/hv_lxc.py
> index 9c4eb03..070ccca 100644
> --- a/lib/hypervisor/hv_lxc.py
> +++ b/lib/hypervisor/hv_lxc.py
> @@ -68,6 +68,7 @@ class LXCHypervisor(hv_base.BaseHypervisor):
>      constants.HV_LXC_CGROUP_USE: hv_base.NO_CHECK,
>      constants.HV_LXC_DEVICES: hv_base.NO_CHECK,
>      constants.HV_LXC_DROP_CAPABILITIES: hv_base.NO_CHECK,
> +    constants.HV_LXC_EXTRA_CONFIG: hv_base.NO_CHECK,
>      constants.HV_LXC_STARTUP_WAIT: hv_base.OPT_NONNEGATIVE_INT_CHECK,
>      }
>
> @@ -518,6 +519,16 @@ class LXCHypervisor(hv_base.BaseHypervisor):
>      for cap in self._GetInstanceDropCapabilities(instance.hvparams):
>        out.append("lxc.cap.drop = %s" % cap)
>
> +    # Extra config
> +    # TODO: Currently a configuration parameter that includes comma
> +    # in its value can't be added via this parameter.
> +    # Make this parameter able to read from a file once the
> +    # "parameter from a file" feature added.
> +    extra_configs = instance.hvparams[constants.HV_LXC_EXTRA_CONFIG]
> +    if extra_configs:
> +      out.append("# User defined configs")
> +      out.extend(extra_configs.split(","))
> +
>      return "\n".join(out) + "\n"
>
>    @classmethod
> diff --git a/man/gnt-instance.rst b/man/gnt-instance.rst
> index 5e0fe49..54fae78 100644
> --- a/man/gnt-instance.rst
> +++ b/man/gnt-instance.rst
> @@ -941,6 +941,16 @@ lxc\_devices
>      /dev/console, /dev/ptmx and first block of Unix98 PTY slaves) with
>      read-writable(rw) access.
>
> +lxc\_extra\_config
> +    Valid for the LXC hypervisor.
> +
> +    This option specifies the list of extra config parameters which
> +    are not supported by the Ganeti LXC hypervisor natively.
> +    Each value of this option must be valid a line of the LXC
> +    container config file(see: **lxc.container.conf**\(5)).
> +
> +    This parameter is not set by default.
> +
>  The ``-O (--os-parameters)`` option allows customisation of the OS
>  parameters. The actual parameter names and values depend on the OS being
>  used, but the syntax is the same key=value. For example, setting a
> diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs
> index 3dec5f5..4d17930 100644
> --- a/src/Ganeti/Constants.hs
> +++ b/src/Ganeti/Constants.hs
> @@ -1698,6 +1698,9 @@ hvLxcDevices = "lxc_devices"
>  hvLxcDropCapabilities :: String
>  hvLxcDropCapabilities = "lxc_drop_capabilities"
>
> +hvLxcExtraConfig :: String
> +hvLxcExtraConfig = "lxc_extra_config"
> +
>  hvMemPath :: String
>  hvMemPath = "mem_path"
>
> @@ -1863,6 +1866,7 @@ hvsParameterTypes = Map.fromList
>    , (hvLxcCgroupUse,                    VTypeString)
>    , (hvLxcDevices,                      VTypeString)
>    , (hvLxcDropCapabilities,             VTypeString)
> +  , (hvLxcExtraConfig,                  VTypeString)
>    , (hvLxcStartupWait,                  VTypeInt)
>    , (hvMemPath,                         VTypeString)
>    , (hvMigrationBandwidth,              VTypeInt)
> @@ -3947,6 +3951,7 @@ hvcDefaults =
>            , (hvLxcCgroupUse,        PyValueEx "")
>            , (hvLxcDevices,          PyValueEx lxcDevicesDefault)
>            , (hvLxcDropCapabilities, PyValueEx lxcDropCapabilitiesDefault)
> +          , (hvLxcExtraConfig,      PyValueEx "")
>            , (hvLxcStartupWait,      PyValueEx (30 :: Int))
>            ])
>    ]
> --
> 2.0.4
>
>


Hrvoje Ribicic
Ganeti Engineering
Google Germany GmbH
Dienerstr. 12, 80331, München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Graham Law, Christine Elizabeth Flores
Steuernummer: 48/725/00206
Umsatzsteueridentifikationsnummer: DE813741370

Reply via email to