From b8bb7cc4234d56cd25b17a84a5eecc245b0136a9 Mon Sep 17 00:00:00 2001 From: Digimer Date: Thu, 25 Aug 2022 12:43:51 -0400 Subject: [PATCH] * Changed the default trigger of live migrations to require a health score difference of 2 or higher. This can be user-adjusted using the new 'feature::scancore::threshold::preventative-live-migration' anvil.conf option. Signed-off-by: Digimer --- Anvil/Tools.pm | 10 ++++++++++ Anvil/Tools/ScanCore.pm | 14 +++++++++++++- share/words.xml | 8 +++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Anvil/Tools.pm b/Anvil/Tools.pm index 2335d59b..c82b803f 100644 --- a/Anvil/Tools.pm +++ b/Anvil/Tools.pm @@ -1009,6 +1009,16 @@ sub _set_defaults html => "alteeve", }, }; + $anvil->data->{feature} = { + scancore => { + disable => { + 'preventative-live-migration' => 0, + }, + threshold => { + 'preventative-live-migration' => 2, + }, + }, + }; return(0); } diff --git a/Anvil/Tools/ScanCore.pm b/Anvil/Tools/ScanCore.pm index da503dd4..7e6cf3bf 100644 --- a/Anvil/Tools/ScanCore.pm +++ b/Anvil/Tools/ScanCore.pm @@ -2022,13 +2022,25 @@ sub post_scan_analysis_node # Last, evaluate health if we're otherwise OK if ($peer_health > $local_health) { + # The user may have set a migration threashold. + my $difference = $peer_health - $local_health; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { difference => $difference }}); + + if (not $anvil->data->{feature}{scancore}{threshold}{'preventative-live-migration'}) + { + $anvil->data->{feature}{scancore}{threshold}{'preventative-live-migration'} = 2; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { + 'feature::scancore::threshold::preventative-live-migration' => $anvil->data->{feature}{scancore}{threshold}{'preventative-live-migration'}, + }}); + } + # A user may disable health-based preventative live migrations. if ($anvil->data->{feature}{scancore}{disable}{'preventative-live-migration'}) { # Do nothing. $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, key => "message_0239"}); } - else + elsif ($difference >= $anvil->data->{feature}{scancore}{threshold}{'preventative-live-migration'}) { # How long has this been the case? my $age = $anvil->Alert->check_condition_age({ diff --git a/share/words.xml b/share/words.xml index e934f2e0..2584c794 100644 --- a/share/words.xml +++ b/share/words.xml @@ -576,7 +576,13 @@ sys::privacy::strong = #!data!sys::privacy::strong!# # Normally, if one node in the Anvil! is healthier than the other, it will pull the servers from the peer # on to it. This is a process called "preventative live migration". If you would like to disable this # feature, set this to '1'. -feature::scancore::disable::preventative-live-migration = 0 +#feature::scancore::disable::preventative-live-migration = 0 + +# If "preventative live migration" is enabled, this sets the threshold to trigger migration. The difference +# in health score has to be equal to or greater than the number below. The health scores are usually set to +# '1' per event, though scan agents are free to assign higher scores per event. The default threshold is +# '2'. To migrate on any health difference, set this to '1'. Use whole numbers only. +#feature::scancore::threshold::preventative-live-migration = 2 ### Database # Database connections;