[health-checker] Added logging messages
These will probably be useful in the future.
Change-Id: Ibc41abbd25da74f247db56d7698b7bf0df104b2f
diff --git a/cmd/health_checker/main.go b/cmd/health_checker/main.go
index 3b3b376..6617f6e 100644
--- a/cmd/health_checker/main.go
+++ b/cmd/health_checker/main.go
@@ -121,6 +121,7 @@
}
// Wait for Zedboot to come back up.
+ log.Printf("Waiting for Zedboot to come back up.")
start := time.Now()
for ; time.Since(start) < zedbootWaitDuration; {
time.Sleep(zedbootCheckInterval)
@@ -130,6 +131,7 @@
}
// If we get here, Zedboot never came back up, so we need to powercycle the device.
+ log.Printf("Zedboot did not come up; attempting powercycle")
if err := device.Powercycle(ctx); err != nil {
return err
}
diff --git a/devices/power.go b/devices/power.go
index 4843fca..d94a9eb 100644
--- a/devices/power.go
+++ b/devices/power.go
@@ -9,6 +9,7 @@
"errors"
"fmt"
"io"
+ "log"
"time"
"go.fuchsia.dev/fuchsia/tools/net/sshutil"
@@ -68,9 +69,12 @@
// additionally uses the given configuration to reboot the device if specified.
func (c PowerClient) RebootDevice(signers []ssh.Signer, nodename string, serial io.ReadWriter) error {
var rebooter Rebooter
+ log.Printf("Attempting to soft reboot device %s", nodename)
if serial != nil {
+ log.Printf("Using serial to reboot.")
rebooter = NewSerialRebooter(serial)
} else {
+ log.Printf("Using SSH to reboot.")
rebooter = NewSSHRebooter(nodename, signers)
}
return rebooter.reboot()
@@ -78,13 +82,16 @@
// Powercycle the device using an out of band method
func (c PowerClient) Powercycle(nodename string, serial io.ReadWriter) error {
+ log.Printf("Attempting to powercycle device %s", nodename)
switch c.Type {
case "amt":
+ log.Printf("Using AMT to powercycle.")
return AMTReboot(c.Host, c.Username, c.Password)
case "wol":
if serial == nil {
return errors.New(fmt.Sprintf("WOL Reboot requires serial connection."))
}
+ log.Printf("Using WOL to powercycle")
if err := WOLReboot(botBroadcastAddr, botInterface, c.HostMACAddr); err != nil {
return err
}
@@ -92,6 +99,7 @@
if serial == nil {
return errors.New(fmt.Sprintf("PDU Reboot requires serial connection."))
}
+ log.Printf("Using PDU to powercycle")
if err := PDUReboot(c.PDUPort, c.Host, c.Username, c.Password); err != nil {
return err
}
@@ -99,6 +107,7 @@
return errors.New(fmt.Sprintf("%v does not have AMT, WOL, or PDU support. Cannot powercycle.", nodename))
}
// Send dm reboot-recovery to the device so that it always boots into zedboot.
+ log.Printf("Powercycle complete; using serial to send dm reboot recovery.")
time.Sleep(powercycleWait)
rebooter := NewSerialRebooter(serial)
return rebooter.reboot()