// VerifySupportedSeries verifies if the given series is supported by the
// application.
324565
func (a *Application) VerifySupportedSeries(series string, force bool) error {
	ch, _, err := a.Charm()
	if err != nil {
		return err
	}
	supportedSeries := ch.Meta().Series
	if len(supportedSeries) == 0 {
		supportedSeries = append(supportedSeries, ch.URL().Series)
	}
	_, seriesSupportedErr := charm.SeriesForCharm(series, supportedSeries)
	if seriesSupportedErr != nil && !force {
		return &ErrIncompatibleSeries{
			SeriesList: supportedSeries,
			Series:     series,
			CharmName:  ch.String(),
		}
	}
	return nil
}
422561
func (volumeOptions VolumeOptions) VerifyVolumeOptions() bool {
	// Validate only if SCSIControllerType is set by user.
	// Default value is set later in virtualDiskManager.Create and vmDiskManager.Create
	if volumeOptions.SCSIControllerType != "" {
		isValid := CheckControllerSupported(volumeOptions.SCSIControllerType)
		if !isValid {
			return false
		}
	}
	// ThinDiskType is the default, so skip the validation.
	if volumeOptions.DiskFormat != ThinDiskType {
		isValid := CheckDiskFormatSupported(volumeOptions.DiskFormat)
		if !isValid {
			return false
		}
	}
	return true
}
840812
func (bbs BollingerBandsSeries) Validate() error {
	if bbs.InnerSeries == nil {
		return fmt.Errorf("bollinger bands series requires InnerSeries to be set")
	}
	return nil
}
998710
func UnsupportedMediaType(w http.ResponseWriter, response interface{}) {
	Respond(w, http.StatusUnsupportedMediaType, response)
}
870841
func (r reedSolomon) Verify(shards [][]byte) (bool, error) {
	if len(shards) != r.Shards {
		return false, ErrTooFewShards
	}
	err := checkShards(shards, false)
	if err != nil {
		return false, err
	}

	// Slice of buffers being checked.
	toCheck := shards[r.DataShards:]

	// Do the checking.
	return r.checkSomeShards(r.parity, shards[0:r.DataShards], toCheck, r.ParityShards, len(shards[0])), nil
}
84258
func xfsSupported() bool {
	// Make sure mkfs.xfs is available
	if _, err := exec.LookPath("mkfs.xfs"); err != nil {
		return false
	}

	// Check if kernel supports xfs filesystem or not.
	exec.Command("modprobe", "xfs").Run()

	f, err := os.Open("/proc/filesystems")
	if err != nil {
		logrus.Warnf("devmapper: Could not check if xfs is supported: %v", err)
		return false
	}
	defer f.Close()

	s := bufio.NewScanner(f)
	for s.Scan() {
		if strings.HasSuffix(s.Text(), "\txfs") {
			return true
		}
	}

	if err := s.Err(); err != nil {
		logrus.Warnf("devmapper: Could not check if xfs is supported: %v", err)
	}
	return false
}
391745
func (m *MockUpgradeSeriesMachine) Series() string {
	ret := m.ctrl.Call(m, "Series")
	ret0, _ := ret[0].(string)
	return ret0
}
497114
func (c *Client) UpdateApplicationSeries(appName, series string, force bool) error {
	args := params.UpdateSeriesArgs{
		Args: []params.UpdateSeriesArg{{
			Entity: params.Entity{Tag: names.NewApplicationTag(appName).String()},
			Force:  force,
			Series: series,
		}},
	}

	results := new(params.ErrorResults)
	err := c.facade.FacadeCall("UpdateApplicationSeries", args, results)
	if err != nil {
		return errors.Trace(err)
	}
	return results.OneError()
}
673787
func (t *seriesPartitionTracker) SubSeries(n uint64) {
	if !t.enabled {
		return
	}

	labels := t.Labels()
	t.metrics.Series.With(labels).Sub(float64(n))
}
923364
func (t *UniversalTranslator) VerifyTranslations() (err error) {

	for _, trans := range t.translators {
		err = trans.VerifyTranslations()
		if err != nil {
			return
		}
	}

	return
}
162259
func Verify(versionValidator VersionValidator, signedMsg []byte, keyring SigKeyring) (skey SigningPublicKey, verifiedMsg []byte, err error) {
	skey, stream, err := NewVerifyStream(versionValidator, bytes.NewReader(signedMsg), keyring)
	if err != nil {
		return nil, nil, err
	}

	verifiedMsg, err = ioutil.ReadAll(stream)
	if err != nil {
		return nil, nil, err
	}
	return skey, verifiedMsg, nil
}
492715
func NotSupported(field *Path, value interface{}, validValues []string) *Error {
	detail := ""
	if validValues != nil && len(validValues) > 0 {
		quotedValues := make([]string, len(validValues))
		for i, v := range validValues {
			quotedValues[i] = strconv.Quote(v)
		}
		detail = "supported values: " + strings.Join(quotedValues, ", ")
	}
	return &Error{ErrorTypeNotSupported, field.String(), value, detail}
}
858863
func (m *Machine) setUpgradeSeriesInstanceStatus(usStatus model.UpgradeSeriesStatus) error {
	msg := "Running"
	if !noInstanceMessage.Contains(string(usStatus)) {
		msg = "Series upgrade: " + string(usStatus)
	}

	sInfo := status.StatusInfo{
		Status:  status.Running,
		Message: msg,
	}
	return errors.Trace(m.SetInstanceStatus(sInfo))
}
57419
func (s *Client) FinishUpgradeSeries(hostSeries string) error {
	var results params.ErrorResults
	args := params.UpdateSeriesArgs{Args: []params.UpdateSeriesArg{{
		Entity: params.Entity{Tag: s.authTag.String()},
		Series: hostSeries,
	}}}

	err := s.facade.FacadeCall("FinishUpgradeSeries", args, &results)
	if err != nil {
		return err
	}
	if len(results.Results) != 1 {
		return errors.Errorf("expected 1 result, got %d", len(results.Results))
	}

	result := results.Results[0]
	if result.Error != nil {
		return result.Error
	}
	return nil
}
140746
func (v *validator) RegisterUnsupported(unsupported []string) {
	v.unsupported = set.NewStrings(unsupported...)
}
736310
func (m *Machine) verifyUnitUpgradeSeriesStatus(unitName string, status model.UpgradeSeriesStatus) (bool, error) {
	lock, err := m.getUpgradeSeriesLock()
	if err != nil {
		return false, err
	}
	us, ok := lock.UnitStatuses[unitName]
	if !ok {
		return false, errors.NotFoundf(unitName)
	}

	comp, err := model.CompareUpgradeSeriesStatus(us.Status, status)
	if err != nil {
		return false, err
	}
	return comp == -1, nil
}
434943
func MergeSeriesIDIterators(itrs ...SeriesIDIterator) SeriesIDIterator {
	if n := len(itrs); n == 0 {
		return nil
	} else if n == 1 {
		return itrs[0]
	}

	// Merge as series id sets, if available.
	if a := NewSeriesIDSetIterators(itrs); a != nil {
		sets := make([]*SeriesIDSet, len(a))
		for i := range a {
			sets[i] = a[i].SeriesIDSet()
		}

		ss := NewSeriesIDSet()
		ss.Merge(sets...)
		SeriesIDIterators(itrs).Close()
		return NewSeriesIDSetIterator(ss)
	}

	return &seriesIDMergeIterator{
		buf:  make([]SeriesIDElem, len(itrs)),
		itrs: itrs,
	}
}