# yum install openstack-nova-compute
Edit the /etc/nova/nova.conf file and complete the following actions:html
○ In the [DEFAULT] section, enable only the compute and metadata APIs: [DEFAULT] # ... enabled_apis = osapi_compute,metadata ○ In the [DEFAULT] section, configure RabbitMQ message queue access: [DEFAULT] # … transport_url=rabbit://openstack:openstack123@dbs.flex.net ○ In the [api] and [keystone_authtoken] sections, configure Identity service access:: [api] # ... auth_strategy = keystone [keystone_authtoken] # ... auth_url = http://stack.flex.net:5000/v3 memcached_servers = dbs.flex.net:11211 auth_type = password project_domain_name = Default user_domain_name = Default project_name = service username = nova password = nova123 注意: 註釋或移除在掉在[keystone_authtoken]區域中的其它的選項 ○ In the [DEFAULT] section, configure the my_ip option: [DEFAULT] # ... my_ip = 192.168.205.187 注意:使用管理接口的IP在你的計算節點上. ○ In the [DEFAULT] section, enable support for the Networking service: [DEFAULT] # ... use_neutron = true firewall_driver = nova.virt.firewall.NoopFirewallDriver 注意:缺省的,計算節點使用一內部的防火牆驅動,由於網絡服務包含了一個防火牆驅動,你必須禁用防火牆驅動並使用nova.virt.firewall.NoopFirewallDriver firewall driver ○ In the [vnc] section, enable and configure remote console access: [vnc] # ... enabled = true server_listen = 0.0.0.0 server_proxyclient_address = $my_ip novncproxy_base_url = http://stack.flex.net:6080/vnc_auto.html 服務器組件監聽全部IP地址,代理組件只監聽計算節點的管理接口IP地址。基本URL指示能夠使用web瀏覽器訪問此計算節點上實例的遠程控制檯的位置。 注意:若是要訪問遠程控制檯的web瀏覽器駐留在沒法解析控制器主機名的主機上,則必須使用控制器節點的管理接口IP地址替換控制器。 ○ In the [glance] section, configure the location of the Image service API: [glance] # ... api_servers = http://stack.flex.net:9292 ○ In the [oslo_concurrency] section, configure the lock path: [oslo_concurrency] # ... lock_path = /var/lib/nova/tmp ○ In the [placement] section, configure the Placement API: [placement] # ... region_name = RegionOne project_domain_name = Default project_name = service auth_type = password user_domain_name = Default auth_url = http://stack.flex.net:5000/v3 username = placement password = placement123
Determine whether your compute node supports hardware acceleration for virtual machines:node
$ egrep -c '(vmx|svm)' /proc/cpuinfo 若是這個命令返回1或大於1的值,你的計算節點支持硬件加速,一般不須要額外的配置,一般若是你的計算節點使用的是Vmware Workstation虛擬機,你能夠充許virtuallze Intel VT-x/EPT or AMD-V/RVI這樣打開虛擬化設置 若是這個命令返回一個0值,你的計算節點不支持硬件加速,而且你必須配置libvirt使用QEMU取代KVM, 編輯文件/etc/nova/nova.conf文件以下: [libvirt] # ... virt_type = qemu
Start the Compute service including its dependencies and configure them to start automatically when the system boots:web
# systemctl enable libvirtd.service openstack-nova-compute.service # systemctl start libvirtd.service openstack-nova-compute.service 注意:若是nova-compute服務沒法啓動,請檢查/var/log/nova/nova- computer .log。controller:5672上的錯誤消息AMQP服務器不可訪問,這可能代表控制器節點上的防火牆正在阻止對端口5672的訪問。將防火牆配置爲打開控制器節點上的端口5672並在計算節點上從新啓動nova-compute服務。
Source the admin credentials to enable admin-only CLI commands, then confirm there are compute hosts in the database:api
$ . admin-openrc $ openstack compute service list --service nova-compute +----+-------+--------------+------+-------+---------+----------------------------+ | ID | Host | Binary | Zone | State | Status | Updated At | +----+-------+--------------+------+-------+---------+----------------------------+ | 1 | node1 | nova-compute | nova | up | enabled | 2017-04-14T15:30:44.000000 | +----+-------+--------------+------+-------+---------+----------------------------+
Discover compute hosts:瀏覽器
# 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 compute nodes from cell 'cell1': ad5a5985-a719-4567-98d8-8d148aaae4bc Found 1 computes in cell: ad5a5985-a719-4567-98d8-8d148aaae4bc Checking host mapping for compute host 'compute': fe58ddc1-1d65-4f87-9456-bc040dc106b3 Creating host mapping for compute host 'compute': fe58ddc1-1d65-4f87-9456-bc040dc106b3 注意:當你添加新的計算節點,你必須運行nova-manage cell_v2 discover_hosts在控制器上註冊新的計算節點,替代方法爲你能夠在/etc/nova/nova.conf中設置一個適當的間間隔自動發現計算節點: [scheduler] discover_hosts_in_cells_interval = 300
Verify operation of the Compute service.
Note: Perform these commands on the controller node.服務器
$ . admin-openrc
List service components to verify successful launch and registration of each process:網絡
$ openstack compute service list +----+--------------------+------------+----------+---------+-------+----------------------------+ | Id | Binary | Host | Zone | Status | State | Updated At | +----+--------------------+------------+----------+---------+-------+----------------------------+ | 1 | nova-scheduler | controller | internal | enabled | up | 2016-02-09T23:11:15.000000 | | 2 | nova-conductor | controller | internal | enabled | up | 2016-02-09T23:11:16.000000 | | 3 | nova-compute | compute1 | nova | enabled | up | 2016-02-09T23:11:20.000000 | +----+--------------------+------------+----------+---------+-------+----------------------------+ Note: This output should indicate two service components enabled on the controller node and one service component enabled on the compute node.
$ openstack catalog list +-----------+-----------+---------------------------------------------+ | Name | Type | Endpoints | +-----------+-----------+---------------------------------------------+ | placement | placement | RegionOne | | | | admin: http://stack.flex.net:8778 | | | | RegionOne | | | | internal: http://stack.flex.net:8778 | | | | RegionOne | | | | public: http://stack.flex.net:8778 | | | | | | glance | image | RegionOne | | | | admin: http://stack.flex.net:9292 | | | | RegionOne | | | | public: http://stack.flex.net:9292 | | | | RegionOne | | | | internal: http://stack.flex.net:9292 | | | | | | nova | compute | RegionOne | | | | public: http://stack.flex.net:8774/v2.1 | | | | RegionOne | | | | internal: http://stack.flex.net:8774/v2.1 | | | | RegionOne | | | | admin: http://stack.flex.net:8774/v2.1 | | | | | | keystone | identity | RegionOne | | | | public: http://stack.flex.net:5000/v3/ | | | | RegionOne | | | | admin: http://stack.flex.net:5000/v3/ | | | | RegionOne | | | | internal: http://stack.flex.net:5000/v3/ | | | | | +-----------+-----------+---------------------------------------------+
List images in the Image service to verify connectivity with the Image service:app
$ openstack image list +--------------------------------------+-------------+-------------+ | ID | Name | Status | +--------------------------------------+-------------+-------------+ | 9a76d9f9-9620-4f2e-8c69-6c5691fae163 | cirros | active | +--------------------------------------+-------------+-------------+
Check the cells and placement API are working successfully and that other necessary prerequisites are in place:dom
# nova-status upgrade check +--------------------------------------------------------------------+ | Upgrade Check Results | +--------------------------------------------------------------------+ | Check: Cells v2 | | Result: Success | | Details: None | +--------------------------------------------------------------------+ | Check: Placement API | | Result: Success | | Details: None | +--------------------------------------------------------------------+ | Check: Ironic Flavor Migration | | Result: Success | | Details: None | +--------------------------------------------------------------------+ | Check: Request Spec Migration | | Result: Success | | Details: None | +--------------------------------------------------------------------+ | Check: Console Auths | | Result: Success | | Details: None | +--------------------------------------------------------------------+