Merge pull request #1132 from sak0/dev

allow update running/created container.
This commit is contained in:
Antonio Murdaca 2017-11-12 01:51:04 +01:00 committed by GitHub
commit 98f7591d5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,9 +1,11 @@
package server
import (
"fmt"
"time"
"github.com/gogo/protobuf/proto"
"github.com/kubernetes-incubator/cri-o/oci"
rspec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/sirupsen/logrus"
"golang.org/x/net/context"
@ -23,6 +25,11 @@ func (s *Server) UpdateContainerResources(ctx context.Context, req *pb.UpdateCon
if err != nil {
return nil, err
}
state := s.Runtime().ContainerStatus(c)
if !(state.Status == oci.ContainerStateRunning || state.Status == oci.ContainerStateCreated) {
return nil, fmt.Errorf("container %s is not running or created state: %s", c.ID(), state.Status)
}
resources := toOCIResources(req.GetLinux())
if err := s.Runtime().UpdateContainer(c, resources); err != nil {
return nil, err