* Added 'anvil_uuid' as a set parameter in Database->get_hosts().

* Added calling 'debug => $debug' in System->X methods.
* Got more work done on System->configure_ipmi(). It should now determine if a BMC exists and pull the OEM and network details automatically.
* Updated anvil-configure-host to log more data in an attempt to find a reproducer for an odd bug where (apparently) a host was picking up the wrong job data meant for another host.

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent 99afd2e936
commit 1fa63d2ea3
  1. 11
      Anvil/Tools/Database.pm
  2. 216
      Anvil/Tools/System.pm
  3. 3
      share/words.xml
  4. 71
      tools/anvil-configure-host
  5. 20
      tools/anvil-join-anvil
  6. 1
      tools/test.pl

@ -1639,22 +1639,28 @@ WHERE
if ($anvil_node1_host_uuid)
{
$anvil->data->{anvils}{host_uuid}{$anvil_node1_host_uuid}{anvil_name} = $anvil_name;
$anvil->data->{anvils}{host_uuid}{$anvil_node1_host_uuid}{anvil_uuid} = $anvil_uuid;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"anvils::host_uuid::${anvil_node1_host_uuid}::anvil_name" => $anvil->data->{anvils}{host_uuid}{$anvil_node1_host_uuid}{anvil_name},
"anvils::host_uuid::${anvil_node1_host_uuid}::anvil_uuid" => $anvil->data->{anvils}{host_uuid}{$anvil_node1_host_uuid}{anvil_uuid},
}});
}
if ($anvil_node2_host_uuid)
{
$anvil->data->{anvils}{host_uuid}{$anvil_node2_host_uuid}{anvil_name} = $anvil_name;
$anvil->data->{anvils}{host_uuid}{$anvil_node2_host_uuid}{anvil_uuid} = $anvil_uuid;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"anvils::host_uuid::${anvil_node2_host_uuid}::anvil_name" => $anvil->data->{anvils}{host_uuid}{$anvil_node2_host_uuid}{anvil_name},
"anvils::host_uuid::${anvil_node2_host_uuid}::anvil_uuid" => $anvil->data->{anvils}{host_uuid}{$anvil_node2_host_uuid}{anvil_uuid},
}});
}
if ($anvil_dr1_host_uuid)
{
$anvil->data->{anvils}{host_uuid}{$anvil_dr1_host_uuid}{anvil_name} = $anvil_name;
$anvil->data->{anvils}{host_uuid}{$anvil_dr1_host_uuid}{anvil_uuid} = $anvil_uuid;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"anvils::host_uuid::${anvil_dr1_host_uuid}::anvil_name" => $anvil->data->{anvils}{host_uuid}{$anvil_dr1_host_uuid}{anvil_name},
"anvils::host_uuid::${anvil_dr1_host_uuid}::anvil_uuid" => $anvil->data->{anvils}{host_uuid}{$anvil_dr1_host_uuid}{anvil_uuid},
}});
}
}
@ -1858,6 +1864,7 @@ It also sets the variables;
hosts::host_uuid::<host_uuid>::host_key = <Machine's public key / fingerprint>
hosts::host_uuid::<host_uuid>::host_ipmi = <If equiped, this is how to log into the host's IPMI BMC>
hosts::host_uuid::<host_uuid>::anvil_name = <anvil_name if associated with an anvil>
hosts::host_uuid::<host_uuid>::anvil_uuid = <anvil_uuid if associated with an anvil>
And to simplify look-ups by UUID or name;
@ -1923,9 +1930,11 @@ FROM
}});
my $anvil_name = "";
my $anvil_uuid = "";
if ((exists $anvil->data->{anvils}{host_uuid}{$host_uuid}) && ($anvil->data->{anvils}{host_uuid}{$host_uuid}{anvil_name}))
{
$anvil_name = $anvil->data->{anvils}{host_uuid}{$host_uuid}{anvil_name};
$anvil_uuid = $anvil->data->{anvils}{host_uuid}{$host_uuid}{anvil_uuid};
}
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { anvil_name => $anvil_name }});
@ -1944,12 +1953,14 @@ FROM
$anvil->data->{hosts}{host_uuid}{$host_uuid}{host_key} = $host_key;
$anvil->data->{hosts}{host_uuid}{$host_uuid}{host_ipmi} = $host_ipmi;
$anvil->data->{hosts}{host_uuid}{$host_uuid}{anvil_name} = $anvil_name;
$anvil->data->{hosts}{host_uuid}{$host_uuid}{anvil_uuid} = $anvil_uuid;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
"hosts::host_uuid::${host_uuid}::host_name" => $anvil->data->{hosts}{host_uuid}{$host_uuid}{host_name},
"hosts::host_uuid::${host_uuid}::host_type" => $anvil->data->{hosts}{host_uuid}{$host_uuid}{host_type},
"hosts::host_uuid::${host_uuid}::host_key" => $anvil->data->{hosts}{host_uuid}{$host_uuid}{host_key},
"hosts::host_uuid::${host_uuid}::host_ipmi" => $anvil->data->{hosts}{host_uuid}{$host_uuid}{host_ipmi},
"hosts::host_uuid::${host_uuid}::anvil_name" => $anvil->data->{hosts}{host_uuid}{$host_uuid}{anvil_name},
"hosts::host_uuid::${host_uuid}::anvil_uuid" => $anvil->data->{hosts}{host_uuid}{$host_uuid}{anvil_uuid},
}});
# Record the host_uuid in a hash so that the name can be easily retrieved.

