手动安装openstack并配置虚拟化集成VM

手 动 安 装 openstack并 配 置 虚 拟 化 集 成 VM
云 计 算 含 义 :
弹 性 质
可 以 随 便 增 加 内 存 和 cpu,硬 盘
对 用 户 是 透 明 的
对 数 据 进 行 去 重

应 用 ,数 据 ,跑 的 时 间 ,中 间 件 ,系 统
虚 拟 机 ,服 务 器 ,存 储 ,网 络

计 算 分 层
云 计 算 绝 不 等 于 虚 拟 化
云 计 算 用 到 虚 拟 化 的 技 术

nova负 责 计 算 节 点
quantum 负 责 虚 拟 网 络
swift 负 责 云 存 储 ‘
libvirt 负 责 虚 拟 机 管 理 ,虚 拟 机 设 备 管 理 远 程 过 程

目 录 :
安 装 先 决 要 求
1.环 境
2.域 名 解 析 和 关 闭 防 火 墙
3.配 置 时 间 同 步 服 务 器 (NTP)
4.安 装 软 件 包
5.安 装 数 据 库
6.验 证 数 据 库
7.安 装 rabbitmq服 务
8.安 装 Memcached

安 装 目 录 :
1.安 装 配 置 keystone身 份 认 证 服 务
2.镜 像 服 务
3.(nova)的 安 装 及 配 置
4.网 络 服 务 neutron服 务 器 端 的 安 装 及 配 置
5.安 装 dashboard组 件
6.安 装 cinder
7.EXSI集 成 VM虚 拟 化
8.安 装 VMware vCenter Appliance 的 的 OVF
9.集 成 vmware

1.环 境
手 动 安 装 openstack
openstack-newton版
192.168.2.34 **
192.168.2.35 compute1
CentOS 7.3系 统 2 台
**即 作 为 控 制 节 点 ,也 作 为 计 算 节 点 .
compute1 就 只 是 计 算 节 点
拓 扑 图
wKioL1noBlHioxx0AAD5E3T6voU200.png
在 ESXI里 面 创 建 虚 拟 交 换 机
现 在 我 们 开 始 在 ESXI上 部 署 网 络
ESXI创 建 两 个 虚 拟 交 换 机 ,一 个 命 名 为 fuel_pxe,一 个 命 名 为 fuel_storage,加 上 原 有 的 vm network总 共 三 个 交 换 机 。
wKiom1noCViDHmRfAABkTZnRwOA978.png
wKioL1noBqOCdDNGAABV3rxaYkU331.png

创 建 虚 拟 机 ,内 存 8G以 上 ,硬 盘 100G以 上 ,创 建 三 个 网 卡 。
wKiom1noCbeh7t7uAACLQ6I8sYg567.png

控 制 节 点 去 操 控 计 算 节 点 ,计 算 节 点 上 可 以 创 建 虚 拟 机
** 192.168.2.34 网 卡 NAT ens160
(ens160是 内 网 网 卡 ,下 面 neutron配 置 文 件 里 会 设 置 到 )
compute1 192.168.2.35 网 卡 NAT ens160
wKioL1noBC2DMCDHAACBWZySfhE364.png
2.域 名 解 析 和 关 闭 防 火 墙 (控 制 节 点 和 计 算 节 点 都 做 )
/etc/hosts#主 机 名 一 开 始 设 置 好
后 面 就 无 法 更 改 了 ,否 则 就 会 出 问 题 !这 里 设 置 好 ip与 主 机 名 的 对 应 关 系
192.168.2.34 **
192.168.2.35 compute1
setenforce 0
systemctl start firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld.service
3.配 置 时 间 同 步 服 务 器 (NTP)
控 制 节 点
yum install chrony -y

安 装 服 务

sed -i ‘s/#allow 192.168\/2/allow 192.168\/2/g’ /etc/chrony.conf
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

更 改 时 区

启 动 NTP服 务
systemctl enable chronyd.service
systemctl start chronyd.service
配 置 计 算 节 点
yum install chrony -y
sed -i ‘s/^server.*$//g’ /etc/chrony.conf
sed -i “N;2aserver ** iburst” /etc/chrony.conf
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
更 改 时 区
systemctl enable chronyd.service
systemctl start chronyd.servic

4.安 装 软 件 包
sudo yum install -y centos-release-openstack-newton
sudo yum update -y
sudo yum install -y openstack-packstack
yum install python-openstackclient openstack-selinux -y
wKiom1noCr3gRep2AACNDDypctg003.png
5.安 装 数 据 库
控 制 节 点 下 操 作
yum install mariadb mariadb-server python2-PyMySQL -y
[root@** openstack]# vim /etc/my.cnf.d/openstack.cnf
[mysqld]
bind-address = 192.168.2.34 #本 服 务 器 的 ip
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8

启 动 数 据 库
systemctl enable mariadb.service
systemctl start mariadb.service
5.初 始 化 数 据 库

mysql_secure_installation

数 据 库 密 码 为 123456
6.验 证 数 据 库
[root@** openstack]# mysql -uroot -p123456
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.1.20-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)]>
wKioL1noB_LAddPlAAAi6FWc8nA162.png
wKioL1noB_OAO0AfAAFe_Xqdcso802.png
wKiom1noCqnTYPUVAABdW8SoQSc191.png

7.消 息 队 列
openstack使 用 一 个 消 息 队 列 的 服 务 之 间 进 行 协 调 的 操 作 和 状 态 的 信 息 。消 息 队 列 服 务 通 常 在 控 制 器 节 点 上 运 行 。OpenStack的 支 持 多 种 消 息 队 列 服 务 ,包 括 RabbitMQ的 , Qpid和 ZeroMQ。
8.安 装 rabbitmq
yum install rabbitmq-server -y

