From 0d36d4923228351025d6b3b3ee0991130c323e2d Mon Sep 17 00:00:00 2001 From: Christophe Fergeau Date: Thu, 1 Aug 2024 10:56:00 +0300 Subject: [PATCH] workaround(?) crash on GetState Needs a closer look, was crashing because we were calling into podman which expects a non-nil vmconfig. Haven't looked if the problem was with the serialization/deserialization of the machine driver, or if it's expected to have a nil vmconfig in certain situations. --- pkg/machinedriver/driver.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/machinedriver/driver.go b/pkg/machinedriver/driver.go index 81d8b802..9d58ce30 100644 --- a/pkg/machinedriver/driver.go +++ b/pkg/machinedriver/driver.go @@ -427,6 +427,9 @@ func podmanStatusToCrcState(status define.Status) state.State { // GetState returns the state that the host is in (running, stopped, etc) func (d *Driver) GetState() (state.State, error) { + if d.vmConfig == nil { + return state.Stopped, nil + } status, err := d.vmProvider.State(d.vmConfig, false) if err != nil { return state.Error, err