Update driver names and base class.
Also, add (task, node) to the base and fake driver method parameters. Prepares the way for adding TaskManagers in a following patch. Change-Id: I846227b2416445a539f9ac51d86b33ea49d4abcb
This commit is contained in:
parent
ae832fe8cf
commit
c835425781
@ -15,14 +15,16 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
"""
|
||||
Base classes for drivers
|
||||
Base classes for drivers.
|
||||
|
||||
All methods take, at minimum, a TaskManager resource and a single Node.
|
||||
"""
|
||||
|
||||
import abc
|
||||
|
||||
|
||||
class DeploymentDriver(object):
|
||||
"""Base class for hardware deployment drivers."""
|
||||
class DeployDriver(object):
|
||||
"""Base class for image deployment drivers."""
|
||||
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
@ -30,58 +32,48 @@ class DeploymentDriver(object):
|
||||
def __init__(self):
|
||||
"""Constructor."""
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def is_capable(self):
|
||||
"""Check if this driver is capable of handling the givens."""
|
||||
|
||||
@abc.abstractmethod
|
||||
def activate_bootloader(self):
|
||||
def activate_bootloader(self, task, node):
|
||||
"""Prepare the bootloader for this deployment."""
|
||||
|
||||
@abc.abstractmethod
|
||||
def deactivate_bootloader(self):
|
||||
def deactivate_bootloader(self, task, node):
|
||||
"""Tear down the bootloader for this deployment."""
|
||||
|
||||
@abc.abstractmethod
|
||||
def activate_node(self):
|
||||
def activate_node(self, task, node):
|
||||
"""Perform post-power-on operations for this deployment."""
|
||||
|
||||
@abc.abstractmethod
|
||||
def deactivate_node(self):
|
||||
def deactivate_node(self, task, node):
|
||||
"""Perform pre-power-off operations for this deployment."""
|
||||
|
||||
|
||||
class BMCDriver(object):
|
||||
"""Base class for baseboard management controller drivers."""
|
||||
class ControlDriver(object):
|
||||
"""Base class for node control drivers."""
|
||||
|
||||
__metaclass__ = abc.ABCMeta
|
||||
|
||||
@abc.abstractmethod
|
||||
def __init__(self):
|
||||
def __init__(self, nodes):
|
||||
"""Constructor."""
|
||||
|
||||
@classmethod
|
||||
@abc.abstractmethod
|
||||
def is_capable(self):
|
||||
"""Check if this driver is capable of handling the givens."""
|
||||
def start_console(self, task, node):
|
||||
"""Start a remote console for the nodes."""
|
||||
|
||||
@abc.abstractmethod
|
||||
def start_console(self):
|
||||
"""Start a remote console for this BMC."""
|
||||
def stop_console(self, task, node):
|
||||
"""Stop the remote console session for the nodes."""
|
||||
|
||||
@abc.abstractmethod
|
||||
def stop_console(self):
|
||||
"""Stop the remote console session for this BMC."""
|
||||
def get_power_state(self, task, node):
|
||||
"""Return the power state of the nodes."""
|
||||
|
||||
@abc.abstractmethod
|
||||
def get_power_state(self):
|
||||
"""Return the power state."""
|
||||
def set_power_state(self, task, node):
|
||||
"""Set the power state of the nodes."""
|
||||
|
||||
@abc.abstractmethod
|
||||
def set_power_state(self):
|
||||
"""Set the power state."""
|
||||
|
||||
@abc.abstractmethod
|
||||
def reboot(self):
|
||||
"""Perform a hard reboot."""
|
||||
def reboot(self, task, node):
|
||||
"""Perform a hard reboot of the nodes."""
|
||||
|
@ -21,49 +21,41 @@ Fake drivers used in testing.
|
||||
from ironic.drivers import base
|
||||
|
||||
|
||||
class FakeDeploymentDriver(base.DeploymentDriver):
|
||||
class FakeDeployDriver(base.DeployDriver):
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def is_capable(self):
|
||||
return True
|
||||
|
||||
def activate_bootloader(self):
|
||||
def activate_bootloader(self, task, node):
|
||||
pass
|
||||
|
||||
def deactivate_bootloader(self):
|
||||
def deactivate_bootloader(self, task, node):
|
||||
pass
|
||||
|
||||
def activate_node(self):
|
||||
def activate_node(self, task, node):
|
||||
pass
|
||||
|
||||
def deactivate_node(self):
|
||||
def deactivate_node(self, task, node):
|
||||
pass
|
||||
|
||||
|
||||
class FakeBMCDriver(base.BMCDriver):
|
||||
class FakeControlDriver(base.ControlDriver):
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def is_capable(self):
|
||||
return True
|
||||
|
||||
def start_console(self):
|
||||
def start_console(self, task, node):
|
||||
pass
|
||||
|
||||
def stop_console(self):
|
||||
def stop_console(self, task, node):
|
||||
pass
|
||||
|
||||
def attach_console(self):
|
||||
def attach_console(self, task, node):
|
||||
pass
|
||||
|
||||
def get_power_state(self):
|
||||
def get_power_state(self, task, node):
|
||||
pass
|
||||
|
||||
def set_power_state(self):
|
||||
def set_power_state(self, task, node):
|
||||
pass
|
||||
|
||||
def reboot(self):
|
||||
def reboot(self, task, node):
|
||||
pass
|
||||
|
@ -83,12 +83,12 @@ def _get_console_pid(node_id):
|
||||
return None
|
||||
|
||||
|
||||
class IPMIPowerDriver(base.BMCDriver):
|
||||
class IPMIPowerDriver(base.ControlDriver):
|
||||
"""Generic IPMI Power Driver
|
||||
|
||||
This BMCDriver class provides mechanism for controlling the power state
|
||||
of physical hardware via IPMI calls. It also provides console access
|
||||
for some supported hardware.
|
||||
This ControlDriver class provides mechanism for controlling the power state
|
||||
of physical hardware via IPMI calls. It also provides console access for
|
||||
some supported hardware.
|
||||
"""
|
||||
|
||||
def __init__(self, node, **kwargs):
|
||||
|
@ -32,6 +32,15 @@ console_scripts =
|
||||
ironic-dbsync = ironic.cmd.dbsync:main
|
||||
ironic-manager = ironic.cmd.manager:main
|
||||
|
||||
ironic.controllers =
|
||||
fake = ironic.drivers.fake:FakeControlDriver
|
||||
ipmi = ironic.drivers.ipmi:IPMIPowerDriver
|
||||
# vpd = ironic.drivers.vpd:VirtualPowerDriver
|
||||
|
||||
ironic.deployers =
|
||||
fake = ironic.drivers.fake:FakeDeployDriver
|
||||
# pxe = ironic.drivers.pxe.PXEDeployDriver
|
||||
|
||||
[build_sphinx]
|
||||
all_files = 1
|
||||
build-dir = doc/build
|
||||
|
Loading…
x
Reference in New Issue
Block a user