def update_boot_mode_capability(task): """Update 'boot_mode' capability value of node's 'capabilities' property. :param task: Task object. """ ilo_object = get_ilo_object(task.node) try: p_boot_mode = ilo_object.get_pending_boot_mode() if p_boot_mode == "UNKNOWN": # NOTE(faizan) ILO will return this in remote cases and mostly on # the nodes which supports UEFI. Such nodes mostly comes with UEFI # as default boot mode. So we will try setting bootmode to UEFI # and if it fails then we fall back to BIOS boot mode. ilo_object.set_pending_boot_mode("UEFI") p_boot_mode = "UEFI" except ilo_client.IloCommandNotSupportedError: p_boot_mode = DEFAULT_BOOT_MODE driver_utils.rm_node_capability(task, "boot_mode") driver_utils.add_node_capability(task, "boot_mode", BOOT_MODE_ILO_TO_GENERIC[p_boot_mode.lower()])
def update_boot_mode_capability(task): """Update 'boot_mode' capability value of node's 'capabilities' property. :param task: Task object. """ ilo_object = get_ilo_object(task.node) try: p_boot_mode = ilo_object.get_pending_boot_mode() if p_boot_mode == 'UNKNOWN': # NOTE(faizan) ILO will return this in remote cases and mostly on # the nodes which supports UEFI. Such nodes mostly comes with UEFI # as default boot mode. So we will try setting bootmode to UEFI # and if it fails then we fall back to BIOS boot mode. ilo_object.set_pending_boot_mode('UEFI') p_boot_mode = 'UEFI' except ilo_client.IloCommandNotSupportedError: p_boot_mode = DEFAULT_BOOT_MODE driver_utils.rm_node_capability(task, 'boot_mode') driver_utils.add_node_capability(task, 'boot_mode', BOOT_MODE_ILO_TO_GENERIC[p_boot_mode.lower()])
def test_rm_node_capability_non_existent(self): with task_manager.acquire(self.context, self.node.uuid, shared=False) as task: task.node.properties['capabilities'] = 'a:b' self.assertIsNone(driver_utils.rm_node_capability(task, 'x')) self.assertEqual('a:b', task.node.properties['capabilities'])
def test_rm_node_capability(self): with task_manager.acquire(self.context, self.node.uuid, shared=False) as task: task.node.properties['capabilities'] = 'a:b' driver_utils.rm_node_capability(task, 'a') self.assertIsNone(task.node.properties['capabilities'])