diff --git a/lib/simulux/disks.py b/lib/simulux/disks.py index 1e567f5..c648cd9 100644 --- a/lib/simulux/disks.py +++ b/lib/simulux/disks.py @@ -29,6 +29,7 @@ def __init__(self, conf=None): self.disks = {} self.partitions = {} self.files = {} + self.scenario_name = None # Add default layout self.add_layout() @@ -37,7 +38,7 @@ def __init__(self, conf=None): if conf: self.disks.update(conf.get('disks', {})) self.partitions.update(conf.get('partitions', {})) - + self.scenario_name = conf.get('scenario_name', None) # Need to process files for more conveniency files = conf.get('files', {}) self._process_mounts(files) diff --git a/lib/simulux/memory.py b/lib/simulux/memory.py index f90aab8..c2f503d 100644 --- a/lib/simulux/memory.py +++ b/lib/simulux/memory.py @@ -45,16 +45,16 @@ def __init__(self, conf=None): # Add scenario specific memory data if conf: - self.data.update({'used': conf['memory'].get('used', 0)}) - self.data.update({'buffers': conf['memory'].get('buffers', 0)}) - self.data.update({'shared': conf['memory'].get('shared', 0)}) - self.data.update({'cached': conf['memory'].get('cached', 0)}) - self.data.update({'total': conf['memory'].get('total', 0)}) - self.data.update({'free': conf['memory'].get('free', int(self.data['total'])-int(self.data['used']))}) + self.data.update({'used': int(conf['memory'].get('used', 0))}) + self.data.update({'buffers': int(conf['memory'].get('buffers', 0))}) + self.data.update({'shared': int(conf['memory'].get('shared', 0))}) + self.data.update({'cached': int(conf['memory'].get('cached', 0))}) + self.data.update({'total': int(conf['memory'].get('total', 0))}) + self.data.update({'free': int(conf['memory'].get('free', int(self.data['total'])))-int(self.data['used'])}) - assert self.data['used'] <= self.data['total'] - assert self.data['free'] <= self.data['total'] - assert self.data['used'] + self.data['free'] == self.data['total'] + assert int(self.data['used']) <= int(self.data['total']) + assert int(self.data['free']) <= int(self.data['total']) + assert int(self.data['used']) + int(self.data['free']) == int(self.data['total']) def set_layout(self, layout_file=None):