Fix nits in the XClarity Driver codebase.
Follow up to commit 346a9a3bfc
* Move exception XClarityError to common/exceptions.py
* Update language of the release note.
* Specify the kind of power operation being performed.
Change-Id: I1dbc49d7d6185ce3c5f37f518bbecd11571a74fb
This commit is contained in:
parent
46ee76aa46
commit
4f08f726be
@ -772,3 +772,7 @@ class InstanceRescueFailure(IronicException):
|
|||||||
class InstanceUnrescueFailure(IronicException):
|
class InstanceUnrescueFailure(IronicException):
|
||||||
_msg_fmt = _('Failed to unrescue instance %(instance)s for node '
|
_msg_fmt = _('Failed to unrescue instance %(instance)s for node '
|
||||||
'%(node)s: %(reason)s')
|
'%(node)s: %(reason)s')
|
||||||
|
|
||||||
|
|
||||||
|
class XClarityError(IronicException):
|
||||||
|
_msg_fmt = _("XClarity exception occurred. Error: %(error)s")
|
||||||
|
@ -67,7 +67,7 @@ def get_xclarity_client():
|
|||||||
msg = (_("Error getting connection to XClarity manager IP: %(ip)s. "
|
msg = (_("Error getting connection to XClarity manager IP: %(ip)s. "
|
||||||
"Error: %(exc)s"), {'ip': CONF.xclarity.manager_ip,
|
"Error: %(exc)s"), {'ip': CONF.xclarity.manager_ip,
|
||||||
'exc': exc})
|
'exc': exc})
|
||||||
raise XClarityError(error=msg)
|
raise exception.XClarityError(error=msg)
|
||||||
return xclarity_client
|
return xclarity_client
|
||||||
|
|
||||||
|
|
||||||
@ -132,7 +132,3 @@ def is_node_managed_by_xclarity(xclarity_client, node):
|
|||||||
return xclarity_client.is_node_managed(hardware_id)
|
return xclarity_client.is_node_managed(hardware_id)
|
||||||
except exception.MissingParameterValue:
|
except exception.MissingParameterValue:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class XClarityError(exception.IronicException):
|
|
||||||
_msg_fmt = _("XClarity exception occurred. Error: %(error)s")
|
|
||||||
|
@ -108,7 +108,7 @@ class XClarityManagement(base.ManagementInterface):
|
|||||||
"Error getting boot device from XClarity for node %(node)s. "
|
"Error getting boot device from XClarity for node %(node)s. "
|
||||||
"Error: %(error)s", {'node': task.node.uuid,
|
"Error: %(error)s", {'node': task.node.uuid,
|
||||||
'error': xclarity_exc})
|
'error': xclarity_exc})
|
||||||
raise common.XClarityError(error=xclarity_exc)
|
raise exception.XClarityError(error=xclarity_exc)
|
||||||
|
|
||||||
persistent = False
|
persistent = False
|
||||||
primary = None
|
primary = None
|
||||||
@ -216,4 +216,4 @@ class XClarityManagement(base.ManagementInterface):
|
|||||||
{'boot_device': xclarity_boot_device, 'node': task.node.uuid,
|
{'boot_device': xclarity_boot_device, 'node': task.node.uuid,
|
||||||
'error': xclarity_exc}
|
'error': xclarity_exc}
|
||||||
)
|
)
|
||||||
raise common.XClarityError(error=xclarity_exc)
|
raise exception.XClarityError(error=xclarity_exc)
|
||||||
|
@ -16,6 +16,7 @@ from ironic_lib import metrics_utils
|
|||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
|
|
||||||
|
from ironic.common import exception
|
||||||
from ironic.common import states
|
from ironic.common import states
|
||||||
from ironic.conductor import task_manager
|
from ironic.conductor import task_manager
|
||||||
from ironic.drivers import base
|
from ironic.drivers import base
|
||||||
@ -66,7 +67,7 @@ class XClarityPower(base.PowerInterface):
|
|||||||
"%(error)s"),
|
"%(error)s"),
|
||||||
{'node': task.node.uuid, 'error': xclarity_exc}
|
{'node': task.node.uuid, 'error': xclarity_exc}
|
||||||
)
|
)
|
||||||
raise common.XClarityError(error=xclarity_exc)
|
raise exception.XClarityError(error=xclarity_exc)
|
||||||
return common.translate_xclarity_power_state(power_state)
|
return common.translate_xclarity_power_state(power_state)
|
||||||
|
|
||||||
@METRICS.timer('XClarityPower.set_power_state')
|
@METRICS.timer('XClarityPower.set_power_state')
|
||||||
@ -107,12 +108,12 @@ class XClarityPower(base.PowerInterface):
|
|||||||
"Error setting power state of node %(node_uuid)s to "
|
"Error setting power state of node %(node_uuid)s to "
|
||||||
"%(power_state)s",
|
"%(power_state)s",
|
||||||
{'node_uuid': task.node.uuid, 'power_state': power_state})
|
{'node_uuid': task.node.uuid, 'power_state': power_state})
|
||||||
raise common.XClarityError(error=xclarity_exc)
|
raise exception.XClarityError(error=xclarity_exc)
|
||||||
|
|
||||||
@METRICS.timer('XClarityPower.reboot')
|
@METRICS.timer('XClarityPower.reboot')
|
||||||
@task_manager.require_exclusive_lock
|
@task_manager.require_exclusive_lock
|
||||||
def reboot(self, task, timeout=None):
|
def reboot(self, task, timeout=None):
|
||||||
"""Reboot the node
|
"""Soft reboot the node
|
||||||
|
|
||||||
:param task: a TaskManager instance.
|
:param task: a TaskManager instance.
|
||||||
:param timeout: timeout (in seconds). Unsupported by this interface.
|
:param timeout: timeout (in seconds). Unsupported by this interface.
|
||||||
|
@ -22,6 +22,7 @@ import mock
|
|||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
|
|
||||||
from ironic.common import boot_devices
|
from ironic.common import boot_devices
|
||||||
|
from ironic.common import exception
|
||||||
from ironic.conductor import task_manager
|
from ironic.conductor import task_manager
|
||||||
from ironic.drivers.modules.xclarity import common
|
from ironic.drivers.modules.xclarity import common
|
||||||
from ironic.drivers.modules.xclarity import management
|
from ironic.drivers.modules.xclarity import management
|
||||||
@ -82,9 +83,9 @@ class XClarityManagementDriverTestCase(db_base.DbTestCase):
|
|||||||
if 'ironic.drivers.modules.xclarity' in sys.modules:
|
if 'ironic.drivers.modules.xclarity' in sys.modules:
|
||||||
six.moves.reload_module(
|
six.moves.reload_module(
|
||||||
sys.modules['ironic.drivers.modules.xclarity'])
|
sys.modules['ironic.drivers.modules.xclarity'])
|
||||||
ex = common.XClarityError('E')
|
ex = exception.XClarityError('E')
|
||||||
mock_get_xc_client.return_value.set_node_boot_info.side_effect = ex
|
mock_get_xc_client.return_value.set_node_boot_info.side_effect = ex
|
||||||
self.assertRaises(common.XClarityError,
|
self.assertRaises(exception.XClarityError,
|
||||||
task.driver.management.set_boot_device,
|
task.driver.management.set_boot_device,
|
||||||
task,
|
task,
|
||||||
"pxe")
|
"pxe")
|
||||||
@ -117,9 +118,9 @@ class XClarityManagementDriverTestCase(db_base.DbTestCase):
|
|||||||
if 'ironic.drivers.modules.xclarity' in sys.modules:
|
if 'ironic.drivers.modules.xclarity' in sys.modules:
|
||||||
six.moves.reload_module(
|
six.moves.reload_module(
|
||||||
sys.modules['ironic.drivers.modules.xclarity'])
|
sys.modules['ironic.drivers.modules.xclarity'])
|
||||||
ex = common.XClarityError('E')
|
ex = exception.XClarityError('E')
|
||||||
mock_xc_client.return_value.get_node_all_boot_info.side_effect = ex
|
mock_xc_client.return_value.get_node_all_boot_info.side_effect = ex
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
common.XClarityError,
|
exception.XClarityError,
|
||||||
task.driver.management.get_boot_device,
|
task.driver.management.get_boot_device,
|
||||||
task)
|
task)
|
||||||
|
@ -26,6 +26,7 @@ import mock
|
|||||||
|
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
|
|
||||||
|
from ironic.common import exception
|
||||||
from ironic.common import states
|
from ironic.common import states
|
||||||
from ironic.conductor import task_manager
|
from ironic.conductor import task_manager
|
||||||
from ironic.drivers.modules.xclarity import common
|
from ironic.drivers.modules.xclarity import common
|
||||||
@ -84,9 +85,9 @@ class XClarityPowerDriverTestCase(db_base.DbTestCase):
|
|||||||
if 'ironic.drivers.modules.xclarity' in sys.modules:
|
if 'ironic.drivers.modules.xclarity' in sys.modules:
|
||||||
six.moves.reload_module(
|
six.moves.reload_module(
|
||||||
sys.modules['ironic.drivers.modules.xclarity'])
|
sys.modules['ironic.drivers.modules.xclarity'])
|
||||||
ex = common.XClarityError('E')
|
ex = exception.XClarityError('E')
|
||||||
mock_xc_client.return_value.get_node_power_status.side_effect = ex
|
mock_xc_client.return_value.get_node_power_status.side_effect = ex
|
||||||
self.assertRaises(common.XClarityError,
|
self.assertRaises(exception.XClarityError,
|
||||||
task.driver.power.get_power_state,
|
task.driver.power.get_power_state,
|
||||||
task)
|
task)
|
||||||
|
|
||||||
@ -121,9 +122,9 @@ class XClarityPowerDriverTestCase(db_base.DbTestCase):
|
|||||||
if 'ironic.drivers.modules.xclarity' in sys.modules:
|
if 'ironic.drivers.modules.xclarity' in sys.modules:
|
||||||
six.moves.reload_module(
|
six.moves.reload_module(
|
||||||
sys.modules['ironic.drivers.modules.xclarity'])
|
sys.modules['ironic.drivers.modules.xclarity'])
|
||||||
ex = common.XClarityError('E')
|
ex = exception.XClarityError('E')
|
||||||
mock_xc_client.return_value.set_node_power_status.side_effect = ex
|
mock_xc_client.return_value.set_node_power_status.side_effect = ex
|
||||||
self.assertRaises(common.XClarityError,
|
self.assertRaises(exception.XClarityError,
|
||||||
task.driver.power.set_power_state,
|
task.driver.power.set_power_state,
|
||||||
task, states.POWER_OFF)
|
task, states.POWER_OFF)
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
features:
|
features:
|
||||||
- |
|
- |
|
||||||
Adds the new ``xclarity`` hardware type for managing Lenovo server
|
Adds the new ``xclarity`` hardware type for managing the Lenovo IMM2 and IMM3
|
||||||
hardware with the following interfaces:
|
family of server hardware with the following interfaces:
|
||||||
|
|
||||||
* management: ``xclarity``
|
* management: ``xclarity``
|
||||||
* power: ``xclarity``
|
* power: ``xclarity``
|
||||||
|
Loading…
Reference in New Issue
Block a user