1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
"""
Cyborg SPDK driver modules implementation.
"""
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
class SPDKDRIVER(object):
"""SPDKDRIVER
This is just a virtual SPDK drivers interface.
SPDK-based app server should implement their specific drivers.
"""
@classmethod
def create(cls, server, *args, **kwargs):
for subclass in cls.__subclasses__():
if server == subclass.SERVER:
return subclass(*args, **kwargs)
raise LookupError("Could not find the driver for server %s" % server)
def __init__(self, *args, **kwargs):
super(SPDKDRIVER, self).__init__()
def discover_accelerator(self):
"""Discover a backend accelerator
:return: accelerator list.
"""
raise NotImplementedError('Subclasses must implement this method.')
def install_accelerator(self, driver_id, driver_type):
"""install a backend accelerator
:param driver_id: driver id.
:param driver_type: driver type.
:raise: NotImplementedError.
"""
raise NotImplementedError('Subclasses must implement this method.')
def uninstall_accelerator(self, driver_id, driver_type):
"""uninstall a backend accelerator
:param driver_id: driver id.
:param driver_type: driver type.
:raise: NotImplementedError.
"""
raise NotImplementedError('Subclasses must implement this method.')
def accelerator_list(self):
"""Discover a backend accelerator list
:return: accelerator list.
:raise: NotImplementedError.
"""
raise NotImplementedError('Subclasses must implement this method.')
def update(self, driver_type, **kwargs):
"""update
:param driver_type: driver type.
:param kwargs: kwargs.
:raise: NotImplementedError.
"""
raise NotImplementedError('Subclasses must implement this method.')
def attach_instance(self, instance_id):
"""attach a backend instance
:param instance_id: instance id.
:return: instance.
:raise: NotImplementedError.
"""
raise NotImplementedError('Subclasses must implement this method.')
def detach_instance(self, instance_id):
"""detach a backend instance
:param instance_id: instance id.
:return: instance.
:raise: NotImplementedError.
"""
raise NotImplementedError('Subclasses must implement this method.')
|