mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-15 06:34:03 +00:00
persist: save/load GuestMemoryHotplugProbe
Support saving/loading `GuestMemoryHotplugProbe` from sandbox state. Signed-off-by: Wei Zhang <zhangwei555@huawei.com>
This commit is contained in:
parent
4c192139cf
commit
297097779e
@ -592,7 +592,7 @@ func statusContainer(sandbox *Sandbox, containerID string) (ContainerStatus, err
|
||||
if !running {
|
||||
virtLog.WithFields(logrus.Fields{
|
||||
"state": container.state.State,
|
||||
"process pid": container.process.Pid}).
|
||||
"pid": container.process.Pid}).
|
||||
Info("container isn't running")
|
||||
if err := container.stop(); err != nil {
|
||||
return ContainerStatus{}, err
|
||||
|
@ -237,34 +237,28 @@ func (dm *deviceManager) LoadDevices(devStates []persistapi.DeviceState) {
|
||||
defer dm.Unlock()
|
||||
|
||||
for _, ds := range devStates {
|
||||
var dev api.Device
|
||||
|
||||
switch config.DeviceType(ds.Type) {
|
||||
case config.DeviceGeneric:
|
||||
dev := &drivers.GenericDevice{}
|
||||
dev.Load(ds)
|
||||
dm.devices[dev.DeviceID()] = dev
|
||||
dev = &drivers.GenericDevice{}
|
||||
case config.DeviceBlock:
|
||||
dev := &drivers.BlockDevice{}
|
||||
dev.Load(ds)
|
||||
dm.devices[dev.DeviceID()] = dev
|
||||
dev = &drivers.BlockDevice{}
|
||||
case config.DeviceVFIO:
|
||||
dev := &drivers.VFIODevice{}
|
||||
dev.Load(ds)
|
||||
dm.devices[dev.DeviceID()] = dev
|
||||
dev = &drivers.VFIODevice{}
|
||||
case config.VhostUserSCSI:
|
||||
dev := &drivers.VhostUserSCSIDevice{}
|
||||
dev.Load(ds)
|
||||
dm.devices[dev.DeviceID()] = dev
|
||||
dev = &drivers.VhostUserSCSIDevice{}
|
||||
case config.VhostUserBlk:
|
||||
dev := &drivers.VhostUserBlkDevice{}
|
||||
dev.Load(ds)
|
||||
dm.devices[dev.DeviceID()] = dev
|
||||
dev = &drivers.VhostUserBlkDevice{}
|
||||
case config.VhostUserNet:
|
||||
dev := &drivers.VhostUserNetDevice{}
|
||||
dev.Load(ds)
|
||||
dm.devices[dev.DeviceID()] = dev
|
||||
dev = &drivers.VhostUserNetDevice{}
|
||||
default:
|
||||
deviceLogger().WithField("device-type", ds.Type).Warning("unrecognized device type is detected")
|
||||
// continue the for loop
|
||||
continue
|
||||
}
|
||||
|
||||
dev.Load(ds)
|
||||
dm.devices[dev.DeviceID()] = dev
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ func (s *Sandbox) dumpVersion(ss *persistapi.SandboxState) {
|
||||
func (s *Sandbox) dumpState(ss *persistapi.SandboxState, cs map[string]persistapi.ContainerState) {
|
||||
ss.SandboxContainer = s.id
|
||||
ss.GuestMemoryBlockSizeMB = s.state.GuestMemoryBlockSizeMB
|
||||
ss.GuestMemoryHotplugProbe = s.state.GuestMemoryHotplugProbe
|
||||
ss.State = string(s.state.State)
|
||||
ss.CgroupPath = s.state.CgroupPath
|
||||
|
||||
@ -122,6 +123,7 @@ func (s *Sandbox) loadState(ss persistapi.SandboxState) {
|
||||
s.state.BlockIndex = ss.HypervisorState.BlockIndex
|
||||
s.state.State = types.StateString(ss.State)
|
||||
s.state.CgroupPath = ss.CgroupPath
|
||||
s.state.GuestMemoryHotplugProbe = ss.GuestMemoryHotplugProbe
|
||||
}
|
||||
|
||||
func (s *Sandbox) loadDevices(devStates []persistapi.DeviceState) {
|
||||
|
Loading…
Reference in New Issue
Block a user