mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-09 08:56:34 +00:00
display crush map
This commit is contained in:
parent
9662c1952a
commit
2f692121ce
@ -158,16 +158,16 @@ my $run_ceph_cmd = sub {
|
|||||||
die $err if $err;
|
die $err if $err;
|
||||||
};
|
};
|
||||||
|
|
||||||
my $run_ceph_cmd_json = sub {
|
my $run_ceph_cmd_text = sub {
|
||||||
my ($cmd, %opts) = @_;
|
my ($cmd, %opts) = @_;
|
||||||
|
|
||||||
my $json = '';
|
my $out = '';
|
||||||
|
|
||||||
my $quiet = delete $opts{quiet};
|
my $quiet = delete $opts{quiet};
|
||||||
|
|
||||||
my $parser = sub {
|
my $parser = sub {
|
||||||
my $line = shift;
|
my $line = shift;
|
||||||
$json .= $line;
|
$out .= "$line\n";
|
||||||
};
|
};
|
||||||
|
|
||||||
my $errfunc = sub {
|
my $errfunc = sub {
|
||||||
@ -175,12 +175,17 @@ my $run_ceph_cmd_json = sub {
|
|||||||
print "$line\n" if !$quiet;
|
print "$line\n" if !$quiet;
|
||||||
};
|
};
|
||||||
|
|
||||||
&$run_ceph_cmd([@$cmd, '--format', 'json'],
|
&$run_ceph_cmd($cmd, outfunc => $parser, errfunc => $errfunc);
|
||||||
outfunc => $parser, errfunc => $errfunc);
|
|
||||||
|
|
||||||
my $res = decode_json($json);
|
return $out;
|
||||||
|
};
|
||||||
|
|
||||||
return $res;
|
my $run_ceph_cmd_json = sub {
|
||||||
|
my ($cmd, %opts) = @_;
|
||||||
|
|
||||||
|
my $json = &$run_ceph_cmd_text([@$cmd, '--format', 'json'], %opts);
|
||||||
|
|
||||||
|
return decode_json($json);
|
||||||
};
|
};
|
||||||
|
|
||||||
sub ceph_mon_status {
|
sub ceph_mon_status {
|
||||||
@ -261,6 +266,7 @@ __PACKAGE__->register_method ({
|
|||||||
{ name => 'stop' },
|
{ name => 'stop' },
|
||||||
{ name => 'start' },
|
{ name => 'start' },
|
||||||
{ name => 'status' },
|
{ name => 'status' },
|
||||||
|
{ name => 'crush' },
|
||||||
];
|
];
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
@ -678,3 +684,29 @@ __PACKAGE__->register_method ({
|
|||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
__PACKAGE__->register_method ({
|
||||||
|
name => 'crush',
|
||||||
|
path => 'crush',
|
||||||
|
method => 'GET',
|
||||||
|
description => "Get OSD crush map",
|
||||||
|
proxyto => 'node',
|
||||||
|
protected => 1,
|
||||||
|
parameters => {
|
||||||
|
additionalProperties => 0,
|
||||||
|
properties => {
|
||||||
|
node => get_standard_option('pve-node'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
returns => { type => 'string' },
|
||||||
|
code => sub {
|
||||||
|
my ($param) = @_;
|
||||||
|
|
||||||
|
&$check_ceph_inited();
|
||||||
|
|
||||||
|
my $txt = &$run_ceph_cmd_text(['osd', 'crush', 'dump'], quiet => 1);
|
||||||
|
|
||||||
|
return $txt;
|
||||||
|
}});
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,3 +1,50 @@
|
|||||||
|
Ext.define('PVE.node.CephCrushMap', {
|
||||||
|
extend: 'Ext.panel.Panel',
|
||||||
|
alias: 'widget.pveNodeCephCrushMap',
|
||||||
|
|
||||||
|
load: function() {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
PVE.Utils.API2Request({
|
||||||
|
url: me.url,
|
||||||
|
waitMsgTarget: me,
|
||||||
|
failure: function(response, opts) {
|
||||||
|
me.update(gettext('Error') + " " + response.htmlStatus);
|
||||||
|
},
|
||||||
|
success: function(response, opts) {
|
||||||
|
var data = response.result.data;
|
||||||
|
me.update(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
initComponent: function() {
|
||||||
|
var me = this;
|
||||||
|
|
||||||
|
var nodename = me.pveSelNode.data.node;
|
||||||
|
if (!nodename) {
|
||||||
|
throw "no node name specified";
|
||||||
|
}
|
||||||
|
|
||||||
|
Ext.apply(me, {
|
||||||
|
url: '/api2/extjs/nodes/' + nodename + '/ceph/crush',
|
||||||
|
style: 'padding-left:10px',
|
||||||
|
bodyStyle: 'white-space:pre',
|
||||||
|
bodyPadding: 5,
|
||||||
|
autoScroll: true,
|
||||||
|
listeners: {
|
||||||
|
show: function() {
|
||||||
|
me.load();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
me.callParent();
|
||||||
|
|
||||||
|
me.load();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Ext.define('PVE.node.CephStatus', {
|
Ext.define('PVE.node.CephStatus', {
|
||||||
extend: 'PVE.grid.ObjectGrid',
|
extend: 'PVE.grid.ObjectGrid',
|
||||||
alias: 'widget.pveNodeCephStatus',
|
alias: 'widget.pveNodeCephStatus',
|
||||||
@ -178,8 +225,8 @@ Ext.define('PVE.node.Ceph', {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Crush',
|
title: 'Crush',
|
||||||
itemId: 'test5',
|
xtype: 'pveNodeCephCrushMap',
|
||||||
html: "ABCD"
|
itemId: 'crushmap'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
listeners: {
|
listeners: {
|
||||||
|
Loading…
Reference in New Issue
Block a user