$ mysql -u root -p
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
IDENTIFIED BY 'GLANCE_DBPASS';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \
IDENTIFIED BY 'GLANCE_DBPASS';
创建service,user,role
$ . admin-openrc
$ openstack user create --domain default --password-prompt glance
$ openstack role add --project service --user glance admin
创建endpoint,依次有public,internal,admin
$ openstack service create --name glance \
--description "OpenStack Image" image
$ openstack endpoint create --region RegionOne \
image public :9292
$ openstack endpoint create --region RegionOne \
image internal :9292
$ openstack endpoint create --region RegionOne \
image admin :9292
安装
# yum install openstack-glance
配置文件/etc/glance/glance-api.conf
数据库
[database]
...
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
keystone认证
[keystone_authtoken]
...
auth_uri = :5000
auth_url = :35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = GLANCE_PASS
[paste_deploy]
...
flavor = keystone
glance存储
[glance_store]
...
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
配置文件/etc/glance/glance-registry.conf
数据库
[database]
...
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
keystone认证
[keystone_authtoken]
...
auth_uri = :5000
auth_url = :35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = GLANCE_PASS
[paste_deploy]
...
flavor = keystone
同步数据库
# su -s /bin/sh -c "glance-manage db_sync" glance
启动
# systemctl enable openstack-glance-api.service \
openstack-glance-registry.service
# systemctl start openstack-glance-api.service \
openstack-glance-registry.service
验证
$ . admin-openrc
下载cirros镜像
$ wget
创建镜像
$ openstack image create "cirros" \
--file cirros-0.3.4-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--public
如果执行以下命令,显示如下,则成功
$ openstack image list
+--------------------------------------+--------+
| ID | Name |
+--------------------------------------+--------+
| 38047887-61a7-41ea-9b49-27987d5e8bb9 | cirros |
+--------------------------------------+--------+
计算资源服务 nova
控制节点
数据库
$ mysql -u root -p
CREATE DATABASE nova_api;
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \
IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' \
IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
IDENTIFIED BY 'NOVA_DBPASS';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \
IDENTIFIED BY 'NOVA_DBPASS';
创建service,user,role
$ . admin-openrc
$ openstack user create --domain default \
--password-prompt nova
$ openstack role add --project service --user nova admin
$ openstack service create --name nova \
--description "OpenStack Compute" compute
创建endpoint,依次有public,internal,admin
$ openstack endpoint create --region RegionOne \
compute public :8774/v2.1/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
compute internal :8774/v2.1/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
compute admin :8774/v2.1/%\(tenant_id\)s
安装
# yum install openstack-nova-api openstack-nova-conductor \
openstack-nova-console openstack-nova-novncproxy \
openstack-nova-scheduler
配置文件/etc/nova/nova.conf
启用的api
[DEFAULT]
...
enabled_apis = osapi_compute,metadata
[api_database]
...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova_api
数据库
[database]
...
connection = mysql+pymysql://nova:NOVA_DBPASS@controller/nova
rabbitmq队列
[DEFAULT]
...
rpc_backend = rabbit
[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS
keystone认证