Fix setting persistent boot device does not work

- The old value 'is_next_boot_persistent'=False of "driver_internal_info"
is still in database, Because when persistent set is True we didn't set
'is_next_boot_persistent'=True. This will lead to get_boot_device work
wrong in response boot information.

https://github.com/openstack/ironic/blob/70b992c/ironic/drivers/modules/ipmitool.py#L975
or
https://github.com/openstack/ironic/blob/70b992c/ironic/drivers/modules/ipminative.py#L501

Thus we have to pop "is_next_boot_persistent" to fix the problem.

Co-Authored-By: Dmitry Tantsur <divius.inside@gmail.com>
Change-Id: I79efed519b2bacf178f078b338394ca0c4e87d4f
Closes-bug: #1626453
This commit is contained in:
Luong Anh Tuan 2016-09-26 16:06:28 +07:00
parent bbd0e96c4b
commit 6fa142160e
3 changed files with 10 additions and 2 deletions

View File

@ -220,6 +220,7 @@ def force_persistent_boot(task, device, persistent):
node = task.node
driver_internal_info = node.driver_internal_info
if persistent:
driver_internal_info.pop('is_next_boot_persistent', None)
driver_internal_info['persistent_boot_device'] = device
else:
driver_internal_info['is_next_boot_persistent'] = False

View File

@ -158,8 +158,10 @@ class UtilsTestCase(db_base.DbTestCase):
ret = driver_utils.force_persistent_boot(task, 'pxe', True)
self.assertIsNone(ret)
task.node.refresh()
self.assertIn('persistent_boot_device',
task.node.driver_internal_info)
self.assertIn(('persistent_boot_device', 'pxe'),
task.node.driver_internal_info.items())
self.assertNotIn('is_next_boot_persistent',
task.node.driver_internal_info)
def test_force_persistent_boot_false(self):
with task_manager.acquire(self.context, self.node.uuid,

View File

@ -0,0 +1,5 @@
---
fixes:
- This fixes the issue setting persistent boot device does not work
with ipmi_force_boot_device=True. For more information, see
https://bugs.launchpad.net/ironic/+bug/1626453