Change "type" to "interface_type"

Since cyborg has added a new field "interface_type" to indicate the type of
interface, os-acc should also change "type" to "interface_type".

Change-Id: I112de865807effd8b385a6f7b3788e1b51f5ccd6
This commit is contained in:
Xinran WANG 2018-07-30 11:16:52 +08:00
parent f3cb2261c3
commit 9ad2bcf636
3 changed files with 10 additions and 10 deletions

View File

@ -43,7 +43,7 @@ def get_config(acc, instance=None, inst_type=None):
if _EXT_MANAGER is None:
raise os_acc.exception.LibraryNotInitialized()
acc_type = acc['type']
acc_type = acc['interface_type']
if acc_type is None:
raise os_acc.exception.InternalError(
_("acc_type parameter must be present "
@ -59,7 +59,7 @@ def get_config(acc, instance=None, inst_type=None):
def attach(acc, guest=None, host=None, instance=None, inst_type=None):
if _EXT_MANAGER is None:
raise os_acc.exception.LibraryNotInitialized()
acc_type = acc['type']
acc_type = acc['interface_type']
if acc_type is None:
raise os_acc.exception.InternalError(
_("acc_type parameter must be present "
@ -82,7 +82,7 @@ def detach(acc, guest=None, host=None, instance=None, inst_type=None):
if _EXT_MANAGER is None:
raise os_acc.exception.LibraryNotInitialized()
acc_type = acc['type']
acc_type = acc['interface_type']
if acc_type is None:
raise os_acc.exception.InternalError(
_("acc_type parameter must be present "

View File

@ -18,7 +18,7 @@ from os_acc import base
class PciAccelerator(base.PluginBase):
def get_config(self, acc, instance=None, inst_type=None):
pcie_addr = acc["pcie_address"]
pcie_addr = acc["address"]
domain, bus, slot, func = self._get_pci_address_fields(pcie_addr)
from nova.virt.libvirt.config import LibvirtConfigGuestHostdevPCI
conf = LibvirtConfigGuestHostdevPCI()

View File

@ -113,9 +113,9 @@ class TestOSACC(base.TestCase):
mock.patch('stevedore.extension.ExtensionManager.__getitem__',
return_value=plg):
os_acc.initialize()
fake_acc = {"instance_uuid": "", "type": "demo",
fake_acc = {"instance_uuid": "", "interface_type": "demo",
"name": "NVIDIA Corporation GP100GL",
"pcie_address": "0000:81:00.0"}
"address": "0000:81:00.0"}
fake_instance = {}
fake_inst_type = {}
fake_guest = ""
@ -137,9 +137,9 @@ class TestOSACC(base.TestCase):
mock.patch('stevedore.extension.ExtensionManager.__getitem__',
return_value=plg):
os_acc.initialize()
fake_acc = {"instance_uuid": "", "type": "demo",
fake_acc = {"instance_uuid": "", "interface_type": "demo",
"name": "NVIDIA Corporation GP100GL",
"pcie_address": "0000:81:00.0"}
"address": "0000:81:00.0"}
fake_instance = {}
fake_inst_type = {}
os_acc.get_config(fake_acc, fake_instance, fake_inst_type)
@ -157,9 +157,9 @@ class TestOSACC(base.TestCase):
mock.patch('stevedore.extension.ExtensionManager.__getitem__',
return_value=plg):
os_acc.initialize()
fake_acc = {"instance_uuid": "", "type": "demo",
fake_acc = {"instance_uuid": "", "interface_type": "demo",
"name": "NVIDIA Corporation GP100GL",
"pcie_address": "0000:81:00.0"}
"address": "0000:81:00.0"}
fake_instance = {}
fake_inst_type = {}
fake_guest = ""