9.启 动 rabbitmq服 务
systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service

9.创 建 openstack用 户 这 里 使 用 RABBIT_PASS做 openstack用 户 的 密 码
[root@** ~]# rabbitmqctl add_user openstack RABBIT_PASS

Creating user “openstack” …
10.允 许 openstack用 户 的 配 置 ,写 入 和 读 取 的 访 问

rabbitmqctl set_permissions openstack “.” “.” “.*”
Setting permissions for user “openstack” in vhost “/” …

11.安 装 Memcached
yum install memcached python-memcached -y

12.启 动 服 务
systemctl enable memcached.service
systemctl start memcached.service

安 装 配 置 keystone身 份 认 证 服 务
[root@** ~]# mysql -uroot -p123456

创 建 keystone数 据 库

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

授 予 数 据 库 访 问 权 限

MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO ‘keystone’@’localhost’ IDENTIFIED BY ‘123456’;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO ‘keystone’@’%’ IDENTIFIED BY ‘123456’;

Query OK, 0 rows affected (0.00 sec)

用 合 适 的 密 码 替 换 KEYSTONE_DBPASS。

2.安 装 软 件 包
[root@** ~]# yum install openstack-keystone httpd mod_wsgi -y

3.编 辑 /etc/keystone/keystone.conf文 件
[root@** ~]# cd /etc/keystone/
[root@** keystone]# cp keystone.conf keystone.conf.bak
[root@** keystone]# egrep -v “^#|^$” keystone.conf.bak > keystone.conf
[root@** keystone]# vim keystone.conf
添 加 如 下 内 容
[database]
connection = mysql+pymysql://keystone:123456@**/keystone
[token]
provider = fernet

4.导 入 数 据 库
su -s /bin/sh -c “keystone-manage db_sync” keystone

5.初 始 化 存 储 库
[root@** ~]# keystone-manage fernet_setup –keystone-user keystone –keystone-group keystone
[root@** ~]# keystone-manage credential_setup –keystone-user keystone –keystone-group keystone

6.引 导 身 份 认 证
keystone-manage bootstrap –bootstrap-password admin –bootstrap-admin-url http://*/v3/ –bootstrap-internal-url http://*/v3/ –bootstrap-public-url http://**/v3/ –bootstrap-region-id RegionOne

7.配 置 http
[root@* ~]# sed -i ‘s/#ServerName www.example.com:80/ServerName */g’ /etc/httpd/conf/httpd.conf
[root@** ~]# ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/

systemctl enable httpd.service
systemctl start httpd.service
netstat -lntp |grep http

Oct 11 22:26:28 ** systemd[1]: Failed to start The Apache HTTP Server.
Oct 11 22:26:28 ** systemd[1]: Unit httpd.service entered failed state.
Oct 11 22:26:28 ** systemd[1]: httpd.service failed.

[root@localhost conf.d]# vi/etc/httpd/conf/httpd.conf
353行 是 这 一 行 ,我 们 把 它 注 释 掉 。
353 IncludeOptional conf.d/*.conf
systemctl start httpd.service
9.配 置 管 理 用 户
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://**/v3
export OS_IDENTITY_API_VERSION=3

10.创 建 用 户 、域 、角 色
openstack project create –domain default –description “Service Project” service
[root@** ~]# openstack project create –domain default –description “Service Project” service
Discovering versions from the identity service failed when creating the password plugin. Attempting to determine version from URL.
Unable to establish connection to http://*/v3/auth/tokens: HTTPConnectionPool(host=’*‘, port=35357): Max retries exceeded with url: /v3/auth/tokens (Caused by NewConnectionError(‘

. admin-openrc

3.创 建 服 务
创 建 nova用 户
[root@** openstack]# openstack user create –domain default –password-prompt nova
User Password:123456
Repeat User Password:123456
+———————+———————————-+
| Field | Value |
+———————+———————————-+
| domain_id | default |
| enabled | True |
| id | b0c274d46433459f8048cf5383d81e91 |
| name | nova |
| password_expires_at | None |
+———————+———————————-+
将 admin角 色 添 加 到 nova用 户
openstack role add –project service –user nova admin
创 建 nova服 务 实 体
openstack service create –name nova –description “OpenStack Compute” compute
4.创 建 API
openstack endpoint create –region RegionOne compute public http://**/v2.1/%(tenant_id)s
[root@* openstack]# openstack endpoint create –region RegionOne compute public http://*/v2.1/%(tenant_id)s
+————–+——————————————-+
| Field | Value |
+————–+——————————————-+
| enabled | True |
| id | c73837b6665a4583a1885b70e2727a2e |
| interface | public |
| region | RegionOne |
| region_id | RegionOne |
| service_id | e511923b761e4103ac6f2ff693c68639 |
| service_name | nova |
| service_type | compute |
| url | http://**/v2.1/%(tenant_id)s |
+————–+——————————————-+
[root@** openstack]#
openstack endpoint create –region RegionOne compute internal http://**/v2.1/%(tenant_id)s
openstack endpoint create –region RegionOne compute admin http://**/v2.1/%(tenant_id)s

