[pve-devel] [PATCH container 2/2] add unicodeconsole config for containers

Dominik Csapak d.csapak at proxmox.com
Tue Feb 28 12:06:41 CET 2017


to explicitely use utf8 mode in the terminals via SPICE/VNC
even when the host locale is not set to xx_XX.UTF-8

this should fix a problem where you could not login when using utf8
symbols in the container password

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/PVE/API2/LXC.pm   | 4 +++-
 src/PVE/LXC/Config.pm | 8 ++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index 47dcb08..cb6031b 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -707,6 +707,8 @@ __PACKAGE__->register_method ({
 		       '-timeout', $timeout, '-authpath', $authpath,
 		       '-perm', 'VM.Console'];
 
+	    push @$cmd, '-utf8' if $conf->{unicodeconsole};
+
 	    if ($param->{websocket}) {
 		$ENV{PVE_VNC_TICKET} = $ticket; # pass ticket to vncterm
 		push @$cmd, '-notls', '-listen', 'localhost';
@@ -822,7 +824,7 @@ __PACKAGE__->register_method ({
 
 	my $title = "CT $vmid";
 
-	return PVE::API2Tools::run_spiceterm($authpath, $permissions, $vmid, $node, $proxy, $title, $shcmd);
+	return PVE::API2Tools::run_spiceterm($authpath, $permissions, $vmid, $node, $proxy, $title, $shcmd, $conf->{unicodeconsole});
     }});
 
 
diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 05cd970..002d8eb 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -403,6 +403,12 @@ my $confdesc = {
 	description => "Makes the container run as unprivileged user. (Should not be modified manually.)",
 	default => 0,
     },
+    unicodeconsole => {
+	optional => 1,
+	type => 'boolean',
+	description => "Enables UTF8 mode in the VNC and SPICE Console",
+	default => 0,
+    }
 };
 
 my $valid_lxc_conf_keys = {
@@ -961,6 +967,8 @@ sub update_pct_config {
 	} elsif ($opt eq 'ostype') {
 	    next if $hotplug_error->($opt);
 	    $conf->{$opt} = $value;
+	} elsif ($opt eq 'unicodeconsole') {
+	    $conf->{$opt} = $value ? 1 : 0;
 	} else {
 	    die "implement me: $opt";
 	}
-- 
2.1.4





More information about the pve-devel mailing list