未验证 提交 f7b3c877 编写于 作者: S stormgbs 提交者: GitHub

Merge pull request #155 from hustliyilin/master

shim/runtime: Store inclavare-containers configuration
...@@ -93,6 +93,7 @@ func New(ctx context.Context, id string, publisher shim.Publisher, shutdown func ...@@ -93,6 +93,7 @@ func New(ctx context.Context, id string, publisher shim.Publisher, shutdown func
ep: ep, ep: ep,
cancel: shutdown, cancel: shutdown,
containers: make(map[string]*runc.Container), containers: make(map[string]*runc.Container),
config: make(map[string]*containerConfiguration),
} }
go s.processExits() go s.processExits()
runcC.Monitor = reaper.Default runcC.Monitor = reaper.Default
...@@ -104,6 +105,11 @@ func New(ctx context.Context, id string, publisher shim.Publisher, shutdown func ...@@ -104,6 +105,11 @@ func New(ctx context.Context, id string, publisher shim.Publisher, shutdown func
return s, nil return s, nil
} }
type containerConfiguration struct {
binary string
root string
}
// service is the shim implementation of a remote shim over GRPC // service is the shim implementation of a remote shim over GRPC
type service struct { type service struct {
mu sync.Mutex mu sync.Mutex
...@@ -119,6 +125,7 @@ type service struct { ...@@ -119,6 +125,7 @@ type service struct {
id string id string
containers map[string]*runc.Container containers map[string]*runc.Container
config map[string]*containerConfiguration
cancel func() cancel func()
} }
...@@ -360,21 +367,31 @@ func (s *service) Create(ctx context.Context, r *taskAPI.CreateTaskRequest) (_ * ...@@ -360,21 +367,31 @@ func (s *service) Create(ctx context.Context, r *taskAPI.CreateTaskRequest) (_ *
v, err := typeurl.UnmarshalAny(r.Options) v, err := typeurl.UnmarshalAny(r.Options)
if err != nil { if err != nil {
logrus.Errorf("Get rune options error: %v", err) logrus.Errorf("Get rune options error: %v", err)
}
if err != nil {
return nil, err return nil, err
} }
opts = *v.(*options.Options) opts = *v.(*options.Options)
} }
//result := make(chan bool, 1) ns, err := namespaces.NamespaceRequired(ctx)
// start remote attestation if err != nil {
if opts.BinaryName == constants.RuneOCIRuntime { return nil, err
logrus.Infof("Attestation Start") }
//go attestation.Attestation_main(ctx, result)
var runeRootGlobalOption string = process.RuncRoot
if opts.Root != "" {
runeRootGlobalOption = opts.Root
} }
runeRootGlobalOption = filepath.Join(runeRootGlobalOption, ns)
config := &containerConfiguration{
binary: opts.BinaryName,
root: runeRootGlobalOption,
}
s.containers[r.ID] = container s.containers[r.ID] = container
s.config[r.ID] = config
logrus.Infof("s.config[%v] = %v", r.ID, s.config[r.ID])
s.send(&eventstypes.TaskCreate{ s.send(&eventstypes.TaskCreate{
ContainerID: r.ID, ContainerID: r.ID,
Bundle: r.Bundle, Bundle: r.Bundle,
...@@ -391,15 +408,6 @@ func (s *service) Create(ctx context.Context, r *taskAPI.CreateTaskRequest) (_ * ...@@ -391,15 +408,6 @@ func (s *service) Create(ctx context.Context, r *taskAPI.CreateTaskRequest) (_ *
logrus.Infof("TaskCreate sent: %s %d", r.ID, container.Pid()) logrus.Infof("TaskCreate sent: %s %d", r.ID, container.Pid())
if opts.BinaryName == constants.RuneOCIRuntime {
//// judge remote attestation result
//switch <-result {
//case true:
// log.G(ctx).Infof("Attestation Success!")
//case false:
// log.G(ctx).Infof("Attestation Failed!")
//}
}
logrus.Debugf("Create: total time cost: %d", (time.Now().Sub(timeStart))/time.Second) logrus.Debugf("Create: total time cost: %d", (time.Now().Sub(timeStart))/time.Second)
logrus.Debugf("Create: total time cost: %d", (time.Now().Sub(ts))/time.Second) logrus.Debugf("Create: total time cost: %d", (time.Now().Sub(ts))/time.Second)
return &taskAPI.CreateTaskResponse{ return &taskAPI.CreateTaskResponse{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册