Merge "Make task parameter mandatory in get_supported_boot_devices"
This commit is contained in:
commit
7ec5a06c3c
@ -1936,16 +1936,7 @@ class ConductorManager(periodic_task.PeriodicTasks):
|
|||||||
if not getattr(task.driver, 'management', None):
|
if not getattr(task.driver, 'management', None):
|
||||||
raise exception.UnsupportedDriverExtension(
|
raise exception.UnsupportedDriverExtension(
|
||||||
driver=task.node.driver, extension='management')
|
driver=task.node.driver, extension='management')
|
||||||
if task.driver.management.get_supported_boot_devices_task_arg:
|
return task.driver.management.get_supported_boot_devices(task)
|
||||||
return task.driver.management.get_supported_boot_devices(task)
|
|
||||||
else:
|
|
||||||
LOG.warning(_LW("Driver '%s' is missing a task "
|
|
||||||
"argument to the method "
|
|
||||||
"get_supported_boot_devices() which "
|
|
||||||
"has been deprecated. Please update the code "
|
|
||||||
"to include a task argument."),
|
|
||||||
task.node.driver)
|
|
||||||
return task.driver.management.get_supported_boot_devices()
|
|
||||||
|
|
||||||
@messaging.expected_exceptions(exception.NoFreeConductorWorker,
|
@messaging.expected_exceptions(exception.NoFreeConductorWorker,
|
||||||
exception.NodeLocked,
|
exception.NodeLocked,
|
||||||
|
@ -748,13 +748,6 @@ class ManagementInterface(BaseInterface):
|
|||||||
:raises: MissingParameterValue
|
:raises: MissingParameterValue
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@property
|
|
||||||
def get_supported_boot_devices_task_arg(self):
|
|
||||||
# NOTE(MattMan): remove this method in next cycle(Mitaka) as task
|
|
||||||
# parameter will be mandatory then.
|
|
||||||
argspec = inspect.getargspec(self.get_supported_boot_devices)
|
|
||||||
return len(argspec.args) > 1
|
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def get_supported_boot_devices(self, task):
|
def get_supported_boot_devices(self, task):
|
||||||
"""Get a list of the supported boot devices.
|
"""Get a list of the supported boot devices.
|
||||||
|
@ -60,9 +60,10 @@ class UcsManagement(base.ManagementInterface):
|
|||||||
|
|
||||||
ucs_helper.parse_driver_info(task.node)
|
ucs_helper.parse_driver_info(task.node)
|
||||||
|
|
||||||
def get_supported_boot_devices(self):
|
def get_supported_boot_devices(self, task):
|
||||||
"""Get a list of the supported boot devices.
|
"""Get a list of the supported boot devices.
|
||||||
|
|
||||||
|
:param task: a task from TaskManager.
|
||||||
:returns: A list with the supported boot devices defined
|
:returns: A list with the supported boot devices defined
|
||||||
in :mod:`ironic.common.boot_devices`.
|
in :mod:`ironic.common.boot_devices`.
|
||||||
"""
|
"""
|
||||||
|
@ -2830,28 +2830,6 @@ class UpdatePortTestCase(_ServiceSetUpMixin, tests_db_base.DbTestCase):
|
|||||||
node.uuid)
|
node.uuid)
|
||||||
self.assertEqual([boot_devices.PXE], bootdevs)
|
self.assertEqual([boot_devices.PXE], bootdevs)
|
||||||
|
|
||||||
def test_get_supported_boot_devices_no_task(self):
|
|
||||||
# NOTE(MattMan): This test method should be removed in next
|
|
||||||
# cycle(Mitaka), task parameter will be mandatory then
|
|
||||||
node = obj_utils.create_test_node(self.context, driver='fake')
|
|
||||||
|
|
||||||
def no_task_get_supported_boot_devices():
|
|
||||||
return "FAKE_BOOT_DEVICE_NO_TASK"
|
|
||||||
|
|
||||||
# Override driver's get_supported_boot_devices method ensuring
|
|
||||||
# no task parameter
|
|
||||||
saved_get_boot_devices = \
|
|
||||||
self.driver.management.get_supported_boot_devices
|
|
||||||
self.driver.management.get_supported_boot_devices = \
|
|
||||||
no_task_get_supported_boot_devices
|
|
||||||
bootdevs = self.service.get_supported_boot_devices(self.context,
|
|
||||||
node.uuid)
|
|
||||||
self.assertEqual("FAKE_BOOT_DEVICE_NO_TASK", bootdevs)
|
|
||||||
|
|
||||||
# Revert back to original method
|
|
||||||
self.driver.management.get_supported_boot_devices = \
|
|
||||||
saved_get_boot_devices
|
|
||||||
|
|
||||||
def test_get_supported_boot_devices_iface_not_supported(self):
|
def test_get_supported_boot_devices_iface_not_supported(self):
|
||||||
node = obj_utils.create_test_node(self.context, driver='fake')
|
node = obj_utils.create_test_node(self.context, driver='fake')
|
||||||
# null the management interface
|
# null the management interface
|
||||||
|
@ -53,9 +53,12 @@ class UcsManagementTestCase(db_base.DbTestCase):
|
|||||||
self.assertEqual(expected, self.interface.get_properties())
|
self.assertEqual(expected, self.interface.get_properties())
|
||||||
|
|
||||||
def test_get_supported_boot_devices(self):
|
def test_get_supported_boot_devices(self):
|
||||||
expected = [boot_devices.PXE, boot_devices.DISK, boot_devices.CDROM]
|
with task_manager.acquire(self.context, self.node.uuid) as task:
|
||||||
self.assertEqual(sorted(expected),
|
expected = [boot_devices.PXE, boot_devices.DISK,
|
||||||
sorted(self.interface.get_supported_boot_devices()))
|
boot_devices.CDROM]
|
||||||
|
self.assertEqual(
|
||||||
|
sorted(expected),
|
||||||
|
sorted(self.interface.get_supported_boot_devices(task)))
|
||||||
|
|
||||||
@mock.patch('ironic.drivers.modules.ucs.helper.ucs_helper',
|
@mock.patch('ironic.drivers.modules.ucs.helper.ucs_helper',
|
||||||
spec_set=True, autospec=True)
|
spec_set=True, autospec=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user