func (d *shimDriver) Create(req volumeplugin.Request) volumeplugin.Response { var res volumeplugin.Response _, err := d.d.Create(req.Name, req.Options) if err != nil { res.Err = err.Error() } return res }
func (d *shimDriver) Path(req volumeplugin.Request) volumeplugin.Response { var res volumeplugin.Response v, err := d.d.Get(req.Name) if err != nil { res.Err = err.Error() return res } res.Mountpoint = v.Path() return res }
func (d *shimDriver) Remove(req volumeplugin.Request) volumeplugin.Response { var res volumeplugin.Response v, err := d.d.Get(req.Name) if err != nil { res.Err = err.Error() return res } if err := d.d.Remove(v); err != nil { res.Err = err.Error() } return res }
func (d *shimDriver) Unmount(req volumeplugin.UnmountRequest) volumeplugin.Response { var res volumeplugin.Response v, err := d.d.Get(req.Name) if err != nil { res.Err = err.Error() return res } if err := v.Unmount(req.ID); err != nil { res.Err = err.Error() } return res }
func (d *shimDriver) Get(req volumeplugin.Request) volumeplugin.Response { var res volumeplugin.Response v, err := d.d.Get(req.Name) if err != nil { res.Err = err.Error() return res } res.Volume = &volumeplugin.Volume{ Name: v.Name(), Mountpoint: v.Path(), } return res }
func (d *shimDriver) Mount(req volumeplugin.MountRequest) volumeplugin.Response { var res volumeplugin.Response v, err := d.d.Get(req.Name) if err != nil { res.Err = err.Error() return res } pth, err := v.Mount(req.ID) if err != nil { res.Err = err.Error() } res.Mountpoint = pth return res }
func (d *kvfsDriver) Get(req volume.Request) volume.Response { var res volume.Response d.Lock() defer d.Unlock() v, exists := d.volumes[req.Name] if !exists { return resp(fmt.Errorf("no such volume")) } res.Volume = &volume.Volume{ Name: v.name, Mountpoint: v.mountPoint, } return res }
func (l *lvmDriver) Get(req volume.Request) volume.Response { l.mu.RLock() defer l.mu.RUnlock() v, exists := l.volumes[req.Name] if !exists { return resp(fmt.Errorf("no such volume")) } var res volume.Response res.Volume = &volume.Volume{ Name: v.Name, Mountpoint: v.MountPoint, } return res }
func (d *kvfsDriver) List(req volume.Request) volume.Response { var res volume.Response d.Lock() defer d.Unlock() var ls = make([]*volume.Volume, len(d.volumes)) for _, vol := range d.volumes { v := &volume.Volume{ Name: vol.name, Mountpoint: vol.mountPoint, } ls = append(ls, v) } res.Volumes = ls return res }
func (d *shimDriver) List(req volumeplugin.Request) volumeplugin.Response { var res volumeplugin.Response ls, err := d.d.List() if err != nil { res.Err = err.Error() return res } vols := make([]*volumeplugin.Volume, len(ls)) for _, v := range ls { vol := &volumeplugin.Volume{ Name: v.Name(), Mountpoint: v.Path(), } vols = append(vols, vol) } res.Volumes = vols return res }
func (d *shimDriver) Capabilities(req volumeplugin.Request) volumeplugin.Response { var res volumeplugin.Response res.Capabilities = volumeplugin.Capability{Scope: d.d.Scope()} return res }