lib/dev-lxc/server.rb in dev-lxc-2.4.0 vs lib/dev-lxc/server.rb in dev-lxc-2.5.0
- old
+ new
@@ -3,14 +3,15 @@
module DevLXC
class Server
attr_reader :container
- def initialize(name, ipaddress, additional_fqdn, mounts, ssh_keys)
+ def initialize(name, ipaddress, additional_fqdn, memory_per_server, mounts, ssh_keys)
@container = DevLXC::Container.new(name)
@ipaddress = ipaddress
@additional_fqdn = additional_fqdn
+ @memory_per_server = memory_per_server
@mounts = mounts
@ssh_keys = ssh_keys
end
def name
@@ -41,9 +42,10 @@
release_lingering_dhcp_ip_addresses(hwaddr)
assign_static_ip_address(hwaddr) if @ipaddress
@container.sync_mounts(@mounts)
@container.start
@container.sync_ssh_keys(@ssh_keys)
+ @container.set_cgroup_item('memory.limit_in_bytes', @memory_per_server) if @memory_per_server
puts
end
def shutdown
@container.shutdown if @container.running?