code
string
signature
string
docstring
string
loss_without_docstring
float64
loss_with_docstring
float64
factor
float64
''' Creates a new file from str/unicode, or updates the content of an existing file, with automatic chunking and progress notifications. :param str share_name: Name of existing share. :param str directory_name: The path to the directory. :param st...
def create_file_from_text(self, share_name, directory_name, file_name, text, encoding='utf-8', content_settings=None, metadata=None, timeout=None)
Creates a new file from str/unicode, or updates the content of an existing file, with automatic chunking and progress notifications. :param str share_name: Name of existing share. :param str directory_name: The path to the directory. :param str file_name: ...
1.797062
1.283494
1.400133
''' Downloads a file's content, metadata, and properties. You can specify a range if you don't need to download the file in its entirety. If no range is specified, the full file will be downloaded. See get_file_to_* for high level functions that handle the download of la...
def _get_file(self, share_name, directory_name, file_name, start_range=None, end_range=None, range_get_content_md5=None, timeout=None)
Downloads a file's content, metadata, and properties. You can specify a range if you don't need to download the file in its entirety. If no range is specified, the full file will be downloaded. See get_file_to_* for high level functions that handle the download of large files with autom...
2.042279
1.257048
1.624663
''' Writes the bytes specified by the request body into the specified range. :param str share_name: Name of existing share. :param str directory_name: The path to the directory. :param str file_name: Name of existing file. :pa...
def update_range(self, share_name, directory_name, file_name, data, start_range, end_range, content_md5=None, timeout=None)
Writes the bytes specified by the request body into the specified range. :param str share_name: Name of existing share. :param str directory_name: The path to the directory. :param str file_name: Name of existing file. :param bytes data: ...
1.766053
1.258483
1.403319
''' Clears the specified range and releases the space used in storage for that range. :param str share_name: Name of existing share. :param str directory_name: The path to the directory. :param str file_name: Name of existing...
def clear_range(self, share_name, directory_name, file_name, start_range, end_range, timeout=None)
Clears the specified range and releases the space used in storage for that range. :param str share_name: Name of existing share. :param str directory_name: The path to the directory. :param str file_name: Name of existing file. :para...
1.886963
1.323138
1.426127
''' Retrieves the valid ranges for a file. :param str share_name: Name of existing share. :param str directory_name: The path to the directory. :param str file_name: Name of existing file. :param int start_range: Specifies ...
def list_ranges(self, share_name, directory_name, file_name, start_range=None, end_range=None, timeout=None)
Retrieves the valid ranges for a file. :param str share_name: Name of existing share. :param str directory_name: The path to the directory. :param str file_name: Name of existing file. :param int start_range: Specifies the start offset of ...
1.869016
1.355079
1.379268
system_url = parse.urljoin(self._sushy.get_system_collection_path(), system_id) try: return self._sushy.get_system(system_url) except sushy.exceptions.SushyError as e: msg = (self._('The Redfish System "%(system)s" was not found...
def _get_sushy_system(self, system_id)
Get the sushy system for system_id :param system_id: The identity of the System resource :returns: the Sushy system instance :raises: IloError
2.834641
2.86172
0.990537
manager_url = parse.urljoin(self._sushy.get_manager_collection_path(), manager_id) try: return self._sushy.get_manager(manager_url) except sushy.exceptions.SushyError as e: msg = (self._('The Redfish Manager "%(manager)s" was n...
def _get_sushy_manager(self, manager_id)
Get the sushy Manager for manager_id :param manager_id: The identity of the Manager resource :returns: the Sushy Manager instance :raises: IloError
2.854153
3.02163
0.944574
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) return GET_POWER_STATE_MAP.get(sushy_system.power_state)
def get_host_power_status(self)
Request the power state of the server. :returns: Power State of the server, 'ON' or 'OFF' :raises: IloError, on an error from iLO.
6.212845
8.044019
0.772356
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) try: sushy_system.reset_system(sushy.RESET_FORCE_RESTART) except sushy.exceptions.SushyError as e: msg = (self._('The Redfish controller failed to reset server. ' 'Error %(error)s...
def reset_server(self)
Resets the server. :raises: IloError, on an error from iLO.
3.850578
3.955367
0.973507
if target_value not in POWER_RESET_MAP: msg = ('The parameter "%(parameter)s" value "%(target_value)s" is ' 'invalid. Valid values are: %(valid_power_values)s' % {'parameter': 'target_value', 'target_value': target_value, 'valid_powe...
def set_host_power(self, target_value)
Sets the power state of the system. :param target_value: The target value to be set. Value can be: 'ON' or 'OFF'. :raises: IloError, on an error from iLO. :raises: InvalidInputError, if the target value is not allowed.
2.830373
2.738547
1.033531
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) try: sushy_system.push_power_button(sys_cons.PUSH_POWER_BUTTON_PRESS) except sushy.exceptions.SushyError as e: msg = (self._('The Redfish controller failed to press power button' ...
def press_pwr_btn(self)
Simulates a physical press of the server power button. :raises: IloError, on an error from iLO.
4.401209
4.274069
1.029747
sushy_manager = self._get_sushy_manager(PROLIANT_MANAGER_ID) try: sushy_manager.set_license(key) except sushy.exceptions.SushyError as e: msg = (self._('The Redfish controller failed to update ' 'the license. Error %(error)s') % ...
def activate_license(self, key)
Activates iLO license. :param key: iLO license key. :raises: IloError, on an error from iLO.
3.984719
4.159711
0.957932
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) if (sushy_system.boot.enabled == sushy.BOOT_SOURCE_ENABLED_ONCE): return DEVICE_REDFISH_TO_COMMON.get(sushy_system.boot.target) else: # value returned by RIBCL if one-time boot setting are absent ...
def get_one_time_boot(self)
Retrieves the current setting for the one time boot. :returns: Returns boot device that would be used in next boot. Returns 'Normal' if no device is set.
9.035016
8.005394
1.128616
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) try: return BOOT_MODE_MAP.get( sushy_system.bios_settings.pending_settings.boot_mode) except sushy.exceptions.SushyError as e: msg = (self._('The pending BIOS Settings was not found. Error ...
def get_pending_boot_mode(self)
Retrieves the pending boot mode of the server. Gets the boot mode to be set on next reset. :returns: either LEGACY or UEFI. :raises: IloError, on an error from iLO.
3.632217
4.049939
0.896857
if device not in VIRTUAL_MEDIA_MAP: msg = (self._("Invalid device '%s'. Valid devices: FLOPPY or " "CDROM.") % device) LOG.debug(msg) raise exception.IloInvalidInputError(msg)
def _validate_virtual_media(self, device)
Check if the device is valid device. :param device: virtual media device :raises: IloInvalidInputError, if the device is not valid.
5.031949
4.583974
1.097726
self._validate_virtual_media(device) manager = self._get_sushy_manager(PROLIANT_MANAGER_ID) try: vmedia_device = ( manager.virtual_media.get_member_device( VIRTUAL_MEDIA_MAP[device])) if not vmedia_device.inserted: ...
def eject_virtual_media(self, device)
Ejects the Virtual Media image if one is inserted. :param device: virual media device :raises: IloError, on an error from iLO. :raises: IloInvalidInputError, if the device is not valid.
3.59698
3.467607
1.037309
# CONNECT is a RIBCL call. There is no such property to set in Redfish. if boot_option == 'CONNECT': return self._validate_virtual_media(device) if boot_option not in BOOT_OPTION_MAP: msg = (self._("Virtual media boot option '%s' is invalid.") ...
def set_vm_status(self, device='FLOPPY', boot_option='BOOT_ONCE', write_protect='YES')
Sets the Virtual Media drive status It sets the boot option for virtual media device. Note: boot option can be set only for CD device. :param device: virual media device :param boot_option: boot option to set on the virtual media device :param write_protect: set the write prote...
3.728522
3.615821
1.031169
try: update_service_inst = self._sushy.get_update_service() update_service_inst.flash_firmware(self, file_url) except sushy.exceptions.SushyError as e: msg = (self._('The Redfish controller failed to update firmware ' 'with firmware ...
def update_firmware(self, file_url, component_type)
Updates the given firmware on the server for the given component. :param file_url: location of the raw firmware file. Extraction of the firmware file (if in compact format) is expected to happen prior to this invocation. :param component_type: Type of c...
4.026348
4.105222
0.980787
boot_mode = self.get_current_boot_mode() return (boot_mode == BOOT_MODE_MAP.get(sys_cons.BIOS_BOOT_MODE_UEFI))
def _is_boot_mode_uefi(self)
Checks if the system is in uefi boot mode. :return: 'True' if the boot mode is uefi else 'False'
5.281909
5.928096
0.890996
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) # Return boot device if it is persistent. if ((sushy_system. boot.enabled) == sushy.BOOT_SOURCE_ENABLED_CONTINUOUS): return PERSISTENT_BOOT_MAP.get(sushy_system.boot.target) # Check if we are in B...
def get_persistent_boot_device(self)
Get current persistent boot device set for the host :returns: persistent boot device for the system :raises: IloError, on an error from iLO.
4.005468
4.222178
0.948674
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) if boot_mode.upper() not in BOOT_MODE_MAP_REV.keys(): msg = (('Invalid Boot mode: "%(boot_mode)s" specified, valid boot ' 'modes are either "uefi" or "legacy"') % {'boot_mode': boot_mod...
def set_pending_boot_mode(self, boot_mode)
Sets the boot mode of the system for next boot. :param boot_mode: either 'uefi' or 'legacy'. :raises: IloInvalidInputError, on an invalid input. :raises: IloError, on an error from iLO.
2.805667
2.828449
0.991946
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) # Check if the input is valid for item in devices: if item.upper() not in DEVICE_COMMON_TO_REDFISH: msg = (self._('Invalid input "%(device)s". Valid devices: ' 'NETWORK, H...
def update_persistent_boot(self, devices=[])
Changes the persistent boot device order for the host :param devices: ordered list of boot devices :raises: IloError, on an error from iLO. :raises: IloInvalidInputError, if the given input is not valid.
3.805349
3.635852
1.046618
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) # Check if the input is valid if device.upper() not in DEVICE_COMMON_TO_REDFISH: msg = (self._('Invalid input "%(device)s". Valid devices: ' 'NETWORK, HDD, ISCSI or CDROM.') % ...
def set_one_time_boot(self, device)
Configures a single boot from a specific device. :param device: Device to be set as a one time boot device :raises: IloError, on an error from iLO. :raises: IloInvalidInputError, if the given input is not valid.
3.903456
3.853003
1.013095
try: acc_service = self._sushy.get_account_service() member = acc_service.accounts.get_member_details(self._username) if member is None: msg = (self._("No account found with username: %s") % self._username) LOG.d...
def reset_ilo_credential(self, password)
Resets the iLO password. :param password: The password to be set. :raises: IloError, if account not found or on an error from iLO.
3.047457
3.1222
0.97606
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) try: return SUPPORTED_BOOT_MODE_MAP.get( sushy_system.supported_boot_mode) except sushy.exceptions.SushyError as e: msg = (self._('The Redfish controller failed to get the ' ...
def get_supported_boot_mode(self)
Get the system supported boot modes. :return: any one of the following proliantutils.ilo.constants: SUPPORTED_BOOT_MODE_LEGACY_BIOS_ONLY, SUPPORTED_BOOT_MODE_UEFI_ONLY, SUPPORTED_BOOT_MODE_LEGACY_BIOS_AND_UEFI :raises: IloError, if account not found or on an error f...
3.432856
3.297512
1.041044
capabilities = {} sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) sushy_manager = self._get_sushy_manager(PROLIANT_MANAGER_ID) try: count = len(sushy_system.pci_devices.gpu_devices) boot_mode = rf_utils.get_supported_boot_mode( ...
def get_server_capabilities(self)
Returns the server capabilities raises: IloError on an error from iLO.
3.25763
3.257789
0.999951
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) try: sushy_system.bios_settings.update_bios_to_default() except sushy.exceptions.SushyError as e: msg = (self._("The Redfish controller is unable to update bios " "settings to def...
def reset_bios_to_default(self)
Resets the BIOS settings to default values. :raises: IloError, on an error from iLO.
3.675246
4.12507
0.890954
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) try: secure_boot_enabled = GET_SECUREBOOT_CURRENT_BOOT_MAP.get( sushy_system.secure_boot.current_boot) except sushy.exceptions.SushyError as e: msg = (self._('The Redfish controller failed ...
def get_secure_boot_mode(self)
Get the status of secure boot. :returns: True, if enabled, else False :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
3.56591
3.515641
1.014299
if self._is_boot_mode_uefi(): sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) try: sushy_system.secure_boot.enable_secure_boot(secure_boot_enable) except exception.InvalidInputError as e: msg = (self._('Invalid input. Error %...
def set_secure_boot_mode(self, secure_boot_enable)
Enable/Disable secure boot on the server. Resetting the server post updating this settings is needed from the caller side to make this into effect. :param secure_boot_enable: True, if secure boot needs to be enabled for next boot, else False. :raises: IloError, on an erro...
2.931931
2.953728
0.99262
if self._is_boot_mode_uefi(): sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) try: sushy_system.secure_boot.reset_keys( sys_cons.SECUREBOOT_RESET_KEYS_DEFAULT) except sushy.exceptions.SushyError as e: msg ...
def reset_secure_boot_keys(self)
Reset secure boot keys to manufacturing defaults. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
3.968206
3.866159
1.026395
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) try: # TODO(nisha): Add local_gb here and return after # local_gb changes are merged. # local_gb = sushy_system.storage_summary prop = {'memory_mb': (sushy_system.memory_summary.size_gib * ...
def get_essential_properties(self)
Constructs the dictionary of essential properties Constructs the dictionary of essential properties, named cpu, cpu_arch, local_gb, memory_mb. The MACs are also returned as part of this method.
4.433552
4.074937
1.088005
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) try: pci_settings_map = ( sushy_system.bios_settings.bios_mappings.pci_settings_mappings) nics = [] for mapping in pci_settings_map: for subinstance in mapping['Subinsta...
def _change_iscsi_target_settings(self, iscsi_info)
Change iSCSI target settings. :param iscsi_info: A dictionary that contains information of iSCSI target like target_name, lun, ip_address, port etc. :raises: IloError, on an error from iLO.
3.202009
3.282303
0.975538
if(self._is_boot_mode_uefi()): iscsi_info = {} iscsi_info['iSCSITargetName'] = target_name iscsi_info['iSCSILUN'] = lun iscsi_info['iSCSITargetIpAddress'] = ip_address iscsi_info['iSCSITargetTcpPort'] = int(port) iscsi_info['iSCSIT...
def set_iscsi_info(self, target_name, lun, ip_address, port='3260', auth_method=None, username=None, password=None)
Set iSCSI details of the system in UEFI boot mode. The initiator system is set with the target details like IQN, LUN, IP, Port etc. :param target_name: Target Name for iSCSI. :param lun: logical unit number. :param ip_address: IP address of the target. :param port: port ...
2.699387
2.298829
1.174244
if(self._is_boot_mode_uefi()): iscsi_info = {'iSCSIConnection': 'Disabled'} self._change_iscsi_target_settings(iscsi_info) else: msg = 'iSCSI boot is not supported in the BIOS boot mode' raise exception.IloCommandNotSupportedInBiosError(msg)
def unset_iscsi_info(self)
Disable iSCSI boot option in UEFI boot mode. :raises: IloCommandNotSupportedInBiosError, if the system is in the BIOS boot mode.
6.68436
3.8332
1.743807
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) if(self._is_boot_mode_uefi()): iscsi_data = {'iSCSIInitiatorName': initiator_iqn} try: (sushy_system.bios_settings.iscsi_resource. iscsi_settings.update_iscsi_settings(iscsi_data))...
def set_iscsi_initiator_info(self, initiator_iqn)
Set iSCSI initiator information in iLO. :param initiator_iqn: Initiator iqn for iLO. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedInBiosError, if the system is in the BIOS boot mode.
3.879762
3.552923
1.091992
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) if(self._is_boot_mode_uefi()): try: iscsi_initiator = ( sushy_system.bios_settings.iscsi_resource.iscsi_initiator) except sushy.exceptions.SushyError as e: msg =...
def get_iscsi_initiator_info(self)
Give iSCSI initiator information of iLO. :returns: iSCSI initiator information. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedInBiosError, if the system is in the BIOS boot mode.
3.817157
3.48157
1.096389
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) if sushy_system.power_state != sushy.SYSTEM_POWER_STATE_ON: raise exception.IloError("Server is not in powered on state.") try: sushy_system.reset_system(sushy.RESET_NMI) except sushy.exceptions.S...
def inject_nmi(self)
Inject NMI, Non Maskable Interrupt. Inject NMI (Non Maskable Interrupt) for a node immediately. :raises: IloError, on an error from iLO
3.385181
3.655831
0.925968
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) return GET_POST_STATE_MAP.get(sushy_system.post_state)
def get_host_post_state(self)
Get the current state of system POST. Retrieves current state of system POST. :returns: POST state of the server. The valida states are:- null, Unknown, Reset, PowerOff, InPost, InPostDiscoveryComplete and FinishedPost. :raises: IloError, on an error from iL...
6.793413
8.476152
0.801474
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) return sushy_system.read_raid(raid_config=raid_config)
def read_raid_configuration(self, raid_config=None)
Read the logical drives from the system :param raid_config: None in case of post-delete read or in case of post-create a dictionary containing target raid configuration data. This data stucture should be as follows: ...
5.98567
8.130632
0.736187
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) try: current_settings = sushy_system.bios_settings.json except sushy.exceptions.SushyError as e: msg = (self._('The current BIOS Settings were not found. Error ' '%(error)s') % ...
def get_current_bios_settings(self, only_allowed_settings=True)
Get current BIOS settings. :param: only_allowed_settings: True when only allowed BIOS settings are to be returned. If False, All the BIOS settings supported by iLO are returned. :return: a dictionary of current BIOS settings is returned. Depending on the...
3.936831
4.341506
0.906789
if not data: raise exception.IloError("Could not apply settings with" " empty data") sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) if only_allowed_settings: unsupported_settings = [key for key in data if key not i...
def set_bios_settings(self, data=None, only_allowed_settings=True)
Sets current BIOS settings to the provided data. :param: only_allowed_settings: True when only allowed BIOS settings are to be set. If False, all the BIOS settings supported by iLO and present in the 'data' are set. :param: data: a dictionary of BIOS settings to be appli...
3.76507
3.847443
0.97859
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) try: settings = sushy_system.bios_settings.default_settings except sushy.exceptions.SushyError as e: msg = (self._('The default BIOS Settings were not found. Error ' '%(error)s') ...
def get_default_bios_settings(self, only_allowed_settings=True)
Get default BIOS settings. :param: only_allowed_settings: True when only allowed BIOS settings are to be returned. If False, All the BIOS settings supported by iLO are returned. :return: a dictionary of default BIOS settings(factory settings). Depending ...
3.665521
3.91347
0.936642
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) sushy_system.create_raid(raid_config)
def create_raid_configuration(self, raid_config)
Create the raid configuration on the hardware. Based on user raid_config input, it will create raid :param raid_config: A dictionary containing target raid configuration data. This data stucture should be as follows: raid_config = {'logical_disks...
6.205037
7.681047
0.807837
sushy_system = self._get_sushy_system(PROLIANT_SYSTEM_ID) try: settings_result = sushy_system.bios_settings.messages except sushy.exceptions.SushyError as e: msg = (self._('The BIOS Settings results were not found. Error ' '%(error)s') %...
def get_bios_settings_result(self)
Gets the result of the bios settings applied :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
3.716605
3.942254
0.942762
# get the collection status, headers, thecollection = self._rest_get(collection_uri) if status != 200: msg = self._get_extended_error(thecollection) raise exception.IloError(msg) while status < 300: # verify expected type # Don'...
def _get_collection(self, collection_uri, request_headers=None)
Generator function that returns collection members.
6.075492
5.983068
1.015448
typever = obj['Type'] typesplit = typever.split('.') return typesplit[0] + '.' + typesplit[1]
def _get_type(self, obj)
Return the type of an object.
7.475933
6.380002
1.171776
messages = [] if isinstance(extended_error, dict): if ('Type' in extended_error and extended_error['Type'].startswith('ExtendedError.')): for msg in extended_error['Messages']: message_id = msg['MessageID'] ...
def _render_extended_error_message_list(self, extended_error)
Parse the ExtendedError object and retruns the message. Build a list of decoded messages from the extended_error using the message registries. An ExtendedError JSON object is a response from the with its own schema. This function knows how to parse the ExtendedError object and, using a...
3.55651
3.204364
1.109896
# Assuming only one system present as part of collection, # as we are dealing with iLO's here. status, headers, system = self._rest_get('/rest/v1/Systems/1') if status < 300: stype = self._get_type(system) if stype not in ['ComputerSystem.0', 'ComputerSys...
def _get_host_details(self)
Get the system details.
5.103335
4.532891
1.125846
system = self._get_host_details() if ('links' in system['Oem']['Hp'] and 'BIOS' in system['Oem']['Hp']['links']): # Get the BIOS URI and Settings bios_uri = system['Oem']['Hp']['links']['BIOS']['href'] status, headers, bios_settings = self._r...
def _check_bios_resource(self, properties=[])
Check if the bios resource exists.
3.669769
3.531047
1.039286
system = self._get_host_details() if ('links' in system['Oem']['Hp'] and 'PCIDevices' in system['Oem']['Hp']['links']): # Get the PCI URI and Settings pci_uri = system['Oem']['Hp']['links']['PCIDevices']['href'] status, headers, pci_device_li...
def _get_pci_devices(self)
Gets the PCI devices. :returns: PCI devices list if the pci resource exist. :raises: IloCommandNotSupportedError if the PCI resource doesn't exist. :raises: IloError, on an error from iLO.
4.148505
3.619004
1.146311
pci_device_list = self._get_pci_devices() gpu_list = [] items = pci_device_list['Items'] for item in items: if item['ClassCode'] in CLASSCODE_FOR_GPU_DEVICES: if item['SubclassCode'] in SUBCLASSCODE_FOR_GPU_DEVICES: gpu_list.appen...
def _get_gpu_pci_devices(self)
Returns the list of gpu devices.
3.395248
3.108588
1.092216
system = self._get_host_details() if ('links' in system['Oem']['Hp'] and 'SmartStorage' in system['Oem']['Hp']['links']): # Get the SmartStorage URI and Settings storage_uri = system['Oem']['Hp']['links']['SmartStorage']['href'] status, header...
def _get_storage_resource(self)
Gets the SmartStorage resource if exists. :raises: IloCommandNotSupportedError if the resource SmartStorage doesn't exist. :returns the tuple of SmartStorage URI, Headers and settings.
4.169231
3.316579
1.257088
headers, storage_uri, storage_settings = self._get_storage_resource() if ('links' in storage_settings and 'ArrayControllers' in storage_settings['links']): # Get the ArrayCOntrollers URI and Settings array_uri = storage_settings['links']['ArrayControllers...
def _get_array_controller_resource(self)
Gets the ArrayController resource if exists. :raises: IloCommandNotSupportedError if the resource ArrayController doesn't exist. :returns the tuple of SmartStorage URI, Headers and settings.
4.502372
3.522721
1.278095
headers, array_uri, array_settings = ( self._get_array_controller_resource()) array_uri_links = [] if ('links' in array_settings and 'Member' in array_settings['links']): array_uri_links = array_settings['links']['Member'] else: ...
def _create_list_of_array_controllers(self)
Creates the list of Array Controller URIs. :raises: IloCommandNotSupportedError if the ArrayControllers doesnt have member "Member". :returns list of ArrayControllers.
5.493752
4.134702
1.328694
disk_details = self._get_physical_drive_resource() drive_hdd = False drive_ssd = False drive_details = {} speed_const_list = [4800, 5400, 7200, 10000, 15000] if disk_details: for item in disk_details: value = item['MediaType'] ...
def _get_drive_type_and_speed(self)
Gets the disk drive type. :returns: A dictionary with the following keys: - has_rotational: True/False. It is True if atleast one rotational disk is attached. - has_ssd: True/False. It is True if at least one SSD disk is attached. - drive_rotational_<...
3.668811
3.284995
1.116839
disk_details_list = [] array_uri_links = self._create_list_of_array_controllers() for array_link in array_uri_links: _, _, member_settings = ( self._rest_get(array_link['href'])) if ('links' in member_settings and drive_name i...
def _get_drive_resource(self, drive_name)
Gets the DiskDrive resource if exists. :param drive_name: can be either "PhysicalDrives" or "LogicalDrives". :returns the list of drives. :raises: IloCommandNotSupportedError if the given drive resource doesn't exist. :raises: IloError, on an error from iLO.
3.342025
3.219577
1.038032
logical_drive_details = self._get_logical_drive_resource() raid_level = {} if logical_drive_details: for item in logical_drive_details: if 'Raid' in item: raid_level_var = "logical_raid_level_" + item['Raid'] raid_level...
def _get_logical_raid_levels(self)
Gets the different raid levels configured on a server. :returns a dictionary of logical_raid_levels set to true. Example if raid level 1+0 and 6 are configured, it returns {'logical_raid_level_10': 'true', 'logical_raid_level_6': 'true'}
3.494774
3.116079
1.121529
header, uri, array_resource = self._get_array_controller_resource() return True if array_resource['Total'] > 0 else False
def _is_raid_supported(self)
Get the RAID support on the server. This method returns the raid support on the physical server. It checks for the list of array controllers configured to the Smart Storage. If one or more array controllers available then raid is supported by the server. If none, raid is not supported. ...
22.383488
15.84683
1.41249
try: bios_settings_uri = data['links']['Settings']['href'] except KeyError: msg = ('BIOS Settings resource not found.') raise exception.IloError(msg) status, headers, bios_settings = self._rest_get(bios_settings_uri) if status != 200: ...
def _get_bios_settings_resource(self, data)
Get the BIOS settings resource.
2.647283
2.550709
1.037862
if not self._operation_allowed(headers, 'PATCH'): msg = ('PATCH Operation not supported on the resource ' '"%s"' % uri) raise exception.IloError(msg)
def _validate_if_patch_supported(self, headers, uri)
Check if the PATCH Operation is allowed on the resource.
6.95356
4.912628
1.415446
headers, bios_uri, bios_settings = self._check_bios_resource([ bios_property]) return bios_settings[bios_property]
def _get_bios_setting(self, bios_property)
Retrieves bios settings of the server.
7.63704
6.643324
1.149581
request_headers = {} if bios_password: bios_password_hash = hashlib.sha256((bios_password.encode()). hexdigest().upper()) request_headers['X-HPRESTFULAPI-AuthToken'] = bios_password_hash return request_headers
def _get_bios_hash_password(self, bios_password)
Get the hashed BIOS password.
5.315094
5.103038
1.041555
keys = properties.keys() # Check if the BIOS resource/property exists. headers, bios_uri, settings = self._check_bios_resource(keys) if not self._operation_allowed(headers, 'PATCH'): headers, bios_uri, _ = self._get_bios_settings_resource(settings) self._...
def _change_bios_setting(self, properties)
Change the bios settings to specified values.
4.585641
4.581859
1.000826
try: iscsi_settings_uri = data['links']['Settings']['href'] except KeyError: msg = ('iscsi settings resource not found.') raise exception.IloCommandNotSupportedError(msg) status, headers, iscsi_settings = self._rest_get(iscsi_settings_uri) i...
def _get_iscsi_settings_resource(self, data)
Get the iscsi settings resoure. :param data: Existing iscsi settings of the server. :returns: headers, iscsi_settings url and iscsi settings as a dictionary. :raises: IloCommandNotSupportedError, if resource is not found. :raises: IloError, on an error from iLO.
3.038905
2.552942
1.190354
try: boot_uri = data['links']['Boot']['href'] except KeyError: msg = ('Boot resource not found.') raise exception.IloCommandNotSupportedError(msg) status, headers, boot_settings = self._rest_get(boot_uri) if status != 200: msg = ...
def _get_bios_boot_resource(self, data)
Get the Boot resource like BootSources. :param data: Existing Bios settings of the server. :returns: boot settings. :raises: IloCommandNotSupportedError, if resource is not found. :raises: IloError, on an error from iLO.
3.302301
2.932382
1.12615
try: map_uri = data['links']['Mappings']['href'] except KeyError: msg = ('Mappings resource not found.') raise exception.IloCommandNotSupportedError(msg) status, headers, map_settings = self._rest_get(map_uri) if status != 200: ms...
def _get_bios_mappings_resource(self, data)
Get the Mappings resource. :param data: Existing Bios settings of the server. :returns: mappings settings. :raises: IloCommandNotSupportedError, if resource is not found. :raises: IloError, on an error from iLO.
3.498312
3.191633
1.096088
headers, bios_uri, bios_settings = self._check_bios_resource() # Check if the bios resource exists. if('links' in bios_settings and 'iScsi' in bios_settings['links']): iscsi_uri = bios_settings['links']['iScsi']['href'] status, headers, settings = self._rest_ge...
def _check_iscsi_rest_patch_allowed(self)
Checks if patch is supported on iscsi. :returns: iscsi url. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
4.088969
3.776306
1.082796
headers, bios_uri, bios_settings = self._check_bios_resource() # Get the Mappings resource. map_settings = self._get_bios_mappings_resource(bios_settings) nics = [] for mapping in map_settings['BiosPciSettingsMappings']: for subinstance in mapping['Subinstanc...
def _change_iscsi_settings(self, iscsi_info)
Change iSCSI settings. :param iscsi_info: A dictionary that contains information of iSCSI target like target_name, lun, ip_address, port etc. :raises: IloError, on an error from iLO.
4.462662
4.467367
0.998947
system = self._get_host_details() # find the BIOS URI if ('links' not in system['Oem']['Hp'] or 'SecureBoot' not in system['Oem']['Hp']['links']): msg = (' "SecureBoot" resource or feature is not ' 'supported on this system') raise e...
def _change_secure_boot_settings(self, property, value)
Change secure boot settings on the server.
4.806203
4.823313
0.996453
system = self._get_host_details() if ('links' not in system['Oem']['Hp'] or 'SecureBoot' not in system['Oem']['Hp']['links']): msg = ('"SecureBoot" resource or feature is not supported' ' on this system') raise exception.IloCommandNotSuppor...
def get_secure_boot_mode(self)
Get the status of secure boot. :returns: True, if enabled, else False :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
3.589053
3.543061
1.012981
if self._is_boot_mode_uefi(): self._change_secure_boot_settings('SecureBootEnable', secure_boot_enable) else: msg = ('System is not in UEFI boot mode. "SecureBoot" related ' 'resources cannot be changed.') ...
def set_secure_boot_mode(self, secure_boot_enable)
Enable/Disable secure boot on the server. :param secure_boot_enable: True, if secure boot needs to be enabled for next boot, else False. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
5.497412
5.445305
1.009569
if self._is_boot_mode_uefi(): self._change_secure_boot_settings('ResetToDefaultKeys', True) else: msg = ('System is not in UEFI boot mode. "SecureBoot" related ' 'resources cannot be changed.') raise exception.IloCommandNotSupportedInBiosEr...
def reset_secure_boot_keys(self)
Reset secure boot keys to manufacturing defaults. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
7.016954
6.808877
1.03056
if self._is_boot_mode_uefi(): self._change_secure_boot_settings('ResetAllKeys', True) else: msg = ('System is not in UEFI boot mode. "SecureBoot" related ' 'resources cannot be changed.') raise exception.IloCommandNotSupportedInBiosError(ms...
def clear_secure_boot_keys(self)
Reset all keys. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
7.154692
6.08202
1.176368
power_settings = {"Action": "Reset", "ResetType": oper} systems_uri = "/rest/v1/Systems/1" status, headers, response = self._rest_post(systems_uri, None, power_settings) if status >= 300: ...
def _perform_power_op(self, oper)
Perform requested power operation. :param oper: Type of power button press to simulate. Supported values: 'ON', 'ForceOff', 'ForceRestart' and 'Nmi' :raises: IloError, on an error from iLO.
6.212956
4.898502
1.268338
power_settings = {"Action": "PowerButton", "Target": "/Oem/Hp", "PushType": pushType} systems_uri = "/rest/v1/Systems/1" status, headers, response = self._rest_post(systems_uri, None, ...
def _press_pwr_btn(self, pushType="Press")
Simulates a physical press of the server power button. :param pushType: Type of power button press to simulate Supported values are: 'Press' and 'PressAndHold' :raises: IloError, on an error from iLO.
5.370684
5.362178
1.001586
# If the system is in the same power state as # requested by the user, it gives the error # InvalidOperationForSystemState. To avoid this error # the power state is checked before power on # operation is performed. status = self.get_host_power_status() if...
def _retry_until_powered_on(self, power)
This method retries power on operation. :param: power : target power state
7.118352
7.111929
1.000903
power = power.upper() if (power is not None) and (power not in POWER_STATE): msg = ("Invalid input '%(pow)s'. " "The expected input is ON or OFF." % {'pow': power}) raise exception.IloInvalidInputError(msg) # Check current p...
def set_host_power(self, power)
Toggle the power button of server. :param power: 'ON' or 'OFF' :raises: IloError, on an error from iLO.
5.114871
5.040884
1.014677
if(self._is_boot_mode_uefi() is True): return self._get_bios_setting('UefiShellStartupUrl') else: msg = 'get_http_boot_url is not supported in the BIOS boot mode' raise exception.IloCommandNotSupportedInBiosError(msg)
def get_http_boot_url(self)
Request the http boot url from system in uefi boot mode. :returns: URL for http boot :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedInBiosError, if the system is in the bios boot mode.
5.529378
3.893018
1.420332
if(self._is_boot_mode_uefi() is True): self._change_bios_setting({'UefiShellStartupUrl': url}) else: msg = 'set_http_boot_url is not supported in the BIOS boot mode' raise exception.IloCommandNotSupportedInBiosError(msg)
def set_http_boot_url(self, url)
Set url to the UefiShellStartupUrl to the system in uefi boot mode. :param url: URL for http boot :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedInBiosError, if the system is in the bios boot mode.
5.229317
3.235404
1.616279
if(self._is_boot_mode_uefi() is True): iscsi_info = {'iSCSIBootEnable': 'Disabled'} self._change_iscsi_settings(iscsi_info) else: msg = 'iSCSI boot is not supported in the BIOS boot mode' raise exception.IloCommandNotSupportedInBiosError(msg)
def unset_iscsi_info(self)
Disable iSCSI boot option in UEFI boot mode. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedInBiosError, if the system is in the BIOS boot mode.
6.034769
3.557401
1.696398
headers, bios_uri, bios_settings = self._check_bios_resource() if('links' in bios_settings and 'iScsi' in bios_settings['links']): iscsi_uri = bios_settings['links']['iScsi']['href'] status, headers, iscsi_settings = self._rest_get(iscsi_uri) if status != 20...
def get_iscsi_initiator_info(self)
Give iSCSI initiator information of iLO. :returns: iSCSI initiator information. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the system is in the bios boot mode.
3.68455
3.443916
1.069872
if(self._is_boot_mode_uefi() is True): iscsi_uri = self._check_iscsi_rest_patch_allowed() initiator_info = {'iSCSIInitiatorName': initiator_iqn} status, headers, response = self._rest_patch(iscsi_uri, None, ini...
def set_iscsi_initiator_info(self, initiator_iqn)
Set iSCSI initiator information in iLO. :param initiator_iqn: Initiator iqn for iLO. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the system is in the bios boot mode.
4.243389
3.682103
1.152436
headers, uri, bios_settings = self._check_bios_resource(['BootMode']) _, _, settings = self._get_bios_settings_resource(bios_settings) boot_mode = settings.get('BootMode') if boot_mode == 'LegacyBios': boot_mode = 'legacy' return boot_mode.upper()
def get_pending_boot_mode(self)
Retrieves the pending boot mode of the server. Gets the boot mode to be set on next reset. :returns: either LEGACY or UEFI. :raises: IloError, on an error from iLO.
5.293147
5.911926
0.895334
boot_mode = boot_mode.lower() if boot_mode not in ['uefi', 'legacy']: msg = 'Invalid Boot mode specified' raise exception.IloInvalidInputError(msg) boot_properties = {'BootMode': boot_mode} if boot_mode == 'legacy': boot_properties['BootMode...
def set_pending_boot_mode(self, boot_mode)
Sets the boot mode of the system for next boot. :param boot_mode: either 'uefi' or 'legacy'. :raises: IloInvalidInputError, on an invalid input. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
3.736605
3.750071
0.996409
system = self._get_host_details() bios_uefi_class_val = 0 # value for bios_only boot mode if ('Bios' in system['Oem']['Hp'] and 'UefiClass' in system['Oem']['Hp']['Bios']): bios_uefi_class_val = (system['Oem']['Hp'] [...
def get_supported_boot_mode(self)
Retrieves the supported boot mode. :returns: any one of the following proliantutils.ilo.constants: SUPPORTED_BOOT_MODE_LEGACY_BIOS_ONLY, SUPPORTED_BOOT_MODE_UEFI_ONLY, SUPPORTED_BOOT_MODE_LEGACY_BIOS_AND_UEFI
4.742369
4.693346
1.010445
acc_uri = '/rest/v1/AccountService/Accounts' for status, hds, account, memberuri in self._get_collection(acc_uri): if account['UserName'] == self.login: mod_user = {} mod_user['Password'] = password status, headers, response = self._r...
def reset_ilo_credential(self, password)
Resets the iLO password. :param password: The password to be set. :raises: IloError, if account not found or on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
4.98686
4.651363
1.072129
manager_uri = '/rest/v1/Managers/1' status, headers, manager = self._rest_get(manager_uri) if status != 200: msg = self._get_extended_error(manager) raise exception.IloError(msg) # verify expected type mtype = self._get_type(manager) if ...
def _get_ilo_details(self)
Gets iLO details :raises: IloError, on an error from iLO. :raises: IloConnectionError, if iLO is not up after reset. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
4.069668
4.010699
1.014703
manager, reset_uri = self._get_ilo_details() action = {'Action': 'Reset'} # perform the POST status, headers, response = self._rest_post(reset_uri, None, action) if(status != 200): msg = self._get_extended_error(response) raise exception.IloErro...
def reset_ilo(self)
Resets the iLO. :raises: IloError, on an error from iLO. :raises: IloConnectionError, if iLO is not up after reset. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
5.742744
5.706632
1.006328
# Check if the BIOS resource if exists. headers_bios, bios_uri, bios_settings = self._check_bios_resource() # Get the BaseConfig resource. try: base_config_uri = bios_settings['links']['BaseConfigs']['href'] except KeyError: msg = ("BaseConfigs re...
def reset_bios_to_default(self)
Resets the BIOS settings to default values. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
3.289829
3.2543
1.010918
try: manager, reset_uri = self._get_ilo_details() ilo_fw_ver_str = ( manager['Oem']['Hp']['Firmware']['Current']['VersionString'] ) return common.get_major_minor(ilo_fw_ver_str) except Exception: return None
def get_ilo_firmware_version_as_major_minor(self)
Gets the ilo firmware version for server capabilities :returns: String with the format "<major>.<minor>" or None.
6.116819
6.215812
0.984074
capabilities = {} system = self._get_host_details() capabilities['server_model'] = system['Model'] rom_firmware_version = ( system['Oem']['Hp']['Bios']['Current']['VersionString']) capabilities['rom_firmware_version'] = rom_firmware_version capabiliti...
def get_server_capabilities(self)
Gets server properties which can be used for scheduling :returns: a dictionary of hardware properties like firmware versions, server model. :raises: IloError, if iLO returns an error in command execution.
3.276876
3.189936
1.027254
manager, uri = self._get_ilo_details() try: lic_uri = manager['Oem']['Hp']['links']['LicenseService']['href'] except KeyError: msg = ('"LicenseService" section in Manager/Oem/Hp does not exist') raise exception.IloCommandNotSupportedError(msg) ...
def activate_license(self, key)
Activates iLO license. :param key: iLO license key. :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
4.673323
4.264904
1.095763
valid_devices = {'FLOPPY': 'floppy', 'CDROM': 'cd'} # Check if the input is valid if device not in valid_devices: raise exception.IloInvalidInputError( "Invalid device. Valid devices: FLOPPY or CDROM.") manager, uri ...
def _get_vm_device_status(self, device='FLOPPY')
Returns the given virtual media device status and device URI :param device: virtual media device to be queried :returns json format virtual media device status and its URI :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported ...
4.610724
4.428655
1.041112
response, vm_device_uri = self._get_vm_device_status(device) # Create RIBCL equivalent response # RIBCL provides this data in VM status # VM_APPLET = CONNECTED | DISCONNECTED # DEVICE = FLOPPY | CDROM # BOOT_OPTION = BOOT_ALWAYS | BOOT_ONCE | NO_BOOT # W...
def get_vm_status(self, device='FLOPPY')
Returns the virtual media drive status. :param device: virtual media device to be queried :returns device status in dictionary form :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
3.075481
3.117102
0.986647
# CONNECT is a RIBCL call. There is no such property to set in RIS. if boot_option == 'CONNECT': return boot_option_map = {'BOOT_ONCE': True, 'BOOT_ALWAYS': False, 'NO_BOOT': False } i...
def set_vm_status(self, device='FLOPPY', boot_option='BOOT_ONCE', write_protect='YES')
Sets the Virtual Media drive status It sets the boot option for virtual media device. Note: boot option can be set only for CD device. :param device: virual media device :param boot_option: boot option to set on the virtual media device :param write_protect: set the write prote...
4.694855
4.516778
1.039426
response, vm_device_uri = self._get_vm_device_status(device) # Eject media if there is one. RIBCL was tolerant enough to overwrite # existing media, RIS is not. This check is to take care of that # assumption. if response.get('Inserted', False): self.eject_v...
def insert_virtual_media(self, url, device='FLOPPY')
Notifies iLO of the location of a virtual media diskette image. :param url: URL to image :param device: virual media device :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
7.274921
6.99976
1.03931
# Check if the BIOS resource if exists. headers_bios, bios_uri, bios_settings = self._check_bios_resource() # Get the Boot resource. boot_settings = self._get_bios_boot_resource(bios_settings) # Get the BootSources resource try: boot_sources = boot_...
def _get_persistent_boot_devices(self)
Get details of persistent boot devices, its order :returns: List of dictionary of boot sources and list of boot device order :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
4.08491
3.56351
1.146317
system = self._get_host_details() try: # Return boot device if it is persistent. if system['Boot']['BootSourceOverrideEnabled'] == 'Continuous': device = system['Boot']['BootSourceOverrideTarget'] if device in DEVICE_RIS_TO_COMMON: ...
def get_persistent_boot_device(self)
Get current persistent boot device set for the host :returns: persistent boot device for the system :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
4.298713
4.287093
1.00271
tenure = 'Once' new_device = device_type[0] # If it is a standard device, we need to convert in RIS convention if device_type[0].upper() in DEVICE_COMMON_TO_RIS: new_device = DEVICE_COMMON_TO_RIS[device_type[0].upper()] if persistent: tenure = 'C...
def _update_persistent_boot(self, device_type=[], persistent=False)
Changes the persistent boot device order in BIOS boot mode for host Note: It uses first boot device from the device_type and ignores rest. :param device_type: ordered list of boot devices :param persistent: Boolean flag to indicate if the device to be set as a persis...
3.142452
3.105781
1.011807
# Check if the input is valid for item in device_type: if item.upper() not in DEVICE_COMMON_TO_RIS: raise exception.IloInvalidInputError("Invalid input. Valid " "devices: NETWORK, HDD," ...
def update_persistent_boot(self, device_type=[])
Changes the persistent boot device order for the host :param device_type: ordered list of boot devices :raises: IloError, on an error from iLO. :raises: IloCommandNotSupportedError, if the command is not supported on the server.
6.796584
7.520594
0.90373