mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-16 08:26:16 +00:00
containerd-shim-kata-v2: add the service Update support
Add the Update api support to update a running process's resouce. Signed-off-by: fupan <lifupan@gmail.com>
This commit is contained in:
parent
642231ba25
commit
47326f566c
@ -6,6 +6,7 @@ package containerdshim
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"os"
|
||||
sysexec "os/exec"
|
||||
"path/filepath"
|
||||
@ -24,6 +25,7 @@ import (
|
||||
"github.com/kata-containers/runtime/pkg/katautils"
|
||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||
"github.com/kata-containers/runtime/virtcontainers/pkg/oci"
|
||||
"github.com/opencontainers/runtime-spec/specs-go"
|
||||
|
||||
"github.com/containerd/containerd/api/types/task"
|
||||
ptypes "github.com/gogo/protobuf/types"
|
||||
@ -574,7 +576,20 @@ func (s *service) Stats(ctx context.Context, r *taskAPI.StatsRequest) (*taskAPI.
|
||||
|
||||
// Update a running container
|
||||
func (s *service) Update(ctx context.Context, r *taskAPI.UpdateTaskRequest) (*ptypes.Empty, error) {
|
||||
return nil, errdefs.ErrNotImplemented
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
|
||||
var resources specs.LinuxResources
|
||||
if err := json.Unmarshal(r.Resources.Value, &resources); err != nil {
|
||||
return empty, err
|
||||
}
|
||||
|
||||
err := s.sandbox.UpdateContainer(r.ID, resources)
|
||||
if err != nil {
|
||||
return nil, errdefs.ToGRPC(err)
|
||||
}
|
||||
|
||||
return empty, nil
|
||||
}
|
||||
|
||||
// Wait for a process to exit
|
||||
|
Loading…
Reference in New Issue
Block a user