安 装 软 件 包
yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler -y
6.编 辑 /etc/nova/nova.conf
[root@** ~]# cd /etc/nova/
[root@** nova]# cp nova.conf nova.conf.bak
[root@** nova]# egrep -v “^$|^#” nova.conf.bak > nova.conf
[root@** nova]# vim nova.conf
添 加 如 下 内 容
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:RABBIT_PASS@**
auth_strategy = keystone
my_ip = 192.168.2.34
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api_database]
connection = mysql+pymysql://nova:123456@**/nova_api
[database]
connection = mysql+pymysql://nova:123456@**/nova
[keystone_authtoken]
auth_uri = http://**
auth_url = http://**
memcached_servers = **:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = 123456
[vnc]
vncserver_listen = myipvncserverproxyclientaddress= my_ip
[glance]
api_servers = http://**/var/lib/nova/tmp

7.导 入 数 据 库
su -s /bin/sh -c “nova-manage api_db sync” nova
su -s /bin/sh -c “nova-manage db sync” nova
忽 略 此 输 出 的 任 何 弃 用 消 息

8.开 启 服 务
systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl start openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service

验 证
[root@** nova]# nova service-list
+—-+——————+————+———-+———+——-+————+—————–+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+—-+——————+————+———-+———+——-+————+—————–+
| 1 | nova-consoleauth | ** | internal | enabled | up | - | - |
| 2 | nova-conductor | ** | internal | enabled | up | - | - |
| 5 | nova-scheduler | ** | internal | enabled | up | - | - |
+—-+——————+————+———-+———+——-+————+—————–+

9d7a3478f985520d61e01b54aa4d1de3.png
72221efc1c68869e0e0cc4b1550b416e.png

nova计 算 节 点 服 务 安 装
安 装 配 置 计 算 节 点
yum install openstack-nova-compute -y
2.编 辑 /etc/nova/nova.conf
[root@compute1 ~]# cd /etc/nova/
[root@compute1 nova]# cp nova.conf nova.conf.bak
[root@compute1 nova]# egrep -v “^#|^$” nova.conf.bak > nova.conf
[root@compute1 nova]# vim nova.conf
[DEFAULT]

enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:RABBIT_PASS@**
auth_strategy = keystone
my_ip = 192.168.2.35
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[keystone_authtoken]

auth_uri = http://**
auth_url = http://**
memcached_servers = **:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = 123456
[vnc]

enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://**/vnc_auto.html
[glance]

api_servers = http://**/var/lib/nova/tmp

3.确 定 计 算 节 点 是 否 支 持 虚 拟 化 。

egrep -c ‘(vmx|svm)’ /proc/cpuinfo

假 如 返 回 值 大 于 1表 态 支 持 虚 拟 化
0
假 如 不 支 持 请 更 改 /etc/nova/nova.conf
[libvirt]

virt_type = qemu
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service

启 动 报 错
2017-10-11 16:13:04.611 15074 ERROR nova AccessRefused: (0, 0): (403) ACCESS_REFUSED - Login was refused using authentication mechanism AMQPLAIN. For details see the broker logfile.

rabbitmqctl add_user openstack RABBIT_PASS
rabbitmqctl set_permissions openstack “.” “.” “.*”
systemctl restart rabbitmq-server.service
重 启 所 有 nova服 务 在 控 制 节 点 上

[root@** openstack]# systemctl stop openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
[root@** openstack]# systemctl start openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
[root@** openstack]# openstack compute service list
+—-+——————+————+———-+———+——-+—————————-+
| ID | Binary | Host | Zone | Status | State | Updated At |
+—-+——————+————+———-+———+——-+—————————-+
| 1 | nova-consoleauth | ** | internal | enabled | up | 2017-10-11T08:27:57.000000 |
| 2 | nova-conductor | ** | internal | enabled | up | 2017-10-11T08:27:57.000000 |
| 5 | nova-scheduler | ** | internal | enabled | up | 2017-10-11T08:27:57.000000 |
+—-+——————+————+———-+———+——-+—————————-+
[root@** openstack]# nova service-list
+—-+——————+————+———-+———+——-+—————————-+—————–+
| Id | Binary | Host | Zone | Status | State | Updated_at | Disabled Reason |
+—-+——————+————+———-+———+——-+—————————-+—————–+
| 1 | nova-consoleauth | ** | internal | enabled | up | 2017-10-11T08:28:57.000000 | - |
| 2 | nova-conductor | ** | internal | enabled | up | 2017-10-11T08:28:57.000000 | - |
| 5 | nova-scheduler | ** | internal | enabled | up | 2017-10-11T08:28:57.000000 | - |
| 9 | nova-compute | compute1 | nova | enabled | up | 2017-10-11T08:29:03.000000 | - |
+—-+——————+————+———-+———+——-+—————————-+—————–+
[root@** openstack]#

网 络 服 务 neutron服 务 器 端 的 安 装 及 配 置
mysql -u root -p123456
CREATE DATABASE neutron;
GRANT ALL PRIVILEGES ON neutron.* TO ‘neutron’@’localhost’ IDENTIFIED BY ‘123456’;
GRANT ALL PRIVILEGES ON neutron.* TO ‘neutron’@’%’ IDENTIFIED BY ‘123456’;
2.获 取 admin权 限

. admin-openrc

3.创 建 neutron服 务

openstack user create –domain default –password-prompt neutron

[root@** ~]# openstack user create –domain default –password-prompt neutron
User Password:123456
Repeat User Password:123456
+———————+———————————-+
| Field | Value |
+———————+———————————-+
| domain_id | default |
| enabled | True |
| id | 6d0d3ffc8b3247d5b2e35ccd93cb5fb6 |
| name | neutron |
| password_expires_at | None |
+———————+———————————-+
openstack role add –project service –user neutron admin
openstack service create –name neutron –description “OpenStack Networking” network
+————-+———————————-+
| Field | Value |
+————-+———————————-+
| description | OpenStack Networking |
| enabled | True |
| id | 41251fae3b584d96a5485739033a700e |
| name | neutron |
| type | network |
+————-+———————————-+

