Ejemplo n.º 1
0
    def _check_bios_resource(self, properties=[]):
        """Check if the bios resource exists."""

        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._rest_get(bios_uri)

            if status >= 300:
                msg = self._get_extended_error(bios_settings)
                raise exception.IloError(msg)

            # If property is not None, check if the bios_property is supported
            for property in properties:
                if property not in bios_settings:
                    # not supported on this platform
                    msg = ('\tBIOS Property "' + property + '" is not'
                           '  supported on this system.')
                    raise exception.IloCommandNotSupportedError(msg)

            return headers, bios_uri, bios_settings

        else:
            msg = ('"links/BIOS" section in ComputerSystem/Oem/Hp'
                   ' does not exist')
            raise exception.IloCommandNotSupportedError(msg)
Ejemplo n.º 2
0
 def _raise_command_not_supported(self, method):
     platform = self.get_product_name()
     msg = ("`%(method)s` is not supported on %(platform)s" % {
         'method': method,
         'platform': platform
     })
     raise (exception.IloCommandNotSupportedError(msg))
Ejemplo n.º 3
0
    def set_vm_status(self, device='FLOPPY',
                      boot_option='BOOT_ONCE', write_protect='YES'):
        """Sets the Virtual Media drive status and allows the

        boot options for booting from the virtual media.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 4
0
    def get_host_uuid(self):
        """Request host UUID of the server.

        :returns: the host UUID of the server
        :raises: IloConnectionError if failed connecting to the iLO.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 5
0
    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.
        """
        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.IloCommandNotSupportedError(msg)

        secure_boot_uri = system['Oem']['Hp']['links']['SecureBoot']['href']

        # get the Secure Boot object
        status, headers, secure_boot_settings = self._rest_get(secure_boot_uri)

        if status >= 300:
            msg = self._get_extended_error(system)
            raise exception.IloError(msg)

        return secure_boot_settings['SecureBootCurrentState']
Ejemplo n.º 6
0
    def set_iscsi_boot_info(self,
                            mac,
                            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 iSCSI initiator is identified by the MAC provided.
        The initiator system is set with the target details like
        IQN, LUN, IP, Port etc.
        :param mac: MAC address of initiator.
        :param target_name: Target Name for iscsi.
        :param lun: logical unit number.
        :param ip_address: IP address of the target.
        :param port: port of the target.
        :param auth_method : either None or CHAP.
        :param username: CHAP Username for authentication.
        :param password: CHAP secret.
        :raises: IloError, on an error from iLO.
        :raises: IloCommandNotSupportedInBiosError, if the system is
                 in the bios boot mode.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 7
0
    def _change_secure_boot_settings(self, property, value):
        """Change secure boot settings on the server."""
        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 exception.IloCommandNotSupportedError(msg)

        secure_boot_uri = system['Oem']['Hp']['links']['SecureBoot']['href']

        # Change the property required
        new_secure_boot_settings = dict()
        new_secure_boot_settings[property] = value

        # perform the patch
        status, headers, response = self._rest_patch(secure_boot_uri, None,
                                                     new_secure_boot_settings)
        if status >= 300:
            msg = self._get_extended_error(response)
            raise exception.IloError(msg)

        # Change the bios setting as a workaround to enable secure boot
        # Can be removed when fixed for Gen9 snap2
        val = self._get_bios_setting('CustomPostMessage')
        val = val.rstrip() if val.endswith(" ") else val + " "
        self._change_bios_setting({'CustomPostMessage': val})
Ejemplo n.º 8
0
    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.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 9
0
    def reset_ilo(self):
        """Resets the iLO.

        :raises: IloError, on an error from iLO.
        :raises: IloCommandNotSupportedError, if the command is not supported
                 on the server.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 10
0
    def unset_iscsi_info(self):
        """Disable iscsi boot option of the system in uefi boot mode.

        :raises: IloError, on an error from iLO.
        :raises: IloCommandNotSupportedError, if the system is
                 in the bios boot mode.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 11
0
    def delete_raid_configuration(self):
        """Deletes the logical drives from the system

        :raises: IloError, on an error from iLO.
        :raises: IloCommandNotSupportedError, if the command is
                 not supported on the server.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 12
0
    def get_host_health_present_power_reading(self, data=None):
        """Request the power consumption of the server.

        :param: the data to retrieve from the server, defaults to None.
        :returns: the dictionary containing the power readings.
        :raises: IloConnectionError if failed connecting to the iLO.
        :raises: IloError, on an error from iLO.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 13
0
    def get_host_health_data(self, data=None):
        """Request host health data of the server.

        :param: the data to retrieve from the server, defaults to None.
        :returns: the dictionary containing the embedded health data.
        :raises: IloConnectionError if failed connecting to the iLO.
        :raises: IloError, on an error from iLO.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 14
0
    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.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 15
0
    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.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 16
0
    def unset_iscsi_boot_info(self, mac):
        """Disable iscsi boot option of the system in uefi boot mode.

        :param mac: MAC address of initiator.
        :raises: IloError, on an error from iLO.
        :raises: IloCommandNotSupportedError, if the system is
                 in the bios boot mode.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 17
0
    def get_host_health_power_supplies(self, data=None):
        """Request the health power supply information.

        :param: the data to retrieve from the server, defaults to None.
        :returns: the dictionary containing the power supply information.
        :raises: IloConnectionError if failed connecting to the iLO.
        :raises: IloError, on an error from iLO.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 18
