app/app.go
func (app *App) AddUnits(n uint, process string, w io.Writer) error {
	if n == 0 {
		return errors.New("Cannot add zero units.")
	}
	units, err := app.Units()
	if err != nil {
		return err
	}
	for _, u := range units {
		if (u.Status == provision.StatusAsleep) || (u.Status == provision.StatusStopped) {
			return errors.New("Cannot add units to an app that has stopped or sleeping units")
		}
	}
	w = app.withLogWriter(w)
	err = action.NewPipeline(
		&reserveUnitsToAdd,
		&provisionAddUnits,
	).Execute(app, n, w, process)
	rebuild.RoutesRebuildOrEnqueue(app.Name)
	quotaErr := app.fixQuota()
	if err != nil {
		return err
	}
	return quotaErr
}
func (app *App) AddUnits(n uint, process string, w io.Writer) error {
	if n == 0 {
		return errors.New("Cannot add zero units.")
	}
	units, err := app.Units()
	if err != nil {
		return err
	}
	for _, u := range units {
		if (u.Status == provision.StatusAsleep) || (u.Status == provision.StatusStopped) {
			return errors.New("Cannot add units to an app that has stopped or sleeping units")
		}
	}
	w = app.withLogWriter(w)
	err = action.NewPipeline(
		&reserveUnitsToAdd,
		&provisionAddUnits,
	).Execute(app, n, w, process)
	rebuild.RoutesRebuildOrEnqueue(app.Name)
	quotaErr := app.fixQuota()
	if err != nil {
		return err
	}
	return quotaErr
}
// AddUnits creates n new units within the provisioner, saves new units in the
// database and enqueues the apprc serialization.