示例#1
0
def validate(task):
    """Validates the pre-requisites for iSCSI deploy.

    Validates whether node in the task provided has some ports enrolled.
    This method validates whether conductor url is available either from CONF
    file or from keystone.

    :param task: a TaskManager instance containing the node to act on.
    :raises: InvalidParameterValue if the URL of the Ironic API service is not
             configured in config file and is not accessible via Keystone
             catalog.
    :raises: MissingParameterValue if no ports are enrolled for the given node.
    """
    # TODO(lucasagomes): Validate the format of the URL
    deploy_utils.get_ironic_api_url()
    # Validate the root device hints
    try:
        root_device = task.node.properties.get('root_device')
        il_utils.parse_root_device_hints(root_device)
    except ValueError as e:
        raise exception.InvalidParameterValue(
            _('Failed to validate the root device hints for node '
              '%(node)s. Error: %(error)s') % {'node': task.node.uuid,
                                               'error': e})
    deploy_utils.parse_instance_info(task.node)
示例#2
0
def validate(task):
    """Validates the pre-requisites for iSCSI deploy.

    Validates whether node in the task provided has some ports enrolled.
    This method validates whether conductor url is available either from CONF
    file or from keystone.

    :param task: a TaskManager instance containing the node to act on.
    :raises: InvalidParameterValue if the URL of the Ironic API service is not
             configured in config file and is not accessible via Keystone
             catalog.
    :raises: MissingParameterValue if no ports are enrolled for the given node.
    """
    # TODO(lucasagomes): Validate the format of the URL
    deploy_utils.get_ironic_api_url()
    # Validate the root device hints
    try:
        root_device = task.node.properties.get('root_device')
        il_utils.parse_root_device_hints(root_device)
    except ValueError as e:
        raise exception.InvalidParameterValue(
            _('Failed to validate the root device hints for node '
              '%(node)s. Error: %(error)s') % {'node': task.node.uuid,
                                               'error': e})
    deploy_utils.parse_instance_info(task.node)
示例#3
0
def _start_managed_inspection(task):
    """Start inspection managed by ironic."""
    try:
        client = _get_client(task.context)
        endpoint = _get_callback_endpoint(client)
        params = dict(_parse_kernel_params(),
                      **{'ipa-inspection-callback-url': endpoint})
        if CONF.deploy.fast_track:
            params['ipa-api-url'] = deploy_utils.get_ironic_api_url()

        cond_utils.node_power_action(task, states.POWER_OFF)
        with cond_utils.power_state_for_network_configuration(task):
            task.driver.network.add_inspection_network(task)
        task.driver.boot.prepare_ramdisk(task, ramdisk_params=params)
        client.start_introspection(task.node.uuid, manage_boot=False)
        cond_utils.node_power_action(task, states.POWER_ON)
    except Exception as exc:
        LOG.exception(
            'Unable to start managed inspection for node %(uuid)s: '
            '%(err)s', {
                'uuid': task.node.uuid,
                'err': exc
            })
        error = _('unable to start inspection: %s') % exc
        _inspection_error_handler(task, error, raise_exc=True)
示例#4
0
 def _publish_endpoint(self):
     params = {}
     if CONF.debug:
         params['ipa_debug'] = True
     self._zeroconf = mdns.Zeroconf()
     self._zeroconf.register_service('baremetal',
                                     deploy_utils.get_ironic_api_url(),
                                     params=params)
示例#5
0
 def _publish_endpoint(self):
     params = {}
     if CONF.debug:
         params['ipa_debug'] = True
     self._zeroconf = mdns.Zeroconf()
     self._zeroconf.register_service('baremetal',
                                     deploy_utils.get_ironic_api_url(),
                                     params=params)
示例#6
0
def validate(task):
    """Validates the pre-requisites for iSCSI deploy.

    Validates whether node in the task provided has some ports enrolled.
    This method validates whether conductor url is available either from CONF
    file or from keystone.

    :param task: a TaskManager instance containing the node to act on.
    :raises: InvalidParameterValue if the URL of the Ironic API service is not
             configured in config file and is not accessible via Keystone
             catalog.
    :raises: MissingParameterValue if no ports are enrolled for the given node.
    """
    # TODO(lucasagomes): Validate the format of the URL
    deploy_utils.get_ironic_api_url()
    # Validate the root device hints
    deploy_utils.get_root_device_for_deploy(task.node)
    deploy_utils.parse_instance_info(task.node)
示例#7
0
    def _build_pxe_config_options(self, task):
        """Builds the pxe config options for booting agent.

        This method builds the config options to be replaced on
        the agent pxe config template.

        :param task: a TaskManager instance
        :returns: a dict containing the options to be applied on
        the agent pxe config template.
        """

        agent_config_opts = {
            'deployment_id': task.node.uuid,
            'ironic_api_url': deploy_utils.get_ironic_api_url(),
        }

        return agent_config_opts