From dc989f0950073cc73fa272e1df983d33b3f1dd0d Mon Sep 17 00:00:00 2001 From: Digimer Date: Wed, 16 Feb 2022 21:55:33 -0500 Subject: [PATCH] Added more logging to track when and how reboots happen in systems. Signed-off-by: Digimer --- cgi-bin/striker | 3 +++ notes | 27 +++++++++++++++++++++++++++ share/words.xml | 10 ++++++++-- tools/anvil-manage-power | 3 +++ tools/anvil-safe-stop | 2 ++ tools/anvil-update-system | 3 +-- 6 files changed, 44 insertions(+), 4 deletions(-) diff --git a/cgi-bin/striker b/cgi-bin/striker index b3b77129..807767b2 100755 --- a/cgi-bin/striker +++ b/cgi-bin/striker @@ -6451,6 +6451,7 @@ sub process_power my $job_description = "job_0006"; my $say_title = "#!string!job_0005!#"; my $say_description = "#!string!job_0006!#"; + my $say_reason = "log_0199"; if ($task eq "poweroff") { $job_command = $anvil->data->{path}{exe}{'anvil-manage-power'}." --poweroff -y".$anvil->Log->switches; @@ -6458,7 +6459,9 @@ sub process_power $job_description = "job_0008"; $say_title = "#!string!job_0007!#"; $say_description = "#!string!job_0008!#"; + $say_reason = "log_0200"; } + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0687", variables => { reason => $say_reason }}); my ($job_uuid) = $anvil->Database->insert_or_update_jobs({ file => $THIS_FILE, line => __LINE__, diff --git a/notes b/notes index 73d9f1c4..85a9cc5a 100644 --- a/notes +++ b/notes @@ -1291,6 +1291,33 @@ rs-striker03(config-if)#switchport access vlan 100 rs-striker03(config-if)#no shutdown rs-striker03(config-if)#exit +#### NOTE: Put IP on VID 1! + +rs-switch03(config)#show vlan + +VLAN Name Ports Type +----- --------------- ------------- -------------- +1 default Po1-128, Default + Gi1/0/1-12, + Te1/0/1-4, + Gi2/0/1-12, + Te2/0/1-4 +300 IFN1 Gi1/0/13-24, Static + Gi2/0/13-24 + +rs-switch03(config)#interface vlan 1 + +rs-switch03(config-if-vlan1)#ip address 10.201.1.3 255.255.0.0 + +rs-switch03(config-if-vlan1)#exit + +rs-switch03(config)#exit + +rs-switch03#copy running-config startup-config + +########################### + + rs-striker03#show vlan diff --git a/share/words.xml b/share/words.xml index be3625b5..dcf027fa 100644 --- a/share/words.xml +++ b/share/words.xml @@ -1523,8 +1523,8 @@ The database connection error was: Failed to reconnect to the database, and now no connections remail. Exiting. maintenance_mode() was passed an invalid 'set' value: [#!variable!set!#]. No action taken.]]> The user: [#!variable!user!#] logged out successfully. - A system reboot is required, setting the database flag. - A system reboot is required, setting the database flag. + A system reboot has been requested via the Striker UI. + A system power-off has been requested via the Striker UI. Unable to connect to any database. Will try to initialize the local system and then try again. Failed to connect to any databases. Skipping the loop of the daemon. Disconnected from all databases. Will reconnect when entering the main loop. @@ -2079,6 +2079,12 @@ The file: [#!variable!file!#] needs to be updated. The difference is: The network interface: [#!variable!nic!#] on the host: [#!variable!host!#] is recorded in the 'history.network_interfaces' table, but has not corresponding entry in the public table. Removing it. [ Note ] - The network bridge: [#!variable!name!#] with 'bridge_uuid': [#!variable!uuid!#] is a duplicate, removing it from the database(s). Skipping resync, not a Striker dashboard. + ### REBOOT REQUESTED ### - [#!variable!reason!#] + Reboot flag set by command line switch to 'anvil-manage-power'. + Poweroff flag set by command line switch to 'anvil-manage-power'. + Kernel updated, reboot queued. + Requested to power-off as part of the anvil-safe-stop job. + The anvil-safe-stop job has completed and will now power off. The host name: [#!variable!target!#] does not resolve to an IP address. diff --git a/tools/anvil-manage-power b/tools/anvil-manage-power index 4b4b9934..8786b572 100755 --- a/tools/anvil-manage-power +++ b/tools/anvil-manage-power @@ -130,6 +130,7 @@ if ($anvil->data->{switches}{'reboot-needed'} eq "1") # Enable if (not $reboot_needed) { + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0687", variables => { reason => "log_0688" }}); $reboot_needed = $anvil->System->reboot_needed({debug => 2, set => 1}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { reboot_needed => $reboot_needed }}); print $anvil->Words->string({key => "message_0048"})."\n"; @@ -246,6 +247,8 @@ sub do_poweroff # Make sure the 'reboot needed' flag is set. When 'anvil-daemon' starts, it will use this to confirm # that it is starting post-reboot and clear it. + my $say_reason = $task eq "poweroff" ? "log_0689" : "log_0688"; + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0687", variables => { reason => $say_reason }}); $reboot_needed = $anvil->System->reboot_needed({debug => 2, set => 1}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { reboot_needed => $reboot_needed }}); diff --git a/tools/anvil-safe-stop b/tools/anvil-safe-stop index 6f30a1c8..b2b68ff2 100755 --- a/tools/anvil-safe-stop +++ b/tools/anvil-safe-stop @@ -101,6 +101,7 @@ if ($anvil->data->{switches}{'job-uuid'}) $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { 'switches::power-off' => $anvil->data->{switches}{'power-off'}, }}); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0687", variables => { reason => "log_0691" }}); } if ($line =~ /stop-reason=(.*?)$/) { @@ -156,6 +157,7 @@ if ($anvil->data->{switches}{'power-off'}) host_status => "stopping", }); + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0687", variables => { reason => "log_0692" }}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, 'print' => 1, level => 1, key => "job_0325"}); $anvil->Job->update_progress({progress => 100, message => "job_0325"}); diff --git a/tools/anvil-update-system b/tools/anvil-update-system index 0f8147ee..a8626705 100755 --- a/tools/anvil-update-system +++ b/tools/anvil-update-system @@ -173,8 +173,7 @@ sub run_os_update if ($line =~ /^kernel /) { # Reboot will be needed. - $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, secure => 0, key => "log_0199"}); - + $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0687", variables => { reason => "log_0690" }}); my $reboot_needed = $anvil->System->reboot_needed({set => 1}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { reboot_needed => $reboot_needed }}); }