Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
cache-factory: fix nil pointer runtime panic
Browse files Browse the repository at this point in the history
For now, when we're using cache factory to launch kata containers,
we would encounter nil pointer runtime panic.

Fixes: #2272

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
  • Loading branch information
Pennyzct authored and Bin Lu committed Nov 26, 2019
1 parent 552e940 commit 3d8ffe4
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cli/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (s *cacheServer) Quit(ctx context.Context, empty *types.Empty) (*types.Empt
time.Sleep(time.Second)
s.quit()
}()
return nil, nil
return &types.Empty{}, nil
}

func (s *cacheServer) Status(ctx context.Context, empty *types.Empty) (*pb.GrpcStatus, error) {
Expand Down
2 changes: 1 addition & 1 deletion virtcontainers/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ type agent interface {
configure(h hypervisor, id, sharePath string, builtin bool, config interface{}) error

// configureFromGrpc will update agent settings based on provided arguments which from Grpc
configureFromGrpc(id string, builtin bool, config interface{}) error
configureFromGrpc(h hypervisor, id string, builtin bool, config interface{}) error

// getVMPath will return the agent vm socket's directory path
getVMPath(id string) string
Expand Down
4 changes: 2 additions & 2 deletions virtcontainers/kata_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,8 @@ func (k *kataAgent) configure(h hypervisor, id, sharePath string, builtin bool,
return h.addDevice(sharedVolume, fsDev)
}

func (k *kataAgent) configureFromGrpc(id string, builtin bool, config interface{}) error {
return k.internalConfigure(nil, id, "", builtin, config)
func (k *kataAgent) configureFromGrpc(h hypervisor, id string, builtin bool, config interface{}) error {
return k.internalConfigure(h, id, "", builtin, config)
}

func (k *kataAgent) createSandbox(sandbox *Sandbox) error {
Expand Down
2 changes: 1 addition & 1 deletion virtcontainers/noop_agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (n *noopAgent) configure(h hypervisor, id, sharePath string, builtin bool,
return nil
}

func (n *noopAgent) configureFromGrpc(id string, builtin bool, config interface{}) error {
func (n *noopAgent) configureFromGrpc(h hypervisor, id string, builtin bool, config interface{}) error {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion virtcontainers/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func NewVMFromGrpc(ctx context.Context, v *pb.GrpcVM, config VMConfig) (*VM, err
}

agent := newAgent(config.AgentType)
agent.configureFromGrpc(v.Id, isProxyBuiltIn(config.ProxyType), config.AgentConfig)
agent.configureFromGrpc(hypervisor, v.Id, isProxyBuiltIn(config.ProxyType), config.AgentConfig)

proxy, err := newProxy(config.ProxyType)
if err != nil {
Expand Down

0 comments on commit 3d8ffe4

Please sign in to comment.