This patch adds a new hvparam "lxc_tty" to the LXC hypervisor. This parameter specifies the number of ttys(actually ptys) that should be allocated for the container. The value of lxc.tty should be configurable because in some cases we want to disable pts instance allocation for the LXC container.
Signed-off-by: Yuto KAWAMURA(kawamuray) <[email protected]> --- lib/hypervisor/hv_lxc.py | 5 ++++- man/gnt-instance.rst | 11 +++++++++++ src/Ganeti/Constants.hs | 5 +++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/hypervisor/hv_lxc.py b/lib/hypervisor/hv_lxc.py index cd31485..caf4ac0 100644 --- a/lib/hypervisor/hv_lxc.py +++ b/lib/hypervisor/hv_lxc.py @@ -69,6 +69,7 @@ class LXCHypervisor(hv_base.BaseHypervisor): 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_TTY: hv_base.REQ_NONNEGATIVE_INT_CHECK, constants.HV_LXC_STARTUP_WAIT: hv_base.OPT_NONNEGATIVE_INT_CHECK, } @@ -451,7 +452,9 @@ class LXCHypervisor(hv_base.BaseHypervisor): # separate pseudo-TTY instances out.append("lxc.pts = 255") # standard TTYs - out.append("lxc.tty = 6") + lxc_ttys = instance.hvparams[constants.HV_LXC_TTY] + if lxc_ttys: # if it is the number greater than 0 + out.append("lxc.tty = %s" % lxc_ttys) # console log file console_log = utils.PathJoin(self._ROOT_DIR, instance.name + ".console") try: diff --git a/man/gnt-instance.rst b/man/gnt-instance.rst index 54fae78..b42c7ad 100644 --- a/man/gnt-instance.rst +++ b/man/gnt-instance.rst @@ -951,6 +951,17 @@ lxc\_extra\_config This parameter is not set by default. +lxc\_tty + Valid for the LXC hypervisor. + + This option specifies the number of ttys(actually ptys) that + should be allocated for the LXC container. + You can disable pty devices allocation for the LXC container by + setting this parameter to 0, but you can't use + **gnt-instance console** in this case. + + It is set to ``6`` 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 4d17930..5174206 100644 --- a/src/Ganeti/Constants.hs +++ b/src/Ganeti/Constants.hs @@ -1701,6 +1701,9 @@ hvLxcDropCapabilities = "lxc_drop_capabilities" hvLxcExtraConfig :: String hvLxcExtraConfig = "lxc_extra_config" +hvLxcTty :: String +hvLxcTty = "lxc_tty" + hvMemPath :: String hvMemPath = "mem_path" @@ -1867,6 +1870,7 @@ hvsParameterTypes = Map.fromList , (hvLxcDevices, VTypeString) , (hvLxcDropCapabilities, VTypeString) , (hvLxcExtraConfig, VTypeString) + , (hvLxcTty, VTypeInt) , (hvLxcStartupWait, VTypeInt) , (hvMemPath, VTypeString) , (hvMigrationBandwidth, VTypeInt) @@ -3952,6 +3956,7 @@ hvcDefaults = , (hvLxcDevices, PyValueEx lxcDevicesDefault) , (hvLxcDropCapabilities, PyValueEx lxcDropCapabilitiesDefault) , (hvLxcExtraConfig, PyValueEx "") + , (hvLxcTty, PyValueEx (6 :: Int)) , (hvLxcStartupWait, PyValueEx (30 :: Int)) ]) ] -- 2.0.4
