# File lib/openshift-origin-controller/app/models/application.rb, line 1034
  def set_user_min_max(cart_group_map, min_scale, max_scale)
    if min_scale and max_scale and Integer(min_scale) > Integer(max_scale) and Integer(max_scale)!=-1
       #raise OpenShift::UserException.new("Invalid scaling factors provided. Minimum (#{min_scale}) should always be less than maximum (#{max_scale}).", 170)
       tmp = min_scale
       min_scale = max_scale
       max_scale = tmp
    end
    cart_current_min, cart_current_max, sup_min, sup_max = get_user_min_max(cart_group_map)
    if min_scale and Integer(min_scale)-cart_current_min<0
      # set min first
      set_user_min(cart_group_map, min_scale)
      set_user_max(cart_group_map, max_scale)
    else
      set_user_max(cart_group_map, max_scale)
      set_user_min(cart_group_map, min_scale)
    end

    if self.scalable
      prof = @profile_name_map[@default_profile]
      cinst = ComponentInstance::find_component_in_cart(prof, self, self.proxy_cartridge, self.get_name_prefix)
      if cinst
        group_inst = self.group_instance_map[cinst.group_instance_name]
        reply = ResultIO.new
        s,f = run_on_gears(group_inst.gears, reply, false) do |gear, r|
          gear.reload(cinst)
        end
      end
    end

  end