tweaked for lbuild-initvm
[infrastructure.git] / slice-attributes / SlicesLoad.py
1 #!/usr/bin/env python
2
3 import sys
4 import pickle
5
6 class SlicesLoad:
7
8     def __init__ (self, filename):
9         self.filename=filename+".bin"
10         self.load()
11
12     def load (self):
13         
14         file = open(self.filename,'rb')
15         self.slices = pickle.load(file)
16         file.close()
17
18     def print_rspecs (self):
19         
20         for slice in self.slices:
21             # filter out a few things
22             list=self.slices[slice]
23             show=[]
24             for dict in list:
25                 if dict['name'] in ['cpu_share']:
26                     break
27                 show += [dict]
28             if show:
29                 print 'slice',slice,'->'
30                 for item in show:
31                     print "  ",item
32
33 if __name__ == '__main__':
34
35     for filename in sys.argv[1:]:
36
37         sl_import = SlicesLoad(filename)
38         sl_import.print_rspecs()