From 4f958489db1acf31330ae79f7ab10663021a8df3 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 14 Aug 2015 08:46:25 +0200 Subject: [PATCH] add console option --- src/PVE/LXC.pm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index 629a41e..57a6273 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -83,6 +83,12 @@ my $confdesc = { enum => ['debian', 'ubuntu', 'centos'], description => "OS type. Corresponds to lxc setup scripts in /usr/share/lxc/config/.common.conf.", }, + console => { + optional => 1, + type => 'boolean', + description => "Attach a console device (/dev/console) to the container.", + default => 1, + }, tty => { optional => 1, type => 'integer', @@ -939,6 +945,8 @@ sub update_lxc_config { die "implement me"; } + $raw .= "lxc.console = none\n" if !$conf->{console}; + my $ttycount = $conf->{tty} // 4; $raw .= "lxc.tty = $ttycount\n"; @@ -1062,7 +1070,8 @@ sub update_pct_config { write_cgroup_value("memory", $vmid, "memory.memsw.limit_in_bytes", -1); } elsif ($opt eq 'description' || $opt eq 'onboot' || $opt eq 'startup') { delete $conf->{$opt}; - } elsif ($opt eq 'nameserver' || $opt eq 'searchdomain') { + } elsif ($opt eq 'nameserver' || $opt eq 'searchdomain' || + $opt eq 'tty' || $opt eq 'console') { delete $conf->{$opt}; push @nohotplug, $opt; next if $running; @@ -1106,7 +1115,7 @@ sub update_pct_config { $conf->{$opt} = $value ? 1 : 0; } elsif ($opt eq 'startup') { $conf->{$opt} = $value; - } elsif ($opt eq 'tty') { + } elsif ($opt eq 'tty' || $opt eq 'console') { $conf->{$opt} = $value; push @nohotplug, $opt; next if $running; -- 2.39.5