Fix: use only node's HW profile for nic logical names

Change-Id: Ib0d4c2e341ffb8c7a367d1a48cc7e99d60f70ef6
This commit is contained in:
Mark Burnett 2018-06-05 11:40:01 -05:00
parent def51688e4
commit 786271af5c
2 changed files with 52 additions and 4 deletions

View File

@ -204,9 +204,10 @@ class BaremetalNode(drydock_provisioner.objects.hostprofile.HostProfile):
(bus_type, address))
for logicalname in reversed(nodes[0].text.split("/")):
self.logger.debug(
"Logicalname build dict: alias_name = %s, bus_type = %s, address = %s, "
"to logicalname = %s" % (alias_name, bus_type, address,
logicalname))
"Logicalname build dict: node_name = %s, alias_name = %s, "
"bus_type = %s, address = %s, to logicalname = %s" % (
self.get_name(), alias_name, bus_type, address,
logicalname))
return logicalname
self.logger.debug(
"Logicalname build dict: alias_name = %s, bus_type = %s, address = %s, not found"
@ -232,12 +233,18 @@ class BaremetalNode(drydock_provisioner.objects.hostprofile.HostProfile):
if xml_data:
xml_root = fromstring(xml_data)
for hardware_profile in site_design.hardware_profiles:
try:
hardware_profile = site_design.get_hardware_profile(self.hardware_profile)
for device in hardware_profile.devices:
logicalname = self._apply_logicalname(
xml_root, device.alias, device.bus_type,
device.address)
logicalnames[device.alias] = logicalname
except errors.DesignError:
self.logger.exception("Failed to load hardware profile while "
"resolving logical names for node %s",
self.get_name())
raise
else:
self.logger.info("No Build Data found for node_name %s" %
(self.get_name()))

View File

@ -419,6 +419,47 @@ data:
size: '2M'
count: 530000
---
schema: 'drydock/HardwareProfile/v1'
metadata:
schema: 'metadata/Document/v1'
# NOTE(mark-burnett): This duplicate is used as a test to ensure we do not
# include erroneous hardware profiles for nodes when computing logical device
# names.
name: HPGen9v3-duplicate
storagePolicy: 'cleartext'
labels:
application: 'drydock'
data:
vendor: HP
generation: '8'
hw_version: '3'
bios_version: '2.2.3'
boot_mode: bios
bootstrap_protocol: pxe
pxe_interface: 0
device_aliases:
prim_nic01:
address: '0000:00:04.0'
dev_type: '82540EM Gigabit Ethernet Controller'
bus_type: 'pci'
prim_nic02:
address: '0000:00:03.0'
dev_type: '82540EM Gigabit Ethernet Controller'
bus_type: 'pci'
primary_boot:
address: '2:0.0.0'
dev_type: 'VBOX HARDDISK'
bus_type: 'scsi'
cpu_sets:
sriov: '2,4'
hugepages:
sriov:
size: '1G'
count: 300
dpdk:
size: '2M'
count: 530000
---
schema: 'drydock/BootAction/v1'
metadata:
schema: 'metadata/Document/v1'