From d4b83a14983224c43f5b24a5eb2c3ea641f86600 Mon Sep 17 00:00:00 2001 From: Xinran WANG Date: Thu, 4 Apr 2019 15:01:27 +0800 Subject: [PATCH] Bug-fix: attach_type or control path type should be majuscule. The sysinfo based fpga driver report attach_type or control path type as "pci" which will cause an error of creating related object in conductor. Change-Id: I442511d3232da90484886dbf169b53b8acf4681c --- cyborg/accelerator/drivers/fpga/intel/sysinfo.py | 4 ++-- .../unit/accelerator/drivers/fpga/intel/test_driver.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cyborg/accelerator/drivers/fpga/intel/sysinfo.py b/cyborg/accelerator/drivers/fpga/intel/sysinfo.py index 656ad0b3..56ffc34a 100644 --- a/cyborg/accelerator/drivers/fpga/intel/sysinfo.py +++ b/cyborg/accelerator/drivers/fpga/intel/sysinfo.py @@ -169,7 +169,7 @@ def _generate_driver_device(fpga, pf_has_vf): def _generate_controlpath_id(fpga): driver_cpid = driver_controlpath_id.DriverControlPathID() - driver_cpid.cpid_type = "pci" + driver_cpid.cpid_type = "PCI" driver_cpid.cpid_info = fpga["devices"] return driver_cpid @@ -198,7 +198,7 @@ def _generate_dep_list(fpga, pf_has_vf): def _generate_attach_handle(fpga, pf_has_vf): driver_ah = driver_attach_handle.DriverAttachHandle() - driver_ah.attach_type = "pci" + driver_ah.attach_type = "PCI" driver_ah.attach_info = fpga["devices"] driver_ah.in_use = False return driver_ah diff --git a/cyborg/tests/unit/accelerator/drivers/fpga/intel/test_driver.py b/cyborg/tests/unit/accelerator/drivers/fpga/intel/test_driver.py index 017a00f1..88bd5ad3 100644 --- a/cyborg/tests/unit/accelerator/drivers/fpga/intel/test_driver.py +++ b/cyborg/tests/unit/accelerator/drivers/fpga/intel/test_driver.py @@ -42,12 +42,12 @@ class TestIntelFPGADriver(base.TestCase): def test_discover(self): attach_handle_list = [ [ - {'attach_type': 'pci', + {'attach_type': 'PCI', 'attach_info': '0000:be:00.0', 'in_use': False} ], [ - {'attach_type': 'pci', + {'attach_type': 'PCI', 'attach_info': '0000:5e:00.1', 'in_use': False} ] @@ -64,7 +64,7 @@ class TestIntelFPGADriver(base.TestCase): ], 'controlpath_id': {'cpid_info': '0000:be:00.0', - 'cpid_type': 'pci'}}, + 'cpid_type': 'PCI'}}, {'vendor': '0x8086', 'type': 'FPGA', 'model': '0xbcc0', @@ -77,7 +77,7 @@ class TestIntelFPGADriver(base.TestCase): ], 'controlpath_id': {'cpid_info': '0000:5e:00.0', - 'cpid_type': 'pci'}}] + 'cpid_type': 'PCI'}}] intel = IntelFPGADriver() fpgas = intel.discover() list.sort(fpgas, key=lambda x: x._obj_deployable_list[0].name)