91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Ironic - 裸機統一管理

發布時間:2020-08-03 09:04:10 來源:網絡 閱讀:9102 作者:沈豬豬 欄目:數據庫

環境

操作系統: CentOS 7.2 (x86_64)、

OpenStack版本: Newton

node-51  172.16.140.51(ironic controller)

node-52  172.16.140.52(ironic agent)


配置主機名解析

[root@node-51 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.140.51 node-51


安裝chrony

[root@node-51 ~]# yum install chrony -y  # chrony可以認為就是類似ntp的軟件

[root@node-51 ~]# vim /etc/chrony.conf    # 編輯chrony配置文件
allow 172.16.140.0/24    # 允許這段地址的ip連接

# 啟動服務
[root@node-51 ~]# systemctl enable chronyd
[root@node-51 ~]# systemctl start chronyd

# 驗證ntp同步情況
[root@node-51 ~]# chronyc sources
210 Number of sources = 4
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^- 59.46.44.253                  2   6   377    59  -4173us[-4173us] +/-   72ms
^* news.neu.edu.cn               2   6   377    59   -708us[ -666us] +/-   19ms
^? 2001:da8:9000::130            0   6     0   10y     +0ns[   +0ns] +/-    0ns
^? dns2.synet.edu.cn             2   7   100   448    -45ms[  -47ms] +/-   68ms


準備OpenStack源

[root@node-51 ~]# yum install centos-release-openstack-newton -y


升級系統

[root@node-51 ~]#  yum upgrade -y


安裝OpenStack客戶端

[root@node-51 ~]# yum install python-openstackclient -y


安裝Mariadb

[root@node-51 ~]# yum install mariadb mariadb-server python2-PyMySQL -y # 安裝mariadb相關包

[root@node-51 ~]# vim /etc/my.cnf.d/openstack.cnf  # 創建openstack mariadb配置文件,添加如下內容
[mysqld]
bind-address = node-51

default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8

# 啟動mariadb服務,并設置開機自啟動
[root@node-51 ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@node-51 ~]# systemctl start mariadb

[root@node-51 ~]# mysql_secure_installation  # mariadb初始化,設置root密碼為openstack


安裝Rabbitmq

[root@node-51 ~]# yum install rabbitmq-server -y # 安裝rabbitmq包

# 啟動rabbitmq服務
[root@node-51 ~]# systemctl enable rabbitmq-server.service
Created symlink from /etc/systemd/system/multi-user.target.wants/rabbitmq-server.service to /usr/lib/systemd/system/rabbitmq-server.service.
[root@node-51 ~]# systemctl start rabbitmq-server.service

# 創建openstack用戶, 密碼openstack
[root@node-51 ~]# rabbitmqctl add_user openstack openstack
Creating user "openstack" ...

# 設置openstack用戶權限
[root@node-51 ~]# rabbitmqctl set_permissions openstack ".*" ".*" ".*"
Setting permissions for user "openstack" in vhost "/" ...


安裝Memcached

[root@node-51 ~]# yum install memcached python-memcached -y    # 安裝memcached包

# 啟動memcached服務
[root@node-51 ~]# systemctl enable memcached.service
Created symlink from /etc/systemd/system/multi-user.target.wants/memcached.service to /usr/lib/systemd/system/memcached.service.
[root@node-51 ~]# systemctl start memcached.service


安裝Keystone

# 創建keystone數據庫
[root@node-51 ~]# mysql -u root -popenstack

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.1.17-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database keystone;
Query OK, 1 row affected (0.00 sec)

創建keystone數據庫的keystone用戶
MariaDB [(none)]> grant all privileges on keystone.* to 'keystone'@'localhost' identified by 'keystone';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all privileges on keystone.* to 'keystone'@'%' identified by 'keystone'; 
Query OK, 0 rows affected (0.00 sec)


# http + mod_wsgi啟動keystone服務
[root@node-51 ~]# yum install openstack-keystone httpd mod_wsgi  # 安裝keystone相關包
[root@node-51 ~]# yum install openstack-utils -y # 安裝openstack工具包,方便修改配置文件

# 配置keystone連接數據庫
[root@node-51 ~]# openstack-config --set \
                            /etc/keystone/keystone.conf \
                            database \
                            connection \
                            mysql+pymysql://keystone:keystone@node-51/keystone

# 使用fernet token
[root@node-51 ~]# openstack-config --set \
                            /etc/keystone/keystone.conf \
                            token \
                            provider \
                            fernet
                            
# 同步keystone數據庫
[root@node-51 ~]# keystone-manage db_sync

# 登錄數據庫,查看keystone庫是否導入表成功
[root@node-51 ~]# mysql -u root -popenstackWelcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.1.17-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use keystone;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [keystone]> show tables;
+------------------------+
| Tables_in_keystone     |
+------------------------+
| access_token           |
| assignment             |
| config_register        |
| consumer               |
| credential             |
| endpoint               |
| endpoint_group         |
| federated_user         |
| federation_protocol    |
| group                  |
| id_mapping             |
| identity_provider      |
| idp_remote_ids         |
| implied_role           |
| local_user             |
| mapping                |
| migrate_version        |
| nonlocal_user          |
| password               |
| policy                 |
| policy_association     |
| project                |
| project_endpoint       |
| project_endpoint_group |
| region                 |
| request_token          |
| revocation_event       |
| role                   |
| sensitive_config       |
| service                |
| service_provider       |
| token                  |
| trust                  |
| trust_role             |
| user                   |
| user_group_membership  |
| whitelisted_config     |
+------------------------+
37 rows in set (0.00 sec)

MariaDB [keystone]> exit
Bye   

#  初始化fernet key倉庫
[root@node-51 ~]# keystone-manage fernet_setup \
                                --keystone-user keystone \
                                --keystone-group keystone
[root@node-51 ~]# keystone-manage credential_setup \
                                --keystone-user keystone \
                                --keystone-group keystone 
                                
# 初始化keystone admin用戶,密碼為openstack
[root@node-51 ~]# keystone-manage bootstrap \
                                  --bootstrap-password openstack \
                                  --bootstrap-admin-url http://node-51:35357/v3/  \
                                  --bootstrap-internal-url http://node-51:35357/v3/  \
                                  --bootstrap-public-url http://node-51:5000/v3/ \
                                  --bootstrap-region-id RegionOne
 
 # 配置http啟動keystone服務                                       
 [root@node-51 ~]# vim /etc/httpd/conf/httpd.conf  # 編輯httpd配置文件
 ServerName node-51                 # ServerName替換為node-51
 
 # 創建軟連接
 [root@node-51 ~]# ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/
[root@node-51 ~]# ll /etc/httpd/conf.d/
total 16
-rw-r--r-- 1 root root 2926 Jul 18 23:30 autoindex.conf
-rw-r--r-- 1 root root  366 Jul 18 23:30 README
-rw-r--r-- 1 root root 1252 Jul 18 23:22 userdir.conf
-rw-r--r-- 1 root root  824 Jul 18 23:22 welcome.conf
lrwxrwxrwx 1 root root   38 Oct 19 11:35 wsgi-keystone.conf -> /usr/share/keystone/wsgi-keystone.conf

# 啟動httpd服務
[root@node-51 ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@node-51 ~]# systemctl start httpd

# 驗證keystone
[root@node-51 ~]# vim ~/keystonerc    # 創建keystonerc文件
export OS_USERNAME=admin
export OS_PASSWORD=openstack
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://node-51:35357/v3
export OS_IDENTITY_API_VERSION=3

[root@node-51 ~]# source ~/keystonerc    # 加載keystonerc文件
[root@node-51 ~]# openstack user list    # 測試keystone user api

+----------------------------------+-------+
| ID                               | Name  |
+----------------------------------+-------+
| 48780bee4aed4daab77a44a75fe3b4b8 | admin |
+----------------------------------+-------+

# 創建service項目
[root@node-51 ~]#  openstack project create --domain default \
> --description "Service Project" service
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | Service Project                  |
| domain_id   | default                          |
| enabled     | True                             |
| id          | 64fc665189d64d9d828dada15067f452 |
| is_domain   | False                            |
| name        | service                          |
| parent_id   | default                          |
+-------------+----------------------------------+



安裝Glance

# 創建glance數據庫
[root@node-51 ~]# mysql -uroot -popenstack
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 20
Server version: 10.1.17-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database glance;
Query OK, 1 row affected (0.00 sec)

# 創建glance數據庫用戶
MariaDB [(none)]> grant all privileges on glance.* to 'glance'@'localhost' identified by 'glance';
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> grant all privileges on glance.* to 'glance'@'%' identified by 'glance';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye

# 創建keystone glance用戶
[root@node-51 ~]# openstack user create --domain default --password glance glance
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 6324fc62585d45c2bb13a66fdb1864d2 |
| name                | glance                           |
| password_expires_at | None                             |
+---------------------+----------------------------------+

# 賦予glance用戶admin角色
[root@node-51 ~]# openstack role add --project service --user glance admin

# 創建glance service
[root@node-51 ~]# openstack service create --name glance \
    --description "OpenStack Image" p_w_picpath
+-------------+----------------------------------+
| Field       | Value                            |
+-------------+----------------------------------+
| description | OpenStack Image                  |
| enabled     | True                             |
| id          | 7aecf5cc2c7f4f73a094fa49e0ea369e |
| name        | glance                           |
| type        | p_w_picpath                            |
+-------------+----------------------------------+

# 創建glance service API訪問入口地址
[root@node-51 ~]# openstack endpoint create --region RegionOne \
                            p_w_picpath \
                            public http://172.16.140.51:9292
                            
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 12424a9794ee4fafa2da4d7dac84d662 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 7aecf5cc2c7f4f73a094fa49e0ea369e |
| service_name | glance                           |
| service_type | p_w_picpath                            |
| url          | http://172.16.140.51:9292              |
+--------------+----------------------------------+
[root@node-51 ~]# openstack endpoint create --region RegionOne \
                            p_w_picpath \
                            internal \
                            http://172.16.140.51:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 27ae33cfa6c24f6db1a11c1e9ad2afb0 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 7aecf5cc2c7f4f73a094fa49e0ea369e |
| service_name | glance                           |
| service_type | p_w_picpath                            |
| url          | http://172.16.140.51:9292              |
+--------------+----------------------------------+
[root@node-51 ~]# openstack endpoint create --region RegionOne \
                            p_w_picpath \
                            admin \
                            http://172.16.140.51:9292
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 70b173108cd44750aea4fd01481459ef |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 7aecf5cc2c7f4f73a094fa49e0ea369e |
| service_name | glance                           |
| service_type | p_w_picpath                            |
| url          | http://172.16.140.51:9292              |
+--------------+----------------------------------+

# 安裝glance相關包
[root@node-51 ~]# yum install openstack-glance -y  

# 編輯glance配置文件,修改數據庫連接部分配置
[root@node-51 ~]# openstack-config --set /etc/glance/glance-api.conf \
                                database \
                                connection \
                                mysql+pymysql://glance:glance@node-51/glance
[root@node-51 ~]# openstack-config --set /etc/glance/glance-registry.conf \
                                database \
                                connection \
                                mysql+pymysql://glance:glance@node-51/glance                               

# 修改glance api配置文件
[root@node-51 ~]# vim /etc/glance/glance-api.conf
[keystone_authtoken]
auth_uri = http://node-51:5000
auth_url = http://node-51:35357
memcached_servers = node-51:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance

[paste_deploy]
flavor = keystone

[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/p_w_picpaths/

# 修改glance registry配置文件
[root@node-51 ~]# vim /etc/glance/glance-registry.conf
[keystone_authtoken]
auth_uri = http://node-51:5000
auth_url = http://node-51:35357
memcached_servers = node-51:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance

[paste_deploy]
flavor = keystone


# 同步glance數據庫, 出現deprecation的信息可以忽略
[root@node-51 ~]# glance-manage db_sync
Option "verbose" from group "DEFAULT" is deprecated for removal.  Its value may be silently ignored in the future.
/usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:1171: OsloDBDeprecationWarning: EngineFacade is deprecated; please use oslo_db.sqlalchemy.enginefacade
  expire_on_commit=expire_on_commit, _conf=conf)
/usr/lib/python2.7/site-packages/pymysql/cursors.py:146: Warning: Duplicate index 'ix_p_w_picpath_properties_p_w_picpath_id_name' defined on the table 'glance.p_w_picpath_properties'. This is deprecated and will be disallowed in a future release.
  result = self._query(query)

# 啟動glance服務
[root@node-51 ~]# systemctl enable openstack-glance-api openstack-glance-registry
[root@node-51 ~]# systemctl start openstack-glance-api openstack-glance-registry

# 下載cirros鏡像
[root@node-51 ~]# wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

# 上傳鏡像
[root@node-51 ~]# openstack p_w_picpath create "cirros" \
>   --file cirros-0.3.4-x86_64-disk.img \
>   --disk-format qcow2 --container-format bare \
>   --public

+------------------+------------------------------------------------------+
| Field            | Value                                                |
+------------------+------------------------------------------------------+
| checksum         | ee1eca47dc88f4879d8a229cc70a07c6                     |
| container_format | bare                                                 |
| created_at       | 2016-10-19T06:05:09Z                                 |
| disk_format      | qcow2                                                |
| file             | /v2/p_w_picpaths/b23a6384-765b-4ae3-b4b0-4c95e26ac7ca/file |
| id               | b23a6384-765b-4ae3-b4b0-4c95e26ac7ca                 |
| min_disk         | 0                                                    |
| min_ram          | 0                                                    |
| name             | cirros                                               |
| owner            | 7121240f973245d4a758c5787211216b                     |
| protected        | False                                                |
| schema           | /v2/schemas/p_w_picpath                                    |
| size             | 13287936                                             |
| status           | active                                               |
| tags             |                                                      |
| updated_at       | 2016-10-19T06:05:09Z                                 |
| virtual_size     | None                                                 |
| visibility       | public                                               |
+------------------+------------------------------------------------------+ 

# 查看glance鏡像列表
[root@node-51 ~]# openstack p_w_picpath list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| b23a6384-765b-4ae3-b4b0-4c95e26ac7ca | cirros | active |
+--------------------------------------+--------+--------+



安裝Ironic

# 創建ironic數據庫
[root@node-51 ~]# mysql -uroot -popenstack
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 28
Server version: 10.1.17-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
MariaDB [(none)]> create database ironic;
Query OK, 1 row affected (0.00 sec)

# 創建數據庫ironic用戶
MariaDB [(none)]> grant all privileges on ironic.* to 'ironic'@'localhost' identified by 'ironic';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on ironic.* to 'ironic'@'%' identified by 'ironic';
Query OK, 0 rows affected (0.00 sec)

# 安裝ironic相關包
[root@node-51 ~]# yum install openstack-ironic-api \
                              openstack-ironic-conductor \
                              python-ironicclient qemu-img-ev \
                              iscsi-initiator-utils \
                              psmisc \
                              fuse \
                              gdisk parted -y

# 編輯ironic配置文件,修改ironic數據庫連接
[root@node-51 ~]# openstack-config --set /etc/ironic/ironic.conf \
                                    database \
                                    connection \
                                    mysql+pymysql://ironic:ironic@node-51/ironic

# 修改ironic配置文件
[root@node-51 ~]# vim /etc/ironic/ironic.conf
[DEFAULT]
auth_strategy=keystone
my_ip=172.16.140.51
enabled_network_interfaces = noop
debug = True
[agent]
[amt]
[api]
[audit]
[cimc]
[cisco_ucs]
[conductor]
api_url=http://172.16.140.51:6385
automated_clean = false   # 是否開啟自動清除磁盤,開啟比較耗時間
[console]
[cors]
[cors.subdomain]
[database]
connection = mysql+pymysql://ironic:ironic@172.16.140.51/ironic
[deploy]
[dhcp]
dhcp_provider = none
[disk_partitioner]
[disk_utils]
[drac]
[glance]
glance_host=172.16.140.51
[iboot]
[ilo]
[inspector]
[ipmi]
[irmc]
[ironic_lib]
[iscsi]
[keystone]
[keystone_authtoken]
auth_uri = http://172.16.140.51:5000
auth_url = http://172.16.140.51:35357
memcached_servers = 172.16.140.51:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = ironic
password = ironic
[matchmaker_redis]
[metrics]
[metrics_statsd]
[neutron]
[oneview]
[oslo_concurrency]
[oslo_messaging_amqp]
[oslo_messaging_notifications]
[oslo_messaging_rabbit]
rabbit_hosts = 172.16.140.51:5672
rabbit_userid = openstack
rabbit_password = openstack
[oslo_messaging_zmq]
[oslo_policy]
[pxe]
tftp_server=172.16.140.51
tftp_root=/tftpboot
tftp_master_path=/tftpboot/master_p_w_picpaths
pxe_bootfile_name=pxelinux.0
pxe_append_params = coreos.autologin  # 如果ironic deploy p_w_picpath用的是coreos的話,開啟這個有助于排錯
  

# 同步ironic數據庫
[root@node-51 ~]# ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema
2016-10-19 14:31:30.992 21099 INFO alembic.runtime.migration [-] Context impl MySQLImpl.
2016-10-19 14:31:30.993 21099 INFO alembic.runtime.migration [-] Will assume non-transactional DDL.

INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running stamp_revision  -> 60cf717201bc

# 啟動ironic api、conductor服務
[root@node-51 ~]# systemctl enable openstack-ironic-api openstack-ironic-conductor.service
[root@node-51 ~]# systemctl start openstack-ironic-api.service openstack-ironic-conductor.service


# 創建keystone ironic用戶
[root@node-51 ~]# openstack user create --password ironic ironic
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | default                          |
| enabled             | True                             |
| id                  | 0b284faf14f6407fb502e1c2804c3363 |
| name                | ironic                           |
| password_expires_at | None                             |
+---------------------+----------------------------------+

[root@node-51 ~]# openstack role add --project service --user ironic admin

# 創建ironic service
[root@node-51 ~]# openstack service create --name ironic --description \
     "Ironic baremetal provisioning service" baremetal
+-------------+---------------------------------------+
| Field       | Value                                 |
+-------------+---------------------------------------+
| description | Ironic baremetal provisioning service |
| enabled     | True                                  |
| id          | 1041fc80d30a4f33ac7620d99b239e78      |
| name        | ironic                                |
| type        | baremetal                             |
+-------------+---------------------------------------+

# 創建ironic service endpoint
[root@node-51 ~]# openstack endpoint create --region RegionOne \
        baremetal admin http://172.16.140.51:6385
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | d1104db185414482b813c53809a26f26 |
| interface    | admin                            |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 1041fc80d30a4f33ac7620d99b239e78 |
| service_name | ironic                           |
| service_type | baremetal                        |
| url          | http://172.16.140.51:6385              |
+--------------+----------------------------------+
[root@node-51 ~]# openstack endpoint create --region RegionOne \
                            baremetal \
                            public http://172.16.140.51:6385
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 7f6ccafa6fad4590b48ef1b05031aa69 |
| interface    | public                           |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 1041fc80d30a4f33ac7620d99b239e78 |
| service_name | ironic                           |
| service_type | baremetal                        |
| url          | http://172.16.140.51:6385              |
+--------------+----------------------------------+
[root@node-51 ~]# openstack endpoint create --region RegionOne \
                            baremetal \
                            internal http://172.16.140.51:6385
+--------------+----------------------------------+
| Field        | Value                            |
+--------------+----------------------------------+
| enabled      | True                             |
| id           | 681149e943c849a48f98cf46358cd426 |
| interface    | internal                         |
| region       | RegionOne                        |
| region_id    | RegionOne                        |
| service_id   | 1041fc80d30a4f33ac7620d99b239e78 |
| service_name | ironic                           |
| service_type | baremetal                        |
| url          | http://172.16.140.51:6385        |
+--------------+----------------------------------+
  
# tips
如果keystone endpoint寫的是主機名、域名之類的話,用這條命令可以批量替換為ip地址

[root@node-51 ~]# mysql -uroot -popenstack
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 28
Server version: 10.1.17-MariaDB MariaDB Server
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
MariaDB [(none)]> use keystone;
MariaDB [(none)]> update endpoint set url=(replace(url,'node-51','172.16.140.51'));


創建PXE環境

# 創建tftp的根目錄
[root@node-51 ~]# mkdir -p /tftpboot
[root@node-51 ~]# chown -R ironic /tftpboot
[root@node-51 ~]# mkdir -p /tftpboot/master_p_w_picpaths

# 安裝tftp相關包
[root@node-51 ~]# yum install tftp-server syslinux-tftpboot xinetd -y

# 拷貝pxe p_w_picpath、chain.c32到/tftpboot目錄下
[root@node-51 ~]# cp /var/lib/tftpboot/pxelinux.0 /tftpboot
[root@node-51 ~]# cp /var/lib/tftpboot/chain.c32 /tftpboot

# 創建tftp map file
[root@node-51 ~]# echo 're ^(/tftpboot/) /tftpboot/\2' > /tftpboot/map-file
[root@node-51 ~]# echo 're ^/tftpboot/ /tftpboot/' >> /tftpboot/map-file
[root@node-51 ~]# echo 're ^(^/) /tftpboot/\1' >> /tftpboot/map-file
[root@node-51 ~]# echo 're ^([^/]) /tftpboot/\1' >> /tftpboot/map-file

# 安裝dnsmasq
[root@node-51 ~]# yum install -y dnsmasq
[root@node-51 ~]# cat /etc/dnsmasq.conf
dhcp-range=172.16.140.52,172.16.140.53,255.255.255.0,infinite
dhcp-host=0c:c4:7a:53:3f:ca,172.16.140.52,node-52   # 這里做了靜態ip綁定mac
dhcp-leasefile=/var/lib/dnsmasq/dnsmasq.leases
dhcp-option=3,172.16.140.1
expand-hosts
domain-needed
no-resolv
no-poll
no-hosts
cache-size=500
log-queries
log-facility=/var/log/dnsmasq.log
log-async=20
enable-tftp
tftp-root=/tftpboot
dhcp-boot=pxelinux.0

# 啟動&開機自啟動dnsmasq
[root@node-51 ~]# systemctl enable dnsmasq
[root@node-51 ~]# systemctl start dnsmasq


下載Ironic Deploy鏡像

[root@node-51 ~]# wget -c http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe-stable-newton.vmlinuz \
                        -p /tftpboot/
[root@node-51 ~]# wget -c http://tarballs.openstack.org/ironic-python-agent/coreos/files/coreos_production_pxe_p_w_picpath-oem-stable-newton.cpio.gz \
                        -p /tftpboot/


制作Ironic系統鏡像

參考這里:http://docs.openstack.org/project-install-guide/baremetal/draft/deploy-ramdisk.html#deploy-ramdisk

[root@node-51 ~]# ll /tftpboot/centos7/        # 這里做了個centos7的ironic鏡像
total 1308684
-rw-r--r-- 1 ironic ironic   45767864 Oct 19 20:36 centos7.2.initrd
-rw-r--r-- 1 ironic ironic 1289164800 Oct 19 20:37 centos7.2.qcow2
-rwxr-xr-x 1 ironic ironic    5155536 Oct 19 20:37 centos7.2.vmlinuz

[root@node-51 ~]# chown -R ironic /tftpboot


創建Ironic節點

#添加主機到ironic
ironic node-create -d pxe_ipmitool \
                    -i ipmi_address=172.16.130.52 \
                    -i ipmi_username=ADMIN \
                    -i ipmi_password=admin \
                    -i deploy_kernel=file:///tftpboot/coreos_production_pxe-stable-newton.vmlinuz \
                    -i deploy_ramdisk=file:////tftpboot/coreos_production_pxe_p_w_picpath-oem-stable-newton.cpio

#創建dhcp端口                                        
ironic port-create -n 5a0b47f8-98dc-4296-8d6c-9b7c25e6c893(ironic節點id) \
                   -a 0c:c4:7a:53:3f:ca(node-52實際mac地址)

#設置鏡像信息                   
ironic node-update 5a0b47f8-98dc-4296-8d6c-9b7c25e6c893 \
            add instance_info/p_w_picpath_source=file:///tftpboot/centos7/centos7.2.qcow2 \
            instance_info/kernel=file:///tftpboot/centos7/centos7.2.vmlinuz \
            instance_info/ramdisk=file:///tftpboot/centos7/centos7.2.initrd \
            instance_info/root_gb=30
            
#部署操作系統
ironic node-set-provision-state 5a0b47f8-98dc-4296-8d6c-9b7c25e6c893 active

#取消部署操作系統
ironic node-set-provision-state 5a0b47f8-98dc-4296-8d6c-9b7c25e6c893 deleted


參考鏈接

http://docs.openstack.org/project-install-guide/baremetal/draft/deploy-ramdisk.html#deploy-ramdisk

http://docs.openstack.org/developer/ironic-python-agent/troubleshooting.html











向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

镇康县| 伊宁县| 额尔古纳市| 新和县| 平度市| 蒙阴县| 大城县| 宜都市| 洪洞县| 凤山县| 宝鸡市| 博野县| 胶南市| 镇平县| 丰原市| 孟州市| 成安县| 朝阳区| 抚宁县| 涟水县| 仙桃市| 遂平县| 玉山县| 吴江市| 通榆县| 无棣县| 丹阳市| 巴林左旗| 武清区| 刚察县| 日喀则市| 砚山县| 宜春市| 尉犁县| 乐平市| 庆城县| 庄河市| 西充县| 巴里| 鹿泉市| 怀宁县|