func getTenants(cfg interface{}) (map[string]string, error) {
	items, err := config.GetConfigItems(cfg, "endpoint", "user", "password")
	if err != nil {
		return nil, err
	}

	endpoint := items["endpoint"].(string)
	user := items["user"].(string)
	password := items["password"].(string)

	// retrieve list of all available tenants for provided endpoint, user and password
	cmn := openstackintel.Common{}
	allTenants, err := cmn.GetTenants(endpoint, user, password)
	if err != nil {
		return nil, err
	}

	return allTenants, nil
}
// Dispatch redirects to selected Cinder API version based on priority
func Dispatch(provider *gophercloud.ProviderClient) Service {
	cmn := openstackintel.Common{}
	versions, err := cmn.GetApiVersions(provider)
	if err != nil {
		panic(err)
	}

	chosen, err := openstackintel.ChooseVersion(versions)
	if err != nil {
		panic(err)
	}

	service := Service{}
	switch chosen {
	case "v1.0":
		service.Set(cinderv1.ServiceV1{})
	case "v2.0":
		service.Set(cinderv2.ServiceV2{})
	default:
		panic("Could not select dispatcher")
	}

	return service
}