[pve-devel] r5481 - in pve-manager/pve2: lib/PVE lib/PVE/API2 www/manager www/manager/data
svn-commits at proxmox.com
svn-commits at proxmox.com
Wed Feb 2 13:45:44 CET 2011
Author: dietmar
Date: 2011-02-02 13:45:44 +0100 (Wed, 02 Feb 2011)
New Revision: 5481
Modified:
pve-manager/pve2/lib/PVE/API2/Nodes.pm
pve-manager/pve2/lib/PVE/APIDaemon.pm
pve-manager/pve2/lib/PVE/REST.pm
pve-manager/pve2/www/manager/PVECache.js
pve-manager/pve2/www/manager/StatusPanel.js
pve-manager/pve2/www/manager/data/UpdateStore.js
Log:
* implement syslog viewer
* implement proxyto handling
Modified: pve-manager/pve2/lib/PVE/API2/Nodes.pm
===================================================================
--- pve-manager/pve2/lib/PVE/API2/Nodes.pm 2011-02-02 12:33:06 UTC (rev 5480)
+++ pve-manager/pve2/lib/PVE/API2/Nodes.pm 2011-02-02 12:45:44 UTC (rev 5481)
@@ -50,6 +50,7 @@
path => 'syslog',
method => 'GET',
description => "Read system log",
+ proxyto => 'node',
parameters => {
additionalProperties => 0,
properties => {
Modified: pve-manager/pve2/lib/PVE/APIDaemon.pm
===================================================================
--- pve-manager/pve2/lib/PVE/APIDaemon.pm 2011-02-02 12:33:06 UTC (rev 5480)
+++ pve-manager/pve2/lib/PVE/APIDaemon.pm 2011-02-02 12:45:44 UTC (rev 5481)
@@ -267,7 +267,6 @@
my $parser = HTTP::Request::Params->new({req => $r});
my $params = $parser->params;
- syslog('info', "PA: " . Dumper($params));
PVE::Cluster::cfs_update();
Modified: pve-manager/pve2/lib/PVE/REST.pm
===================================================================
--- pve-manager/pve2/lib/PVE/REST.pm 2011-02-02 12:33:06 UTC (rev 5480)
+++ pve-manager/pve2/lib/PVE/REST.pm 2011-02-02 12:45:44 UTC (rev 5481)
@@ -199,7 +199,7 @@
syslog('info', "proxy start $method $host:$abs_uri");
my $ua = LWP::UserAgent->new(
- protocols_allowed => [ 'http' ],
+ protocols_allowed => [ 'http', 'https' ],
timeout => 30,
);
@@ -318,6 +318,29 @@
$uri_param->{$p} = $params->{$p};
}
+ if ($info->{proxyto}) {
+ my $remip;
+ eval {
+ my $pn = $info->{proxyto};
+ my $node = $uri_param->{$pn};
+ die "proxy parameter '$pn' does not exists" if !$node;
+
+ if ($node ne 'localhost' &&
+ $node ne PVE::INotify::nodename()) {
+ $remip = PVE::Cluster::remote_node_ip($node);
+ }
+ };
+ if (my $err = $@) {
+ return {
+ status => HTTP_INTERNAL_SERVER_ERROR,
+ message => $err,
+ };
+ }
+ if ($remip) {
+ return { proxy => $remip };
+ }
+ }
+
# fixme: not sure if we should do that here, because we can't proxy those
# methods to other hosts?
return { proxy => 'localhost' } if $info->{protected} && ($euid != 0);
Modified: pve-manager/pve2/www/manager/PVECache.js
===================================================================
--- pve-manager/pve2/www/manager/PVECache.js 2011-02-02 12:33:06 UTC (rev 5480)
+++ pve-manager/pve2/www/manager/PVECache.js 2011-02-02 12:45:44 UTC (rev 5481)
@@ -61,25 +61,6 @@
}(),
- cllogstore: function(){
-
- var fields = [
- { name: 'time', type : 'date', dateFormat: 'timestamp' },
- { name: 'pri', type: 'int' },
- { name: 'pid', type: 'int' },
- 'node', 'user', 'tag', 'msg' ];
-
- var store = new PVE.data.UpdateStore({
- itype: 'storage',
- autoDestroy: false,
- url: '/api2/json/cluster/log',
- fields: fields
- });
-
- return store;
-
- }(),
-
dummy: "ignore me"
};
Modified: pve-manager/pve2/www/manager/StatusPanel.js
===================================================================
--- pve-manager/pve2/www/manager/StatusPanel.js 2011-02-02 12:33:06 UTC (rev 5480)
+++ pve-manager/pve2/www/manager/StatusPanel.js 2011-02-02 12:45:44 UTC (rev 5481)
@@ -8,9 +8,26 @@
self.title = "Realtime logfile viewer";
self.layout = 'fit';
- var clstore = PVE.Cache.cllogstore;
- clstore.startUpdate();
+ var fields = [
+ { name: 'time', type : 'date', dateFormat: 'timestamp' },
+ { name: 'pri', type: 'int' },
+ { name: 'pid', type: 'int' },
+ 'node', 'user', 'tag', 'msg' ];
+ var sysstore = new PVE.data.UpdateStore({
+ itype: 'storage',
+ autoDestroy: true,
+ url: '/api2/json/nodes/maui/syslog',
+ fields: fields
+ });
+
+ var clstore = new PVE.data.UpdateStore({
+ itype: 'storage',
+ autoDestroy: false,
+ url: '/api2/json/cluster/log',
+ fields: fields
+ });
+
var cllogview = new Ext.list.ListView({
store: clstore,
columnSort: false,
@@ -28,11 +45,11 @@
{ header: "Message", dataIndex: 'msg' }
]});
- var move_to_end = true;
+ var cl_move_to_end = true;
clstore.on("load", function() {
- if (move_to_end) {
- move_to_end = false;
+ if (cl_move_to_end) {
+ cl_move_to_end = false;
var count = clstore.getCount();
if (count) {
var item = cllogview.getNode(count - 1);
@@ -42,6 +59,37 @@
}
});
+ var sysview = new Ext.list.ListView({
+ store: sysstore,
+ columnSort: false,
+ columns: [
+ { header: "Time", width: 0.10, dataIndex: 'time',
+ tpl: '{time:date("M d H:i:s")}'
+ },
+ { header: "Node", width: 0.05, dataIndex: 'node' },
+ { header: "Tag", width: 0.05, dataIndex: 'tag' },
+ { header: "PID", width: 0.05, dataIndex: 'pid' },
+ { header: "User", width: 0.05, dataIndex: 'user' },
+ { header: "Severity", width: 0.05, dataIndex: 'pri',
+ tpl: '{[ PVE.Utils.render_serverity(values.pri) ]}'
+ },
+ { header: "Message", dataIndex: 'msg' }
+ ]});
+
+ var sys_move_to_end = true;
+
+ sysstore.on("load", function() {
+ if (sys_move_to_end) {
+ sys_move_to_end = false;
+ var count = sysstore.getCount();
+ if (count) {
+ var item = sysview.getNode(count - 1);
+ if (item)
+ Ext.fly(item).scrollIntoView(sysview.innerBody.dom.parentNode);
+ }
+ }
+ });
+
self.items = {
xtype: 'tabpanel',
border: false,
@@ -53,11 +101,28 @@
items: [
{
title: 'Cluster Log',
- items: cllogview
+ items: cllogview,
+ listeners: {
+ show: function() {
+ clstore.startUpdate();
+ },
+ hide: function() {
+ clstore.stopUpdate();
+ }
+ }
},
{
- title: 'System Log'
- },
+ title: 'System Log',
+ items: sysview,
+ listeners: {
+ show: function() {
+ sysstore.startUpdate();
+ },
+ hide: function() {
+ sysstore.stopUpdate();
+ }
+ }
+ },
{
title: 'Task list'
}
Modified: pve-manager/pve2/www/manager/data/UpdateStore.js
===================================================================
--- pve-manager/pve2/www/manager/data/UpdateStore.js 2011-02-02 12:33:06 UTC (rev 5480)
+++ pve-manager/pve2/www/manager/data/UpdateStore.js 2011-02-02 12:45:44 UTC (rev 5481)
@@ -33,6 +33,13 @@
run_load_task(10);
},
+ stopUpdate: function() {
+ if (!load_task)
+ return;
+
+ load_task.cancel();
+ },
+
listeners: {
beforeload: function() {
if (!PVE.Utils.authOK()) {
More information about the pve-devel
mailing list