clh: add 'APIsocket' to persist HypervisorState

The 'apiSocket' member in the CloudHypervisorState struct needs to be kept
across different executions of kata-runtime with persist HypervisorState, so
that kata-runtime can talk with the same running cloud-hypervisor through
HTTP/REST API calls.

Fixes: #2506

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen 2020-03-03 16:13:01 -08:00
parent 83eef430bd
commit 63c7ac5bbe
2 changed files with 5 additions and 0 deletions

View File

@ -435,12 +435,14 @@ func (clh *cloudHypervisor) save() (s persistapi.HypervisorState) {
s.Pid = clh.state.PID
s.Type = string(ClhHypervisor)
s.VirtiofsdPid = clh.state.VirtiofsdPID
s.APISocket = clh.state.apiSocket
return
}
func (clh *cloudHypervisor) load(s persistapi.HypervisorState) {
clh.state.PID = s.Pid
clh.state.VirtiofsdPID = s.VirtiofsdPid
clh.state.apiSocket = s.APISocket
}
func (clh *cloudHypervisor) check() error {

View File

@ -42,4 +42,7 @@ type HypervisorState struct {
VirtiofsdPid int
HotplugVFIOOnRootBus bool
PCIeRootPort int
// clh sepcific: refer to 'virtcontainers/clh.go:CloudHypervisorState'
APISocket string
}