keep FPGA driver's deployable_name unique

The deployable_name should be unique because deployable_name will be
reported to placement as the resource_provider_name, which is required
by placement to be unique. The current naming method for deployable_name
in cyborg cannot ensure the uniqueness, so we should enhance this.

This patch enhances the FPGA driver naming method.

Change-Id: If8afa4718c0c90ac938ec691eff699aaf0e5125e
Story: 2008074
Task: 40763
This commit is contained in:
Xinran Wang 2020-08-27 06:11:49 -04:00 committed by Xinran WANG
parent 40259a25ec
commit 0154175097
1 changed files with 2 additions and 2 deletions

View File

@ -21,6 +21,7 @@ Cyborg Intel FPGA driver implementation.
import glob
import os
import re
import socket
from oslo_serialization import jsonutils
@ -38,7 +39,6 @@ PCI_DEVICES_PATH_PATTERN = "/sys/bus/pci/devices/*"
# TODO(shaohe) The KNOWN_FPGAS can be configurable.
KNOWN_FPGAS = [("0x8086", "0x09c4")]
INTEL_FPGA_DEV_PREFIX = "intel-fpga-dev"
SYS_FPGA = "/sys/class/fpga"
DEVICE = "device"
PF = "physfn"
@ -231,7 +231,7 @@ def fpga_tree():
# name = os.path.basename(path)
fpga = {"type": constants.DEVICE_FPGA,
"devices": bdf, "stub": True,
"name": "_".join((INTEL_FPGA_DEV_PREFIX, bdf))}
"name": "_".join((socket.gethostname(), bdf))}
d_info = fpga_device(path)
fpga.update(d_info)
if names: