From: peusterm Date: Fri, 25 Mar 2016 11:27:07 +0000 (+0100) Subject: Added emulation max memory property to network and RM registrar X-Git-Tag: v3.1~155^2~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=a4d8479f913ed45b18199d70c4b524fca73a0a21;p=osm%2Fvim-emu.git Added emulation max memory property to network and RM registrar --- diff --git a/src/emuvim/dcemulator/net.py b/src/emuvim/dcemulator/net.py index d91ef4a..80fb2f8 100755 --- a/src/emuvim/dcemulator/net.py +++ b/src/emuvim/dcemulator/net.py @@ -27,7 +27,10 @@ class DCNetwork(Dockernet): This class is used by topology definition scripts. """ - def __init__(self, controller=RemoteController, dc_emulation_max_cpu=1.0, **kwargs): + def __init__(self, controller=RemoteController, + dc_emulation_max_cpu=1.0, # fraction of overall CPU time for emulation + dc_emulation_max_mem=512, # emulation max mem in MB + **kwargs): """ Create an extended version of a Dockernet network :param dc_emulation_max_cpu: max. CPU time used by containers in data centers @@ -56,7 +59,8 @@ class DCNetwork(Dockernet): self.monitor_agent = DCNetworkMonitor(self) # initialize resource model registrar - self.rm_registrar = ResourceModelRegistrar(dc_emulation_max_cpu) + self.rm_registrar = ResourceModelRegistrar( + dc_emulation_max_cpu, dc_emulation_max_mem) def addDatacenter(self, label, metadata={}): """ diff --git a/src/emuvim/dcemulator/resourcemodel/__init__.py b/src/emuvim/dcemulator/resourcemodel/__init__.py index 3d05b96..e35da25 100644 --- a/src/emuvim/dcemulator/resourcemodel/__init__.py +++ b/src/emuvim/dcemulator/resourcemodel/__init__.py @@ -12,11 +12,13 @@ class ResourceModelRegistrar(object): Global registry to keep track of all existing resource models. """ - def __init__(self, dc_emulation_max_cpu): + def __init__(self, dc_emulation_max_cpu, dc_emulation_max_mem): self.e_cpu = dc_emulation_max_cpu + self.e_mem = dc_emulation_max_mem # pointer to all resource models assigned to DCs self._resource_models = dict() - LOG.info("Resource model registrar created with dc_emulation_max_cpu=%r" % dc_emulation_max_cpu) + LOG.info("Resource model registrar created with dc_emulation_max_cpu=%r and dc_emulation_max_mem=%r" + % (dc_emulation_max_cpu, dc_emulation_max_mem)) def register(self, dc, rm): """