From 96ebc35ab77f45816c2ee33df61136d643409e8b Mon Sep 17 00:00:00 2001 From: Luiz Aoqui Date: Wed, 3 Aug 2022 18:42:51 -0400 Subject: [PATCH 1/2] qemu: restore monitor socket path 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. --- drivers/qemu/driver.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/qemu/driver.go b/drivers/qemu/driver.go index 23c127ee5457..b6fe6041b983 100644 --- a/drivers/qemu/driver.go +++ b/drivers/qemu/driver.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "net" + "os" "os/exec" "path/filepath" "regexp" @@ -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, From 9772b4ef10d07bed71d9ee5dd5896ffca7f851d4 Mon Sep 17 00:00:00 2001 From: Luiz Aoqui Date: Wed, 3 Aug 2022 18:45:42 -0400 Subject: [PATCH 2/2] changelog: add entry for #14000 --- .changelog/14000.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/14000.txt diff --git a/.changelog/14000.txt b/.changelog/14000.txt new file mode 100644 index 000000000000..3db5ca3b6482 --- /dev/null +++ b/.changelog/14000.txt @@ -0,0 +1,3 @@ +```release-note:bug +qemu: restore the monitor socket path when restoring a QEMU task. +```