Sysinv helm: move _get_host_cpu_list to base class
This commit moves the _get_host_cpu_list method from NovaHelm to the BaseHelm class so it can be inherited and used by other classes. Story: 2003909 Task: 30367 Change-Id: I928f716f4f37c95214f077f5e1d775b2e0101248 Signed-off-by: Steven Webster <steven.webster@windriver.com>
This commit is contained in:
parent
b9d966b7e2
commit
27573403d6
|
@ -178,6 +178,19 @@ class BaseHelm(object):
|
|||
constants.CONTROLLER_0_HOSTNAME, constants.NETWORK_TYPE_MGMT)
|
||||
return address.address
|
||||
|
||||
def _get_host_cpu_list(self, host, function=None, threads=False):
|
||||
"""
|
||||
Retrieve a list of CPUs for the host, filtered by function and thread
|
||||
siblings (if supplied)
|
||||
"""
|
||||
cpus = []
|
||||
for c in self.dbapi.icpu_get_by_ihost(host.id):
|
||||
if c.thread != 0 and not threads:
|
||||
continue
|
||||
if c.allocated_function == function or not function:
|
||||
cpus.append(c)
|
||||
return cpus
|
||||
|
||||
def get_namespaces(self):
|
||||
"""
|
||||
Return list of namespaces supported by this chart
|
||||
|
|
|
@ -188,19 +188,6 @@ class NovaHelm(openstack.OpenstackBaseHelm):
|
|||
else:
|
||||
return 'kvm'
|
||||
|
||||
def _get_host_cpu_list(self, host, function=None, threads=False):
|
||||
"""
|
||||
Retreive a list of CPUs for the host, filtered by function and thread
|
||||
siblings (if supplied)
|
||||
"""
|
||||
cpus = []
|
||||
for c in self.dbapi.icpu_get_by_ihost(host.id):
|
||||
if c.thread != 0 and not threads:
|
||||
continue
|
||||
if c.allocated_function == function or not function:
|
||||
cpus.append(c)
|
||||
return cpus
|
||||
|
||||
def _update_host_cpu_maps(self, host, default_config):
|
||||
host_cpus = self._get_host_cpu_list(host, threads=True)
|
||||
if host_cpus:
|
||||
|
|
Loading…
Reference in New Issue