4.创 建 网 络 服 务 API端 点
openstack endpoint create –region RegionOne network public http://**/span>
openstack endpoint create –region RegionOne network internal http://**/span>
openstack endpoint create –region RegionOne network admin http://**/span>
[root@* openstack]# openstack endpoint create –region RegionOne network public http://*//**:9696 |
+————–+———————————-+
[root@* openstack]# openstack endpoint create –region RegionOne network internal http://*//**:9696 |
+————–+———————————-+
[root@* openstack]# openstack endpoint create –region RegionOne network admin http://*//**:9696 |
+————–+———————————-+

网 络 选 择 网 络 1模 式 :Provider networks
yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables -y
5.编 辑 /etc/neutron/neutron.conf
[root@** ~]# cd /etc/neutron/
[root@** neutron]# cp neutron.conf neutron.conf.bak
[root@** neutron]# egrep -v “^$|^#” neutron.conf.bak > neutron.conf
[root@** neutron]# vim neutron.conf
[database]

connection = mysql+pymysql://neutron:123456@**/neutron
[keystone_authtoken]

auth_uri = http://**
auth_url = http://**
memcached_servers = **:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = neutron
password = 123456
[nova]

auth_url = http://**
auth_type = password
project_domain_name = Default
user_domain_name = Default
region_name = RegionOne
project_name = service
username = nova
password = 123456
[oslo_concurrency]

lock_path = /var/lib/neutron/tmp
[DEFAULT]
core_plugin = ml2
service_plugins =
transport_url = rabbit://openstack:RABBIT_PASS@**
auth_strategy = keystone
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
6.编 辑 /etc/neutron/plugins/ml2/ml2_conf.ini

[root@** ~]# cd /etc/neutron/plugins/ml2/
[root@** ml2]# cp ml2_conf.ini ml2_conf.ini.bak
[root@** ml2]# egrep -v “^$|^#” ml2_conf.ini.bak > ml2_conf.ini
[root@** ml2]# vim ml2_conf.ini
[ml2]

type_drivers = flat,vlan
tenant_network_types =
mechanism_drivers = linuxbridge
extension_drivers = port_security
[ml2_type_flat]

flat_networks = provider
[securitygroup]

enable_ipset = True

6.编 辑 /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[root@** ~]# cd /etc/neutron/plugins/ml2/
[root@controller ml2]# cp linuxbridge_agent.ini linuxbridge_agent.ini.bak
[root@** ml2]# egrep -v “^$|^#” linuxbridge_agent.ini.bak >linuxbridge_agent.ini
[root@** ml2]# vim linuxbridge_agent.ini
7.编 辑 /etc/neutron/dhcp_agent.ini
[linux_bridge]
physical_interface_mappings = provider:eth0
[vxlan]
enable_vxlan = False
[securitygroup]

enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
[root@** ~]# cd /etc/neutron/
[root@** neutron]# cp dhcp_agent.ini dhcp_agent.ini.bak
[root@** neutron]# egrep -v “^$|^#” dhcp_agent.ini.bak > dhcp_agent.ini
[root@** neutron]# vim dhcp_agent.ini
[DEFAULT]

interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True

8.修 改 /etc/neutron/metadata_agent.ini
[root@** ~]# cd /etc/neutron/
[root@** neutron]# cp metadata_agent.ini metadata_agent.ini.bak
[root@** neutron]# egrep -v “^$|^#” metadata_agent.ini.bak metadata_agent.ini
[root@** neutron]# egrep -v “^$|^#” metadata_agent.ini.bak > metadata_agent.ini
[root@** neutron]# vim metadata_agent.ini
[DEFAULT]

nova_metadata_ip = **
metadata_proxy_shared_secret = mate

8.编 辑 /etc/nova/nova.conf
[root@** ~]# cd /etc/nova/
[root@** nova]# cp nova.conf nova.conf.nova
[root@** nova]# vim nova.conf
[neutron]

url = http://*//*
auth_type = password
project_domain_name = Default
user_domain_name = Default
region_name = RegionOne
project_name = service
username = neutron
password = NEUTRON_PASS
service_metadata_proxy = True
metadata_proxy_shared_secret = mate

9.创 建 链 接
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
10.导 入 数 据 库
su -s /bin/sh -c “neutron-db-manage –config-file /etc/neutron/neutron.conf –config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head” neutron
INFO [alembic.runtime.migration] Running upgrade 89ab9a816d70 -> c879c5e1ee90, Add segment_id to subnet
INFO [alembic.runtime.migration] Running upgrade c879c5e1ee90 -> 8fd3918ef6f4, Add segment_host_mapping table.
INFO [alembic.runtime.migration] Running upgrade 8fd3918ef6f4 -> 4bcd4df1f426, Rename ml2_dvr_port_bindings
INFO [alembic.runtime.migration] Running upgrade 4bcd4df1f426 -> b67e765a3524, Remove mtu column from networks.
INFO [alembic.runtime.migration] Running upgrade b67e765a3524 -> a84ccf28f06a, migrate dns name from port
INFO [alembic.runtime.migration] Running upgrade a84ccf28f06a -> 7d9d8eeec6ad, rename tenant to project
INFO [alembic.runtime.migration] Running upgrade 7d9d8eeec6ad -> a8b517cff8ab, Add routerport bindings for L3 HA
INFO [alembic.runtime.migration] Running upgrade a8b517cff8ab -> 3b935b28e7a0, migrate to pluggable ipam
INFO [alembic.runtime.migration] Running upgrade 3b935b28e7a0 -> b12a3ef66e62, add standardattr to qos policies
INFO [alembic.runtime.migration] Running upgrade b12a3ef66e62 -> 97c25b0d2353, Add Name and Description to the networksegments table
INFO [alembic.runtime.migration] Running upgrade 97c25b0d2353 -> 2e0d7a8a1586, Add binding index to RouterL3AgentBinding
INFO [alembic.runtime.migration] Running upgrade 2e0d7a8a1586 -> 5c85685d616d, Remove availability ranges.
INFO [alembic.runtime.migration] Running upgrade 67daae611b6e -> 6b461a21bcfc, uniq_floatingips0floating_network_id0fixed_port_id0fixed_ip_addr
INFO [alembic.runtime.migration] Running upgrade 6b461a21bcfc -> 5cd92597d11d, Add ip_allocation to port
OK