0
    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
        :raises: IloConnectionError, if not able to reach iLO.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 19
0
    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.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 20
0
    def set_http_boot_url(self, url):
        """Set the url to the UefiShellStartupUrl.

        :param url: URL for http boot.
        :raises: IloError, on an error from iLO.
        :raises: IloCommandNotSupportedError, if the command is not supported
                 on the server.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 21
0
    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.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 22
0
    def get_http_boot_url(self):
        """Request the http boot url.

        :returns: URL for http boot.
        :raises: IloError, on an error from iLO.
        :raises: IloCommandNotSupportedError, if the command is not supported
                 on the server.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 23
0
    def get_server_capabilities(self):
        """Get hardware properties which can be used for scheduling

        :return: a dictionary of server capabilities.
        :raises: IloError, on an error from iLO.
        :raises: IloCommandNotSupportedError, if the command is not supported
                 on the server.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 24
0
    def get_host_power_readings(self):
        """Retrieves the host power readings.

        :param: the data to retrieve from the server, defaults to None.
        :returns: the dictionary containing the power readings.
        :raises: IloConnectionError if failed connecting to the iLO.
        :raises: IloError, on an error from iLO.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 25
0
    def get_host_health_at_a_glance(self, data=None):
        """Get the health at a glance Report.

        :param: the data to retrieve from the server, defaults to None.
        :returns: the dictionary containing the health at a glance information.
        :raises: IloConnectionError if failed connecting to the iLO.
        :raises: IloError, on an error from iLO.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 26
0
    def get_host_post_state(self):
        """Request the current state of system POST

        Retrieves current state of system POST.

        :raises: IloError, on an error from iLO
        :raises: IloCommandNotSupportedError, if the command is
                 not supported on the server
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 27
0
    def get_host_health_temperature_sensors(self, data=None):
        """Get the health Temp Sensor report.

        :param: the data to retrieve from the server, defaults to None.
        :returns: the dictionary containing the temperature sensors
            information.
        :raises: IloConnectionError if failed connecting to the iLO.
        :raises: IloError, on an error from iLO.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 28
0
    def _validate_message(self, message):
        """Validate XML response from iLO.

        This function validates the XML response to see
        if the exit status is 0 or not in the response.
        If the status is non-zero it raises exception.
        """
        if message.tag != 'RIBCL':
            # the true case shall be unreachable for response
            # XML from Ilo as all messages are tagged with RIBCL
            # but still raise an exception if any invalid
            # XML response is returned by Ilo. Set status to some
            # arbitary non-zero value.
            status = -1
            raise exception.IloClientInternalError(message, status)

        for child in message:
            if child.tag != 'RESPONSE':
                return message
            status = int(child.get('STATUS'), 16)
            msg = child.get('MESSAGE')
            if status == 0 and msg != 'No error':
                return msg
            if status != 0:
                if 'syntax error' in msg or 'Feature not supported' in msg:
                    for cmd in BOOT_MODE_CMDS:
                        if cmd in msg:
                            platform = self.get_product_name()
                            msg = ("%(cmd)s is not supported on %(platform)s" %
                                   {
                                       'cmd': cmd,
                                       'platform': platform
                                   })
                            LOG.debug(
                                self._("Got invalid response with "
                                       "message: '%(message)s'"),
                                {'message': msg})
                            raise (exception.IloCommandNotSupportedError(
                                msg, status))
                    else:
                        LOG.debug(
                            self._("Got invalid response with "
                                   "message: '%(message)s'"), {'message': msg})
                        raise exception.IloClientInternalError(msg, status)
                if (status in exception.IloLoginFailError.statuses
                        or msg in exception.IloLoginFailError.messages):
                    LOG.debug(
                        self._("Got invalid response with "
                               "message: '%(message)s'"), {'message': msg})
                    raise exception.IloLoginFailError(msg, status)

                LOG.debug(
                    self._("Got invalid response with "
                           "message: '%(message)s'"), {'message': msg})
                raise exception.IloError(msg, status)
Ejemplo n.º 29
0
    def get_essential_properties(self):
        """Get the essential scheduling properties

        :returns: a dictionary containing memory size, disk size,
                  number of cpus, cpu arch, port numbers and
                  mac addresses.
        :raises: IloError, on an error from iLO.
        :raises: IloCommandNotSupportedError, if the command is not supported
                 on the server.
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)
Ejemplo n.º 30
0
    def update_firmware(self, firmware_url, component_type):
        """Updates the given firmware on the server

        :param firmware_url: location of the firmware file
        :param component_type: Type of component to be applied to.
        :raises: InvalidInputError, if the validation of the input fails
        :raises: IloError, on an error from iLO
        :raises: IloConnectionError, if not able to reach iLO.
        :raises: IloCommandNotSupportedError, if the command is
                 not supported on the server
        """
        raise exception.IloCommandNotSupportedError(ERRMSG)