|
|
|
#!/usr/bin/perl
|
|
|
|
#
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Anvil::Tools;
|
|
|
|
use Data::Dumper;
|
|
|
|
|
|
|
|
my $THIS_FILE = ($0 =~ /^.*\/(.*)$/)[0];
|
|
|
|
my $running_directory = ($0 =~ /^(.*?)\/$THIS_FILE$/)[0];
|
|
|
|
if (($running_directory =~ /^\./) && ($ENV{PWD}))
|
|
|
|
{
|
|
|
|
$running_directory =~ s/^\./$ENV{PWD}/;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Turn off buffering so that the pinwheel will display while waiting for the SSH call(s) to complete.
|
|
|
|
$| = 1;
|
|
|
|
|
|
|
|
my $anvil = Anvil::Tools->new();
|
|
|
|
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0115", variables => { program => $THIS_FILE }});
|
|
|
|
|
|
|
|
# Read switches (target ([user@]host[:port]) and the file with the target's password.
|
|
|
|
$anvil->Get->switches;
|
|
|
|
|
|
|
|
# Connect to the database(s).
|
|
|
|
$anvil->Database->connect({debug => 3});
|
* Created Convert->fence_ipmilan_to_ipmitool() that takes a 'fence_ipmilan' call and converts it into a direct 'ipmitool' call.
* Created Database->get_power() that loads data from the special 'power' table.
* Fixed a bug in calls to Network->ping() where some weren't formatted properly for receiving two string variables.
* Updated Database->get_anvils() to record the machine types when recording host information.
* Updated Database->get_hosts_info() to also load the 'host_ipmi' column.
* Updated Database->get_upses() to store the link to the 'power' -> 'power_uuid', when available.
* Created ScanCore->call_scan_agents() that does the work of actually calling scan agents, moving the logic out from the scancore daemon.
* Created ScanCore->check_power() that takes a host and the anvil it is in and returns if it's on batteries or not. If it is, the time on batteries and estimate hold-up time is returned. If not, the highest charge percentage is returned.
* Created ScanCore->post_scan_analysis() that is a wrapper for calling the new ->post_scan_analysis_dr(), ->post_scan_analysis_node() and ->post_scan_analysis_striker(). Of which, _dr and _node are still empty, but _striker is complete.
** ->post_scan_analysis_striker() is complete. It now boots a node after a power loss if the UPSes powering it are OK (at least one has mains power, and the main-powered UPS(es) have reached the minimum charge percentage). If it's thermal, IPMI is called and so long as at least one thermal sensor is found and it/they are all OK, it is booted. For now, M2's thermal reboot delay logic hasn't been replicated, as it added a lot of complexity and didn't prove practically useful.
* Created System->collect_ipmi_data() and moved 'scan_ipmitool's ipmitool call and parse into that method. This was done to allow ScanCore->post_scan_analysis_striker() to also call IPMI on a remote machine during thermal down events without reimplementing the logic.
* Updated scan-ipmitool to only record temperature data for data collected locally. Also renamed 'machine' variables and hash keys to 'host_name' to clarify what is being stored.
* Updated scancore to clear the 'system::stop_reason' variable.
* Added missing packages to striker-manage-install-target.
Signed-off-by: Digimer <digimer@alteeve.ca>
4 years ago
|
|
|
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0132"});
|
|
|
|
|
|
|
|
my $key_string = 'scan_drbd_message_0007,!!resource_name!srv00-sql1!!,!!resource_state!#!string!scan_drbd_unit_0004!#!!,!!resource_xml!<resource name="srv00-sql1" conf-file-line="/etc/drbd.d/srv00-sql1.res:2">] from key string: [scan_drbd_message_0007,!!resource_name!srv00-sql1!!,!!resource_state!#!string!scan_drbd_unit_0004!#!!,!!resource_xml!<resource name="srv00-sql1" conf-file-line="/etc/drbd.d/srv00-sql1.res:2">
|
|
|
|
<host name="mk-a02n01">
|
|
|
|
<volume vnr="0">
|
|
|
|
<device minor="0">/dev/drbd_srv00-sql1_0</device>
|
|
|
|
<disk>/dev/mk-a02n01_ssd0/srv00-sql1_0</disk>
|
|
|
|
<meta-disk>internal</meta-disk>
|
|
|
|
</volume>
|
|
|
|
<address family="(null)" port="(null)">(null)</address>
|
|
|
|
</host>
|
|
|
|
<host name="mk-a02n02">
|
|
|
|
<volume vnr="0">
|
|
|
|
<device minor="0">/dev/drbd_srv00-sql1_0</device>
|
|
|
|
<disk>/dev/mk-a02n02_ssd0/srv00-sql1_0</disk>
|
|
|
|
<meta-disk>internal</meta-disk>
|
|
|
|
</volume>
|
|
|
|
<address family="(null)" port="(null)">(null)</address>
|
|
|
|
</host>
|
|
|
|
<connection>
|
|
|
|
<host name="mk-a02n01"><address family="ipv4" port="7788">10.101.12.1</address></host>
|
|
|
|
<host name="mk-a02n02"><address family="ipv4" port="7788">10.101.12.2</address></host>
|
|
|
|
<section name="net">
|
|
|
|
<option name="protocol" value="C"/>
|
|
|
|
<option name="fencing" value="resource-and-stonith"/>
|
|
|
|
</section>
|
|
|
|
<section name="disk">
|
|
|
|
<option name="c-max-rate" value="500M"/>
|
|
|
|
</section>
|
|
|
|
</connection>
|
|
|
|
</resource>!!';
|
|
|
|
my $out_string = $anvil->Words->parse_banged_string({
|
|
|
|
debug => 2,
|
|
|
|
key_string => $key_string,
|
|
|
|
});
|
|
|
|
|
|
|
|
print "Got:
|
|
|
|
====
|
|
|
|
".$out_string."
|
|
|
|
====
|
|
|
|
";
|
|
|
|
|
|
|
|
$anvil->nice_exit({exit_code => 0});
|