11.重 启 nova-api服 务
systemctl restart openstack-nova-api.service
12.启 动 服 务
systemctl enable neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service
systemctl start neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service
systemctl enable neutron-l3-agent.service
systemctl start neutron-l3-agent.service

验 证 :
[root@** ~]# openstack network agent list
+————————————–+—————-+————+——————-+——-+——-+————————+
| ID | Agent Type | Host | Availability Zone | Alive | State | Binary |
+————————————–+—————-+————+——————-+——-+——-+————————+
| 5d6eb39f-5a04-41e3-9403-20319ef8c816 | DHCP agent | ** | nova | True | UP | neutron-dhcp-agent |
| 70fbc282-4dd1-4cd5-9af5-2434e8de9285 | Metadata agent | ** | None | True | UP | neutron-metadata-agent |
+————————————–+—————-+————+——————-+——-+——-+————————+

[root@** ~]#
网 卡 地 址 不 对
Failed to start OpenStack Neutron Linux Bridge Agent.
解 决 办 法 :
编 辑 /etc/neutron/plugins/ml2/linuxbridge_agent.ini
在 linux_bridge部 分 将 physical_interface_mappings改 为 physnet1:ens160,重 启 neutron-linuxbridge-agent服 务 即 可
[linux_bridge]

physical_interface_mappings = physnet1:ens160
[root@** ~]# openstack network agent list
+————————————–+——————–+————+——————-+——-+——-+—————————+
| ID | Agent Type | Host | Availability Zone | Alive | State | Binary |
+————————————–+——————–+————+——————-+——-+——-+—————————+
| 0207fffa-ae6b-4e06-a901-cc6ccb6c1404 | Linux bridge agent | ** | None | True | UP | neutron-linuxbridge-agent |
| 5d6eb39f-5a04-41e3-9403-20319ef8c816 | DHCP agent | ** | nova | True | UP | neutron-dhcp-agent |
| 70fbc282-4dd1-4cd5-9af5-2434e8de9285 | Metadata agent | ** | None | True | UP | neutron-metadata-agent |
+————————————–+——————–+————+——————-+——-+——-+—————————+

[root@cntroller ~]#
网 络 服 务 计 算 节 点 的 安 装 及 配 置
1.安 装 服 务

yum install openstack-neutron-linuxbridge ebtables ipset -y

2.修 改 /etc/neutron/neutron.conf
[database]

connection = mysql+pymysql://neutron:123456@**/neutron
[keystone_authtoken]

auth_uri = http://**
auth_url = http://**
memcached_servers = **:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = neutron
password = 123456
[nova]

auth_url = http://**
auth_type = password
project_domain_name = Default
user_domain_name = Default
region_name = RegionOne
project_name = service
username = nova
password = 123456
[oslo_concurrency]

lock_path = /var/lib/neutron/tmp
[DEFAULT]
core_plugin = ml2
service_plugins =
transport_url = rabbit://openstack:RABBIT_PASS@**
auth_strategy = keystone
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True

3.修 改 /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]
physical_interface_mappings = provider:ens160
[vxlan]
enable_vxlan = False
[securitygroup]

enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver

4.修 改 /etc/nova/nova.conf
[neutron]

url = http://*//*
auth_type = password
project_domain_name = Default
user_domain_name = Default
region_name = RegionOne
project_name = service
username = neutron
password = 123456
5.重 启 nova-compute服 务
systemctl restart openstack-nova-compute.service
6.启 动 服 务
systemctl enable neutron-linuxbridge-agent.service
systemctl start neutron-linuxbridge-agent.service
7.验 证
openstack network agent list
[root@** ~]# openstack network agent list
+————————————–+——————–+————+——————-+——-+——-+—————————+
| ID | Agent Type | Host | Availability Zone | Alive | State | Binary |
+————————————–+——————–+————+——————-+——-+——-+—————————+
| 0207fffa-ae6b-4e06-a901-cc6ccb6c1404 | Linux bridge agent | ** | None | True | UP | neutron-linuxbridge-agent |
| 5d6eb39f-5a04-41e3-9403-20319ef8c816 | DHCP agent | ** | nova | True | UP | neutron-dhcp-agent |
| 70fbc282-4dd1-4cd5-9af5-2434e8de9285 | Metadata agent | ** | None | True | UP | neutron-metadata-agent |
| ab7efa23-4957-475a-8c80-58b786e96cdd | Linux bridge agent | compute1 | None | True | UP | neutron-linuxbridge-agent |
+————————————–+——————–+————+——————-+——-+——-+—————————+
安 装 dashboard组 件
yum install openstack-dashboard httpd mod_wsgi memcached python-memcached
WEBROOT = ‘/dashboard/’
配 置 dashboard
编 辑 文 件 /etc/openstack-dashboard/local_settings 完 成 下 面 内 容
a.配 置 dashboard使 用 OpenStack服 务 【控 制 节 点 】
OPENSTACK_HOST = “192.168.2.34”
b.允 许 hosts 访 问 dashboard
ALLOWED_HOSTS = [‘*’]
c.配 置 缓 存 会 话 存 储 服 务 :
CACHES = {
‘default’: {
‘BACKEND’: ‘django.core.cache.backends.memcached.MemcachedCache’,
‘LOCATION’: ‘192.168.2.34:11211’,
}
}

