def get_boot_device(self, task): driver_info = common.parse_driver_info(task.node) node_has_server_profile = oneview_client.get_server_profile_from_hardware(driver_info) if not node_has_server_profile: raise exception.OperationNotPermitted(_("A Server Profile is not associated with the node.")) boot_order = oneview_client.get_boot_order(driver_info) boot_device = {"boot_device": BOOT_DEVICE_OV_TO_GENERIC.get(boot_order[0]), "persistent": False} return boot_device
def set_boot_device(self, task, device, persistent=False): driver_info = common.parse_driver_info(task.node) if device not in self.get_supported_boot_devices(): raise exception.InvalidParameterValue(_("Invalid boot device %s specified.") % device) node_has_server_profile = oneview_client.get_server_profile_from_hardware(driver_info) if not node_has_server_profile: raise exception.OperationNotPermitted(_("A Server Profile is not associated with the node.")) device_to_oneview = BOOT_DEVICE_MAPPING_TO_OV.get(device) oneview_client.set_boot_device(driver_info, device_to_oneview)