mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-27 05:10:43 +00:00
vm/gce: provide VM console output on boot failures
"can't ssh into the instance" is not a very useful error.
This commit is contained in:
parent
2994ea0981
commit
9badd05327
@ -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 {
|
||||
|
@ -15,6 +15,7 @@ import (
|
||||
"archive/tar"
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
@ -164,6 +165,9 @@ func (pool *Pool) Create(workdir string, index int) (vmimpl.Instance, error) {
|
||||
}
|
||||
Logf(0, "wait instance to boot: %v (%v)", name, ip)
|
||||
if err := pool.waitInstanceBoot(ip, sshKey, sshUser); err != nil {
|
||||
if output, err := pool.GCE.GetSerialPortOutput(name); err == nil {
|
||||
err = errors.New(err.Error() + "\n\n" + output)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
ok = true
|
||||
|
Loading…
Reference in New Issue
Block a user