* Fixed a bug in DRBD->gather_data() where the peer node's data was being recorded where the local node's data should have been saved.

* Fixed a bug in anvil-delete-server where, if a server was off already, the server would not be removed from pacemaker.
* WIP - continuing on scan-network

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 4 years ago
parent a697011b08
commit d7d418ee1b
  1. 5
      Anvil/Tools/DRBD.pm
  2. 62
      scancore-agents/scan-network/scan-network
  3. 91
      tools/anvil-delete-server

@ -481,8 +481,7 @@ sub delete_resource
# Now wipefs and lvremove each backing device
foreach my $backing_disk (sort {$a cmp $b} keys %{$anvil->data->{drbd}{resource}{$resource}{backing_disk}})
{
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0591", variables => { backing_disk => $backing_disk }});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0591", variables => { device_path => $backing_disk }});
my $shell_call = $anvil->data->{path}{exe}{wipefs}." --all ".$backing_disk;
$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});
@ -691,7 +690,7 @@ sub gather_data
}});
# Record the local data only.
if (($this_host_name ne $anvil->Get->host_name) && ($this_host_name ne $anvil->Get->short_host_name))
if (($this_host_name eq $anvil->Get->host_name) or ($this_host_name eq $anvil->Get->short_host_name))
{
$anvil->data->{new}{resource}{$resource}{volume}{$volume}{device_path} = $volume_vnr->findvalue('./device');
$anvil->data->{new}{resource}{$resource}{volume}{$volume}{backing_disk} = $volume_vnr->findvalue('./disk');

@ -1085,6 +1085,67 @@ sub find_changes
return(0);
}
# Look for changes in the bonds.
sub bridge_name
{
my ($anvil) = @_;
foreach my $bond_name (sort {$a cmp $b} keys %{$anvil->data->{new}{bond}})
{
# Store the bond
my $new_mode = $anvil->data->{new}{bond}{$bond_name}{mode};
my $new_mtu = $anvil->data->{new}{bond}{$bond_name}{mtu};
my $new_master = $anvil->data->{new}{bond}{$bond_name}{master};
my $new_link_state = $anvil->data->{new}{bond}{$bond_name}{link_state};
my $new_operational = $anvil->data->{new}{bond}{$bond_name}{operational};
my $new_mac_address = $anvil->data->{new}{bond}{$bond_name}{mac_address};
my $new_primary_interface = $anvil->data->{new}{bond}{$bond_name}{primary_interface};
my $new_primary_reselect = $anvil->data->{new}{bond}{$bond_name}{primary_reselect};
my $new_active_interface = $anvil->data->{new}{bond}{$bond_name}{active_interface};
my $new_mii_polling_interval = $anvil->data->{new}{bond}{$bond_name}{mii_polling_interval};
my $new_up_delay = $anvil->data->{new}{bond}{$bond_name}{up_delay};
my $new_down_delay = $anvil->data->{new}{bond}{$bond_name}{down_delay};
my $new_tx_bytes = $anvil->data->{new}{bond}{$bond_name}{tx_bytes};
my $new_rx_bytes = $anvil->data->{new}{bond}{$bond_name}{rx_bytes};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
bond_name => $bond_name,
new_mode => $new_mode,
new_mtu => $new_mtu,
new_master => $new_master,
new_link_state => $new_link_state,
new_operational => $new_operational,
new_mac_address => $new_mac_address,
new_primary_interface => $new_primary_interface,
new_primary_reselect => $new_primary_reselect,
new_active_interface => $new_active_interface,
new_mii_polling_interval => $new_mii_polling_interval,
new_up_delay => $new_up_delay,
new_down_delay => $new_down_delay,
new_bridge_uuid => $new_bridge_uuid,
new_tx_bytes => $new_tx_bytes." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $new_tx_bytes}).")",
new_rx_bytes => $new_rx_bytes." (".$anvil->Convert->bytes_to_human_readable({'bytes' => $new_rx_bytes}).")",
}});
# If we don't have a bridge_uuid, find it by the name.
my $new_bridge_uuid = "";
my $new_bridge_name = "";
if (exists $anvil->data->{interface_to_bridge}{$bond_name})
{
# This bond is on a bridge
$new_bridge_name = $anvil->data->{interface_to_bridge}{$bond_name};
$new_bridge_uuid = $anvil->data->{old}{bridges}{name_to_uuid}{$new_bridge_name};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
new_bridge_uuid => $new_bridge_uuid,
new_bridge_uuid => $new_bridge_uuid,
}});
}
}
return(0);
}
# Look for changes in the bridges.
sub check_bridges
{
@ -1101,6 +1162,7 @@ sub check_bridges
my $new_tx_bytes = $anvil->data->{new}{bridge}{$bridge_name}{tx_bytes};
my $new_rx_bytes = $anvil->data->{new}{bridge}{$bridge_name}{rx_bytes};
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
bridge_name => $bridge_name,
new_bridge_id => $new_bridge_id,
new_mac_address => $new_mac_address,
new_mtu => $new_mtu,

@ -276,61 +276,64 @@ sub remove_from_pacemaker
$anvil->nice_exit({exit_code => 1});
}
}
elsif ($anvil->data->{cib}{parsed}{data}{server}{$server_name}{status} ne "off")
else
{
# As we're going to delete the server, we won't wait. We'll come back here and destroy the
# server if it's still running.
my $problem = $anvil->Cluster->shutdown_server({
debug => 2,
server => $server_name,
'wait' => 0,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { problem => $problem }});
if ($problem)
if ($anvil->data->{cib}{parsed}{data}{server}{$server_name}{status} ne "off")
{
# Failed to stop.
my $problem = $anvil->Cluster->shutdown_server({
debug => 2,
server => $server_name,
'wait' => 0,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { problem => $problem }});
if ($problem)
{
# Failed to stop.
$anvil->Job->update_progress({
progress => 100,
message => "error_0223,!!server_name!".$server_name."!!",
job_status => "failed",
});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, priority => 'err', key => "error_0223", variables => { server_name => $server_name }});
$anvil->nice_exit({exit_code => 1});
}
# Force the server off now.
$anvil->Job->update_progress({
progress => 100,
message => "error_0223,!!server_name!".$server_name."!!",
job_status => "failed",
progress => 20,
message => "job_0223,!!server_name!".$server_name."!!",
});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, priority => 'err', key => "error_0223", variables => { server_name => $server_name }});
$anvil->nice_exit({exit_code => 1});
}
# Force the server off now.
$anvil->Job->update_progress({
progress => 20,
message => "job_0223,!!server_name!".$server_name."!!",
});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "job_0223", variables => { server_name => $server_name }});
my $success = $anvil->Server->shutdown_virsh({
debug => 2,
force => 1,
server => $server_name,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { success => $success }});
if (not $success)
{
# Failed to stop
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "job_0223", variables => { server_name => $server_name }});
my $success = $anvil->Server->shutdown_virsh({
debug => 2,
force => 1,
server => $server_name,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { success => $success }});
if (not $success)
{
# Failed to stop
$anvil->Job->update_progress({
progress => 100,
message => "error_0223,!!server_name!".$server_name."!!",
job_status => "failed",
});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, priority => 'err', key => "error_0223", variables => { server_name => $server_name }});
$anvil->nice_exit({exit_code => 1});
}
# Server is off now.
$anvil->Job->update_progress({
progress => 100,
message => "error_0223,!!server_name!".$server_name."!!",
job_status => "failed",
progress => 25,
message => "job_0211,!!server_name!".$server_name."!!",
});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 0, priority => 'err', key => "error_0223", variables => { server_name => $server_name }});
$anvil->nice_exit({exit_code => 1});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "job_0211", variables => { server_name => $server_name }});
}
# Server is off now.
$anvil->Job->update_progress({
progress => 25,
message => "job_0211,!!server_name!".$server_name."!!",
});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "job_0211", variables => { server_name => $server_name }});
# Delete the resource.
$problem = $anvil->Cluster->delete_server({debug => 2, server_name => $server_name});
my $problem = $anvil->Cluster->delete_server({debug => 2, server_name => $server_name});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { problem => $problem }});
if ($problem)
{

Loading…
Cancel
Save