[pve-devel] [PATCH container] add 'noescapechar' parameter to get_console_command
Dominik Csapak
d.csapak at proxmox.com
Fri Nov 24 15:43:32 CET 2017
this adds a '-e -1' to lxc-console, and disables the
escape character (which we do not want with the web console)
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/PVE/API2/LXC.pm | 2 +-
src/PVE/LXC.pm | 13 +++++++++----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 561d05e..a1897c7 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -710,7 +710,7 @@ __PACKAGE__->register_method ({
['/usr/bin/ssh', '-e', 'none', '-t', $remip] : [];
my $conf = PVE::LXC::Config->load_config($vmid, $node);
- my $concmd = PVE::LXC::get_console_command($vmid, $conf);
+ my $concmd = PVE::LXC::get_console_command($vmid, $conf, 1);
my $shcmd = [ '/usr/bin/dtach', '-A',
"/var/run/dtach/vzctlconsole$vmid",
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index ebe369d..80d79e1 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -486,19 +486,24 @@ sub verify_searchdomain_list {
}
sub get_console_command {
- my ($vmid, $conf) = @_;
+ my ($vmid, $conf, $noescapechar) = @_;
my $cmode = PVE::LXC::Config->get_cmode($conf);
+ my $cmd = [];
if ($cmode eq 'console') {
- return ['lxc-console', '-n', $vmid, '-t', 0];
+ push @$cmd, 'lxc-console', '-n', $vmid, '-t', 0;
+ push @$cmd, '-e', -1 if $noescapechar;
} elsif ($cmode eq 'tty') {
- return ['lxc-console', '-n', $vmid];
+ push @$cmd, 'lxc-console', '-n', $vmid;
+ push @$cmd, '-e', -1 if $noescapechar;
} elsif ($cmode eq 'shell') {
- return ['lxc-attach', '--clear-env', '-n', $vmid];
+ push @$cmd, 'lxc-attach', '--clear-env', '-n', $vmid;
} else {
die "internal error";
}
+
+ return $cmd;
}
sub get_primary_ips {
--
2.11.0
More information about the pve-devel
mailing list