Subclass OpenShift::Config so we can split the values easily
# File lib/openshift-origin-node/utils/cgroups.rb, line 41 def initialize(conf_path, default={}) super @tc_outbound_htb = Hash.new {|h, k| h[k] = []} tc_outbound_groups.each do |group_name| rate = validate_tc_rate(@conf[group_name]["rate"]) ceil = validate_tc_rate(@conf[group_name]["ceil"]) port = validate_tc_port(@conf[group_name]["port"]) k = [rate, ceil] @tc_outbound_htb[k] << port end end
# File lib/openshift-origin-node/utils/cgroups.rb, line 89 def get(key) super(key.gsub('.','_')) end
# File lib/openshift-origin-node/utils/cgroups.rb, line 72 def tc_outbound_groups @conf.groups.select {|g| g =~ /tc_outbound_limit/} end
# File lib/openshift-origin-node/utils/cgroups.rb, line 76 def tc_outbound_htb # Defaults for backwards compatibility # TODO: Remove this logic as soon as Online has the new code and # has updated resource_limits.conf. if @tc_outbound_htb.keys.empty? @tc_outbound_htb = { ["128kbit", "256kbit"] => [587], ["12kbit", "24kbit"] => [25, 465] } else @tc_outbound_htb end end
# File lib/openshift-origin-node/utils/cgroups.rb, line 64 def validate_tc_port(port) if port !~ /\d+/ or port.to_i <= 0 or port.to_i > 65535 raise InvalidCgroupSettingException.new("port", port, "Outside valid range") end return port end
# File lib/openshift-origin-node/utils/cgroups.rb, line 54 def validate_tc_rate(rate) si_units = "bit|kbit|mbit|gbit|tbit|bps|kbps|mbps|gbps|tbps" iec_units = "kibit|mibit|gibit|tibit|kibps|mibps|gibps|tibps" unless rate =~ /\d+#{si_units}|#{iec_units}/ raise InvalidCgroupSettingException.new("rate", rate, "Please see the tc manpage for the supported SI or IEC units") end return rate end
Generated with the Darkfish Rdoc Generator 2.