try a different way of identifying previous host for VM
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-05-24 12:30:28 +10:00
parent e3ca947ecc
commit cd129feb09

25
main.go
View File

@@ -334,15 +334,26 @@ func main() {
log.Printf("%d [%s] VM: %s, Host: %s, Message: %s\n", h.Key, h.CreatedTime.In(location).Format(time.ANSIC), h.Vm.Name, h.Host.Name, h.FullFormattedMessage) log.Printf("%d [%s] VM: %s, Host: %s, Message: %s\n", h.Key, h.CreatedTime.In(location).Format(time.ANSIC), h.Vm.Name, h.Host.Name, h.FullFormattedMessage)
} }
disconnectedHost := disconnectedEvents[0] // Search for any disconnected messages prior to restart time
log.Printf("First disconnected message indicates that VM was running on host '%s' previously\n", disconnectedHost.Host.Name) log.Printf("Filtering VmDisconnectedEvent list based on VM restart time %s\n", vmRestartTime)
for _, e := range disconnectedEvents {
// Capture all the failure events for this host if e.CreatedTime.In(location).Before(vmRestartTime) || e.CreatedTime.In(location).Equal(vmRestartTime) {
for _, hostEvent := range hostFailures { log.Printf("VM disconnected event on host %s at time %s is applicable\n", e.Host.Name, e.CreatedTime.In(location))
if hostEvent.Host.Name == disconnectedHost.Host.Name { possibleHosts = append(possibleHosts, e)
possibleHosts = append(possibleHosts, hostEvent)
} }
} }
/*
disconnectedHost := disconnectedEvents[0]
log.Printf("First disconnected message indicates that VM was running on host '%s' previously\n", disconnectedHost.Host.Name)
// Capture all the failure events for this host
for _, hostEvent := range hostFailures {
if hostEvent.Host.Name == disconnectedHost.Host.Name {
possibleHosts = append(possibleHosts, hostEvent)
}
}
*/
} else { } else {
log.Printf("could not determine previous host for this VM. Filtering all host failures for events prior to VM restart time '%s'\n", vmRestartTime) log.Printf("could not determine previous host for this VM. Filtering all host failures for events prior to VM restart time '%s'\n", vmRestartTime)