Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/simulux/disks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
Expand Down
18 changes: 9 additions & 9 deletions lib/simulux/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down