Fix the message in the set_raid_config method

The exception message was displaying the driver object representation
instead of the plain text value of the node's driver field.

Change-Id: I5111e6ad9d3a07e90c7ae7846f4bb825e15c13c6
This commit is contained in:
Vladyslav Drok 2016-11-21 19:30:49 +02:00
parent e3bedc4ead
commit f7a8a2cfa6
2 changed files with 3 additions and 1 deletions

View File

@ -2136,7 +2136,7 @@ class ConductorManager(base_manager.BaseConductorManager):
node = task.node
if not getattr(task.driver, 'raid', None):
raise exception.UnsupportedDriverExtension(
driver=task.driver, extension='raid')
driver=task.node.driver, extension='raid')
# Operator may try to unset node.target_raid_config. So, try to
# validate only if it is not empty.
if target_raid_config:

View File

@ -27,6 +27,7 @@ import oslo_messaging as messaging
from oslo_utils import uuidutils
from oslo_versionedobjects import base as ovo_base
from oslo_versionedobjects import fields
import six
from ironic.common import boot_devices
from ironic.common import driver_factory
@ -3519,6 +3520,7 @@ class RaidTestCases(mgr_utils.ServiceSetUpMixin, tests_db_base.DbTestCase):
self.node.refresh()
self.assertEqual({}, self.node.target_raid_config)
self.assertEqual(exception.UnsupportedDriverExtension, exc.exc_info[0])
self.assertIn('fake', six.text_type(exc.exc_info[1]))
def test_set_target_raid_config_invalid_parameter_value(self):
# Missing raid_level in the below raid config.