Merge pull request #66 from ClusterLabs/webui_anvil_page

Webui anvil page
main
digimer-bot 4 years ago committed by GitHub
commit b5aa81471c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 141
      cgi-bin/get_shared_storage
  2. 95
      notes

@ -39,33 +39,138 @@ $anvil->Database->get_anvils();
print $anvil->Template->get({file => "shared.html", name => "json_headers", show_name => 0})."\n"; print $anvil->Template->get({file => "shared.html", name => "json_headers", show_name => 0})."\n";
my $hash = {}; my $hash = {};
my $anvil_uuid = $anvil->data->{cgi}{anvil_uuid}{value}; my $anvil_uuid = "";
if ($anvil->data->{cgi}{anvil_uuid}{value})
{
$anvil_uuid = $anvil->data->{cgi}{anvil_uuid}{value};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { anvil_uuid => $anvil_uuid }});
}
elsif ($anvil->data->{switches}{'anvil-uuid'})
{
$anvil_uuid = $anvil->data->{switches}{'anvil-uuid'};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { anvil_uuid => $anvil_uuid }});
}
if ((not $anvil_uuid) or (not exists $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid})) if ((not $anvil_uuid) or (not exists $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}))
{ {
$anvil->data->{anvil_status}{anvil_name} = "!!invalid!anvil_uuid!!"; $anvil->data->{anvil_status}{anvil_name} = "!!invalid!anvil_uuid!!";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { 'anvil_status::anvil_name' => $anvil->data->{anvil_status}{anvil_name} }});
} }
else else
{ {
$anvil->data->{anvil_status}{anvil_name} = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_name}; my $node1_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_node1_host_uuid};
$anvil->data->{anvil_status}{anvil_description} = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_description}; my $node2_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_node2_host_uuid};
$anvil->data->{anvil_status}{timestamp} = time; my $dr1_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_dr1_host_uuid};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
node1_uuid => $node1_uuid,
node2_uuid => $node2_uuid,
dr1_uuid => $dr1_uuid,
}});
my $query = "
SELECT
a.host_uuid,
a.host_name,
b.scan_filesystem_mount_point,
b.scan_filesystem_size,
b.scan_filesystem_used
FROM
hosts a,
scan_filesystems b
WHERE
a.host_uuid = b.scan_filesystem_host_uuid
AND
(
a.host_uuid = ".$anvil->Database->quote($node1_uuid)."
OR
a.host_uuid = ".$anvil->Database->quote($node2_uuid);
if ($dr1_uuid)
{
$query .= "
OR
a.host_uuid = ".$anvil->Database->quote($dr1_uuid);
}
$query .= "
)
ORDER BY
a.host_name ASC,
b.scan_filesystem_mount_point DESC
;";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
my $results = $anvil->Database->query({query => $query, source => $THIS_FILE, line => __LINE__});
my $count = @{$results};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
results => $results,
count => $count,
}});
foreach my $row (@{$results})
{
my $host_uuid = $row->[0];
my $host_name = $row->[1];
my $mount_point = $row->[2];
my $size = $row->[3];
my $used = $row->[4];
my $free = $size - $used;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
host_uuid => $host_uuid,
host_name => $host_name,
mount_point => $mount_point,
size => $anvil->Convert->add_commas({number => $size})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $size}).")",,
used => $anvil->Convert->add_commas({number => $used})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $used}).")",,
free => $anvil->Convert->add_commas({number => $free})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $free}).")",,
}});
my $node1_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_node1_host_uuid}; $anvil->data->{raw}{file_systems}{$mount_point}{nodes}{$host_uuid}{host_name} = $host_name;
my $node2_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_node2_host_uuid}; $anvil->data->{raw}{file_systems}{$mount_point}{nodes}{$host_uuid}{total} = $size;
my $node2_status = $anvil->data->{hosts}{host_uuid}{$node2_uuid}{host_status} eq "online" ? 1 : 0; $anvil->data->{raw}{file_systems}{$mount_point}{nodes}{$host_uuid}{free} = $free;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"raw::file_systems::${mount_point}::nodes::${host_uuid}::host_name" => $anvil->data->{raw}{file_systems}{$mount_point}{nodes}{$host_uuid}{host_name},
"raw::file_systems::${mount_point}::nodes::${host_uuid}::total" => $anvil->Convert->add_commas({number => $anvil->data->{raw}{file_systems}{$mount_point}{nodes}{$host_uuid}{total}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{raw}{file_systems}{$mount_point}{nodes}{$host_uuid}{total}}).")",,
"raw::file_systems::${mount_point}::nodes::${host_uuid}::free" => $anvil->Convert->add_commas({number => $anvil->data->{raw}{file_systems}{$mount_point}{nodes}{$host_uuid}{free}})." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $anvil->data->{raw}{file_systems}{$mount_point}{nodes}{$host_uuid}{free}}).")",,
}});
}
$anvil->data->{anvil_status}{nodes}{node1}{host_name} = $anvil->data->{hosts}{host_uuid}{$node1_uuid}{host_name}; $anvil->data->{file_systems} = [];
$anvil->data->{anvil_status}{nodes}{node1}{host_uuid} = $node1_uuid;
$anvil->data->{anvil_status}{nodes}{node1}{host_status} = $anvil->data->{hosts}{host_uuid}{$node1_uuid}{host_status} eq "online" ? 1 : 0;
$anvil->data->{anvil_status}{nodes}{node2}{host_name} = $anvil->data->{hosts}{host_uuid}{$node2_uuid}{host_name};
$anvil->data->{anvil_status}{nodes}{node2}{host_uuid} = $node2_uuid;
$anvil->data->{anvil_status}{nodes}{node2}{host_status} = $anvil->data->{hosts}{host_uuid}{$node2_uuid}{host_status} eq "online" ? 1 : 0;
$hash->{timestamp} = time; foreach my $mount_point (sort {$a cmp $b} keys %{$anvil->data->{raw}{file_systems}})
$hash->{nodes} = []; {
push @{$hash->{nodes}}, { on => $anvil->data->{anvil_status}{nodes}{node1}{host_status} }; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { mount_point => $mount_point }});
push @{$hash->{nodes}}, { on => $anvil->data->{anvil_status}{nodes}{node2}{host_status} }; $hash->{mount_point} = $mount_point;
$hash->{nodes} = [];
my $nodes = [$node1_uuid, $node2_uuid];
if ($dr1_uuid)
{
push @{$nodes}, $dr1_uuid;
}
foreach my $host_uuid (@{$nodes})
{
my $host_name = $anvil->data->{hosts}{host_uuid}{$host_uuid}{host_name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
host_uuid => $host_uuid,
host_name => $host_name,
}});
if (exists $anvil->data->{raw}{file_systems}{$mount_point}{nodes}{$host_uuid})
{
push @{$hash->{nodes}}, {
host_uuid => $host_uuid,
host_name => $anvil->data->{raw}{file_systems}{$mount_point}{nodes}{$host_uuid}{host_name},
is_mounted => 1,
total => $anvil->data->{raw}{file_systems}{$mount_point}{nodes}{$host_uuid}{total},
free => $anvil->data->{raw}{file_systems}{$mount_point}{nodes}{$host_uuid}{free},
}
}
else
{
push @{$hash->{nodes}}, {
host_uuid => $host_uuid,
host_name => $anvil->data->{hosts}{host_uuid}{$host_uuid}{host_name},
is_mounted => 0,
total => 0,
free => 0,
}
}
}
}
} }
print JSON->new->utf8->encode($hash)."\n"; print JSON->new->utf8->encode($hash)."\n";

