Add support for reporting CPU socket number
IPA reports a few cpu fields including cores, arch, flags etc. There is a need that user wants to utilize the physical number in a baremetal since cores are just a logical representation of the compute resource. The socket number is more suitable for the quota control in some use cases. Change-Id: I94be86d6b12a3a7e7ca1041d948427a073412a31
This commit is contained in:
parent
845df338f8
commit
9cafe76225
@ -171,7 +171,7 @@ fields:
|
||||
|
||||
``cpu``
|
||||
CPU information: ``model_name``, ``frequency``, ``count``,
|
||||
``architecture`` and ``flags``.
|
||||
``architecture``, ``flags`` and ``socket_count``.
|
||||
|
||||
``memory``
|
||||
RAM information: ``total`` (total size in bytes), ``physical_mb``
|
||||
|
@ -803,13 +803,14 @@ class NetworkInterface(encoding.SerializableComparable):
|
||||
|
||||
class CPU(encoding.SerializableComparable):
|
||||
serializable_fields = ('model_name', 'frequency', 'count', 'architecture',
|
||||
'flags')
|
||||
'flags', 'socket_count')
|
||||
|
||||
def __init__(self, model_name, frequency, count, architecture,
|
||||
flags=None):
|
||||
flags=None, socket_count=None):
|
||||
self.model_name = model_name
|
||||
self.frequency = frequency
|
||||
self.count = count
|
||||
self.socket_count = socket_count
|
||||
self.architecture = architecture
|
||||
self.flags = flags or []
|
||||
|
||||
@ -1491,7 +1492,8 @@ class GenericHardwareManager(HardwareManager):
|
||||
# this includes hyperthreading cores
|
||||
count=int(cpu_info.get('cpu(s)')),
|
||||
architecture=cpu_info.get('architecture'),
|
||||
flags=flags)
|
||||
flags=flags,
|
||||
socket_count=int(cpu_info.get('socket(s)', 0)))
|
||||
|
||||
def get_memory(self):
|
||||
# psutil returns a long, so we force it to an int
|
||||
|
@ -871,6 +871,7 @@ class TestGenericHardwareManager(base.IronicAgentTest):
|
||||
cpus.model_name)
|
||||
self.assertEqual('2400.0000', cpus.frequency)
|
||||
self.assertEqual(4, cpus.count)
|
||||
self.assertEqual(1, cpus.socket_count)
|
||||
self.assertEqual('x86_64', cpus.architecture)
|
||||
self.assertEqual(['fpu', 'vme', 'de', 'pse'], cpus.flags)
|
||||
|
||||
@ -884,6 +885,7 @@ class TestGenericHardwareManager(base.IronicAgentTest):
|
||||
cpus.model_name)
|
||||
self.assertEqual('1794.433', cpus.frequency)
|
||||
self.assertEqual(12, cpus.count)
|
||||
self.assertEqual(1, cpus.socket_count)
|
||||
self.assertEqual('x86_64', cpus.architecture)
|
||||
self.assertEqual(['fpu', 'vme', 'de', 'pse'], cpus.flags)
|
||||
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add support for collecting the cpu socket number.
|
Loading…
Reference in New Issue
Block a user