Beispiel #1
0
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
}
Beispiel #2
0
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
}