forked from nbryant42/rexray
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mod_csi_fake_docker.go
77 lines (65 loc) · 1.73 KB
/
mod_csi_fake_docker.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package csi
import (
"github.com/codedellemc/gocsi/csi"
dvol "github.com/docker/go-plugins-helpers/volume"
apitypes "github.com/codedellemc/rexray/libstorage/api/types"
)
var csiVersion = &csi.Version{
Major: 0,
Minor: 0,
Patch: 0,
}
type dockerVolDriver struct {
ctx apitypes.Context
cs *csiService
}
func (d *dockerVolDriver) Create(
*dvol.CreateRequest) error {
return nil
}
func (d *dockerVolDriver) List() (*dvol.ListResponse, error) {
/*d.ctx.Info("docker->csi: listing volumes")
res, err := d.cs.ListVolumes(
d.ctx, &csi.ListVolumesRequest{Version: csiVersion})
if err != nil {
d.ctx.WithError(err).Error("docker->csi: failed to list vols")
return nil, err
}
if err := gocsi.CheckResponseErrListVolumes(
d.ctx, "/csi.Controller/ListVolumes", res); err != nil {
d.ctx.WithError(err).Error("docker->csi: failed to list vols")
return nil, err
}
dres := &dvol.ListResponse{}
dres.Volumes = make([]*dvol.Volume, len(res.GetResult().Entries))
for i, vi := range res.GetResult().Entries {
v := &dvol.Volume{
Name: fmt.Sprintf("%v", vi.VolumeInfo.Id),
}
dres.Volumes[i] = v
d.ctx.WithField("volume", v).Info("docker->csi: found volume")
}
return dres, nil*/
return nil, nil
}
func (d *dockerVolDriver) Get(
*dvol.GetRequest) (*dvol.GetResponse, error) {
return nil, nil
}
func (d *dockerVolDriver) Remove(*dvol.RemoveRequest) error {
return nil
}
func (d *dockerVolDriver) Path(
*dvol.PathRequest) (*dvol.PathResponse, error) {
return nil, nil
}
func (d *dockerVolDriver) Mount(
*dvol.MountRequest) (*dvol.MountResponse, error) {
return nil, nil
}
func (d *dockerVolDriver) Unmount(*dvol.UnmountRequest) error {
return nil
}
func (d *dockerVolDriver) Capabilities() *dvol.CapabilitiesResponse {
return nil
}