|
|
@ -627,9 +627,6 @@ sub migrate_server |
|
|
|
'switches::migrate_from' => $anvil->data->{switches}{migrate_from}, |
|
|
|
'switches::migrate_from' => $anvil->data->{switches}{migrate_from}, |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
|
|
|
|
|
|
|
|
# Get a view of the servers locally and our peer. |
|
|
|
|
|
|
|
validate_all($anvil); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# The actual migration command will involve enabling dual primary, then beginning the migration. The |
|
|
|
# The actual migration command will involve enabling dual primary, then beginning the migration. The |
|
|
|
# virsh call will depend on if we're pushing or pulling. Once the migration completes, regardless of |
|
|
|
# virsh call will depend on if we're pushing or pulling. Once the migration completes, regardless of |
|
|
|
# success or failure, dual primary will be disabled again. |
|
|
|
# success or failure, dual primary will be disabled again. |
|
|
@ -650,6 +647,9 @@ sub migrate_server |
|
|
|
$anvil->nice_exit({exit_code => 5}); |
|
|
|
$anvil->nice_exit({exit_code => 5}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Get a view of the servers locally and our peer. |
|
|
|
|
|
|
|
validate_all($anvil); |
|
|
|
|
|
|
|
|
|
|
|
# Find the server |
|
|
|
# Find the server |
|
|
|
$anvil->Server->find({debug => 3}); |
|
|
|
$anvil->Server->find({debug => 3}); |
|
|
|
|
|
|
|
|
|
|
@ -770,14 +770,56 @@ sub migrate_server |
|
|
|
} |
|
|
|
} |
|
|
|
elsif ($anvil->data->{switches}{migrate_from}) |
|
|
|
elsif ($anvil->data->{switches}{migrate_from}) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$anvil->Server->find({debug => 3, target => $target}); |
|
|
|
# Pull the server here. Start by verifying it's on the 'meta_on_node' host. |
|
|
|
|
|
|
|
my $meta_on_node = $anvil->data->{environment}{OCF_RESKEY_CRM_meta_on_node}; |
|
|
|
|
|
|
|
my $host = defined $anvil->data->{server}{location}{$server}{host} ? $anvil->data->{server}{location}{$server}{host} : ""; |
|
|
|
|
|
|
|
my $status = defined $anvil->data->{server}{location}{$server}{status} ? $anvil->data->{server}{location}{$server}{status} : ""; |
|
|
|
|
|
|
|
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { |
|
|
|
|
|
|
|
host => $host, |
|
|
|
|
|
|
|
status => $status, |
|
|
|
|
|
|
|
meta_on_node => $meta_on_node, |
|
|
|
|
|
|
|
target => $target, |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
$anvil->Server->find({debug => 2, target => $meta_on_node}); |
|
|
|
|
|
|
|
|
|
|
|
my $host = defined $anvil->data->{server}{location}{$server}{host} ? $anvil->data->{server}{location}{$server}{host} : ""; |
|
|
|
my $server_host = defined $anvil->data->{server}{location}{$server}{host} ? $anvil->data->{server}{location}{$server}{host} : ""; |
|
|
|
my $status = defined $anvil->data->{server}{location}{$server}{status} ? $anvil->data->{server}{location}{$server}{status} : ""; |
|
|
|
my $server_status = defined $anvil->data->{server}{location}{$server}{status} ? $anvil->data->{server}{location}{$server}{status} : ""; |
|
|
|
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { |
|
|
|
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { |
|
|
|
host => $host, |
|
|
|
server_host => $server_host, |
|
|
|
status => $status, |
|
|
|
server_status => $server_status, |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# This is called after a migration. If that is the case here, the target will be us. Just |
|
|
|
|
|
|
|
# make sure it is running and, if so, return '0'. The 'meta_on_node' is the new host. |
|
|
|
|
|
|
|
if ($meta_on_node eq $target) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
# Yup. All we want to do if make sure it is running here. |
|
|
|
|
|
|
|
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "log_0345", variables => { server => $server }}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If it's running, we're succesfully out. |
|
|
|
|
|
|
|
if ($status eq "running") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
# Success! |
|
|
|
|
|
|
|
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "log_0347", variables => { server => $server }}); |
|
|
|
|
|
|
|
$anvil->nice_exit({exit_code => 0}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# If we're still alive, we'll proceed as if we're pulling the server to us, and maybe |
|
|
|
|
|
|
|
# that will work. |
|
|
|
|
|
|
|
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 2, key => "log_0348", variables => { server => $server }}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Validate as if we were about to boot the server. |
|
|
|
|
|
|
|
validate_all($anvil); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Call the pull migation. |
|
|
|
|
|
|
|
($migrated) = $anvil->Server->migrate({ |
|
|
|
|
|
|
|
debug => 2, |
|
|
|
|
|
|
|
server => $server, |
|
|
|
|
|
|
|
source => $source, |
|
|
|
|
|
|
|
target => $target |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { migrated => $migrated }}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { migrated => $migrated }}); |
|
|
|
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { migrated => $migrated }}); |
|
|
|