Merge "Power fault recovery: client support"
This commit is contained in:
commit
acc54b48d1
ironicclient
common
osc/v1
tests/unit
v1
releasenotes/notes
@ -43,7 +43,7 @@ from ironicclient import exc
|
||||
# http://specs.openstack.org/openstack/ironic-specs/specs/kilo/api-microversions.html # noqa
|
||||
# for full details.
|
||||
DEFAULT_VER = '1.9'
|
||||
LAST_KNOWN_API_VERSION = 38
|
||||
LAST_KNOWN_API_VERSION = 42
|
||||
LATEST_VERSION = '1.{}'.format(LAST_KNOWN_API_VERSION)
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -555,6 +555,11 @@ class ListBaremetalNode(command.Lister):
|
||||
default=None,
|
||||
help=_("Limit list to nodes not in maintenance mode"),
|
||||
)
|
||||
parser.add_argument(
|
||||
'--fault',
|
||||
dest='fault',
|
||||
metavar='<fault>',
|
||||
help=_("List nodes in specified fault."))
|
||||
associated_group = parser.add_mutually_exclusive_group()
|
||||
associated_group.add_argument(
|
||||
'--associated',
|
||||
@ -625,6 +630,8 @@ class ListBaremetalNode(command.Lister):
|
||||
params['associated'] = False
|
||||
if parsed_args.maintenance is not None:
|
||||
params['maintenance'] = parsed_args.maintenance
|
||||
if parsed_args.fault is not None:
|
||||
params['fault'] = parsed_args.fault
|
||||
if parsed_args.provision_state:
|
||||
params['provision_state'] = parsed_args.provision_state
|
||||
if parsed_args.driver:
|
||||
|
@ -592,13 +592,12 @@ class TestBaremetalList(TestBaremetal):
|
||||
'Console Enabled', 'Driver', 'Driver Info',
|
||||
'Driver Internal Info', 'Extra', 'Instance Info',
|
||||
'Instance UUID', 'Last Error', 'Maintenance',
|
||||
'Maintenance Reason', 'Power State', 'Properties',
|
||||
'Provisioning State', 'Provision Updated At',
|
||||
'Current RAID configuration', 'Reservation',
|
||||
'Resource Class',
|
||||
'Target Power State', 'Target Provision State',
|
||||
'Target RAID configuration', 'Traits',
|
||||
'Updated At', 'Inspection Finished At',
|
||||
'Maintenance Reason', 'Fault',
|
||||
'Power State', 'Properties', 'Provisioning State',
|
||||
'Provision Updated At', 'Current RAID configuration',
|
||||
'Reservation', 'Resource Class', 'Target Power State',
|
||||
'Target Provision State', 'Target RAID configuration',
|
||||
'Traits', 'Updated At', 'Inspection Finished At',
|
||||
'Inspection Started At', 'UUID', 'Name',
|
||||
'Boot Interface', 'Console Interface',
|
||||
'Deploy Interface', 'Inspect Interface',
|
||||
@ -621,6 +620,7 @@ class TestBaremetalList(TestBaremetal):
|
||||
'',
|
||||
baremetal_fakes.baremetal_maintenance,
|
||||
'',
|
||||
'',
|
||||
baremetal_fakes.baremetal_power_state,
|
||||
'',
|
||||
baremetal_fakes.baremetal_provision_state,
|
||||
@ -713,6 +713,33 @@ class TestBaremetalList(TestBaremetal):
|
||||
self.check_parser,
|
||||
self.cmd, arglist, verifylist)
|
||||
|
||||
def test_baremetal_list_fault(self):
|
||||
arglist = [
|
||||
'--maintenance',
|
||||
'--fault', 'power failure',
|
||||
]
|
||||
verifylist = [
|
||||
('maintenance', True),
|
||||
('fault', 'power failure'),
|
||||
]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
# DisplayCommandBase.take_action() returns two tuples
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
# Set expected values
|
||||
kwargs = {
|
||||
'marker': None,
|
||||
'limit': None,
|
||||
'maintenance': True,
|
||||
'fault': 'power failure'
|
||||
}
|
||||
|
||||
self.baremetal_mock.node.list.assert_called_with(
|
||||
**kwargs
|
||||
)
|
||||
|
||||
def test_baremetal_list_associated(self):
|
||||
arglist = [
|
||||
'--associated',
|
||||
|
@ -46,6 +46,7 @@ class NodeShellTest(utils.BaseTestCase):
|
||||
'last_error',
|
||||
'maintenance',
|
||||
'maintenance_reason',
|
||||
'fault',
|
||||
'name',
|
||||
'boot_interface',
|
||||
'console_interface',
|
||||
|
@ -58,7 +58,7 @@ class NodeManager(base.CreateManager):
|
||||
def list(self, associated=None, maintenance=None, marker=None, limit=None,
|
||||
detail=False, sort_key=None, sort_dir=None, fields=None,
|
||||
provision_state=None, driver=None, resource_class=None,
|
||||
chassis=None):
|
||||
chassis=None, fault=None):
|
||||
"""Retrieve a list of nodes.
|
||||
|
||||
:param associated: Optional. Either a Boolean or a string
|
||||
@ -105,6 +105,9 @@ class NodeManager(base.CreateManager):
|
||||
:param chassis: Optional, the UUID of a chassis. Used to get only
|
||||
nodes of this chassis.
|
||||
|
||||
:param fault: Optional. String value to get only nodes with
|
||||
specified fault.
|
||||
|
||||
:returns: A list of nodes.
|
||||
|
||||
"""
|
||||
@ -121,6 +124,8 @@ class NodeManager(base.CreateManager):
|
||||
filters.append('associated=%s' % associated)
|
||||
if maintenance is not None:
|
||||
filters.append('maintenance=%s' % maintenance)
|
||||
if fault is not None:
|
||||
filters.append('fault=%s' % fault)
|
||||
if provision_state is not None:
|
||||
filters.append('provision_state=%s' % provision_state)
|
||||
if driver is not None:
|
||||
|
@ -76,6 +76,7 @@ class Resource(object):
|
||||
'last_error': 'Last Error',
|
||||
'maintenance': 'Maintenance',
|
||||
'maintenance_reason': 'Maintenance Reason',
|
||||
'fault': 'Fault',
|
||||
'mode': 'Mode',
|
||||
'name': 'Name',
|
||||
'node_uuid': 'Node UUID',
|
||||
@ -204,6 +205,7 @@ NODE_DETAILED_RESOURCE = Resource(
|
||||
'last_error',
|
||||
'maintenance',
|
||||
'maintenance_reason',
|
||||
'fault',
|
||||
'power_state',
|
||||
'properties',
|
||||
'provision_state',
|
||||
|
5
releasenotes/notes/node-fault-adbe74fd600063ee.yaml
Normal file
5
releasenotes/notes/node-fault-adbe74fd600063ee.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Supports the node's ``fault`` field, introduced in the Bare Metal API
|
||||
version 1.42, including displaying or querying nodes by this field.
|
Loading…
x
Reference in New Issue
Block a user