Added logging functionality to resource models.
[osm/vim-emu.git] / src / emuvim / dcemulator / resourcemodel / upb / simple.py
index 84aa7a9..8e96dba 100644 (file)
@@ -59,6 +59,22 @@ class UpbSimpleCloudDcRM(BaseResourceModel):
         # we don't have to calculate anything special here in this simple model
         return True
 
+    def get_state_dict(self):
+        """
+        Return the state of the resource model as simple dict.
+        Helper method for logging functionality.
+        :return:
+        """
+        r = dict()
+        r["e_cpu"] = self.registrar.e_cpu
+        r["e_mem"] = self.registrar.e_mem
+        r["dc_max_cu"] = self.dc_max_cu
+        r["dc_max_mu"] = self.dc_max_mu
+        r["dc_alloc_cu"] = self.dc_alloc_cu
+        r["dc_alloc_mu"] = self.dc_alloc_mu
+        r["allocated_compute_instances"] = self.allocated_compute_instances
+        return r
+
     def _allocate_cpu(self, flavor):
         """
         Allocate CPU time.