Skip to content

Commit

Permalink
qemu: restore monitor socket path (#14000)
Browse files Browse the repository at this point in the history
When a QEMU task is recovered the monitor socket path was not being
restored into the task handler, so the `graceful_shutdown` configuration
was effectively ignored if the client restarted.
  • Loading branch information
lgfa29 committed Aug 4, 2022
1 parent c4b3226 commit 258fab1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/14000.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
qemu: restore the monitor socket path when restoring a QEMU task.
```
11 changes: 11 additions & 0 deletions drivers/qemu/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"net"
"os"
"os/exec"
"path/filepath"
"regexp"
Expand Down Expand Up @@ -304,9 +305,19 @@ func (d *Driver) RecoverTask(handle *drivers.TaskHandle) error {
return fmt.Errorf("failed to reattach to executor: %v", err)
}

// Try to restore monitor socket path.
taskDir := filepath.Join(handle.Config.AllocDir, handle.Config.Name)
monitorPath := filepath.Join(taskDir, qemuMonitorSocketName)
if _, err := os.Stat(monitorPath); err == nil {
d.logger.Debug("found existing monitor socket", "monitor", monitorPath)
} else {
monitorPath = ""
}

h := &taskHandle{
exec: execImpl,
pid: taskState.Pid,
monitorPath: monitorPath,
pluginClient: pluginClient,
taskConfig: taskState.TaskConfig,
procState: drivers.TaskStateRunning,
Expand Down

0 comments on commit 258fab1

Please sign in to comment.