diff --git a/Anvil/Tools/Server.pm b/Anvil/Tools/Server.pm index 3bf56862..97d9a189 100644 --- a/Anvil/Tools/Server.pm +++ b/Anvil/Tools/Server.pm @@ -864,37 +864,6 @@ sub map_network return(0); } -=head2 provision - -This method creates a new (virtual) server on an Anvil! system. - -Parameters; - -=cut -sub provision -{ - my $self = shift; - 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 => "Server->provision()" }}); - -=cut -Provision order: - -1. Create LVs and register the storage. - - NOTE: If the LV is already in the DB (from a past install) and the peer is not available and the local - DRBD resource doesn't show Consistent, abort. If the peer is alive but we can't contact it, it's - possible the peer is UpToDate. -2. Create the DRBD resource. If "Inconsistent" on both nodes, force up to date -3. Wait for install media/image to be ready -4. Provision VM and add to Pacemaker. - -=cut - - - return(0); -} =head2 migrate_virsh @@ -918,9 +887,9 @@ This is the host name (or IP) of the host that we're pulling the server from. If set, the server will be pulled. -=head3 target (optional, defaukt is the full local host name) +=head3 target (optional, default is the full local host name) -This is the host name (or IP) Of the host that the server will be pushed to, if C<< source >> is not set. When this is not passed, the local full host name is used as default. +This is the host name (or IP) of the host that the server will be pushed to, if C<< source >> is not set. When this is not passed, the local full host name is used as default. =cut sub migrate_virsh diff --git a/notes b/notes index 604d9fc3..5af42d87 100644 --- a/notes +++ b/notes @@ -6,7 +6,7 @@ TODO: - host_health is a duplicate of 'health' ============ - + # Dump su - postgres -c "pg_dump anvil > /var/lib/pgsql/anvil.out" su - postgres -c "pg_dump --schema-only anvil > /var/lib/pgsql/anvil_schema.out" diff --git a/ocf/alteeve/server b/ocf/alteeve/server index 917df7bb..7f63d952 100755 --- a/ocf/alteeve/server +++ b/ocf/alteeve/server @@ -1260,6 +1260,35 @@ sub migrate_server target_host => $target, }}); + # If there is a '.mnX' (migration network X) entry that can be resolved, we'll change the + # target to use that. This is a dedicated, usually back-to-back network used in nodes specifically + # for migration. + my $test_target = $target; + $test_target =~ s/\..*$//; + $test_target .= "mn1"; # Might want to make this a loop to support MN2+ later + my $test_ip = $anvil->Convert->host_name_to_ip({debug => 2, host_name => $test_target}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + test_target => $test_target, + test_ip => $test_ip, + }}); + if ($test_ip) + { + # Can we access the peer with this? + my ($access) = $anvil->Remote->test_access({debug => 3, target => $test_ip}); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { access => $access }}); + + # Did we get access? + if ($access) + { + # Yup! Switch the target. + $target = $test_ip; + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0663", variables => { + target => $test_target, + ip => $target, + }}); + } + } + # Before migrating, make sure the daemons are running on the peer. check_daemons($anvil, "start"); @@ -1422,7 +1451,7 @@ sub migrate_server debug => 2, server => $server, source => $source, - target => $target + target => $target, }); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { migrated => $migrated }}); } diff --git a/share/words.xml b/share/words.xml index 0fd2c4b4..4ec2d18d 100644 --- a/share/words.xml +++ b/share/words.xml @@ -2053,6 +2053,7 @@ The file: [#!variable!file!#] needs to be updated. The difference is: Stopped the postgresql daemon as a peer is currently primary. Our most recent database dump is newer than any from our peers. As such, we'll just start the database without a load. Retrying to connect to the database. + The target can be reached on the dedicated migration network: [#!variable!target!#] via the IP address: [#!variable!ip!#], switching to use that for the RAM copy. The host name: [#!variable!target!#] does not resolve to an IP address. diff --git a/tools/anvil-manage-dr b/tools/anvil-manage-dr index 77d51519..3d6f3143 100755 --- a/tools/anvil-manage-dr +++ b/tools/anvil-manage-dr @@ -5,6 +5,8 @@ # NOTE: Unlike most jobs, this one will directly work on the peer node and the DR host using SSH connections. # This behaviour is likely to change later as it's not ideal. # +# TODO: --remove is not yet implemented, this needs to be done. Use anvil-delete-server for methods to delete. +# # Exit codes; # 0 = Normal exit. # 1 = Any problem that causes an early exit. @@ -85,8 +87,6 @@ if (not $anvil->data->{switches}{'job-uuid'}) sanity_check($anvil, $terminal); -do_task($anvil, $terminal); - $anvil->nice_exit({exit_code => 0}); @@ -95,19 +95,6 @@ $anvil->nice_exit({exit_code => 0}); # Functions # ############################################################################################################# -sub do_task -{ - my ($anvil, $terminal) = @_; - - # What task am I doing? - if ($anvil->data->{switches}{protect}) - { - - } - - return(0); -} - sub sanity_check { my ($anvil, $terminal) = @_;