CentOS 7部署OpenStack--部署Newtron(计算节点)

郝朝阳 DevOps视角

写在前面 本篇文章本应该是在周二的时候更新的,当时并没有更新,主要是在考虑怎样做才能把这个公众号给做好,给大家提供更好的帮助。思考了一天,仍没有什么好的想法。如果大家有好的建议,好的想法可在文章底部留言。

安装neutron


[root@compute ~]# yum install -y openstack-neutronopenstack-neutron-linuxbridge ebtables ipset

配置neutron


控制节点和计算节点的配置一样,可以直接从控制节点拷贝。


[root@controller ~]# scp /etc/neutron/neutron.conf 192.168.1.12:/etc/neutron/
[root@controller ~]# scp /etc/neutron/plugins/ml2/linuxbridge_agent.ini192.168.1.12:/etc/neutron/plugins/ml2/
[root@controller ~]# scp /etc/neutron/plugins/ml2/ml2_conf.ini192.168.1.12:/etc/neutron/plugins/ml2
[root@compute ~]# ln -s /etc/neutron/plugins/ml2/ml2_conf.ini/etc/neutron/plugin.ini

配置nova




[root@compute ~]# vim /etc/nova/nova.conf
3031 [neutron]
3032 url = http://192.168.1.11:9696
3033 auth_url = http://192.168.1.11:35357
3034 auth_plugin = password
3035 project_domain_id = default
3036 user_domain_id = default
3037 region_name = RegionOne
3038 project_name = service
3039 username = neutron
3040 password = neutron

启动服务



[root@compute ~]# systemctl restart openstack-nova-compute
[root@compute ~]# systemctl enable neutron-linuxbridge-agent.service
[root@compute ~]# systemctl start neutron-linuxbridge-agent.service

查看验证




[root@controller ~]# neutron agent-list
+--------------------------------------+--------------------+------------+-------+----------------+---------------------------+
| id                                  | agent_type         | host       | alive | admin_state_up | binary                    |
+--------------------------------------+--------------------+------------+-------+----------------+---------------------------+
| 41bcc4cb-dea4-4a4d-9ffa-18209c746762 | Metadata agent     | controller | :-)   | True           | neutron-metadata-agent    |
| 5c7c894f-5260-49d7-9da4-c90c0a591fb6 | DHCP agent         | controller | :-)   | True          | neutron-dhcp-agent        |
| 681419da-ab0d-4721-a82c-ac9fadcced67 | Linux bridge agent |compute    | :-)   | True           | neutron-linuxbridge-agent |
| 7df41d2f-f4a6-42cc-a761-83d9eab0a0f0 | Linux bridge agent | controller| :-)   | True           | neutron-linuxbridge-agent |
+--------------------------------------+--------------------+------------+-------+----------------+---------------------------+

创建网络




[root@controller ~]# neutron net-create flat --shared--provider:physical_network physnet1 --provider:network_type flat
Created a new network:
+---------------------------+--------------------------------------+
| Field                     |Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            |True                                 |
| id                        |d9aa89ae-01ba-4a3d-b553-7e63d48d0acb |
| mtu                       |0                                    |
| name                      |flat                                 |
| port_security_enabled     |True                                 |
| provider:network_type     |flat                                 |
| provider:physical_network | physnet1                             |
| provider:segmentation_id  |                                      |
| router:external           |False                                |
| shared                    |True                                 |
| status                    |ACTIVE                               |
| subnets                   |                                      |
| tenant_id                 |69d1967e59d247e6b7c4c3937d5baa89     |
+---------------------------+--------------------------------------+
[root@controller ~]# neutron net-list
+--------------------------------------+------+-----------------------------------------------------+
| id                                  | name | subnets                                             |
+--------------------------------------+------+-----------------------------------------------------+
| d9aa89ae-01ba-4a3d-b553-7e63d48d0acb | flat |a645f499-90a2-4e90-8bcb-f9040392c6bb 192.168.1.0/24 |
+--------------------------------------+------+-----------------------------------------------------+

创建子网


[root@controller ~]# neutron subnet-create flat 192.168.1.0/24 --nameflat-subnet --allocation-pool start=192.168.1.100,end=192.168.1.200--dns-nameserver 192.168.1.1 --gateway 192.168.1.1
Created a new subnet:
+-------------------+----------------------------------------------------+
| Field             | Value                                              |
+-------------------+----------------------------------------------------+
| allocation_pools  | {"start":"192.168.1.100", "end": "192.168.1.200"} |
| cidr              |192.168.1.0/24                                     |
| dns_nameservers   |192.168.1.1                                        |
| enable_dhcp       | True                                               |
| gateway_ip        |192.168.1.1                                        |
| host_routes       |                                                   |
| id                |a645f499-90a2-4e90-8bcb-f9040392c6bb               |
| ip_version        | 4                                                 |
| ipv6_address_mode |                                                   |
| ipv6_ra_mode      |                                                   |
| name              |flat-subnet                                        |
| network_id        |d9aa89ae-01ba-4a3d-b553-7e63d48d0acb               |
| subnetpool_id     |                                                   |
| tenant_id         |69d1967e59d247e6b7c4c3937d5baa89                   |
+-------------------+----------------------------------------------------+
[root@controller ~]# neutron subnet-list
+--------------------------------------+-------------+----------------+----------------------------------------------------+
| id                                   | name        | cidr           | allocation_pools                                   |
+--------------------------------------+-------------+----------------+----------------------------------------------------+
| a645f499-90a2-4e90-8bcb-f9040392c6bb | flat-subnet | 192.168.1.0/24 |{"start": "192.168.1.100", "end":"192.168.1.200"} |
+--------------------------------------+-------------+----------------+----------------------------------------------------+
    此时网络、存储(本地存储)、镜像已经完全具备,因此即使不安装cinder、dashboard就可以创建一台虚拟机了。下节就开始创建第一台虚拟机。