注 意 :
注 释 掉 其 它 session存 储 配 置
d.配 置 user为 默 认 角 色
OPENSTACK_KEYSTONE_DEFAULT_ROLE = “user”
e.配 置 时 区
TIME_ZONE = “Asia/Shanghai”
完 成 安 装

1.CentOS,配 置 SELinux允 许 web server 连 接 to OpenStack 服 务 :
setsebool -P httpd_can_network_connect on
2.可 能 包 bug,dashboard CSS 加 载 失 败 ,运 行 下 面 命 令 解 决
chown -R apache:apache /usr/share/openstack-dashboard/static
3.启 动 服 务 ,并 设 置 开 机 启 动
systemctl enable httpd.service memcached.service
systemctl restart httpd.service memcached.service

http://**/dashboard/
输 入 管 理 员 的 用 户 名 和 密 码
0285f8389babba86f2f5c536d74cec69.png
d3bb6a1dee9f189a72f07526116adc57.png
f040a7081df020e3cbf2b4a1f3b6369e.png
[root@compute1 ~]# curl -I http://**/dashboard/
HTTP/1.1 500 Internal Server Error
Date: Thu, 12 Oct 2017 12:16:13 GMT
Server: Apache/2.4.6 (CentOS) mod_wsgi/3.4 Python/2.7.5
Connection: close
Content-Type: text/html; charset=iso-8859-1
vim /etc/httpd/conf.d/openstack-dashboard.conf
添 加 WSGIApplicationGroup %{GLOBAL}

Not Found
The requested URL /auth/login/ was not found on this server.
[:error] [pid 16188] WARNING:py.warnings:RemovedInDjango19Warning: The use of the language code ‘zh-cn’ is deprecated. Please use the ‘zh-hans’ translation instead.
修 改 vim /etc/httpd/conf.d/openstack-dashboard.conf
WEBROOT = ‘/dashboard/’

安 装 cinder
CREATE DATABASE cinder;
GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder’@’localhost’ IDENTIFIED BY ‘123456’;
GRANT ALL PRIVILEGES ON cinder.* TO ‘cinder’@’%’ IDENTIFIED BY ‘123456’;
GRANT ALL PRIVILEGES ON root.* TO ‘root’@’%’ IDENTIFIED BY ‘123456’;

[root@** neutron]# openstack user create –domain default –password-prompt cinder
User Password:123456
Repeat User Password:123456
‘+———————+———————————-+
| Field | Value |
+———————+———————————-+
| domain_id | default |
| enabled | True |
| id | cb24c3d7a80647d79fa851c8680e4880 |
| name | cinder |
| password_expires_at | None |
+———————+———————————-+’
openstack role add –project service –user cinder admin

[root@ontroller neutron]# openstack service create –name cinder –description “OpenStack Block Storage” volume
+————-+———————————-+
| Field | Value |
+————-+———————————-+
| description | OpenStack Block Storage |
| enabled | True |
| id | 686dd8eed2d44e4081513673e76e8060 |
| name | cinder |
| type | volume |
+————-+———————————-+
[root@** neutron]# openstack service create –name admin –description “OpenStack Block Storage” volume
+————-+———————————-+
| Field | Value |
+————-+———————————-+
| description | OpenStack Block Storage |
| enabled | True |
| id | 635e003e1979452e8f7f63c70b999fb2 |
| name | admin |
| type | volume |
+————-+———————————-+
[root@** neutron]# openstack service create –name public –description “OpenStack Block Storage” volume
+————-+———————————-+
| Field | Value |
+————-+———————————-+
| description | OpenStack Block Storage |
| enabled | True |
| id | 87fd1a9b8b3240458ac3b5fa8925b79b |
| name | public |
| type | volume |
+————-+———————————-+

[root@** neutron]# openstack service create –name internal –description “OpenStack Block Storage” volume
+————-+———————————-+
| Field | Value |
+————-+———————————-+
| description | OpenStack Block Storage |
| enabled | True |
| id | 1ff8370f7d7c4da4b6a2567c9fe83254 |
| name | internal |
| type | volume |
+————-+———————————-+

