一、安装计算服务
1、安装计算服务
yum install openstack-nova-compute -y
2、编辑/etc/nova/nova.conf文件并设置如下内容
[DEFAULT] enabled_apis = osapi_compute,metadata transport_url = rabbit://openstack:ADMIN_PASS@controller my_ip = 192.168.122.31 use_neutron = True firewall_driver = nova.virt.firewall.NoopFirewallDriver ... [api] auth_strategy = keystone ... [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = nova password = ADMIN_PASS ... [vnc] enabled = True server_listen = 0.0.0.0 server_proxyclient_address = $my_ip novncproxy_base_url = http://192.168.122.31:6080/vnc_auto.html ... [glance] api_servers = http://controller:9292 ... [oslo_concurrency] lock_path = /var/lib/nova/tmp ... [placement] os_region_name = RegionOne project_domain_name = Default project_name = service auth_type = password user_domain_name = Default auth_url = http://controller:35357/v3 username = placement password = ADMIN_PASS
3、检测当前计算节点是否支持硬件虚拟化
我使用的虚拟机,这里返回0,明显我不支持硬件虚拟化
egrep -c '(vmx|svm)' /proc/cpuinfo
0
4、编辑/etc/nova/nova.conf文件设置qemu来提供软件虚拟化
[libvirt] virt_type = qemu cpu_mode = none
5、设置服务的开机自启动,并启动计算服务
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service
6、(控制节点)向cell数据库添加计算节点
执行下面的命令,查看计算节点信息是否已经在数据库
openstack compute service list --service nova-compute +----+--------------+------------+------+---------+-------+----------------------------+ | ID | Binary | Host | Zone | Status | State | Updated At | +----+--------------+------------+------+---------+-------+----------------------------+ | 7 | nova-compute | controller | nova | enabled | up | 2020-07-15T04:02:00.000000 | | 8 | nova-compute | computer1 | nova | enabled | up | 2020-07-15T04:01:53.000000 | +----+--------------+------------+------+---------+-------+----------------------------+
7、(控制节点)发现计算节点
su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova Found 2 cell mappings. Skipping cell0 since it does not contain hosts. Getting computes from cell 'cell1': fc354ac0-a088-4dbb-b106-e795ebeaec32 Checking host mapping for compute host 'compute': 47b0f376-fa1a-4fe8-9f2e-af1be125781a Creating host mapping for compute host 'compute': 47b0f376-fa1a-4fe8-9f2e-af1be125781a Found 1 unmapped computes in cell: fc354ac0-a088-4dbb-b106-e795ebeaec32
8、(控制节点)验证操作
列出计算服务的运行状态
openstack compute service list +----+------------------+------------+----------+---------+-------+----------------------------+ | ID | Binary | Host | Zone | Status | State | Updated At | +----+------------------+------------+----------+---------+-------+----------------------------+ | 4 | nova-conductor | controller | internal | enabled | up | 2020-07-15T04:00:58.000000 | | 5 | nova-consoleauth | controller | internal | enabled | up | 2020-07-15T04:00:59.000000 | | 6 | nova-scheduler | controller | internal | enabled | up | 2020-07-15T04:00:55.000000 | | 7 | nova-compute | controller | nova | enabled | up | 2020-07-15T04:01:00.000000 | | 8 | nova-compute | computer1 | nova | enabled | up | 2020-07-15T04:00:57.000000 | +----+------------------+------------+----------+---------+-------+----------------------------+
列出认证服务的端口
openstack catalog list +-----------+-----------+-----------------------------------------+ | Name | Type | Endpoints | +-----------+-----------+-----------------------------------------+ | nova | compute | RegionOne | | | | public: http://controller:8774/v2.1 | | | | RegionOne | | | | admin: http://controller:8774/v2.1 | | | | RegionOne | | | | internal: http://controller:8774/v2.1 | | | | | | placement | placement | RegionOne | | | | public: http://controller:8778 | | | | RegionOne | | | | admin: http://controller:8778 | | | | RegionOne | | | | internal: http://controller:8778 | | | | | | glance | image | RegionOne | | | | internal: http://controller:9292 | | | | RegionOne | | | | admin: http://controller:9292 | | | | RegionOne | | | | public: http://controller:9292 | | | | | | keystone | identity | RegionOne | | | | admin: http://controller:35357/v3/ | | | | RegionOne | | | | internal: http://controller:5000/v3/ | | | | RegionOne | | | | public: http://controller:5000/v3/ | | | | | | neutron | network | RegionOne | | | | public: http://controller:9696 | | | | RegionOne | | | | internal: http://controller:9696 | | | | RegionOne | | | | admin: http://controller:9696 | | | | | +-----------+-----------+-----------------------------------------+
列出镜像信息,确认能访问镜像服务
openstack image list +--------------------------------------+--------+--------+ | ID | Name | Status | +--------------------------------------+--------+--------+ | ca503a7e-e5f0-4773-823d-19d91387de46 | cirros | active | +--------------------------------------+--------+--------+
确认cells和placement api成功运行
nova-status upgrade check /usr/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py:332: NotSupportedWarning: Configuration option(s) ['use_tpool'] not supported exception.NotSupportedWarning Option "os_region_name" from group "placement" is deprecated. Use option "region-name" from group "placement". +--------------------------+ | 升级检查结果 | +--------------------------+ | 检查: Cells v2 | | 结果: 成功 | | 详情: None | +--------------------------+ | 检查: Placement API | | 结果: 成功 | | 详情: None | +--------------------------+ | 检查: Resource Providers | | 结果: 成功 | | 详情: None | +--------------------------+
二、安装网络服务
1、安装软件包
yum install openstack-neutron-linuxbridge ebtables ipset -y
2、编辑/etc/neutron/neutron.conf文件完成如下项
[DEFAULT] transport_url = rabbit://openstack:fuai123@controller auth_strategy = keystone ... [keystone_authtoken] auth_uri = http://controller:5000 auth_url = http://controller:35357 memcached_servers = controller:11211 auth_type = password project_domain_name = default user_domain_name = default project_name = service username = neutron password = fuai123 ... [oslo_concurrency] lock_path = /var/lib/neutron/tmp
3、配置linux bridge插件,编辑/etc/neutron/plugins/ml2/linuxbridge_agent.ini完成如下项
[linux_bridge] physical_interface_mappings = provider:enp0s8 #第二张网卡名 ... [vxlan] enable_vxlan = true local_ip = 192.168.122.78 l2_population = true ... [securitygroup] enable_security_group = true firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
4、确认内核支持网桥filters并作如下设置,编辑/etc/sysctl.conf增加以下内容
net.bridge.bridge-nf-call-iptables=1 net.bridge.bridge-nf-call-ip6tables=1
载入br_netfilter模块
modprobe br_netfilter
从配置文件加载内核参数
sysctl -p
配置计算服务使用网络服务/etc/nova/nova.conf
[neutron] url = http://controller:9696 auth_url = http://controller:35357 auth_type = password project_domain_name = default user_domain_name = default region_name = RegionOne project_name = service username = neutron password = ADMIN_PASS
5、完成安装,设置服务
systemctl restart openstack-nova-compute.service systemctl enable neutron-linuxbridge-agent.service systemctl start neutron-linuxbridge-agent.service
6、(控制节点)向cell数据库添加计算节点
openstack compute service list --service nova-compute 查看计算节点信息是否已经在数据库 su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova 发现计算节点
nova-status upgrade check 确认cells和placement api成功运行
7、(控制节点)验证操作
执行命令验证是否成功启动neutron-server
openstack extension list --network
执行命令列出插件,验证网络插件是否成功启动
# openstack network agent list +--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+ | ID | Agent Type | Host | Availability Zone | Alive | State | Binary | +--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+ | 4859bc89-2ec8-42e3-aa4e-9bd6173aa996 | DHCP agent | controller | nova | :-) | UP | neutron-dhcp-agent | | 53f36185-cd1a-437f-9b48-151c641a0018 | L3 agent | controller | nova | :-) | UP | neutron-l3-agent | | 68145ddd-7af4-4617-9dd4-026650a3b962 | Metadata agent | controller | None | :-) | UP | neutron-metadata-agent | | 8814a062-43e8-41a8-9fb7-0b07e6160dbf | Linux bridge agent | controller | None | :-) | UP | neutron-linuxbridge-agent | | fbe37150-a54b-40cb-91e6-30552a3dbcf2 | Linux bridge agent | compute | None | :-) | UP | neutron-linuxbridge-agent | +--------------------------------------+--------------------+------------+-------------------+-------+-------+---------------------------+