cache-factory: fix nil pointer runtime panic

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>
This commit is contained in:
Penny Zheng 2019-11-25 23:39:18 -08:00 committed by Bin Lu
parent 552e9407b8
commit 3d8ffe4120
5 changed files with 6 additions and 6 deletions

View File

@ -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) {

View File

@ -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

View File

@ -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 {

View File

@ -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
}

View File

@ -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 {