Keep Inspur FPGA 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 by combining hostname and device address. Please reference: https://review.opendev.org/#/c/748366/4 Follow up by bp: https://review.opendev.org/#/c/729852/ Change-Id: I70152146cade74028d84998ade0c796e68f4ef65
This commit is contained in:
parent
21c43211d3
commit
61450faa28
@ -24,6 +24,7 @@ from oslo_serialization import jsonutils
|
||||
|
||||
from cyborg.accelerator.common import utils
|
||||
from cyborg.common import constants
|
||||
from cyborg.conf import CONF
|
||||
from cyborg.objects.driver_objects import driver_attach_handle
|
||||
from cyborg.objects.driver_objects import driver_attribute
|
||||
from cyborg.objects.driver_objects import driver_controlpath_id
|
||||
@ -122,7 +123,10 @@ def _generate_dep_list(fpga):
|
||||
driver_dep = driver_deployable.DriverDeployable()
|
||||
driver_dep.attribute_list = _generate_attribute_list(fpga)
|
||||
driver_dep.attach_handle_list = []
|
||||
driver_dep.name = fpga.get('name', '') + '_' + fpga["devices"]
|
||||
# NOTE(wenping) Now simply named as <Compute_hostname>_<Device_address>
|
||||
# once cyborg needs to support Inspur FPGA devices discovered from a
|
||||
# baremetal node, we might need to support more formats.
|
||||
driver_dep.name = CONF.host + '_' + fpga["devices"]
|
||||
driver_dep.driver_name = VENDOR_MAPS.get(fpga["vendor_id"]).upper()
|
||||
driver_dep.num_accelerators = 1
|
||||
driver_dep.attach_handle_list = [_generate_attach_handle(fpga)]
|
||||
|
@ -46,6 +46,7 @@ class TestInspurFPGADriver(base.TestCase):
|
||||
'inspur.sysinfo.lspci_privileged')
|
||||
def test_discover(self, mock_devices_for_vendor):
|
||||
mock_devices_for_vendor.return_value = self.p.stdout.readlines()
|
||||
self.set_defaults(host='host-192-168-32-195', debug=True)
|
||||
fpga_list = InspurFPGADriver().discover()
|
||||
self.assertEqual(1, len(fpga_list))
|
||||
attach_handle_list = [
|
||||
@ -72,9 +73,7 @@ class TestInspurFPGADriver(base.TestCase):
|
||||
{
|
||||
'num_accelerators': 1,
|
||||
'driver_name': 'INSPUR',
|
||||
'name':
|
||||
'Inspur Electronic Information Industry Co., Ltd.'
|
||||
' Device_0000:86:00.0',
|
||||
'name': 'host-192-168-32-195_0000:86:00.0',
|
||||
'attach_handle_list': attach_handle_list,
|
||||
'attribute_list': attribute_list
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user