@ -65,7 +65,7 @@ Provides all methods related to storage on a system.
# Access to methods using '$anvil->System->X'.
#
# Example using 'system_call()';
my ($host_name, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{hostnamectl}." --static"});
my ($host_name, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{hostnamectl}." --static"});
=head1 METHODS
@ -144,7 +144,7 @@ sub activate_lv
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "error_0064", variables => { path => $path }});
}
my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{lvchange}." --activate y ".$path});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{lvchange}." --activate y ".$path});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
output => $output,
return_code => $return_code,
@ -164,7 +164,7 @@ sub activate_lv
This method makes a system call and returns the output (with the last new-line removed) and the return code. If there is a problem, 'C<< #!error!# >>' is returned and the error will be logged.
my ($output, $return_code) = $anvil->System->call({shell_call => "host_name"});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => "host_name"});
Parameters;
@ -532,7 +532,7 @@ sub check_daemon
my $daemon = defined $parameter->{daemon} ? $parameter->{daemon} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { daemon => $daemon }});
my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{systemctl}." status ".$daemon});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{systemctl}." status ".$daemon});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { output => $output, return_code => $return_code }});
foreach my $line (split/\n/, $output)
{
@ -616,7 +616,7 @@ sub check_memory
my $used_ram = 0;
my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{'anvil-check-memory'}." --program $program_name"});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{'anvil-check-memory'}." --program $program_name"});
foreach my $line (split/\n/, $output)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { line => $line }});
@ -706,7 +706,7 @@ sub check_ssh_keys
# Generate the SSH keys.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0270", variables => { user => $user }});
my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{'ssh-keygen'}." -t rsa -N \"\" -b 8191 -f ".$ssh_private_key_file});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{'ssh-keygen'}." -t rsa -N \"\" -b 8191 -f ".$ssh_private_key_file});
if (-e $ssh_public_key_file)
{
# Success!
@ -1183,7 +1183,7 @@ sub check_storage
This uses the host information along with the Anvil! the host is in to find and configure the local IPMI BMC.
If this host is not in an Anvil!, C<< 0 >> is returned. If the host is in an Anvil!, but no IPMI BMC was found, C<< 1 >> is returned.
If this host is not in an Anvil!, or if the host is in an Anvil!, but no IPMI BMC was found, or any other issue arises, C<< 0 >> is returned.
If a BMC is found and configured, the C<< fence_ipmilan >> call used to check the status is stored in C<< hosts >> -> C<< host_ipmi >>, and the same string is returned.
@ -1198,10 +1198,172 @@ sub configure_ipmi
my $parameter = shift;
my $anvil = $self->parent;
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "System->generate_state_json()" }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "System->configure_ipmi()" }});
my $host_ipmi = "";
# Is this host in an Anvil!?
$anvil->Database->get_hosts();
my $anvil_uuid = "";
my $host_uuid = $anvil->Get->host_uuid;
if ((exists $anvil->data->{hosts}{host_uuid}{$host_uuid}) && ($anvil->data->{hosts}{host_uuid}{$host_uuid}{anvil_uuid}))
{
# We're in an Anvil!
$anvil_uuid = $anvil->data->{hosts}{host_uuid}{$host_uuid}{anvil_uuid};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { anvil_uuid => $anvil_uuid }});
}
else
{
# Not in an Anvil!, return 0.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "err", key => "log_0498"});
return(0);
}
# Call dmidecode to see if there even is an IPMI BMC on this host.
my $host_ipmi = "";
my $has_ipmi = 0;
my $manufacturer = "";
my $lan_channel = 99;
my $current_network_type = "";
my $current_ip_address = "";
my $current_subnet_mask = "";
my $current_gateway = "";
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{dmidecode}." --type 38"});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
output => $output,
return_code => $return_code,
}});
foreach my $line (split/\n/, $output)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { line => $line }});
if ($line =~ /IPMI/i)
{
# Looks like
$has_ipmi = 1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { has_ipmi => $has_ipmi }});
last;
}
}
$output = "";
$return_code = "";
if (not $has_ipmi)
{
# Return
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "err", key => "log_0499"});
return(0);
}
# Find the manufacturer
($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{ipmitool}." mc info"});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
output => $output,
return_code => $return_code,
}});
foreach my $line (split/\n/, $output)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { line => $line }});
# Examples;
# Manufacturer Name : Fujitsu Siemens
# Manufacturer Name : Hewlett-Packard
# Manufacturer Name : DELL Inc
if ($line =~ /Manufacturer Name\s+:\s+(.*)$/i)
{
$manufacturer = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { manufacturer => $manufacturer }});
if ($manufacturer =~ /fujitsu/i)
{
$manufacturer = "Fujitsu";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { manufacturer => $manufacturer }});
}
elsif ($manufacturer =~ /dekk/i)
{
$manufacturer = "Dell";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { manufacturer => $manufacturer }});
}
elsif (($manufacturer =~ /^hp/i) or ($manufacturer =~ /hewlett/i))
{
$manufacturer = "HP";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { manufacturer => $manufacturer }});
}
}
}
$output = "";
$return_code = "";
# Find LAN channel. Fujitsu and HP are on channel 2, Dell id on 1. Unsure yet what other OEMs
# use, but we'll scan 1..9 + 0.
foreach my $i (1..9, 0)
{
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{ipmitool}." lan print ".$i});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
output => $output,
return_code => $return_code,
}});
if (not $return_code)
{
# Found it, but confirm.
$lan_channel = $i;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { lan_channel => $lan_channel }});
foreach my $line (split/\n/, $output)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { line => $line }});
# IP Address Source : Static Address
# IP Address Source : DHCP Address
if ($line =~ /IP Address Source\s+:\s+(.*)$/i)
{
$current_network_type = $1 =~ /DHCP/i ? "dhcp" : "static";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { current_network_type => $current_network_type }});
}
# IP Address : 0.0.0.0
# IP Address : 10.255.199.201
if ($line =~ /IP Address\s+:\s+(.*)$/i)
{
$current_ip_address = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { current_ip_address => $current_ip_address }});
}
# Subnet Mask : 0.0.0.0
# Subnet Mask : 255.255.0.0
if ($line =~ /Subnet Mask\s+:\s+(.*)$/i)
{
$current_subnet_mask = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { current_subnet_mask => $current_subnet_mask }});
}
# Default Gateway IP : 0.0.0.0
# Default Gateway IP : 10.255.255.254
if ($line =~ /Default Gateway IP\s+:\s+(.*)$/i)
{
$current_gateway = $1;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { current_gateway => $current_gateway }});
}
}
last;
}
}
# If we didn't find a LAN channel, we can't proceed.
if (not $lan_channel)
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, priority => "err", key => "log_0499"});
return(0);
}
### TODO: Left off here.
# What values do we want?
=cut
ipmitool lan print {1..x}
ipmitool lan set 2 ipsrc static
ipmitool lan set 2 ipaddr 10.20.51.1
ipmitool lan set 2 netmask 255.255.0.0
ipmitool lan set 2 defgw ipaddr 10.20.255.254
ipmitool user list 2
=cut
return($host_ipmi);
}
@ -1229,7 +1391,7 @@ sub disable_daemon
my $daemon = defined $parameter->{daemon} ? $parameter->{daemon} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { daemon => $daemon }});
my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{systemctl}." disable ".$daemon});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{systemctl}." disable ".$daemon});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
output => $output,
return_code => $return_code,
@ -1673,7 +1835,7 @@ sub enable_daemon
my $daemon = defined $parameter->{daemon} ? $parameter->{daemon} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { daemon => $daemon }});
my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{systemctl}." enable ".$daemon." 2>&1"});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{systemctl}." enable ".$daemon." 2>&1"});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
output => $output,
return_code => $return_code,
@ -1841,7 +2003,7 @@ sub host_name
if ($anvil->Network->is_local({host => $target}))
{
# Local call
($output, $return_code) = $anvil->System->call({shell_call => $shell_call});
($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
output => $output,
return_code => $return_code,
@ -1878,7 +2040,7 @@ sub host_name
if ($anvil->Network->is_local({host => $target}))
{
# Local call
($output, $return_code) = $anvil->System->call({shell_call => $shell_call});
($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
output => $output,
return_code => $return_code,
@ -1913,7 +2075,7 @@ sub host_name
if ($anvil->Network->is_local({host => $target}))
{
# Local call
($host_name, $return_code) = $anvil->System->call({shell_call => $shell_call});
($host_name, $return_code) = $anvil->System->call({debug => $debug, shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
host_name => $host_name,
return_code => $return_code,
@ -1945,7 +2107,7 @@ sub host_name
if ($anvil->Network->is_local({host => $target}))
{
# Local call
($descriptive, $return_code) = $anvil->System->call({shell_call => $shell_call});
($descriptive, $return_code) = $anvil->System->call({debug => $debug, shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
descriptive => $descriptive,
return_code => $return_code,
@ -2319,7 +2481,7 @@ sub manage_firewall
my $shell_call = $anvil->data->{path}{exe}{'iptables-save'};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }});
my ($iptables, $return_code) = $anvil->System->call({shell_call => $shell_call});
my ($iptables, $return_code) = $anvil->System->call({debug => $debug, shell_call => $shell_call});
foreach my $line (split/\n/, $iptables)
{
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { line => $line }});
@ -2372,7 +2534,7 @@ sub manage_firewall
my $shell_call = $anvil->data->{path}{exe}{'firewall-cmd'}." --get-active-zones";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }});
my ($output, $return_code) = $anvil->System->call({shell_call => $shell_call});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { output => $output, return_code => $return_code }});
foreach my $line (split/\n/, $output)
{
@ -2470,7 +2632,7 @@ sub manage_firewall
my $shell_call = $anvil->data->{path}{exe}{'firewall-cmd'}." --permanent --add-service ".$service;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }});
my ($output, $return_code) = $anvil->System->call({shell_call => $shell_call});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { output => $output, return_code => $return_code }});
if ($output eq "success")
{
@ -2489,7 +2651,7 @@ sub manage_firewall
my $shell_call = $anvil->data->{path}{exe}{'firewall-cmd'}." --permanent --add-port ".$port_number."/".$protocol;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }});
my ($output, $return_code) = $anvil->System->call({shell_call => $shell_call});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { output => $output, return_code => $return_code }});
if ($output eq "success")
{
@ -2516,7 +2678,7 @@ sub manage_firewall
my $shell_call = $anvil->data->{path}{exe}{'firewall-cmd'}." --permanent --remove-service ".$service;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }});
my ($output, $return_code) = $anvil->System->call({shell_call => $shell_call});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { output => $output, return_code => $return_code }});
if ($output eq "success")
{
@ -2535,7 +2697,7 @@ sub manage_firewall
my $shell_call = $anvil->data->{path}{exe}{'firewall-cmd'}." --permanent --remove-port ".$port_number."/".$protocol;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }});
my ($output, $return_code) = $anvil->System->call({shell_call => $shell_call});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $shell_call});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { output => $output, return_code => $return_code }});
if ($output eq "success")
{
@ -2602,7 +2764,7 @@ sub pids
my $pids = [];
my $shell_call = $anvil->data->{path}{exe}{ps}." aux";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { shell_call => $shell_call }});
my ($output, $return_code) = $anvil->System->call({shell_call => $shell_call});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $shell_call});
foreach my $line (split/\n/, $output)
{
$line = $anvil->Words->clean_spaces({ string => $line });
@ -2758,7 +2920,7 @@ sub reload_daemon
my $daemon = defined $parameter->{daemon} ? $parameter->{daemon} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { daemon => $daemon }});
my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{systemctl}." reload ".$daemon});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{systemctl}." reload ".$daemon});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
output => $output,
return_code => $return_code,
@ -2947,7 +3109,7 @@ sub stop_daemon
my $daemon = defined $parameter->{daemon} ? $parameter->{daemon} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { daemon => $daemon }});
my ($output, $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{systemctl}." stop ".$daemon});
my ($output, $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{systemctl}." stop ".$daemon});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
output => $output,
return_code => $return_code,
@ -2982,13 +3144,13 @@ sub stty_echo
if ($set eq "off")
{
($anvil->data->{sys}{terminal}{stty}, my $return_code) = $anvil->System->call({shell_call => $anvil->data->{path}{exe}{stty}." --save"});
($anvil->data->{sys}{terminal}{stty}, my $return_code) = $anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{stty}." --save"});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { 'sys::terminal::stty' => $anvil->data->{sys}{terminal}{stty}, return_code => $return_code }});
$anvil->System->call({shell_call => $anvil->data->{path}{exe}{stty}." -echo"});
$anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{stty}." -echo"});
}
elsif (($set eq "on") && ($anvil->data->{sys}{terminal}{stty}))
{
$anvil->System->call({shell_call => $anvil->data->{path}{exe}{stty}." ".$anvil->data->{sys}{terminal}{stty}});
$anvil->System->call({debug => $debug, shell_call => $anvil->data->{path}{exe}{stty}." ".$anvil->data->{sys}{terminal}{stty}});
}
return(0);

