Skip to content

Instantly share code, notes, and snippets.

@fairchild
Created June 20, 2011 04:47
Show Gist options
  • Save fairchild/1035141 to your computer and use it in GitHub Desktop.
Save fairchild/1035141 to your computer and use it in GitHub Desktop.
Draft idea of models for compute hardware
class Component
end
# %w(Case MotherBoard HardDisk PowerSupply Ram PowerSupply NetworkCard).each do |component|
# module_eval "class #{component} < Component; end"
# end
class Ram < Component
end
class Processor < Component
{ :cores => :integer,
:frequency => :integer,
:l1_cache
}
end
class HardDisk < Component
end
class MotherBoard < Component
end
class Case < Component
:u
end
class PowerSupply < Component
end
class NetworkCard < Component
end
class NetworkPort
#physical port of a switch, device or server
end
class Network
:type #infiniband, gige, 10GigE, etc
:bandwidth #max
:latency #minimal, best case
:address #CIDR, 192.168.1.0/24 if ipv4
end
class Server < Component
# has_many :components
:style => :string, # compute, storage
:u => :integer,
:ram => :integer,
:ram_description => :text,
:ram_stick_size => :integer,
:ram_slots_count
:ram_stick_count
:motherboard_description
:harddisk_size
:harddisk_count
:hard_disk_description
:cpu_ghz
:cpu_description
:cpu_count
:cpu_cores_count
:network_ports_count
:network_ports_description
:remote_management # iLo, ipmi, none, other...
:remote_management_description
:lead_time
:cost
def ram
ram_stick_count * ram_stick_size
end
def ram_per_core
ram/(cpu_cores_count*cpu_count)
end
end
class Cabinet < Component
has_many :servers
has_many :components, :through=>:servers
:u
:description
:network # i.e. 145.4.2.1/23
:network_description
:network_max_speed
:network_unmetered_speed
:power_volts
:power_amps
:power_amps_redundant
:setup_cost # Non Recurring Charges
:monthly_cost # Monthly Recurring Charges
:u_01
:u_02
:u_03
def watts
power_amps * power_volts
end
end
class Container < Component
has_many :racks
has_many :servers, :through=>:racks
has_many :components, :through=>:servers
end
class DataCenter
def cost_per_server
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment