Merge "Make task parameter mandatory in get_supported_boot_devices"

This commit is contained in:
Jenkins 2015-11-13 12:19:06 +00:00 committed by Gerrit Code Review
commit 7ec5a06c3c
5 changed files with 9 additions and 43 deletions

View File

@ -1936,16 +1936,7 @@ class ConductorManager(periodic_task.PeriodicTasks):
if not getattr(task.driver, 'management', None):
raise exception.UnsupportedDriverExtension(
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)
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()
return task.driver.management.get_supported_boot_devices(task)
@messaging.expected_exceptions(exception.NoFreeConductorWorker,
exception.NodeLocked,

View File

@ -748,13 +748,6 @@ class ManagementInterface(BaseInterface):
: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
def get_supported_boot_devices(self, task):
"""Get a list of the supported boot devices.

View File

@ -60,9 +60,10 @@ class UcsManagement(base.ManagementInterface):
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.
:param task: a task from TaskManager.
:returns: A list with the supported boot devices defined
in :mod:`ironic.common.boot_devices`.
"""

View File

@ -2830,28 +2830,6 @@ class UpdatePortTestCase(_ServiceSetUpMixin, tests_db_base.DbTestCase):
node.uuid)
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):
node = obj_utils.create_test_node(self.context, driver='fake')
# null the management interface

View File

@ -53,9 +53,12 @@ class UcsManagementTestCase(db_base.DbTestCase):
self.assertEqual(expected, self.interface.get_properties())
def test_get_supported_boot_devices(self):
expected = [boot_devices.PXE, boot_devices.DISK, boot_devices.CDROM]
self.assertEqual(sorted(expected),
sorted(self.interface.get_supported_boot_devices()))
with task_manager.acquire(self.context, self.node.uuid) as task:
expected = [boot_devices.PXE, boot_devices.DISK,
boot_devices.CDROM]
self.assertEqual(
sorted(expected),
sorted(self.interface.get_supported_boot_devices(task)))
@mock.patch('ironic.drivers.modules.ucs.helper.ucs_helper',
spec_set=True, autospec=True)