Skip to content

Commit

Permalink
Add VFIO client stub
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Popov <vladimir.popov@xored.com>
  • Loading branch information
Vladimir Popov committed Sep 16, 2020
1 parent 212b470 commit 5a46690
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/networkservice/mechanisms/vfio/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build !windows

// Package vfio provides VFIO client chain element
package vfio

Expand Down
2 changes: 2 additions & 0 deletions pkg/networkservice/mechanisms/vfio/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// +build !windows

package vfio_test

import (
Expand Down
42 changes: 42 additions & 0 deletions pkg/networkservice/mechanisms/vfio/client_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) 2020 Doc.ai and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Package vfio provides VFIO client chain element
package vfio

import (
"github.com/golang/protobuf/ptypes/empty"
"github.com/pkg/errors"
"google.golang.org/grpc"

"github.com/networkservicemesh/api/pkg/api/networkservice"
"github.com/networkservicemesh/sdk/pkg/networkservice/core/next"
)

type vfioClient struct{}

// NewClient - returns a new VFIO client chain element
func NewClient(_ context.Context, _ string) networkservice.NetworkServiceClient {
return &vfioClient{}
}

func (c *vfioClient) Request(_ context.Context, _ *networkservice.NetworkServiceRequest, _ ...grpc.CallOption) (*networkservice.Connection, error) {
return nil, errors.New("VFIO is not supported for Windows")
}

func (c *vfioClient) Close(ctx context.Context, conn *networkservice.Connection, opts ...grpc.CallOption) (*empty.Empty, error) {
return next.Client(ctx).Close(ctx, conn, opts...)
}

0 comments on commit 5a46690

Please sign in to comment.