[root@** neutron]#
[root@** ~]# openstack service create –name admin –description “OpenStack Block Storage” volumev2
+————-+———————————-+
| Field | Value |
+————-+———————————-+
| description | OpenStack Block Storage |
| enabled | True |
| id | 12eaeb14115548b09688bd64bfee0af2 |
| name | admin |
| type | volumev2 |
+————-+———————————-+
You have new mail in /var/spool/mail/root
[root@** ~]# openstack service create –name public –description “OpenStack Block Storage” volumev2
+————-+———————————-+
| Field | Value |
+————-+———————————-+
| description | OpenStack Block Storage |
| enabled | True |
| id | b1dfc4b8c3084d9789c0b0731e0f4a2a |
| name | public |
| type | volumev2 |
+————-+———————————-+
[root@** ~]# openstack service create –name internal –description “OpenStack Block Storage” volumev2
+————-+———————————-+
| Field | Value |
+————-+———————————-+
| description | OpenStack Block Storage |
| enabled | True |
| id | b8d90f1e658e402f9871a2fbad1d21b0 |
| name | internal |
| type | volumev2 |
openstack service create –name cinderv2 –description “OpenStack Block Storage” volumev2
openstack endpoint create –region RegionOne volume public http://**:8776/v1/%(tenant_id)s
openstack endpoint create –region RegionOne volume internal http://**:8776/v1/%(tenant_id)s
openstack endpoint create –region RegionOne volume admin http://**:8776/v1/%(tenant_id)s
openstack endpoint create –region RegionOne volumev2 public http://**:8776/v2/%(tenant_id)s
openstack endpoint create –region RegionOne volumev2 internal http://**:8776/v2/%(tenant_id)s
openstack endpoint create –region RegionOne volumev2 admin http://**:8776/v2/%(tenant_id)s

安 装
yum install openstack-cinder -y
cd /etc/cinder/
cp cinder.conf cinder.conf.bak
egrep -v “^$|^#” cinder.conf.bak > cinder.conf
vim cinder.conf
[DEFAULT]
transport_url = rabbit://openstack:RABBIT_PASS@**
auth_strategy = keystone
my_ip = 192.168.2.34
[database]
connection = mysql://cinder:123456@**:3306/cinder
[keystone_authtoken]
auth_uri = http://**
auth_url = http://**
memcached_servers = **:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = cinder
password = 123456
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
[cinder]
os_region_name = RegionOne
su -s /bin/sh -c “cinder-manage db sync” cinder

[root@** cinder]# systemctl restart openstack-nova-api.service
[root@** cinder]# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-cinder-api.service to /usr/lib/systemd/system/openstack-cinder-api.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/openstack-cinder-scheduler.service to /usr/lib/systemd/system/openstack-cinder-scheduler.service.
[root@** cinder]# systemctl restart openstack-cinder-api.service openstack-cinder-scheduler.service

安 装 cinder节 点 (本 人 真 实 机 不 足 以 开 启 三 个 节 点 ,cinder节 点 安 装 在 compute上 )
compute
安 装 LVM作 为 后 端 存 储
compute#
yum install lvm2 -y
配 置 LVM(须 要 在 各 个 使 用 LVM的 服 务 节 点 上 配 置 LVM,让 其 显 示 ,能 被 扫 描 到 )
(本 人 的 计 算 节 点 自 带 LVM,所 以 须 要 加 上 之 前 的 LVM信 息 sda)
compute#
vi /etc/lvm/lvm.conf file
devices {

filter = [ “a/sda/”,”a/sdb/”, “r/.*/”]
假 如 存 储 节 点 上 本 身 自 带 LVM(节 点 操 作 系 统 在 sda盘 的 LVM上 ),则 须 要 加 上 sda的 配 置 。
cinder#
filter = [ “a/sda/”, “a/sdb/”, “r/.*/”]
假 如 计 算 节 点 上 本 身 自 带 LVM(节 点 操 作 系 统 在 sda盘 的 LVM上 ),则 须 要 配 置 sda的 配 置 。
compute#
filter = [ “a/sda/”, “r/.*/”]
}

systemctl enable lvm2-lvmetad.service
systemctl restart lvm2-lvmetad.service
yum install openstack-cinder targetcli python-keystone -y

建 立 物 理 卷 和 逻 辑 组
compute#
pvcreate /dev/sdb
vgcreate cinder-volumes /dev/sdb
[root@compute1 ~]# pvcreate /dev/sdb
Physical volume “/dev/sdb” successfully created.
[root@compute1 ~]# vgcreate cinder-volumes /dev/sdb
Volume group “cinder-volumes” successfully created
yum install openstack-cinder targetcli python-keystone -y

配 置 cinder各 个 组 件 的 配 置 文 件 (备 份 配 置 文 件 ,删 除 配 置 文 件 里 的 所 有 数 据 ,使 用 提 供 的 配 置 ):
vi /etc/cinder/cinder.conf
[database]
connection = mysql+pymysql://cinder:123456@**:3306/cinder
[DEFAULT]
transport_url = rabbit://openstack:RABBIT_PASS@**
auth_strategy = keystone
my_ip = 192.168.2.35
enabled_backends = lvm
glance_api_servers = http://**:9292
[keystone_authtoken]
auth_uri = http://**
auth_url = http://**
memcached_servers = **:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = cinder
[lvm]
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm
[oslo_concurrency]
lock_path = /var/lib/cinder/tmp
systemctl enable openstack-cinder-volume.service target.service
systemctl restart openstack-cinder-volume.service target.service
[root@** cinder]# openstack volume service list
+——————+————–+——+———+——-+—————————-+
| Binary | Host | Zone | Status | State | Updated At |
+——————+————–+——+———+——-+—————————-+
| cinder-scheduler | ** | nova | enabled | up | 2017-10-12T10:02:31.000000 |
| cinder-volume | compute1@lvm | nova | enabled | up | 2017-10-12T10:03:32.000000 |
+——————+————–+——+———+——-+—————————-+
[root@** cinder]#

创 建 卷
**#
命 令 :openstack volume create –size [多 少 Gb] [卷 名 ]
例 子 : openstack volume create –size 1 volume1
[root@** cinder]# openstack volume create –size 50 volume1
+———————+————————————–+
| Field | Value |
+———————+————————————–+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2017-10-12T10:03:51.987431 |
| description | None |
| encrypted | False |
| id | 51596429-b877-4f24-9574-dc266b3f4451 |
| migration_status | None |
| multiattach | False |
| name | volume1 |
| properties | |
| replication_status | disabled |
| size | 50 |
| snapshot_id | None |
| source_volid | None |
| status | creating |
| type | None |
| updated_at | None |
| user_id | 01f1a4a6e97244ec8a915cb120caa564 |
+———————+————————————–+

