-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[launcher] Change retry behavior to reboot
Update scripts and service unit file Signed-off-by: Jiankun Lu <jiankun@google.com>
- Loading branch information
Showing
13 changed files
with
378 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
launcher/launcher | ||
launcher/launcher/launcher | ||
*.test | ||
*.test.exe | ||
cmd/gotpm/gotpm | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package main | ||
package launcher | ||
|
||
import ( | ||
"encoding/json" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package main | ||
package launcher | ||
|
||
import ( | ||
"bytes" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package launcher | ||
|
||
// RetryableError means launcher should reboot the VM to retry. | ||
type RetryableError struct { | ||
Err error | ||
} | ||
|
||
// NonRetryableError means launcher shouldn't reboot the VM to retry. | ||
type NonRetryableError struct { | ||
Err error | ||
} | ||
|
||
// WorkloadError represents the result of an workload/task that is non-zero. | ||
type WorkloadError struct { | ||
ReturnCode uint32 | ||
} | ||
|
||
func (e *RetryableError) Error() string { | ||
return e.Err.Error() | ||
} | ||
|
||
func (e *NonRetryableError) Error() string { | ||
return e.Err.Error() | ||
} | ||
|
||
func (e *WorkloadError) Error() string { | ||
return "workload finished with non-zero return code" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#! /bin/bash | ||
|
||
if [[ $EXIT_STATUS -eq 3 ]] | ||
then | ||
# reboot after 2 min | ||
shutdown --reboot +2 | ||
fi | ||
|
||
if [[ $EXIT_STATUS -eq 0 ]] || [[ $EXIT_STATUS -eq 1 ]] || [[ $EXIT_STATUS -eq 2 ]] | ||
then | ||
# poweroff after 2 min | ||
shutdown --poweroff +2 | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.