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
@ -591,8 +591,8 @@ func statusContainer(sandbox *Sandbox, containerID string) (ContainerStatus, err
|
|||||||
|
|
||||||
if !running {
|
if !running {
|
||||||
virtLog.WithFields(logrus.Fields{
|
virtLog.WithFields(logrus.Fields{
|
||||||
"state": container.state.State,
|
"state": container.state.State,
|
||||||
"process pid": container.process.Pid}).
|
"pid": container.process.Pid}).
|
||||||
Info("container isn't running")
|
Info("container isn't running")
|
||||||
if err := container.stop(); err != nil {
|
if err := container.stop(); err != nil {
|
||||||
return ContainerStatus{}, err
|
return ContainerStatus{}, err
|
||||||
|
@ -237,34 +237,28 @@ func (dm *deviceManager) LoadDevices(devStates []persistapi.DeviceState) {
|
|||||||
defer dm.Unlock()
|
defer dm.Unlock()
|
||||||
|
|
||||||
for _, ds := range devStates {
|
for _, ds := range devStates {
|
||||||
|
var dev api.Device
|
||||||
|
|
||||||
switch config.DeviceType(ds.Type) {
|
switch config.DeviceType(ds.Type) {
|
||||||
case config.DeviceGeneric:
|
case config.DeviceGeneric:
|
||||||
dev := &drivers.GenericDevice{}
|
dev = &drivers.GenericDevice{}
|
||||||
dev.Load(ds)
|
|
||||||
dm.devices[dev.DeviceID()] = dev
|
|
||||||
case config.DeviceBlock:
|
case config.DeviceBlock:
|
||||||
dev := &drivers.BlockDevice{}
|
dev = &drivers.BlockDevice{}
|
||||||
dev.Load(ds)
|
|
||||||
dm.devices[dev.DeviceID()] = dev
|
|
||||||
case config.DeviceVFIO:
|
case config.DeviceVFIO:
|
||||||
dev := &drivers.VFIODevice{}
|
dev = &drivers.VFIODevice{}
|
||||||
dev.Load(ds)
|
|
||||||
dm.devices[dev.DeviceID()] = dev
|
|
||||||
case config.VhostUserSCSI:
|
case config.VhostUserSCSI:
|
||||||
dev := &drivers.VhostUserSCSIDevice{}
|
dev = &drivers.VhostUserSCSIDevice{}
|
||||||
dev.Load(ds)
|
|
||||||
dm.devices[dev.DeviceID()] = dev
|
|
||||||
case config.VhostUserBlk:
|
case config.VhostUserBlk:
|
||||||
dev := &drivers.VhostUserBlkDevice{}
|
dev = &drivers.VhostUserBlkDevice{}
|
||||||
dev.Load(ds)
|
|
||||||
dm.devices[dev.DeviceID()] = dev
|
|
||||||
case config.VhostUserNet:
|
case config.VhostUserNet:
|
||||||
dev := &drivers.VhostUserNetDevice{}
|
dev = &drivers.VhostUserNetDevice{}
|
||||||
dev.Load(ds)
|
|
||||||
dm.devices[dev.DeviceID()] = dev
|
|
||||||
default:
|
default:
|
||||||
deviceLogger().WithField("device-type", ds.Type).Warning("unrecognized device type is detected")
|
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) {
|
func (s *Sandbox) dumpState(ss *persistapi.SandboxState, cs map[string]persistapi.ContainerState) {
|
||||||
ss.SandboxContainer = s.id
|
ss.SandboxContainer = s.id
|
||||||
ss.GuestMemoryBlockSizeMB = s.state.GuestMemoryBlockSizeMB
|
ss.GuestMemoryBlockSizeMB = s.state.GuestMemoryBlockSizeMB
|
||||||
|
ss.GuestMemoryHotplugProbe = s.state.GuestMemoryHotplugProbe
|
||||||
ss.State = string(s.state.State)
|
ss.State = string(s.state.State)
|
||||||
ss.CgroupPath = s.state.CgroupPath
|
ss.CgroupPath = s.state.CgroupPath
|
||||||
|
|
||||||
@ -122,6 +123,7 @@ func (s *Sandbox) loadState(ss persistapi.SandboxState) {
|
|||||||
s.state.BlockIndex = ss.HypervisorState.BlockIndex
|
s.state.BlockIndex = ss.HypervisorState.BlockIndex
|
||||||
s.state.State = types.StateString(ss.State)
|
s.state.State = types.StateString(ss.State)
|
||||||
s.state.CgroupPath = ss.CgroupPath
|
s.state.CgroupPath = ss.CgroupPath
|
||||||
|
s.state.GuestMemoryHotplugProbe = ss.GuestMemoryHotplugProbe
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Sandbox) loadDevices(devStates []persistapi.DeviceState) {
|
func (s *Sandbox) loadDevices(devStates []persistapi.DeviceState) {
|
||||||
|
Loading…
Reference in New Issue
Block a user