[pve-devel] [PATCH cluster] deprecate and map 'applet' console setting in datacenter.cfg

Dominik Csapak d.csapak at proxmox.com
Thu Dec 21 12:52:53 CET 2017


we do not use the applet anymore, and setting it throws an error
in the gui when clicking the console button

map it to 'html5' and mark it deprecated, so that we can remove
that setting in the next major release

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 data/PVE/Cluster.pm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/data/PVE/Cluster.pm b/data/PVE/Cluster.pm
index df2758f..5fc7d86 100644
--- a/data/PVE/Cluster.pm
+++ b/data/PVE/Cluster.pm
@@ -1366,7 +1366,7 @@ my $datacenter_schema = {
 	console => {
 	    optional => 1,
 	    type => 'string',
-	    description => "Select the default Console viewer. You can either use the builtin java applet (VNC), an external virt-viewer comtatible application (SPICE), or an HTML5 based viewer (noVNC).",
+	    description => "Select the default Console viewer. You can either use the builtin java applet (VNC; deprecated and maps to html5), an external virt-viewer comtatible application (SPICE), or an HTML5 based viewer (noVNC).",
 	    enum => ['applet', 'vv', 'html5'],
 	},
 	email_from => {
@@ -1423,6 +1423,11 @@ sub parse_datacenter_config {
 	}
     }
 
+    # for backwards compatibility only, applet maps to html5
+    if (defined($res->{console}) && $res->{console} eq 'applet') {
+	$res->{console} = 'html5';
+    }
+
     return $res;
 }
 
@@ -1435,6 +1440,11 @@ sub write_datacenter_config {
 	$cfg->{migration}->{type} = ($migration_unsecure) ? 'insecure' : 'secure';
     }
 
+    # map deprecated applet setting to html5
+    if (defined($cfg->{console}) && $cfg->{console} eq 'applet') {
+	$cfg->{console} = 'html5';
+    }
+
     if (my $migration = $cfg->{migration}) {
 	$cfg->{migration} = PVE::JSONSchema::print_property_string($migration, $migration_format);
     }
-- 
2.11.0





More information about the pve-devel mailing list