mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-13 04:49:36 +00:00
agent: add cgroup v2 support
This PR add basic cgroup v2 support for agent. Fixes: #146, #357 Signed-off-by: bin liu <bin@hyper.sh>
This commit is contained in:
@@ -146,7 +146,7 @@ func watchOOMEvents(ctx context.Context, s *service) {
|
||||
// If the GetOOMEvent call is not implemented, then the agent is most likely an older version,
|
||||
// stop attempting to get OOM events.
|
||||
// for rust agent, the response code is not found
|
||||
if isGRPCErrorCode(codes.NotFound, err) {
|
||||
if isGRPCErrorCode(codes.NotFound, err) || err.Error() == "Dead agent" {
|
||||
return
|
||||
}
|
||||
continue
|
||||
|
@@ -1203,10 +1203,10 @@ func (s *Sandbox) CreateContainer(contConfig ContainerConfig) (VCContainer, erro
|
||||
// Rollback if error happens.
|
||||
if err != nil {
|
||||
logger := s.Logger().WithFields(logrus.Fields{"container-id": c.id, "sandox-id": s.id, "rollback": true})
|
||||
logger.Warning("Cleaning up partially created container")
|
||||
logger.WithError(err).Error("Cleaning up partially created container")
|
||||
|
||||
if err2 := c.stop(true); err2 != nil {
|
||||
logger.WithError(err2).Warning("Could not delete container")
|
||||
logger.WithError(err2).Error("Could not delete container")
|
||||
}
|
||||
|
||||
logger.Debug("Removing stopped container from sandbox store")
|
||||
@@ -1894,9 +1894,11 @@ func (s *Sandbox) updateResources() error {
|
||||
return err
|
||||
}
|
||||
|
||||
s.Logger().Debugf("Request to hypervisor to update oldCPUs/newCPUs: %d/%d", oldCPUs, newCPUs)
|
||||
// If the CPUs were increased, ask agent to online them
|
||||
if oldCPUs < newCPUs {
|
||||
vcpusAdded := newCPUs - oldCPUs
|
||||
s.Logger().Debugf("Request to onlineCPUMem with %d CPUs", vcpusAdded)
|
||||
if err := s.agent.onlineCPUMem(vcpusAdded, true); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user