Openstack Liberty Lab第5部分:Nova计算服务配置

这是Openstack Lab指南系列的第5部分。

Openstack Liberty Lab第一部分:设置网络和所有先决条件

Openstack Liberty Lab第二部分:Openstack软件包安装

Openstack Liberty Lab第3部分:配置Keystone ID服务

Openstack Liberty Lab第四部分:概览图像服务设置

对于nova配置,您需要安装用于配置网络的KVM,qemu-kvm和bridge utils软件包。如果您跳过安装KVM,请立即执行。

[[email protected] ~]# yum -y install libvirt qemu-kvm bridge-utils virt-install

对于KVM来宾控制器VM,请按照以下教程启用嵌套虚拟化。

在Arch Linux和Manjaro上完全安装KVM,QEMU和Virt Manager

请按照以下步骤配置Nova计算服务。

  1. 检查是否已加载kvm内核模块。
[[email protected] ~]# lsmod | grep kvm 
kvm_intel 162153 0 
kvm 525259 1 kvm_intel
[[email protected] ~]#

如果不是,请使用modprobe命令加载它。
检查systemctl libvirtd守护程序服务的状态。必须正在运行:

[[email protected] 〜]#Systemctl状态libvirtd.service●libvirtd.service-virtualization守护程序已加载:已加载(/usr/lib/systemd/system/libvirtd.service;已启用;供应商预设:已启用)活动:活动(正在运行),自2016-03星期一-28 12:03:21吃; 7小时前

文件:man:libvirtd(8)
http://libvirt.org

主PID:1018(libvirtd)CGroup:/system.slice/libvirtd.service

└─1018/ usr / sbin / libvirtd

3月28日12:03:14控制器systemd[1]:虚拟化守护程序的启动… March 28 12:03:21 libvirtd控制器[1018]:Libvirt版本:1.2.17,软件包:13.el7_2.3(Cent…rg)Mar 28 12:03:21 controller libvirtd[1018]:模块/ usr / lib64 / libvirt /连接驱动程序/ libvir…bleMar 28 12:03:21控制器systemd[1]:虚拟化守护程序已启动。提示:某些行已被省略。使用-l进行全屏显示。

要启动libvirtd,请在终端中发出以下命令:

[[email protected] ~]# systemctl start libvirtd.service 
[[email protected] ~]# systemctl enable libvirtd.service
  1. 配置Nova数据库。
[[email protected] ~]# mysql -u root -p 
Enter password: 
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 21
Server version: 5.5.44-MariaDB MariaDB Server Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others. 
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. 
MariaDB [(none)]> create database nova;
Query OK, 1 row affected (0.00 sec) 
MariaDB [(none)]> grant all privileges on nova.* to [email protected]'localhost' identified by 'moonstack';
Query OK, 0 rows affected (0.00 sec) 
MariaDB [(none)]> grant all privileges on nova.* to [email protected]'%' identified by 'moonstack';
Query OK, 0 rows affected (0.00 sec) 
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec) 
MariaDB [(none)]> exit
Bye
[[email protected] ~]#
  1. 添加nova用户并为其分配管理员角色。
[[email protected] ~]# openstack user create --domain default --project service --password moonstack nova 
+--------------------+----------------------------------+
| Field | Value |
+--------------------+----------------------------------+
| default_project_id | 9c3ec09f5e08442eb211612f99cd22ad |
| domain_id | default |
| enabled | True |
| id | a26ae1410a804eb08735395ddbb96806 |
| name | nova |
+--------------------+----------------------------------+
[[email protected] ~]# openstack role add --project service --user nova admin
  1. 添加新星服务条目
[[email protected] ~]# openstack service create --name nova --description "OpenStack Compute service" compute 
+-------------+----------------------------------+
| Field | Value |
+-------------+----------------------------------+
| description | OpenStack Compute service |
| enabled | True |
| id | dc44e10058174846806e0a1ea23d22b6 |
| name | nova |
| type | compute |
+-------------+----------------------------------+
  1. 添加一个Compute Service API端点。内部,公共和管理员
[[email protected] ~]# export controller=192.168.1.60 
[[email protected] ~]# openstack endpoint create --region RegionOne compute public http://$controller:8774/v2/%(tenant_id)s 
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | 831f2786d19e4483897d532ee3241258 |
| interface | public |
| region | RegionOne | 
| region_id | RegionOne |
| service_id | dc44e10058174846806e0a1ea23d22b6 |
| service_name | nova |
| service_type | compute |
| url | http://192.168.1.60:8774/v2/%(tenant_id)s |
+--------------+-------------------------------------------+
[[email protected] ~]# openstack endpoint create --region RegionOne compute internal http://$controller:8774/v2/%(tenant_id)s 
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | f475c02b71054965b8ffbed63ef37a1d |
| interface | internal |
| region | RegionOne |
| region_id | RegionOne |
| service_id | dc44e10058174846806e0a1ea23d22 |
| service_name | nova |
| service_type | compute |
| url | http://192.168.1.60:8774/v2/%(tenant_id)s |
+--------------+-------------------------------------------+
[[email protected] ~]# openstack endpoint create --region RegionOne compute admin http://$controller:8774/v2/%(tenant_id)s 
+--------------+-------------------------------------------+
| Field | Value |
+--------------+-------------------------------------------+
| enabled | True |
| id | fdfe82742ca243328f12abf00b5db743 |
| interface | admin |
| region | RegionOne |
| region_id | RegionOne |
| service_id | dc44e10058174846806e0a1ea23d22 |
| service_name | nova |
| service_type | compute |
| url | http://192.168.1.60:8774/v2/%(tenant_id)s |
+--------------+-------------------------------------------+
[[email protected] ~]#
  1. 配置Nova。要更改的文件是/etc/nova/nova.conf
  • MariaDB服务器连接部分:
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf database connection mysql://nova:[email protected]/nova

