Пример #1
0
 def _to_dict(self):
     # NOTE(sahid): Used as legacy, could be renamed in
     # _legacy_to_dict_ to the future to avoid confusing.
     return {'cpus': hardware.format_cpu_spec(self.cpuset,
                                              allow_ranges=False),
             'mem': {'total': self.memory},
             'id': self.id,
             'pagesize': self.pagesize}
Пример #2
0
 def _to_dict(self):
     return {
         'id': self.id,
         'cpus': hardware.format_cpu_spec(
             self.cpuset, allow_ranges=False),
         'mem': {
             'total': self.memory,
             'used': self.memory_usage},
         'cpu_usage': self.cpu_usage}
Пример #3
0
 def _to_dict(self):
     return {
         'id': self.id,
         'cpus': hardware.format_cpu_spec(self.cpuset, allow_ranges=False),
         'mem': {
             'total': self.memory,
             'used': self.memory_usage
         },
         'cpu_usage': self.cpu_usage
     }
Пример #4
0
 def to_dict_legacy(self, host_topology):
     cells = []
     for cell in host_topology.cells:
         cells.append(
             {'cpus': hardware.format_cpu_spec(
                 cell.cpuset, allow_ranges=False),
              'mem': {'total': cell.memory,
                      'limit': cell.memory * self.ram_allocation_ratio},
              'cpu_limit': len(cell.cpuset) * self.cpu_allocation_ratio,
              'id': cell.id})
     return {'cells': cells}
Пример #5
0
 def _to_dict(self):
     # NOTE(sahid): Used as legacy, could be renamed in
     # _legacy_to_dict_ to the future to avoid confusing.
     return {
         'cpus': hardware.format_cpu_spec(self.cpuset, allow_ranges=False),
         'mem': {
             'total': self.memory
         },
         'id': self.id,
         'pagesize': self.pagesize
     }
Пример #6
0
 def to_dict_legacy(self, host_topology):
     cells = []
     for cell in host_topology.cells:
         cells.append({
             'cpus':
             hardware.format_cpu_spec(cell.cpuset, allow_ranges=False),
             'mem': {
                 'total': cell.memory,
                 'limit': cell.memory * self.ram_allocation_ratio
             },
             'cpu_limit':
             len(cell.cpuset) * self.cpu_allocation_ratio,
             'id':
             cell.id
         })
     return {'cells': cells}