Added emulation max memory property to network and RM registrar
authorpeusterm <manuel.peuster@uni-paderborn.de>
Fri, 25 Mar 2016 11:27:07 +0000 (12:27 +0100)
committerpeusterm <manuel.peuster@uni-paderborn.de>
Fri, 25 Mar 2016 11:27:07 +0000 (12:27 +0100)
src/emuvim/dcemulator/net.py
src/emuvim/dcemulator/resourcemodel/__init__.py

index d91ef4a..80fb2f8 100755 (executable)
@@ -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={}):
         """
index 3d05b96..e35da25 100644 (file)
@@ -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):
         """