diff --git a/Anvil/Tools/Server.pm b/Anvil/Tools/Server.pm index b5e9c300..41f65efc 100644 --- a/Anvil/Tools/Server.pm +++ b/Anvil/Tools/Server.pm @@ -1362,6 +1362,14 @@ sub parse_definition return(1); } + # If whoever called us did so after a 'virsh dumpxml ' while the server was off, the "definition" + # will contain the string 'error: failed to get domain'. In such a case, return. + if ($definition =~ /error: failed to get domain/gs) + { + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "error_0367", variables => { definition => $definition }}); + return(1); + } + ### TODO: Switch this away from XML::Simple local $@; my $xml = XML::Simple->new(); @@ -1370,12 +1378,12 @@ sub parse_definition if (not $test) { chomp $@; - my $error = "[ Error ] - The was a problem parsing: [$definition]. The error was:\n"; + my $error = "[ Error ] - The was a problem parsing: [".$definition."]. The error was:\n"; $error .= "===========================================================\n"; $error .= $@."\n"; $error .= "===========================================================\n"; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", list => { error => $error }}); - $anvil->nice_exit({exit_code => 1}); + return(1); } $anvil->data->{server}{$target}{$server}{$source}{parsed} = $server_xml; diff --git a/share/words.xml b/share/words.xml index f9731b44..6e12b0f8 100644 --- a/share/words.xml +++ b/share/words.xml @@ -512,6 +512,13 @@ The output, if any, was; [ Error ] - There was a problem purging records. The details of the problem should be in the logs. The table: [#!variable!table!#] has an entry in the history schema that doesn't have a corresponding record in the public schema. This is likely a resync artifact of a deleted record. Purging the record: [#!variable!uuid_column!#:#!variable!column_uuid!#] from all databases. [ Error ] - Failed to reconnect to the database, and now no connections remain. + ' for a server that was not running. + +The definition data passed in was: +==== +#!variable!definition!# +==== +]]> diff --git a/tools/anvil-provision-server b/tools/anvil-provision-server index 76229bfc..2b572de6 100755 --- a/tools/anvil-provision-server +++ b/tools/anvil-provision-server @@ -1599,6 +1599,9 @@ sub check_anvil { my ($anvil) = @_; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + "new_server::anvil_uuid" => $anvil->data->{new_server}{anvil_uuid}, + }}); if (($anvil->data->{switches}{anvil}) && (not $anvil->data->{switches}{'anvil-uuid'}) && (not $anvil->data->{switches}{'anvil-name'})) { if ($anvil->Validate->uuid({uuid => $anvil->data->{switches}{anvil}})) @@ -1618,8 +1621,15 @@ sub check_anvil } # Do we know or can we find the Anvil! UUID? - $anvil->data->{new_server}{anvil_uuid} = $anvil->data->{switches}{'anvil-uuid'} ? $anvil->data->{switches}{'anvil-uuid'} : ""; - $anvil->data->{new_server}{anvil_name} = $anvil->data->{switches}{'anvil-name'} ? $anvil->data->{switches}{'anvil-name'} : ""; + if (not $anvil->data->{new_server}{anvil_uuid}) + { + $anvil->data->{new_server}{anvil_uuid} = $anvil->data->{switches}{'anvil-uuid'} ? $anvil->data->{switches}{'anvil-uuid'} : ""; + $anvil->data->{new_server}{anvil_name} = $anvil->data->{switches}{'anvil-name'} ? $anvil->data->{switches}{'anvil-name'} : ""; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + "new_server::anvil_uuid" => $anvil->data->{new_server}{anvil_uuid}, + "new_server::anvil_name" => $anvil->data->{new_server}{anvil_name}, + }}); + } if ((not $anvil->data->{new_server}{anvil_uuid}) && (not $anvil->data->{new_server}{anvil_name})) { @@ -2334,6 +2344,7 @@ sub interactive_ask_server_install_media $anvil->Database->get_files(); $anvil->Database->get_file_locations(); my $anvil_uuid = $anvil->data->{new_server}{anvil_uuid}; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { anvil_uuid => $anvil_uuid }}); # Create an array of install ISOs. my $install_isos = [""]; @@ -2427,6 +2438,7 @@ sub interactive_ask_server_driver_disc $anvil->Database->get_files(); $anvil->Database->get_file_locations(); my $anvil_uuid = $anvil->data->{new_server}{anvil_uuid}; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { anvil_uuid => $anvil_uuid }}); my $say_ram = $anvil->Convert->bytes_to_human_readable({"bytes" => $anvil->data->{new_server}{ram}}); my $storage_group_uuid = $anvil->data->{new_server}{storage_group}; @@ -2555,6 +2567,7 @@ sub interactive_ask_server_os my $say_install_media = $anvil->data->{files}{file_uuid}{$install_media_file_uuid}{file_name}; my $driver_disc_file_uuid = $anvil->data->{new_server}{driver_disc}; my $say_driver_disc = $driver_disc_file_uuid eq "none" ? "#!string!unit_0005!#" : $anvil->data->{files}{file_uuid}{$driver_disc_file_uuid}{file_name}; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { anvil_uuid => $anvil_uuid }}); print $terminal->Tputs('cl'); print $anvil->Words->string({key => "job_0150"})."\n"; @@ -2624,6 +2637,10 @@ sub interactive_ask_server_confirm $anvil->Database->get_files(); $anvil->Database->get_file_locations(); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + "new_server::anvil_uuid" => $anvil->data->{new_server}{anvil_uuid}, + "switches::ci-test" => $anvil->data->{switches}{'ci-test'}, + }}); if ($anvil->data->{switches}{'ci-test'}) { ### NOTE: Show available options; @@ -2946,19 +2963,23 @@ sub interactive_ask_server_confirm $anvil->data->{new_server}{storage_size} = $anvil->data->{switches}{'storage-size'}; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { 's1:new_server::name' => $anvil->data->{new_server}{name}, - 's1:new_server::uuid' => $anvil->data->{new_server}{uuid}, - 's2:new_server::os' => $anvil->data->{new_server}{os}, - 's3:new_server::cpu' => $anvil->data->{new_server}{cpu}, - 's4:new_server::ram' => $anvil->data->{new_server}{ram}, - 's5:new_server::storage_group' => $anvil->data->{new_server}{storage_group}, - 's6:new_server::storage_size' => $anvil->data->{new_server}{storage_size}." (".$anvil->Convert->bytes_to_human_readable({"bytes" => $max_storage_group_size}).")", - 's7:new_server::install_media' => $anvil->data->{new_server}{install_media}, - 's8:new_server::driver_disc' => $anvil->data->{new_server}{driver_disc}, + 's2:new_server::uuid' => $anvil->data->{new_server}{uuid}, + 's3:new_server::os' => $anvil->data->{new_server}{os}, + 's4:new_server::cpu' => $anvil->data->{new_server}{cpu}, + 's5:new_server::ram' => $anvil->data->{new_server}{ram}, + 's6:new_server::storage_group' => $anvil->data->{new_server}{storage_group}, + 's7:new_server::storage_size' => $anvil->data->{new_server}{storage_size}." (".$anvil->Convert->bytes_to_human_readable({"bytes" => $max_storage_group_size}).")", + 's8:new_server::install_media' => $anvil->data->{new_server}{install_media}, + 's9:new_server::driver_disc' => $anvil->data->{new_server}{driver_disc}, }}); } my $anvil_uuid = $anvil->data->{new_server}{anvil_uuid}; my $node1_host_uuid = $anvil->data->{anvils}{anvil_uuid}{$anvil_uuid}{anvil_node1_host_uuid}; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + 's1:anvil_uuid' => $anvil_uuid, + 's2:node1_host_uuid' => $node1_host_uuid, + }}); my $storage_group_uuid = $anvil->data->{new_server}{storage_group}; my $say_ram = $anvil->Convert->bytes_to_human_readable({"bytes" => $anvil->data->{new_server}{ram}});