[pve-devel] r6481 - in pve-cluster/trunk/data: . PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Tue Aug 16 07:10:03 CEST 2011


Author: dietmar
Date: 2011-08-16 07:10:03 +0200 (Tue, 16 Aug 2011)
New Revision: 6481

Modified:
   pve-cluster/trunk/data/ChangeLog
   pve-cluster/trunk/data/PVE/Cluster.pm
Log:
	* PVE/Cluster.pm (parse_datacenter_config)
	(write_datacenter_config): register reader/writer for
	datacenter.cfg




Modified: pve-cluster/trunk/data/ChangeLog
===================================================================
--- pve-cluster/trunk/data/ChangeLog	2011-08-16 04:51:59 UTC (rev 6480)
+++ pve-cluster/trunk/data/ChangeLog	2011-08-16 05:10:03 UTC (rev 6481)
@@ -1,3 +1,9 @@
+2011-08-16  Proxmox Support Team  <support at proxmox.com>
+
+	* PVE/Cluster.pm (parse_datacenter_config)
+	(write_datacenter_config): register reader/writer for
+	datacenter.cfg
+
 2011-08-15  Proxmox Support Team  <support at proxmox.com>
 
 	* PVE/Cluster.pm: add 'datacenter.cfg' to observed files.

Modified: pve-cluster/trunk/data/PVE/Cluster.pm
===================================================================
--- pve-cluster/trunk/data/PVE/Cluster.pm	2011-08-16 04:51:59 UTC (rev 6480)
+++ pve-cluster/trunk/data/PVE/Cluster.pm	2011-08-16 05:10:03 UTC (rev 6481)
@@ -1108,3 +1108,45 @@
 	if ! -l $sshglobalknownhosts;
 
 }
+
+my $keymaphash = PVE::Tools::kvmkeymaps();
+my $datacenter_schema = {
+    type => "object",
+    additionalProperties => 0,
+    properties => {
+	keyboard => {
+	    optional => 1,
+	    type => 'string',
+	    description => "Default keybord layout for vnc server.",
+	    enum => [ keys %$keymaphash ],
+	},
+	language => {
+	    optional => 1,
+	    type => 'string',
+	    description => "Default GUI language.",
+	    enum => [ 'en', 'de' ],
+	},
+	http_proxy => {
+	    optional => 1,
+	    type => 'string',
+	    description => "Specify external http proxy which is used for downloads (example: 'http://username:password\@host:port/')",
+	    pattern => "http://.*",
+	},
+    },
+};
+
+sub parse_datacenter_config {
+    my ($filename, $raw) = @_;
+
+    return PVE::JSONSchema::parse_config($datacenter_schema, $filename, $raw);
+}
+
+sub write_datacenter_config {
+    my ($filename, $cfg) = @_;
+    
+    return PVE::JSONSchema::dump_config($datacenter_schema, $filename, $cfg);
+}
+
+cfs_register_file('datacenter.cfg', 
+		  \&parse_datacenter_config,  
+		  \&write_datacenter_config);



More information about the pve-devel mailing list