RabbitMQ配置部分

[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT rpc_backend rabbit
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_host 192.168.1.60
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_port 5672
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_userid guest
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_password moonstack
[[email protected] ~]#
  • 梯形失真校正配置部分
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://192.168.1.60:5000
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://192.168.1.60:35357
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_plugin password
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_id default
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_id default
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken password moonstack
[[email protected] ~]#
  • 默认配置部分
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT state_path /var/lib/nova
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT log_dir /var/log/nova
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT osapi_compute_listen 0.0.0.0
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT osapi_compute_listen_port 8774
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT rootwrap_config /etc/nova/rootwrap.conf
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 192.168.1.60
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT compute_driver libvirt.LibvirtDriver
[[email protected] ~]#
  • Memcached服务器配置部分
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT memcached_servers 192.168.1.60:11211
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_driver nova.scheduler.filter_scheduler.FilterScheduler
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT notification_driver nova.openstack.common.notifier.rpc_notifier
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT api_paste_config api-paste.ini
[[email protected] ~]#
  • Neutron-Nova配置部分
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT network_api_class nova.network.neutronv2.api.API
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT security_group_api neutron
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT linuxnet_interface_driver nova.network.linux_net.NeutronLinuxBridgeInterfaceDriver
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT metadata_listen 0.0.0.0
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT metadata_host 192.168.1.60
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT vif_plugging_is_fatal True
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf DEFAULT vif_plugging_timeout 300
[[email protected] ~]#
  • VNC配置部分
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf vnc vncserver_proxyclient_address 192.168.1.60
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf vnc enabled True
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf vnc vncserver_listen 0.0.0.0
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url http://192.168.1.60:6080/vnc_auto.html
[[email protected] ~]#
  • 概览服务器配置部分
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf glance host 192.168.1.60
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf glance port 9292
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf glance protocol http
  • oslo_concurrency配置部分
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp
  • KVM / libvirt配置部分
[[email protected] ~]# openstack-config --set /etc/nova/nova.conf libvirt virt_type kvm
[[email protected] ~]#
  1. 将数据输入Compute数据库。
[[email protected] ~]# su -s /bin/sh -c "nova-manage db sync" nova
  1. 启动Compute服务并将其配置为在系统启动时启动:
  • 设置为在系统启动时启动。
[[email protected] ~]# systemctl enable openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service openstack-nova-compute.service
  • 启动服务:
[[email protected] ~]# systemctl start openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service openstack-nova-compute.service
  1. 检查所有分段服务是否正在运行。
[[email protected] ~]# systemctl status openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service openstack-nova-compute.service

输出:

[[email protected] 〜]#Systemctl status openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service●openstack-nova- api.service –加载OpenStack Nova API服务器:已加载(/usr/lib/systemd/system/openstack-nova-api.service;已启用;供应商预设:禁用)活动:活动(运行)2016-03- 28 20:27:36 EAT; 1分钟55秒前主PID:30155(nova-api)CGroup:/system.slice/openstack-nova-api.service

├─30155/ usr / bin / python2 / usr / bin /nova-api├─30236/ usr / bin / python2 / usr / bin /nova-api├─30237/ usr / bin / python2 / usr / bin / nova- api├─30238/ usr / bin / python2 / usr / bin / nova-api-30239 / usr / bin / python2 / usr / bin /nova-api├─30254/ usr / bin / python2 / usr / bin / nova -api├─30255/ usr / bin / python2 / usr / bin /nova-api├─30256/ usr / bin / python2 / usr / bin /nova-api└─30257/ usr / bin / python2 / usr / bin /新API

3月28日20:27:32控制器systemd[1]:OpenStack Nova API Server的启动… 3月28日20:27:36控制器sudo[30240]:Nova:TTY =未知; PWD = /; USER = root; COMMAND = / bin / nova-rootwrap /etc/nova/rootwrap.conf ipt…-save -c Mar 28 20:27:36 controller sudo[30243]:Nova:TTY =未知; PWD = /; USER = root; COMMAND = / bin / nova-rootwrap /etc/nova/rootwrap.conf ipt…存储-c Mar 28 20:27:36 controller systemd[1]:OpenStack Nova API服务器已启动。 ●openstack-nova-cert.service –已加载OpenStack Nova证书服务器:已加载(/usr/lib/systemd/system/openstack-nova-cert.service;已启用,供应商预设:已禁用)活动(运行)月2016- 03-28 20:27:35在EAT主PID之前的1分57秒:30156(nova-cert)CGroup:/system.slice/openstack-nova-cert.service

156─30156/ usr / bin / python2 / usr / bin / nova-cert

3月28日20:27:32控制器systemd[1]:OpenStack Nova Cert服务器启动… 3月28日20:27:35控制器systemd[1]:OpenStack Nova Cert服务器已启动。 ●openstack-nova-consoleauth.service –已加载OpenStack Nova VNC控制台身份验证服务器:已加载(/usr/lib/systemd/system/openstack-nova-consoleauth.service;已启用,供应商预设:已禁用)活动时间:2016年5月- 03-28 20:27:34 EAT后活动(运行)。 1分钟57秒前主PID:30157(nova-consoleaut)CGroup:/system.slice/openstack-nova-consoleauth.service

157─30157/ usr / bin / python2 / usr / bin / nova-consoleauth

3月28日20:27:32控制器systemd[1]:OpenStack Nova VNC控制台身份验证服务器的启动… 3月28日20:27:34控制器systemd[1]:OpenStack Nova VNC控制台身份验证服务器已启动。 ●openstack-nova-scheduler.service –已加载OpenStack Nova Scheduler Server:已加载(/usr/lib/systemd/system/openstack-nova-scheduler.service;有效,供应商预设:无效)活动:2016年3月20:27:34从EAT开始活跃(运行)。 1分零57秒前Main PID:30158(nova-scheduler)CGroup:/system.slice/openstack-nova-scheduler.service

└─30158/ usr / bin / python2 / usr / bin / nova-scheduler

3月28日20:27:32控制器systemd[1]:OpenStack Nova Scheduler Server启动… 3月28日20:27:34控制器systemd[1]:OpenStack Nova Scheduler Server已启动。 3月28日20:27:35控制器nova-scheduler[30158]:/Usr/lib64/python2.7/site-packages/sqlalchemy/sql/default_comparator.py:153:SAWarning:IN-pr…Mar 28 20:27:35 Controller nova-scheduler[30158]:“提高性能的策略”(%expr)●openstack-nova-conductor.service –已加载OpenStack Nova导体服务器:已加载(/usr/lib/systemd/system/openstack-nova-conductor.service;已启用;供应商预设:禁用)有效:2016年3月28日20:27:34 EAT之后有效(运行)。 1分钟57秒前主PID:30159(nova-conductor)CGroup:/system.slice/openstack-nova-conductor.service

├─30159/ usr / bin / python2 / usr / bin /新星导体├─30211/ usr / bin / python2 / usr / bin /新星导体├─30212/ usr / bin / python2 / usr / bin / nova-导体├─30213/ usr / bin / python2 / usr / bin /nova-conductor└─30214/ usr / bin / python2 / usr / bin / nova-conductor

3月28日20:27:32控制器systemd[1]:OpenStack Nova Conductor服务器启动… 3月28日20:27:34控制器systemd[1]:OpenStack Nova Conductor服务器已启动。 ●openstack-nova-novncproxy.service –已加载OpenStack Nova NoVNC代理服务器:已加载(/usr/lib/systemd/system/openstack-nova-novncproxy.service;已启用,供应商预设:已禁用)活动时间:2016-03-28 20:27:32从星期一开始活动(运行)。 2分钟0秒前主PID:30160(nova-novncproxy)CGroup:/system.slice/openstack-nova-novncproxy.service

160─30160/ usr / bin / python2 / usr / bin / nova-novncproxy –web / usr / share / novnc /

3月28日20:27:32控制器systemd[1]:OpenStack Nova NoVNC代理服务器已启动。 3月28日20:27:32控制器systemd[1]:启动OpenStack Nova NoVNC代理服务器…提示:省略了一些行。使用-l进行全屏显示。

●openstack-nova-compute.service – OpenStack Nova计算服务器
已加载:已加载(/usr/lib/systemd/system/openstack-nova-compute.service;已启用;供应商预设:已禁用)
活动:周二2016-03-29 00:20:00自EAT起活动(运行)。 5分钟前
主PID:3362(新星计算)
CGroup:/system.slice/openstack-nova-compute.service
336─3362/ usr / bin / python2 / usr / bin / nova-compute

3月29日00:19:58控制器systemd[1]:启动OpenStack Nova Compute Server…
3月29日00:20:00控制器systemd[1]:OpenStack Nova Compute Server已启动。
3月29日00:23:33控制器systemd[1]:OpenStack Nova Compute Server已启动。
提示:某些行已被省略。使用-l进行全屏显示。

在这一部分。配置了用于启动虚拟机的Nova计算服务。在Nova中启动虚拟机的最简单方法是使用Openstack Dashboard(Horizo​​ n)。稍后安装它并使用它启动虚拟机。说的东西:

Openstack Liberty Lab第4部分:Glance映像服务配置

下一篇文章:

Openstack Liberty Lab第6部分:配置Neutron网络服务

Sidebar