From 2d1987f91a74d84f6e33e0a1c6402f893d449930 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Tue, 22 Jun 2021 19:59:29 -0400 Subject: [PATCH] fix(cgi-bin): enable sending power on/off server VM jobs --- cgi-bin/set_power | 44 ++++++++++++++++++++++---------------------- share/words.xml | 8 ++++++++ 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/cgi-bin/set_power b/cgi-bin/set_power index b48999bf..e49129ac 100755 --- a/cgi-bin/set_power +++ b/cgi-bin/set_power @@ -141,28 +141,28 @@ WHERE $anvil->Log->variables({ source => $THIS_FILE, line => __LINE__, level => 2, list => { anvil_uuid => $anvil_uuid, host_uuid => $host_uuid, server_uuid => $server_uuid } }); - # if ($on) - # { - # $anvil->Database->insert_or_update_jobs({ - # job_command => $anvil->data->{path}{exe}{'anvil-boot-server'}." --server-uuid ".$server_uuid, - # job_host_uuid => $host_uuid, - # job_description => "", - # job_name => "cgi-bin::set_power::server::on", - # job_progress => 0, - # job_title => "" - # }); - # } - # else - # { - # $anvil->Database->insert_or_update_jobs({ - # job_command => $anvil->data->{path}{exe}{'anvil-shutdown-server'}." --server-uuid ".$server_uuid, - # job_host_uuid => $host_uuid, - # job_description => "", - # job_name => "cgi-bin::set_power::server::off", - # job_progress => 0, - # job_title => "" - # }); - # } + if ($on) + { + $anvil->Database->insert_or_update_jobs({ + job_command => $anvil->data->{path}{exe}{'anvil-boot-server'}." --server-uuid ".$server_uuid, + job_host_uuid => $host_uuid, + job_description => "job_0341", + job_name => "cgi-bin::set_power::server::on", + job_progress => 0, + job_title => "job_0340" + }); + } + else + { + $anvil->Database->insert_or_update_jobs({ + job_command => $anvil->data->{path}{exe}{'anvil-shutdown-server'}." --server-uuid ".$server_uuid, + job_host_uuid => $host_uuid, + job_description => "job_0343", + job_name => "cgi-bin::set_power::server::off", + job_progress => 0, + job_title => "job_0342" + }); + } } } diff --git a/share/words.xml b/share/words.xml index fef1b511..d0e898ad 100644 --- a/share/words.xml +++ b/share/words.xml @@ -1096,6 +1096,14 @@ It should be provisioned in the next minute or two. Host Leave Cluster Make target host leave its anvil cluster. + + Power On Server VM + + Power on the target server VM by executing a start script on the first host within the cluster. + + Power Off Server VM + + Power off the target server VM by executing a stop script on the first a host within the cluster. Starting: [#!variable!program!#].