예제 #1
0
func (d SolidFireDriver) List(r volume.Request) volume.Response {
	log.Info("Get volume: ", r.Name)
	path := filepath.Join(d.MountPoint, r.Name)
	var vols []*volume.Volume
	var req sfapi.ListVolumesForAccountRequest
	req.AccountID = d.TenantID
	vlist, err := d.Client.ListVolumesForAccount(&req)
	if err != nil {
		log.Error("Failed to retrieve volume list:", err)
		return volume.Response{Err: err.Error()}
	}

	for _, v := range vlist {
		if v.Status == "active" && v.AccountID == d.TenantID {
			vols = append(vols, &volume.Volume{Name: v.Name, Mountpoint: path})
		}
	}
	return volume.Response{Volumes: vols}
}
예제 #2
0
func listForAccount(acctID int64) (vols []sfapi.Volume, err error) {
	var req sfapi.ListVolumesForAccountRequest
	req.AccountID = acctID
	return client.ListVolumesForAccount(&req)
}