95
notes

@ -778,3 +778,98 @@ systemctl restart firewalld
;;;; ;;;;
; Note: packaged extension modules are now loaded via the .ini files ; Note: packaged extension modules are now loaded via the .ini files
==== ====
Dell S4128T-ON Configuration
# Terminal access using serial port on back on the switch (USB-B front connect seems flaky)
screen /dev/ttyUSB0 115200
u: admin
p: admin
# Interface numbering (management port on the rear is 'mgmt 1/1/1');
OS10# show interface status
--------------------------------------------------------------------------------------------------
Port Description Status Speed Duplex Mode Vlan Tagged-Vlans
--------------------------------------------------------------------------------------------------
Eth 1/1/1 down 0 full A 1 -
Eth 1/1/2 down 0 full A 1 -
Eth 1/1/3 down 0 full A 1 -
Eth 1/1/4 down 0 full A 1 -
Eth 1/1/5 down 0 full A 1 -
Eth 1/1/6 down 0 full A 1 -
Eth 1/1/7 down 0 full A 1 -
Eth 1/1/8 down 0 full A 1 -
Eth 1/1/9 down 0 full A 1 -
Eth 1/1/10 down 0 full A 1 -
Eth 1/1/11 down 0 full A 1 -
Eth 1/1/12 down 0 full A 1 -
Eth 1/1/13 down 0 full A 1 -
Eth 1/1/14 down 0 full A 1 -
Eth 1/1/15 down 0 full A 1 -
Eth 1/1/16 down 0 full A 1 -
Eth 1/1/17 down 0 full A 1 -
Eth 1/1/18 down 0 full A 1 -
Eth 1/1/19 down 0 full A 1 -
Eth 1/1/20 down 0 full A 1 -
Eth 1/1/21 down 0 full A 1 -
Eth 1/1/22 down 0 full A 1 -
Eth 1/1/23 down 0 full A 1 -
Eth 1/1/24 down 0 full A 1 -
Eth 1/1/25 up 100G full A 1 -
Eth 1/1/26 up 100G full A 1 -
Eth 1/1/27 down 0 full A 1 -
Eth 1/1/28 down 0 full A 1 -
Eth 1/1/29 down 0 full A 1 -
Eth 1/1/30 down 0 full A 1 -
--------------------------------------------------------------------------------------------------
OS10# configure terminal
OS10(config)# interface range ethernet 1/1/1-1/1/24
OS10(conf-range-eth1/1/1-1/1/24)# exit
OS10(config)# interface range ethernet 1/1/1-1/1/24,1/1/27-1/1/30
OS10(conf-range-eth1/1/1-1/1/24,1/1/27-1/1/30)# exit
# Configure management IP address
OS10# configure terminal
OS10(config)# interface mgmt 1/1/1
OS10(conf-if-ma-1/1/1)# no ip address dhcp
OS10(conf-if-ma-1/1/1)# ip address 10.201.1.2/16
OS10(conf-if-ma-1/1/1)# <165>1 2021-04-02T12:23:40.141901+00:00 OS10 dn_alm 652 - - Node.1-Unit.1:PRI [event], Dell EMC (OS10) %IP_ADDRESS_ADD: IP Address add is successful. IP 10.201.1.2/16 in VRF:default added successfully
OS10(conf-if-ma-1/1/1)# no shutdown
# Connected via SSH to confirm access:
OS10(config)#
<165>1 2021-04-02T12:25:49.956308+00:00 OS10 dn_alm 652 - - Node.1-Unit.1:PRI [event], Dell EMC (OS10) %ALM_AUTH_EVENT: Authentication event was raised MESSAGE=pam_unix(sshd:session): session opened for user admin by (uid=0)
<86>1 2021-04-02T12:25:49.501860+00:00 OS10 sshd 6512 - - Node.1-Unit.1:PRI [event], Dell EMC (OS10) pam_unix(sshd:session): session opened for user admin by (uid=0)
<86>1 2021-04-02T12:25:51.795620+00:00 OS10 sshd 6527 - - Node.1-Unit.1:PRI [event], Dell EMC (OS10) pam_unix(sshd:session): session opened for user admin by (uid=0)
<165>1 2021-04-02T12:25:51.957630+00:00 OS10 dn_alm 652 - - Node.1-Unit.1:PRI [event], Dell EMC (OS10) %ALM_AUTH_EVENT: Authentication event was raised MESSAGE=pam_unix(sshd:session): session opened for user admin by (uid=0)
OS10(config)# exit
OS10# write memory
### Stacking is not a thing anymore, but VLT is its replacement.
# On both switches;
OS10# configure terminal
OS10(config)# interface range ethernet 1/1/25-1/1/26
OS10(conf-range-eth1/1/25-1/1/26)# no shutdown
OS10(conf-range-eth1/1/25-1/1/26)# no switchport
<165>1 2021-04-02T11:47:05.731264+00:00 OS10 dn_alm 652 - - Node.1-Unit.1:PRI [event], Dell EMC (OS10) %STP_ROOT_CHANGE: STP:Root Brg Chg RPVST root changed for vlan 1.
<165>1 2021-04-02T11:47:05.739950+00:00 OS10 dn_alm 652 - - Node.1-Unit.1:PRI [event], Dell EMC (OS10) %STP_ROOT_CHANGE: STP:Root Brg Chg My ID:f0d4.e250.cb8b OldRt:32769:f0d4.e250.c00b NewRt:32769:f0d4.e250.cb8b
OS10(conf-range-eth1/1/25-1/1/26)# exit
OS10(config)# vlt-domain 1
OS10(conf-vlt-1)# discovery-interface ethernet 1/1/25-1/1/26
# When this is done to the second switch;
<165>1 2021-04-02T12:31:11.702525+00:00 OS10 dn_alm 803 - - Node.1-Unit.1:PRI [event], Dell EMC (OS10) %IFM_ASTATE_UP: Interface admin state up :port-channel1000
<165>1 2021-04-02T12:31:11.707501+00:00 OS10 dn_alm 803 - - Node.1-Unit.1:PRI [event], Dell EMC (OS10) %IFM_OSTATE_DN: Interface operational state is down :port-channel1000
<165>1 2021-04-02T12:31:11.720332+00:00 OS10 dn_alm 803 - - Node.1-Unit.1:PRI [event], Dell EMC (OS10) %IFM_OSTATE_UP: Interface operational state is up :port-channel1000
<165>1 2021-04-02T12:31:11.845070+00:00 OS10 dn_alm 803 - - Node.1-Unit.1:PRI [event], Dell EMC (OS10) %IFM_OSTATE_UP: Interface operational state is up :vlan4094
<165>1 2021-04-02T12:31:11.863978+00:00 OS10 dn_alm 803 - - Node.1-Unit.1:PRI [event], Dell EMC (OS10) %VLT_PEER_UP: VLT unit 1 is up
<165>1 2021-04-02T12:31:18.996716+00:00 OS10 dn_alm 803 - - Node.1-Unit.1:PRI [event], Dell EMC (OS10) %VLT_ELECTION_ROLE: VLT unit 1 is elected as secondary
<165>1 2021-04-02T12:31:19.087695+00:00 OS10 dn_alm 803 - - Node.1-Unit.1:PRI [event], Dell EMC (OS10) %IFM_OSTATE_UP: Interface operational state is up :vlan1
# Configure the same MAC address to the VLT on both switches:
OS10# configure terminal
OS10(config)# vlt-domain 1
OS10(conf-vlt-1)# vlt-mac 00:00:00:00:00:02

Loading…
Cancel
Save