@ -930,6 +930,9 @@ If the targets are unique, did you copy the full database directory? A unique id
<key name="log_0495">Stopping the daemon: [#!variable!daemon!#] on: [#!variable!host!#].</key>
<key name="log_0496">One or more servers are still running on the Anvil!, not stopping daemons.</key>
<key name="log_0497">About to remove the old host type file: [#!variable!file!#].</key>
<key name="log_0498">This machine is not in an #!string!brand_0002!#, not configuring IPMI.</key>
<key name="log_0499">This machine does not appear to have an IPMI BMC (no BMC reported by 'dmidecode'). Not attempting to configure IPMI.</key>
<key name="log_0500">This machine appears to have an IPMI BMC, but the LAN channel (used to configure the BMC's network) wasn't found. Channels 0 to 9 were checked.</key>
<!-- Messages for users (less technical than log entries), though sometimes used for logs, too. -->
<key name="message_0001">The host name: [#!variable!target!#] does not resolve to an IP address.</key>

@ -712,12 +712,61 @@ sub reconfigure_network
# Are we writing a bridge config?
if ($bridge)
{
$anvil->Storage->write_file({file => $bridge_file, body => $bridge_config, user => "root", group => "root", mode => "0644", overwrite => 1});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, secure => 0, list => {
output => $bridge_file,
return_code => $bridge_config,
}});
$anvil->Storage->write_file({
debug => 3,
file => $bridge_file,
body => $bridge_config,
user => "root",
group => "root",
mode => "0644",
overwrite => 1
});
}
# Bond, Link 1 and Link 2
$anvil->Storage->write_file({file => $bond_file, body => $bond_config, user => "root", group => "root", mode => "0644", overwrite => 1});
$anvil->Storage->write_file({file => $new_link1_file, body => $link1_config, user => "root", group => "root", mode => "0644", overwrite => 1});
$anvil->Storage->write_file({file => $new_link2_file, body => $link2_config, user => "root", group => "root", mode => "0644", overwrite => 1});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, secure => 0, list => {
output => $bond_file,
return_code => $bond_config,
}});
$anvil->Storage->write_file({
debug => 3,
file => $bond_file,
body => $bond_config,
user => "root",
group => "root",
mode => "0644",
overwrite => 1,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, secure => 0, list => {
output => $new_link1_file,
return_code => $link1_config,
}});
$anvil->Storage->write_file({
debug => 3,
file => $new_link1_file,
body => $link1_config,
user => "root",
group => "root",
mode => "0644",
overwrite => 1,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, secure => 0, list => {
output => $new_link2_file,
return_code => $link2_config,
}});
$anvil->Storage->write_file({
debug => 3,
file => $new_link2_file,
body => $link2_config,
user => "root",
group => "root",
mode => "0644",
overwrite => 1,
});
# If the NICs names have changed, rename them now.
if ((exists $anvil->data->{network}{'local'}{mac_address}{$link1_mac}{interface}) &&
@ -820,7 +869,19 @@ sub reconfigure_network
}
# Write out the link1 config file.
$anvil->Storage->write_file({file => $new_link1_file, body => $link1_config, user => "root", group => "root", mode => "0644", overwrite => 1});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, secure => 0, list => {
output => $new_link1_file,
return_code => $link1_config,
}});
$anvil->Storage->write_file({
debug => 3,
file => $new_link1_file,
body => $link1_config,
user => "root",
group => "root",
mode => "0644",
overwrite => 1,
});
# If the name differs from old, delete the old interface.
if ((exists $anvil->data->{network}{'local'}{mac_address}{$link1_mac}{interface}) &&

@ -151,17 +151,17 @@ sub configure_pacemaker
# cluster shortly.
if (not -e $anvil->data->{path}{configs}{'corosync.conf'})
{
my $cluster_conf = $anvil->Storage->read_file({
my $corosync_conf = $anvil->Storage->read_file({
file => $anvil->data->{path}{configs}{'corosync.conf'},
target => $peer_host_name,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { cluster_conf => $cluster_conf }});
if ($cluster_conf ne "!!error!!")
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { corosync_conf => $corosync_conf }});
if ($corosync_conf ne "!!error!!")
{
# Write the file out.
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "job_0100"});
$anvil->Storage->write_file({
body => $cluster_conf,
body => $corosync_conf,
file => $anvil->data->{path}{configs}{'corosync.conf'},
user => "root",
group => "root",
@ -592,7 +592,6 @@ sub check_local_network
my ($now_host_name) = $anvil->System->host_name({
debug => 2,
set => $new_host_name,
});
if ($now_host_name eq $new_host_name)
{
@ -680,6 +679,7 @@ sub check_local_network
}});
foreach my $in_iface (sort {$a cmp $b} keys %{$anvil->data->{network}{'local'}{interface}})
{
### BUG: DNS gets replicated, but updated.
# Only one interface will start with the network name and have an IP address.
next if $in_iface !~ /^${network}_/;
next if not $anvil->data->{network}{'local'}{interface}{$in_iface}{ip};
@ -1031,6 +1031,11 @@ sub check_local_network
# Write out the new file.
update_progress($anvil, ($anvil->data->{job}{progress} += 2), "job_0083,!!file!".$filename."!!");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "job_0083", variables => { file => $filename }});
# print "File about to write: [".$filename."]\n";
# print "============================\n";
# print $new_config."\n";
# print "============================\n";
# die "There's a bug here that is re-writting the config with duplicate DNS and something the wrong IP for this host.\n";
$anvil->Storage->write_file({
debug => 3,
file => $filename,
@ -1186,6 +1191,11 @@ sub check_local_network
# Write out the new file.
update_progress($anvil, ($anvil->data->{job}{progress} += 2), "job_0083,!!file!".$filename."!!");
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "job_0083", variables => { file => $filename }});
# print "File about to write: [".$filename."]\n";
# print "============================\n";
# print $new_config."\n";
# print "============================\n";
# die "There's a bug here that is re-writting the config with duplicate DNS and something the wrong IP for this host.\n";
$anvil->Storage->write_file({
debug => 2,
file => $filename,

@ -26,4 +26,3 @@ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level
$anvil->Get->switches;
$anvil->System->configure_ipmi({debug => 2});

Loading…
Cancel
Save