Skip to content

Commit be08561

Browse files
committed
Respond with Mountpoint in Get
Otherwise docker seems to mount a volume twice on container start.
1 parent 19a468e commit be08561

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

plugin.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ func (d plugin) Create(r *volume.CreateRequest) error {
114114

115115
func (d plugin) Get(r *volume.GetRequest) (*volume.GetResponse, error) {
116116
logger := log.WithFields(log.Fields{"name": r.Name, "action": "get"})
117+
logger.Debug("Volume details requested")
118+
117119
vol, err := d.getByName(r.Name)
118120

119121
if err != nil {
@@ -123,8 +125,9 @@ func (d plugin) Get(r *volume.GetRequest) (*volume.GetResponse, error) {
123125

124126
response := &volume.GetResponse{
125127
Volume: &volume.Volume{
126-
Name: r.Name,
127-
CreatedAt: vol.CreatedAt.Format(time.RFC3339),
128+
Name: r.Name,
129+
CreatedAt: vol.CreatedAt.Format(time.RFC3339),
130+
Mountpoint: filepath.Join(d.config.MountDir, r.Name),
128131
},
129132
}
130133

@@ -133,6 +136,8 @@ func (d plugin) Get(r *volume.GetRequest) (*volume.GetResponse, error) {
133136

134137
func (d plugin) List() (*volume.ListResponse, error) {
135138
logger := log.WithFields(log.Fields{"action": "list"})
139+
logger.Debug("Volume listing requested")
140+
136141
var vols []*volume.Volume
137142

138143
pager := volumes.List(d.blockClient, volumes.ListOpts{})
@@ -252,9 +257,13 @@ func (d plugin) Mount(r *volume.MountRequest) (*volume.MountResponse, error) {
252257
}
253258

254259
func (d plugin) Path(r *volume.PathRequest) (*volume.PathResponse, error) {
260+
logger := log.WithFields(log.Fields{"name": r.Name, "action": "path"})
261+
logger.Debug("Volume path requested")
262+
255263
resp := volume.PathResponse{
256264
Mountpoint: filepath.Join(d.config.MountDir, r.Name),
257265
}
266+
258267
return &resp, nil
259268
}
260269

0 commit comments

Comments
 (0)