Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions pkg/interceptors/dpuproxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ var defaultForwardableMethods = []ForwardableMethod{
Description: "Install package on DPU",
Mode: ForwardToDPU,
},
{
FullMethod: "/gnoi.system.System/RebootStatus",
Description: "Check reboot status on DPU",
Mode: ForwardToDPU,
},
// gRPC reflection methods needed for grpcurl to work with DPU headers
{
FullMethod: "/grpc.reflection.v1.ServerReflection/ServerReflectionInfo",
Expand Down Expand Up @@ -251,6 +256,27 @@ func (p *DPUProxy) forwardTimeRequest(ctx context.Context, conn *grpc.ClientConn
return resp, nil
}

// forwardRebootStatusRequest forwards a gNOI System.RebootStatus request to the DPU.
func (p *DPUProxy) forwardRebootStatusRequest(ctx context.Context, conn *grpc.ClientConn, req interface{}) (interface{}, error) {
rebootStatusReq, ok := req.(*system.RebootStatusRequest)
if !ok {
glog.Errorf("[DPUProxy] Invalid request type for System.RebootStatus method: %T", req)
return nil, status.Errorf(codes.Internal,
"invalid request type for System.RebootStatus: expected *system.RebootStatusRequest, got %T", req)
}

client := system.NewSystemClient(conn)
resp, err := client.RebootStatus(ctx, rebootStatusReq)
if err != nil {
glog.Errorf("[DPUProxy] Error forwarding System.RebootStatus request to DPU: %v", err)
return nil, err
}

glog.Infof("[DPUProxy] Successfully forwarded System.RebootStatus to DPU, active=%v, wait=%v",
resp.GetActive(), resp.GetWait())
return resp, nil
}

// forwardStream forwards a streaming RPC to the DPU.
// This implements bidirectional streaming proxy between client and DPU.
func (p *DPUProxy) forwardStream(ctx context.Context, conn *grpc.ClientConn, ss grpc.ServerStream, info *grpc.StreamServerInfo) error {
Expand Down Expand Up @@ -477,6 +503,8 @@ func (p *DPUProxy) UnaryInterceptor() grpc.UnaryServerInterceptor {
switch info.FullMethod {
case "/gnoi.system.System/Time":
return p.forwardTimeRequest(ctx, conn, req)
case "/gnoi.system.System/RebootStatus":
return p.forwardRebootStatusRequest(ctx, conn, req)
default:
// This shouldn't happen due to getForwardingMode check, but handle gracefully
glog.Errorf("[DPUProxy] Unknown forwardable method: %s", info.FullMethod)
Expand Down
Loading