Merge pull request #2055 from lifupan/fix_missingqemulog

virtcontainers: fix the issue of missing qemu error logs
This commit is contained in:
Julio Montes 2019-09-20 07:41:47 -05:00 committed by GitHub
commit 948dd3303a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -763,7 +763,15 @@ func (q *qemu) startSandbox(timeout int) error {
var strErr string
strErr, err = govmmQemu.LaunchQemu(q.qemuConfig, newQMPLogger())
if err != nil {
return fmt.Errorf("fail to launch qemu: %s, error messages from qemu log: %s", err, strErr)
if q.config.Debug && q.qemuConfig.LogFile != "" {
b, err := ioutil.ReadFile(q.qemuConfig.LogFile)
if err == nil {
strErr += string(b)
}
}
q.Logger().WithError(err).Errorf("failed to launch qemu: %s", strErr)
return fmt.Errorf("failed to launch qemu: %s, error messages from qemu log: %s", err, strErr)
}
err = q.waitSandbox(timeout) // the virtiofsd deferred checks err's value