配置ironic-api服务

以下所有操作在baremetal节点执行。

  1. 打开“/etc/ironic/ironic.conf”文件。

    vi /etc/ironic/ironic.conf

  2. 按“i”进入编辑模式,配置数据库的位置。裸金属服务将信息存储在数据库中,本指南使用其他OpenStack服务使用的MySQL数据库。

    1
    2
    3
    4
    [database]
    # The SQLAlchemy connection string used to connect to the
    # database (string value)
    connection = mysql+pymysql://ironic:PASSWORD@controller/ironic?charset=utf8
    

    为方便理解,本文将涉及到的密码全部以“PASSWORD”代替,请用户根据实际情况进行修改。此处将PASSWORD修改为ironic数据库的密码。

  3. 通过设置以下选项,将ironic-api服务配置为使用RabbitMQ消息代理。替换RPC_*为RabbitMQ服务器的适当地址详细信息和凭证:

    1
    2
    [DEFAULT]
    transport_url = rabbit://RPC_USER:RPC_PASSWORD@RPC_HOST:RPC_PORT/
    

    此处RPC_USER为RabbitMQ服务的OpenStack用户,RPC_PASSWORD为RabbitMQ服务用户对应的密码,RPC_HOST为RabbitMQ消息队列所在节点的管理IP地址,RPC_PORT为RabbitMQ服务的端口,RabbitMQ消息详细信息请参见安装RabbitMQ。本指导中为:transport_url = rabbit://openstack:123456@controller:5672/。

  4. 配置使用JSON RPC进行ironic-condutor与ironic-api之间的交互。在配置中启用它,并提供用于身份验证的关键凭证。

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    [DEFAULT]
    rpc_transport = json-rpc
     
    [json_rpc]
    # Authentication type to load (string value)
    auth_type = password
     
    # Authentication URL (string value)
    auth_url = http://controller:5000/
     
    # Username (string value)
    username = ironic
     
    # User's password (string value)
    password = PASSWORD
     
    # Project name to scope to (string value)
    project_name = service
     
    # Domain ID containing project (string value)
    project_domain_id = default
     
    # User's domain id (string value)
    user_domain_id = default
    

    为方便理解,本文将涉及到的密码全部以“PASSWORD”代替,请用户根据实际情况进行修改。此处将PASSWORD修改为创建裸金属服务数据库中ironic用户数据库的密码。

  5. 配置ironic-api服务与身份服务一起使用。

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    [DEFAULT]
    auth_strategy = keystone
     
    [keystone_authtoken]
    # Authentication type to load (string value)
    auth_type = password
     
    # Complete public Identity API endpoint (string value)
    www_authenticate_uri = http://controller:5000
     
    # Complete admin Identity API endpoint. (string value)
    auth_url = http://controller:5000
     
    # Service username. (string value)
    username = ironic
     
    # Service account password. (string value)
    password = PASSWORD
     
    # Service tenant name. (string value)
    project_name = service
     
    # Domain name containing project (string value)
    project_domain_name = Default
     
    # User's domain name (string value)
    user_domain_name = Default
    

    为方便理解,本文将涉及到的密码全部以“PASSWORD”代替,请用户根据实际情况进行修改。此处将PASSWORD修改为创建裸金属服务数据库ironic在身份服务中为用户选择的密码。

  6. 按“Esc”键退出编辑模式,输入:wq!,按“Enter”键保存并退出文件。
  7. 在裸金属服务管理baremetal节点执行如下命令,创建裸金属Ironic服务数据库表。

    1
    ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema
    

  8. 重新启动ironic-api服务。

    1
    2
    systemctl restart openstack-ironic-api
    systemctl status openstack-ironic-api