From 4f46bb43eb8dab531e771c01d42ab304fa8559b5 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Thu, 13 Jul 2023 01:54:04 -0400 Subject: [PATCH] fix(tools): remove server screenshot fetching in anvil-daemon --- tools/anvil-daemon | 88 ---------------------------------------------- 1 file changed, 88 deletions(-) diff --git a/tools/anvil-daemon b/tools/anvil-daemon index c1bede5e..4643c72c 100755 --- a/tools/anvil-daemon +++ b/tools/anvil-daemon @@ -554,9 +554,6 @@ sub handle_periodic_tasks # Check if anything is needed to be done in /mnt/shared. check_incoming($anvil); - # TODO: resolve the possible libvirt deadlock and re-enable screenshot fetching. - # do_non_striker_tasks($anvil); - # Check for stale db_in_use states. check_db_in_use_states($anvil); } @@ -1818,88 +1815,3 @@ sub update_state_file return(0); } - -sub get_server_screenshot -{ - my $anvil = shift; - my $parameters = shift; - my $debug = $parameters->{debug} // 3; - - my $query = "SELECT host_uuid FROM hosts WHERE host_type = 'striker';"; - my $results = $anvil->Database->query({ query => $query, source => $THIS_FILE, line => __LINE__ }); - my $count = @{$results}; - - $anvil->Log->variables({ source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query, count => $count } }); - - return (1) if ($count == 0); - - my $striker_uuid_csv = $results->[0]->[0]; - - foreach my $row ( @{$results}[1 .. $#{$results}] ) - { - my $host_uuid = $row->[0]; - - $striker_uuid_csv = "$striker_uuid_csv,$host_uuid"; - } - - $anvil->Log->variables({ source => $THIS_FILE, line => __LINE__, level => $debug, list => { striker_uuid_csv => $striker_uuid_csv } }); - - my $server_list_on_local = $anvil->data->{server}{location}; - my $server_name_csv = join(", ", map { $anvil->Database->quote($_) } keys %{$server_list_on_local}); - - $anvil->Log->variables({ source => $THIS_FILE, line => __LINE__, level => $debug, list => { server_name_csv => $server_name_csv } }); - - return (1) if ( length($server_name_csv) == 0 ); - - $query = "SELECT server_uuid FROM servers WHERE server_name IN (".$server_name_csv.") ORDER BY server_name;"; - $results = $anvil->Database->query({ query => $query, source => $THIS_FILE, line => __LINE__ }); - $count = @{$results}; - - $anvil->Log->variables({ source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query, count => $count } }); - - return (1) if ($count == 0); - - foreach my $row ( @{$results} ) - { - my $server_uuid = $row->[0]; - - my ($syscall_output, $syscall_rcode) = $anvil->System->call({ - debug => $debug, - line => __LINE__, - shell_call => $anvil->data->{path}{exe}{'anvil-get-server-screenshot'}." --server-uuid '$server_uuid' --request-host-uuid '$striker_uuid_csv'", - source => $THIS_FILE, - }); - - $anvil->Log->variables({ source => $THIS_FILE, line => __LINE__, level => $debug, list => { - syscall_output => $syscall_output, - syscall_rcode => $syscall_rcode, - }}); - } - - return (0); -} - -sub do_non_striker_tasks -{ - my $anvil = shift; - my $parameters = shift; - my $debug = $parameters->{debug} // 3; - - my $host_type = $anvil->data->{sys}{host_type}; - - $anvil->Log->variables({ source => $THIS_FILE, line => __LINE__, level => $debug, list => { host_type => $host_type } }); - - return (1) if ($host_type eq "striker"); - - # Get the servers running on this host (except striker). - my ($rcode) = $anvil->Server->find(); - - if ($rcode == 0) - { - # Get a screenshot from every server (cluster resource) - # running on localhost and punt them to all strikers. - get_server_screenshot($anvil, { debug => $debug }); - } - - return (0); -} \ No newline at end of file