Skip to content

Commit d6b73a0

Browse files
committed
fix device plugin
1 parent 69cd0b9 commit d6b73a0

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

server.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
)
1717

1818
const (
19-
resourceName = "github.com/gdatasoftwareag/fuse-device-plugin"
19+
resourceName = "github.com/fuse"
2020
serverSock = pluginapi.DevicePluginPath + "fuse.sock"
2121
)
2222

@@ -32,8 +32,7 @@ type FuseDevicePlugin struct {
3232
}
3333

3434
func (m *FuseDevicePlugin) GetPreferredAllocation(_ context.Context, _ *pluginapi.PreferredAllocationRequest) (*pluginapi.PreferredAllocationResponse, error) {
35-
//TODO implement me
36-
panic("implement me")
35+
return nil, nil
3736
}
3837

3938
func NewFuseDevicePlugin(number int) *FuseDevicePlugin {
@@ -59,7 +58,13 @@ func dial(unixSocketPath string, timeout time.Duration) (*grpc.ClientConn, error
5958
ctx, _ := context.WithTimeout(context.Background(), timeout)
6059
c, err := grpc.DialContext(ctx, unixSocketPath,
6160
grpc.WithTransportCredentials(insecure.NewCredentials()),
62-
grpc.WithBlock())
61+
grpc.WithBlock(),
62+
grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) {
63+
if deadline, ok := ctx.Deadline(); ok {
64+
return net.DialTimeout("unix", addr, time.Until(deadline))
65+
}
66+
return net.Dial("unix", addr)
67+
}))
6368

6469
if err != nil {
6570
return nil, err

0 commit comments

Comments
 (0)