2014-08-22 2:18 GMT+09:00 Hrvoje Ribicic <[email protected]>:
> On Mon, Aug 18, 2014 at 3:38 AM, 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 |  6 ++++++
>>  man/gnt-instance.rst     | 10 ++++++++++
>>  src/Ganeti/Constants.hs  |  5 +++++
>>  3 files changed, 21 insertions(+)
>>
>> diff --git a/lib/hypervisor/hv_lxc.py b/lib/hypervisor/hv_lxc.py
>> index b8ea73a..596def2 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,
>>      }
>>
>> @@ -512,6 +513,11 @@ class LXCHypervisor(hv_base.BaseHypervisor):
>>      for cap in self._GetInstanceDropCapabilities(instance.hvparams):
>>        out.append("lxc.cap.drop = %s" % cap)
>>
>> +    # Extra config
>> +    out.append("# User defined configs")
>> +    extra_configs = instance.hvparams[constants.HV_LXC_EXTRA_CONFIG]
>> +    out.extend(extra_configs.split(","))
>
>
> By splitting these values at ',', we are limiting the params to values which
> do not contain a comma, aren't we?
> Given that lxc.mount.entry would usually require commas, we should probably
> avoid this restriction.
>
> For the time being, it can remain as-is, but perhaps a TODO should be added
> / issue should be filed stating that we could load these values from a file.
> The contents would have to be read instantly and committed to the
> configuration to allow for instance mobility, but it would help solve this
> horrible issue of escapes and separators and escaping escapes.
>
Right and agreed. I'll try to make this parameter to be specify the
extra configuration file path.

> This is a bigger issue though, and I will try and consult with the team
> before moving on this one.
>
>> +
>>      return "\n".join(out) + "\n"
>>
>>    @classmethod
>> diff --git a/man/gnt-instance.rst b/man/gnt-instance.rst
>> index 1e00a54..d5cfe13 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.
>> +    The each value of this option must be valid as a line of a LXC
>
>
> Each value ... 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 4d8d420..848085e 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