Add validate_driver_info to driver classes.

Change-Id: I8ba2f4bd70bd2d7af405868cca2aedb56d3f0640
This commit is contained in:
Devananda van der Veen 2013-05-24 13:32:25 -07:00
parent b9f39b81b9
commit 438b77e006
3 changed files with 34 additions and 1 deletions

View File

@ -32,6 +32,17 @@ class DeployDriver(object):
def __init__(self):
"""Constructor."""
@abc.abstractmethod
def validate_driver_info(cls, node):
"""Validate the driver-specific Node info.
This method validates whether the 'deploy_info' property of the
supplied nodes contains the required information for this driver to
manage the nodes.
:returns: True or False, depending on capabilities.
"""
@abc.abstractmethod
def activate_bootloader(self, task, node):
"""Prepare the bootloader for this deployment."""
@ -55,9 +66,20 @@ class ControlDriver(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def __init__(self, nodes):
def __init__(self):
"""Constructor."""
@abc.abstractmethod
def validate_driver_info(cls, node):
"""Validate the driver-specific Node info.
This method validates whether the 'control_info' property of the
supplied nodes contains the required information for this driver to
manage the nodes.
:returns: True or False, depending on capabilities.
"""
@abc.abstractmethod
def start_console(self, task, node):
"""Start a remote console for the nodes."""

View File

@ -25,6 +25,9 @@ class FakeDeployDriver(base.DeployDriver):
def __init__(self):
pass
def validate_driver_info(self, node):
return True
def activate_bootloader(self, task, node):
pass
@ -42,6 +45,9 @@ class FakeControlDriver(base.ControlDriver):
def __init__(self):
pass
def validate_driver_info(self, node):
return True
def start_console(self, task, node):
pass

View File

@ -198,6 +198,11 @@ class IPMIPowerDriver(base.ControlDriver):
else:
self.state = states.ERROR
def validate_driver_info(node):
# Temporary stub so patch I8ba2f4bd70bd2d7af405868cca2aedb56d3f0640
# will pass. The next patch actually implements this.
pass
def get_power_state(self):
"""Checks and returns current power state."""
self._update_state()