查 看 卷 详 情
**#
openstack volume list
[root@** cinder]# openstack volume list
+————————————–+————–+———–+——+————-+
| ID | Display Name | Status | Size | Attached to |
+————————————–+————–+———–+——+————-+
| 51596429-b877-4f24-9574-dc266b3f4451 | volume1 | available | 50 | |
+————————————–+————–+———–+——+————-+

9f4c5b9cdeb4acecd0348ea3aad9a723.png

在 192.168.2.53 VMEXSI主 机 上 操 作
集 成 VM虚 拟 化

vi /etc/vmware/config

libdir = “/usr/lib/vmware”
authd.proxy.vim = “vmware-hostd:hostd-vmdb”
authd.proxy.nfc = “vmware-hostd:ha-nfc”
authd.proxy.nfcssl = “vmware-hostd:ha-nfcssl”
authd.proxy.vpxa-nfcssl = “vmware-vpxa:vpxa-nfcssl”
authd.proxy.vpxa-nfc = “vmware-vpxa:vpxa-nfc”
authd.fullpath = “/sbin/authd”
authd.soapServer = “TRUE”
vmauthd.server.alwaysProxy = “TRUE”
vhv.enable = “TRUE”
安 装 VMware vCenter Appliance 的 的 OVF
点 进 login设 置 网 卡

c647a17b1ad90b915629d8d1884d5ca5.png
f7d67957dbb707f88c011b7c534fc229.png
4eb78af0cc96c5e644bd59eea0f0f651.png
9391233dfc74d830a116c7cbec9cb00c.png
688185febac4a738f3df4321948b72b4.png
632752780fe36dfcbbcadde3bfdfe558.png
5c7085440e36b4d491d9d43b81c33eb1.png
8eb3fa6daa4893743966a11f14cd7a91.png
729b4658b156ec029840e77ff264ffcd.png
526d43e42c6ae41224ef4fc0c3bc2408.png
f98ecd379676c4170dd6e598a5f6c1a6.png
cbb083e7c0420cb57c98916df534f4e9.png
Service network restart
安 装 VMware vCenter
浏 览 器 打 开 https://192.168.2.38:5480,登 录 root 密 码 vmware

集 成 vmware
(1)在 控 制 节 点 安 装 nova-compute。
yum install openstack-nova-compute python-suds
(2)备 份 nova.conf
cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
(3)修 改 nova.conf 集 成 VMware vCenter。
vi /etc/nova/nova.conf
添 加 以 下 配 置 :
在 [DEFAULT] 段 落 添 加 :
compute_driver = vmwareapi.VMwareVCDriver
在 [vmware] 段 落 添 加 :
vif_driver = nova.virt.baremetal.vif_driver.BareMetalVIFDriver
host_ip = 192.168.2.38 # vCenter 的 IP 地 址
host_username = root # vCenter 用 户 名
host_password = vmware # vCenter 密 码
datastore_regex = datastore5 # ESXi 存 储
cluster_name = openstack # vCenter 群 集
api_retry_count = 10
integration_bridge = VM Network # ESXi 虚 拟 机 网 络 端 口 组
vlan_interface = vmnic5 # ESXi 网 卡
fbac20c505dd5b68c1d54d934d5d1a88.png
(4)将 nova-compute 服 务 设 置 为 自 动 启 动 ,重 新 启 动 控 制 节 点 。
chkconfig openstack-nova-compute on
shutdown -r now
或 将 以 下 服 务 重 启 :
service openstack-nova-api restart
service openstack-nova-cert restart
service openstack-nova-consoleauth restart
service openstack-nova-scheduler restart
service openstack-nova-conductor restart
service openstack-nova-novncproxy restart
service openstack-nova-compute restart
(5)检 查 OpenStack 是 否 已 集 成 VMware vCenter。
nova connectionError: HTTPSConnectionPool(host=’192.168.2.38’, port=443): Max retries exceeded with url: /sdk/vimService.wsdl (Caused by NewConnectionError(‘

self.verify = cacert if cacert else not insecure

并 修 改 self.verify的 值 为 False,如 下 所 示 :
[python] view plain copy
class RequestsTransport(transport.Transport):
def init(self, cacert=None, insecure=True, pool_maxsize=10):
transport.Transport.init(self)
# insecure flag is used only if cacert is not
# specified.
#self.verify = cacert if cacert else not insecure
self.verify = False

self.session = requests.Session()
self.session.mount(‘file:///’,
LocalFileAdapter(pool_maxsize=pool_maxsize))
self.cookiejar = self.session.cookies
[root@** nova]# service openstack-nova-compute restart
Redirecting to /bin/systemctl restart openstack-nova-compute.service
[root@** nova]# nova hypervisor-list
+—-+————————————————+——-+———+
| ID | Hypervisor hostname | State | Status |
+—-+————————————————+——-+———+
| 1 | compute1 | up | enabled |
| 2 | domain-c7.21FC92E0-0460-40C7-9DE1-05536B3F9F2C | up | enabled |
+—-+————————————————+——-+———+
[root@** nova]#

1fbed381bb1b44b634204a15b0bcde9c.png
到 此 实 验 结 束 ,开 始 学 习 云 计 算
以 上 是 我 安 装 笔 记 。

你可能感兴趣的:(手动安装openstack并配置虚拟化集成VM)