Merge pull request #635 from ClusterLabs/tools-dev

Tools dev
main
Digimer 9 months ago committed by GitHub
commit 84e321ff7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 88
      Anvil/Tools/Cluster.pm
  2. 2
      Anvil/Tools/Database.pm
  3. 12
      Anvil/Tools/System.pm
  4. 3
      scancore-agents/scan-network/scan-network
  5. 5
      share/words.xml
  6. 12
      tools/anvil-join-anvil
  7. 35
      tools/striker-collect-debug
  8. 2
      tools/striker-manage-peers

@ -353,6 +353,10 @@ sub add_server
return_code => $return_code,
}});
# Log the contents of the PCS file
my $pcs_body = $anvil->Storage->read_file({debug => $debug, file => $pcs_file});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { pcs_body => $pcs_body }});
# Commit
my $commit_command = $anvil->data->{path}{exe}{pcs}." cluster cib-push ".$pcs_file;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { commit_command => $commit_command }});
@ -1090,7 +1094,6 @@ sub check_stonith_config
$check_ipmi_config = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { check_ipmi_config => $check_ipmi_config }});
}
}
if ($check_ipmi_config)
{
@ -4192,7 +4195,84 @@ sub parse_crm_mon
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { problem => $problem }});
foreach my $resource ($dom->findnodes('/pacemaker-result/resources/resource'))
{
if ($resource->{resource_agent} eq "ocf::alteeve:server")
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { resource => $resource }});
if ($resource =~ /<resource /)
{
# If this is pure XML, parse it manually. This shouldn't happen, but it seems to.
my $id = "";
my $resource_agent = "";
my $resource_key = "";
my $stonith_name = "";
foreach my $line (split/\n/, $resource)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { line => $line }});
if (($line !~ /<node /) && ($line =~ /id="(.*?)"/))
{
$id = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { id => $id }});
}
if ($line =~ /resource_agent="(.*?)"/)
{
$resource_agent = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { resource_agent => $resource_agent }});
if ($resource_agent eq "ocf:alteeve:server")
{
$resource_key = "resource";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { resource_key => $resource_key }});
}
elsif ($resource_agent =~ /stonith:(.*)$/)
{
$stonith_name = $1;
$resource_key = "stonith";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
stonith_name => $stonith_name,
resource_key => $resource_key,
}});
$anvil->data->{crm_mon}{parsed}{'pacemaker-result'}{resources}{$resource_key}{$id}{variables}{resource_agent} = $stonith_name;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"crm_mon::parsed::pacemaker-result::resources::${resource_key}::${id}::variables::resource_agent" => $anvil->data->{crm_mon}{parsed}{'pacemaker-result'}{resources}{$resource_key}{$id}{variables}{resource_agent},
}});
}
}
if (($id) && ($resource_agent))
{
if ($line =~ /<node /)
{
$anvil->data->{crm_mon}{parsed}{'pacemaker-result'}{resources}{$resource_key}{$id}{host}{node_name} = ($line =~ /name="(.*?)"/)[0];
$anvil->data->{crm_mon}{parsed}{'pacemaker-result'}{resources}{$resource_key}{$id}{host}{node_id} = ($line =~ /id="(.*?)"/)[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"crm_mon::parsed::pacemaker-result::resources::${resource_key}::${id}::host::node_name" => $anvil->data->{crm_mon}{parsed}{'pacemaker-result'}{resources}{$resource_key}{$id}{host}{node_name},
"crm_mon::parsed::pacemaker-result::resources::${resource_key}::${id}::host::node_id" => $anvil->data->{crm_mon}{parsed}{'pacemaker-result'}{resources}{$resource_key}{$id}{host}{node_id},
}});
}
else
{
foreach my $pair (split/ /, $line)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { pair => $pair }});
if ($pair =~ /^(.*?)="(.*)"$/)
{
my $variable = $1;
my $value = $2;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's1:variable' => $variable,
's2:value' => $value,
}});
next if $variable eq "id";
next if $variable eq "resource_agent";
$anvil->data->{crm_mon}{parsed}{'pacemaker-result'}{resources}{$resource_key}{$id}{variables}{$variable} = $value;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"crm_mon::parsed::pacemaker-result::resources::${resource_key}::${id}::variables::${variable}" => $anvil->data->{crm_mon}{parsed}{'pacemaker-result'}{resources}{$resource_key}{$id}{variables}{$variable},
}});
}
}
}
}
}
}
elsif ($resource->{resource_agent} eq "ocf::alteeve:server")
{
my $id = $resource->{id};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { id => $id }});
@ -4208,7 +4288,6 @@ sub parse_crm_mon
{
my $node_id = $node->{id};
my $node_name = $node->{name};
my $cached = $node->{cached};
$anvil->data->{crm_mon}{parsed}{'pacemaker-result'}{resources}{resource}{$id}{host}{node_name} = $node->{name};
$anvil->data->{crm_mon}{parsed}{'pacemaker-result'}{resources}{resource}{$id}{host}{node_id} = $node->{id};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
@ -4217,7 +4296,7 @@ sub parse_crm_mon
}});
}
}
if ($resource->{resource_agent} =~ /stonith:(.*)$/)
elsif ($resource->{resource_agent} =~ /stonith:(.*)$/)
{
my $fence_agent = $1;
my $id = $resource->{id};
@ -4237,7 +4316,6 @@ sub parse_crm_mon
{
my $node_id = $node->{id};
my $node_name = $node->{name};
my $cached = $node->{cached};
$anvil->data->{crm_mon}{parsed}{'pacemaker-result'}{resources}{stonith}{$id}{host}{node_name} = $node->{name};
$anvil->data->{crm_mon}{parsed}{'pacemaker-result'}{resources}{stonith}{$id}{host}{node_id} = $node->{id};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {

@ -14043,7 +14043,7 @@ sub insert_or_update_states
}
foreach my $db_uuid (@{$db_uuids})
{
my $count = $anvil->Database->query({uuid => $db_uuid, query => $query, source => $THIS_FILE, line => __LINE__})->[0]->[0];
my $count = $anvil->Database->query({debug => $debug, uuid => $db_uuid, query => $query, source => $THIS_FILE, line => __LINE__})->[0]->[0];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
's2:db_uuid' => $db_uuid,
's2:count' => $count,

@ -2565,16 +2565,16 @@ LIMIT 1
}});
# See if the current password works.
my $lanplus = "no-yes";
if (($manufacturer eq "HP") or ($manufacturer eq "Dell"))
my $lanplus = "yes-no";
if ($manufacturer eq "Fujitsu")
{
# These need LAN Plus
$lanplus = "yes-no"
# Fujitsu doesn't usually need lanplus
$lanplus = "no-yes"
}
$host_ipmi = $anvil->System->test_ipmi({
debug => $debug,
ipmi_user => $user_name,
ipmi_password => $ipmi_password,
ipmi_password => $anvil->Log->is_secure($ipmi_password),
ipmi_target => $ipmi_ip_address,
lanplus => $lanplus,
});
@ -5000,7 +5000,7 @@ sub test_ipmi
($output, my $error, $return_code) = $anvil->Remote->call({
debug => $debug,
secure => 1,
timeout => 2,
timeout => 20,
shell_call => $shell_call,
target => $target,
password => $password,

@ -2553,6 +2553,9 @@ sub check_interfaces
new_rx_bytes => $new_rx_bytes,
}});
# This is likely an unused interface, like a wireless adapter.
next if not $new_nm_name;
# Find the bridge, if any, and the bond UUID, if there's a bond name.
if ($new_bond_name)
{

@ -203,8 +203,8 @@ The error was:
<key name="error_0134">Failed to start the daemon: [#!variable!daemon!#] on the local system, unable to boot the server.</key>
<key name="error_0135">Failed to start the daemon: [#!variable!daemon!#] on [#!variable!host!#], unable to boot the server.</key>
<key name="error_0136">System->test_ipmi() was called with an invalid 'lanplus' parameter. It must be 'yes', 'no', 'yes-no' or 'no-yes'. Received: [#!variable!lanplus!#].</key>
<key name="error_0137">All attempts to change the IPMI user: [#!variable!user_name!#] (number: [#!variable!user_number!#] failed. The last try's output (if any) was: [#!variable!output!#] (return code: [#!variable!return code!#]).</key>
<key name="error_0138">The system call: [#!variable!shell_call!#] failed with the return code: [#!variable!return code!#]. The output (if any) was;
<key name="error_0137">All attempts to change the IPMI user: [#!variable!user_name!#] (number: [#!variable!user_number!#] failed. The last try's output (if any) was: [#!variable!output!#] (return code: [#!variable!return_code!#]).</key>
<key name="error_0138">The system call: [#!variable!shell_call!#] failed with the return code: [#!variable!return_code!#]. The output (if any) was;
====
#!variable!output!#
====</key>
@ -4191,6 +4191,7 @@ We will try to proceed anyway.</key>
<key name="warning_0171">[ Warning ] - The daemon: [#!variable!daemon!#] appears to have failed! Attempting to restart it now.</key>
<key name="warning_0172">[ Warning ] - The line: [#!variable!line!#] that was going to be added to the hosts file is invalid, removing it.</key>
<key name="warning_0173">[ Warning ] - Failed to convert: [#!variable!source_file!#] to: [#!variable!new_file!#] (format: [#!variable!format!#]! Return code was: [#!variable!return_code!#], expected '0'.</key>
<key name="warning_0174">[ Warning ] - The fence method: [#!variable!method!#] already existed, proceeding.</key>
</language>
<!-- 日本語 -->

@ -989,7 +989,7 @@ sub configure_pacemaker
pcs_add_command => $pcs_add_command =~ /passw/ ? $anvil->Log->is_secure($pcs_add_command) : $pcs_add_command,
}});
# If there's an entry in the CIB, so if it's different somehow
# If there's an entry in the CIB, see if it's different somehow
if (exists $anvil->data->{cib}{parsed}{data}{node}{$node_name}{fencing}{device}{$ipmi_stonith_name})
{
foreach my $argument (sort {$a cmp $b} keys %{$anvil->data->{cib}{parsed}{data}{node}{$node_name}{fencing}{device}{$ipmi_stonith_name}{argument}})
@ -1114,6 +1114,15 @@ sub configure_pacemaker
return_code => $return_code,
}});
if ($return_code)
{
# If this is because the method already exists, ignore the error.
if ($output =~ /already exists/i)
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, priority => "alert", key => "warning_0174", variables => {
method => $ipmi_stonith_name,
}});
}
else
{
# Something went wrong.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, priority => "err", key => "error_0138", variables => {
@ -1125,6 +1134,7 @@ sub configure_pacemaker
sleep 2;
$anvil->nice_exit({exit_code => 6});
}
}
$something_changed->{$node_name} = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { "something_changed->{$node_name}" => $something_changed->{$node_name} }});

@ -595,6 +595,30 @@ sub collect_remote_data
});
}
print "- Grabbing Anvil! config... ";
$anvil->Storage->rsync({
debug => 2,
source => "root\@".$anvil->data->{peer}{$short_host_name}{access}{ip}.":/etc/anvil/anvil.conf*",
destination => $target_directory."/",
});
$test_file = $target_directory."/anvil.conf";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { test_file => $test_file }});
if (-e $test_file)
{
print "Done.\n";
}
else
{
print "Failed!\n";
print "- For some reason, this file was not collected.\n";
$anvil->Storage->write_file({
file => $test_file,
body => $failed_body,
overwrite => 1,
backup => 0,
});
}
# If this is a node, grab the shared files.
if ($this_host_type eq "node")
{
@ -794,6 +818,17 @@ sub collect_local_data
}});
print "Done!\n";
print "- Grabbing Anvil! config... ";
$shell_call = $anvil->data->{path}{exe}{cp}." /etc/anvil/anvil.conf ".$target_directory."/";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }});
($output, $return_code) = $anvil->System->call({shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
output => $output,
return_code => $return_code,
}});
print "Done!\n";
print "- Grabbing Anvil! log... ";
$shell_call = $anvil->data->{path}{exe}{cp}." /var/log/anvil.log ".$target_directory."/";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { shell_call => $shell_call }});

@ -544,7 +544,7 @@ sub process_entry
# Flag a resync, connect, and configure, if needed.
$anvil->data->{sys}{database}{resync_needed} = 1;
$anvil->Database->connect({
debug => 3,
debug => 2,
check_for_resync => 1,
check_if_configured => $host_uuid eq $anvil->Get->host_uuid ? 1 : 0,
});

Loading…
Cancel
Save