@@ -16,6 +16,7 @@ type ZfsDriver struct {
16
16
17
17
func NewZfsDriver (ds string , mp string ) (* ZfsDriver , error ) {
18
18
log .SetLevel (log .DebugLevel )
19
+ log .Debug ("Creating new ZfsDriver." )
19
20
20
21
props := make (map [string ]string )
21
22
props ["mountpoint" ] = mp
@@ -34,6 +35,7 @@ func NewZfsDriver(ds string, mp string) (*ZfsDriver, error) {
34
35
}
35
36
36
37
func (zd * ZfsDriver ) Create (req volume.Request ) volume.Response {
38
+ log .WithField ("Request" , req ).Debug ("Create" )
37
39
dsName := zd .rds .Name + "/" + req .Name
38
40
39
41
if zfs .DatasetExists (dsName ) {
@@ -49,11 +51,10 @@ func (zd *ZfsDriver) Create(req volume.Request) volume.Response {
49
51
}
50
52
51
53
func (zd * ZfsDriver ) List (req volume.Request ) volume.Response {
52
- log .WithField ("Requst" , req ).Debug ("List() " )
54
+ log .WithField ("Requst" , req ).Debug ("List" )
53
55
var vols []* volume.Volume
54
56
55
57
dsl , err := zd .rds .DatasetList ()
56
- log .WithField ("DatasetList" , dsl ).Debug ("List()" )
57
58
if err != nil {
58
59
return volume.Response {Err : err .Error ()}
59
60
}
@@ -72,6 +73,7 @@ func (zd *ZfsDriver) List(req volume.Request) volume.Response {
72
73
}
73
74
74
75
func (zd * ZfsDriver ) Get (req volume.Request ) volume.Response {
76
+ log .WithField ("Request" , req ).Debug ("Get" )
75
77
dsName := zd .rds .Name + "/" + req .Name
76
78
77
79
ds , err := zfs .GetDataset (dsName )
@@ -88,6 +90,7 @@ func (zd *ZfsDriver) Get(req volume.Request) volume.Response {
88
90
}
89
91
90
92
func (zd * ZfsDriver ) Remove (req volume.Request ) volume.Response {
93
+ log .WithField ("Request" , req ).Debug ("Remove" )
91
94
dsName := zd .rds .Name + "/" + req .Name
92
95
93
96
ds , err := zfs .GetDataset (dsName )
@@ -104,24 +107,29 @@ func (zd *ZfsDriver) Remove(req volume.Request) volume.Response {
104
107
}
105
108
106
109
func (zd * ZfsDriver ) Path (req volume.Request ) volume.Response {
107
- ds := zd .Get (req )
110
+ log .WithField ("Request" , req ).Debug ("Path" )
111
+ res := zd .Get (req )
108
112
109
- if ds .Err != "" {
110
- return ds
113
+ if res .Err != "" {
114
+ return res
111
115
}
112
116
113
- return volume.Response {Mountpoint : ds .Mountpoint , Err : "" }
117
+ return volume.Response {Mountpoint : res . Volume .Mountpoint , Err : "" }
114
118
}
115
119
116
120
func (zd * ZfsDriver ) Mount (req volume.MountRequest ) volume.Response {
121
+ log .WithField ("Request" , req ).Debug ("Mount" )
122
+
117
123
return zd .Path (volume.Request {Name : req .Name })
118
124
}
119
125
120
126
func (zd * ZfsDriver ) Unmount (req volume.UnmountRequest ) volume.Response {
127
+ log .WithField ("Request" , req ).Debug ("Unmount" )
121
128
return volume.Response {Err : "" }
122
129
}
123
130
124
131
func (zd * ZfsDriver ) Capabilities (req volume.Request ) volume.Response {
132
+ log .WithField ("Request" , req ).Debug ("Capabilites" )
125
133
return volume.Response {Capabilities : volume.Capability {Scope : "local" }}
126
134
}
127
135
0 commit comments