Merge pull request #1132 from sak0/dev
allow update running/created container.
This commit is contained in:
commit
98f7591d5f
1 changed files with 7 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue