mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-01 21:24:36 +00:00
agent: fix the issue of convert OCI spec to RPC spec
Since the rpc spec used an interface to represen the ErrnoRet, thus the transform function of OCItoGRPC should take care of this case. Depends-on: github.com/kata-containers/tests#3629 Fixes: #1441 Signed-off-by: fupan.lfp <fupan.lfp@antgroup.com>
This commit is contained in:
parent
f607641a6e
commit
d671f78952
@ -524,7 +524,8 @@
|
||||
"write",
|
||||
"writev"
|
||||
],
|
||||
"action": "SCMP_ACT_ALLOW"
|
||||
"action": "SCMP_ACT_ALLOW",
|
||||
"errnoRet": 1008
|
||||
},
|
||||
{
|
||||
"names": [
|
||||
|
@ -53,6 +53,15 @@ func copyValue(to, from reflect.Value) error {
|
||||
return copySliceValue(to, from)
|
||||
case reflect.Map:
|
||||
return copyMapValue(to, from)
|
||||
case reflect.Interface:
|
||||
if to.Type().Name() == "isLinuxSyscall_ErrnoRet" {
|
||||
dest := LinuxSyscall_Errnoret{Errnoret: uint32(from.Uint())}
|
||||
var destintf isLinuxSyscall_ErrnoRet = &dest
|
||||
toVal := reflect.ValueOf(destintf)
|
||||
to.Set(toVal)
|
||||
return nil
|
||||
}
|
||||
return grpcStatus.Errorf(codes.InvalidArgument, "Can not convert %v to %v, kind= %v", from.Type(), to.Type(), toKind)
|
||||
default:
|
||||
// We now are copying non pointers scalar.
|
||||
// This is the leaf of the recursion.
|
||||
@ -62,7 +71,7 @@ func copyValue(to, from reflect.Value) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
return grpcStatus.Errorf(codes.InvalidArgument, "Can not convert %v to %v", from.Type(), to.Type())
|
||||
return grpcStatus.Errorf(codes.InvalidArgument, "Can not convert %v to %v, kind= %v", from.Type(), to.Type(), toKind)
|
||||
}
|
||||
|
||||
to.Set(from)
|
||||
|
Loading…
Reference in New Issue
Block a user