diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2017-11-19 12:29:00 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2017-11-19 12:29:00 +0100 |
| commit | 9badd05327bc3a1a96c828de3c32dc8101be77cc (patch) | |
| tree | d1fe4812d2c3dd4e3d070efee54e832d5a49bc0f /pkg/gce | |
| parent | 2994ea09810a461d7a6334cdc4867179d46a08e2 (diff) | |
vm/gce: provide VM console output on boot failures
"can't ssh into the instance" is not a very useful error.
Diffstat (limited to 'pkg/gce')
| -rw-r--r-- | pkg/gce/gce.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/gce/gce.go b/pkg/gce/gce.go index e8ad084e6..c08ae5519 100644 --- a/pkg/gce/gce.go +++ b/pkg/gce/gce.go @@ -228,6 +228,16 @@ func (ctx *Context) DeleteImage(imageName string) error { return nil } +func (ctx *Context) GetSerialPortOutput(instance string) (string, error) { + <-ctx.apiRateGate + output, err := ctx.computeService.Instances.GetSerialPortOutput( + ctx.ProjectID, ctx.ZoneID, instance).Port(1).Do() + if err != nil { + return "", fmt.Errorf("failed to get serial port output: %v", err) + } + return output.Contents, nil +} + type resourcePoolExhaustedError string func (err resourcePoolExhaustedError) Error() string { |
