Merge "avoid error raised by ironic physical_node not exist read data from daisy db"
This commit is contained in:
commit
321a5d6e1f
@ -34,6 +34,7 @@ from daisy.common import exception
|
||||
from daisy.common import property_utils
|
||||
from daisy.common import utils
|
||||
from daisy.common import wsgi
|
||||
from daisy.common import vcpu_pin
|
||||
from daisy import i18n
|
||||
from daisy import notifier
|
||||
import daisy.registry.client.v1.api as registry
|
||||
@ -630,6 +631,8 @@ class Controller(controller.BaseController):
|
||||
self.check_discover_state_with_hwm(req, host_meta)
|
||||
else:
|
||||
self.check_discover_state_with_no_hwm(req, host_meta)
|
||||
host_vcpu_pin = vcpu_pin.allocate_cpus(host_meta)
|
||||
host_meta.update(host_vcpu_pin)
|
||||
if 'role' in host_meta and 'CONTROLLER_HA' in host_meta['role']:
|
||||
host_cluster_name = host_meta['cluster']
|
||||
params = {'filters': {u'name': host_cluster_name}}
|
||||
|
@ -885,23 +885,6 @@ def is_ip_in_ranges(ip, ip_ranges):
|
||||
return False
|
||||
|
||||
|
||||
def get_host_hw_info(host_interface):
|
||||
host_hw_config = {}
|
||||
ironicclient = get_ironicclient()
|
||||
if host_interface:
|
||||
min_mac = get_host_min_mac(host_interface)
|
||||
try:
|
||||
host_obj = ironicclient.physical_node.get(min_mac)
|
||||
host_hw_config = dict([(f, getattr(host_obj, f, ''))
|
||||
for f in ['system', 'memory', 'cpu',
|
||||
'disks', 'interfaces',
|
||||
'pci', 'devices']])
|
||||
except Exception:
|
||||
LOG.exception(_LE("Unable to find ironic data %s")
|
||||
% Exception)
|
||||
return host_hw_config
|
||||
|
||||
|
||||
def get_dvs_interfaces(host_interfaces):
|
||||
dvs_interfaces = []
|
||||
if not isinstance(host_interfaces, list):
|
||||
|
@ -304,10 +304,12 @@ def allocate_clc_cpus(host_detail):
|
||||
return pci_cpu_sets
|
||||
|
||||
host_interfaces = host_detail.get('interfaces')
|
||||
if host_interfaces:
|
||||
host_hw_info = utils.get_host_hw_info(host_interfaces)
|
||||
else:
|
||||
return pci_cpu_sets
|
||||
host_hw_info = {'system': '', 'memory': '',
|
||||
'cpu': '', 'disk': '', 'interfaces': '',
|
||||
'pci': '', 'devices': ''}
|
||||
host_obj = host_detail
|
||||
for f in host_hw_info:
|
||||
host_hw_info[f] = host_obj.get(f)
|
||||
|
||||
host_id = host_detail.get('id')
|
||||
clc_pci = utils.get_clc_pci_info(host_hw_info['pci'].values())
|
||||
@ -342,7 +344,12 @@ def allocate_dvs_cpus(host_detail):
|
||||
return dvs_cpu_sets
|
||||
|
||||
host_id = host_detail.get('id')
|
||||
host_hw_info = utils.get_host_hw_info(host_interfaces)
|
||||
host_hw_info = {'system': '', 'memory': '',
|
||||
'cpu': '', 'disk': '', 'interfaces': '',
|
||||
'pci': '', 'devices': ''}
|
||||
host_obj = host_detail
|
||||
for f in host_hw_info:
|
||||
host_hw_info[f] = host_obj.get(f)
|
||||
numa_cpus = utils.get_numa_node_cpus(host_hw_info.get('cpu', {}))
|
||||
if not numa_cpus or not numa_cpus['numa_node0']:
|
||||
msg = "No NUMA CPU found from of host '%s'" % host_id
|
||||
|
Loading…
x
Reference in New Issue
Block a user