Check if boot device is persistent on ipminative

The commit 94433a2ab522d8b6ae2e2cf24de0ff723e491c45 to pyghmi added
'persistent' to the return dict of get_bootdev(). This commit is just
making use of it.

Change-Id: I724246de951c1ac94a001ebd8c83f8ef4ffa7e66
This commit is contained in:
Lucas Alvares Gomes 2014-08-05 09:43:19 +01:00
parent 5d4d79fbd1
commit 0c1f44243d
2 changed files with 13 additions and 1 deletions

View File

@ -365,7 +365,7 @@ class NativeIPMIManagement(base.ManagementInterface):
"""
driver_info = _parse_driver_info(task.node)
response = {'boot_device': None, 'persistent': None}
response = {'boot_device': None}
try:
ipmicmd = ipmi_command.Command(bmc=driver_info['address'],
userid=driver_info['username'],
@ -382,6 +382,7 @@ class NativeIPMIManagement(base.ManagementInterface):
{'node_id': driver_info['uuid'], 'error': e})
raise exception.IPMIFailure(cmd=e)
response['persistent'] = ret.get('persistent')
bootdev = ret.get('bootdev')
if bootdev:
response['boot_device'] = next((dev for dev, hdev in

View File

@ -265,6 +265,17 @@ class IPMINativeDriverTestCase(db_base.DbTestCase):
with task_manager.acquire(self.context, self.node.uuid) as task:
bootdev = self.driver.management.get_boot_device(task)
self.assertEqual(boot_devices.DISK, bootdev['boot_device'])
self.assertIsNone(bootdev['persistent'])
@mock.patch('pyghmi.ipmi.command.Command')
def test_management_interface_get_boot_device_persistent(self, ipmi_mock):
ipmicmd = ipmi_mock.return_value
ipmicmd.get_bootdev.return_value = {'bootdev': 'hd',
'persistent': True}
with task_manager.acquire(self.context, self.node.uuid) as task:
bootdev = self.driver.management.get_boot_device(task)
self.assertEqual(boot_devices.DISK, bootdev['boot_device'])
self.assertTrue(bootdev['persistent'])
@mock.patch('pyghmi.ipmi.command.Command')
def test_management_interface_get_boot_device_fail(self, ipmi_mock):