Exemple #1
0
func getLunMaps(initiatorName, volumeID string) ([]*xmsv3.Ref, error) {
	if initiatorName == "" {
		return nil, errors.New("Missing initiatorName")
	}

	initiatorGroup, err := goxtremio.GetInitiatorGroup("", initiatorName)
	if err != nil {
		return nil, err
	}

	lunMaps, err := goxtremio.GetLunMaps()
	if err != nil {
		return nil, err
	}

	var refs []*xmsv3.Ref
	for _, ref := range lunMaps {

		idents := strings.Split(ref.Name, "_")
		if len(idents) < 3 {
			continue
		} else if strconv.Itoa(initiatorGroup.Index) == idents[1] && volumeID == idents[0] {
			refs = append(refs, ref)
		}
	}

	return refs, nil
}
Exemple #2
0
func (driver *Driver) getLunMapsSig() (string, error) {
	lunMap, err := goxtremio.GetLunMaps()
	if err != nil {
		return "", err
	}

	var lunMapsNameHref sort.StringSlice
	for _, lunMap := range lunMap {
		lunMapsNameHref = append(lunMapsNameHref, fmt.Sprintf("%s-%s", lunMap.Name, lunMap.Href))
	}
	lunMapsNameHref.Sort()
	return strings.Join(lunMapsNameHref, ";"), err
}