Merge "Add OSC 'baremetal driver raid property list' cmd"
This commit is contained in:
commit
ea5263a3ce
@ -94,6 +94,30 @@ class ListBaremetalDriverProperty(command.Lister):
|
|||||||
return labels, sorted(driver_properties.items())
|
return labels, sorted(driver_properties.items())
|
||||||
|
|
||||||
|
|
||||||
|
class ListBaremetalDriverRaidProperty(command.Lister):
|
||||||
|
"""List a driver's RAID logical disk properties."""
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__ + ".ListBaremetalDriverRaidProperty")
|
||||||
|
|
||||||
|
def get_parser(self, prog_name):
|
||||||
|
parser = super(ListBaremetalDriverRaidProperty, self).get_parser(
|
||||||
|
prog_name)
|
||||||
|
parser.add_argument(
|
||||||
|
'driver',
|
||||||
|
metavar='<driver>',
|
||||||
|
help='Name of the driver.')
|
||||||
|
return parser
|
||||||
|
|
||||||
|
def take_action(self, parsed_args):
|
||||||
|
self.log.debug("take_action(%s)", parsed_args)
|
||||||
|
baremetal_client = self.app.client_manager.baremetal
|
||||||
|
|
||||||
|
raid_props = baremetal_client.driver.raid_logical_disk_properties(
|
||||||
|
parsed_args.driver)
|
||||||
|
labels = ['Property', 'Description']
|
||||||
|
return labels, sorted(raid_props.items())
|
||||||
|
|
||||||
|
|
||||||
class PassthruCallBaremetalDriver(command.ShowOne):
|
class PassthruCallBaremetalDriver(command.ShowOne):
|
||||||
"""Call a vendor passthru method for a driver."""
|
"""Call a vendor passthru method for a driver."""
|
||||||
|
|
||||||
|
@ -168,6 +168,47 @@ class TestListBaremetalDriverProperty(TestBaremetalDriver):
|
|||||||
self.cmd, arglist, verifylist)
|
self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
|
|
||||||
|
class TestListBaremetalDriverRaidProperty(TestBaremetalDriver):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
super(TestListBaremetalDriverRaidProperty, self).setUp()
|
||||||
|
|
||||||
|
(self.baremetal_mock.driver.
|
||||||
|
raid_logical_disk_properties.return_value) = {
|
||||||
|
'RAIDProperty1': 'driver_raid_property1',
|
||||||
|
'RAIDProperty2': 'driver_raid_property2',
|
||||||
|
}
|
||||||
|
|
||||||
|
self.cmd = (
|
||||||
|
baremetal_driver.ListBaremetalDriverRaidProperty(
|
||||||
|
self.app, None))
|
||||||
|
|
||||||
|
def test_baremetal_driver_raid_property_list(self):
|
||||||
|
arglist = ['fakedrivername']
|
||||||
|
verifylist = []
|
||||||
|
|
||||||
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
columns, data = self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
|
(self.baremetal_mock.driver.
|
||||||
|
raid_logical_disk_properties.assert_called_with(*arglist))
|
||||||
|
|
||||||
|
collist = ('Property', 'Description')
|
||||||
|
self.assertEqual(collist, tuple(columns))
|
||||||
|
|
||||||
|
expected_data = [('RAIDProperty1', 'driver_raid_property1'),
|
||||||
|
('RAIDProperty2', 'driver_raid_property2')]
|
||||||
|
self.assertEqual(expected_data, data)
|
||||||
|
|
||||||
|
def test_baremetal_driver_raid_property_list_no_arg(self):
|
||||||
|
arglist = []
|
||||||
|
verifylist = []
|
||||||
|
|
||||||
|
self.assertRaises(oscutils.ParserException,
|
||||||
|
self.check_parser,
|
||||||
|
self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
|
|
||||||
class TestPassthruCallBaremetalDriver(TestBaremetalDriver):
|
class TestPassthruCallBaremetalDriver(TestBaremetalDriver):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- Adds the ``openstack baremetal driver raid property list <driver>``
|
||||||
|
command. For a specified driver, this returns a list of the
|
||||||
|
RAID logical disk properties that can be specified, along with
|
||||||
|
a description for each property. (The values of these properties
|
||||||
|
are specified in a node's ``target_raid_config`` field.)
|
@ -40,6 +40,7 @@ openstack.baremetal.v1 =
|
|||||||
baremetal_driver_passthru_call = ironicclient.osc.v1.baremetal_driver:PassthruCallBaremetalDriver
|
baremetal_driver_passthru_call = ironicclient.osc.v1.baremetal_driver:PassthruCallBaremetalDriver
|
||||||
baremetal_driver_passthru_list = ironicclient.osc.v1.baremetal_driver:PassthruListBaremetalDriver
|
baremetal_driver_passthru_list = ironicclient.osc.v1.baremetal_driver:PassthruListBaremetalDriver
|
||||||
baremetal_driver_property_list = ironicclient.osc.v1.baremetal_driver:ListBaremetalDriverProperty
|
baremetal_driver_property_list = ironicclient.osc.v1.baremetal_driver:ListBaremetalDriverProperty
|
||||||
|
baremetal_driver_raid_property_list = ironicclient.osc.v1.baremetal_driver:ListBaremetalDriverRaidProperty
|
||||||
baremetal_driver_show = ironicclient.osc.v1.baremetal_driver:ShowBaremetalDriver
|
baremetal_driver_show = ironicclient.osc.v1.baremetal_driver:ShowBaremetalDriver
|
||||||
baremetal_list = ironicclient.osc.v1.baremetal_node:ListBaremetal
|
baremetal_list = ironicclient.osc.v1.baremetal_node:ListBaremetal
|
||||||
baremetal_node_abort = ironicclient.osc.v1.baremetal_node:AbortBaremetalNode
|
baremetal_node_abort = ironicclient.osc.v1.baremetal_node:AbortBaremetalNode
|
||||||
|
Loading…
Reference in New Issue
Block a user