免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12345下一页
最近访问板块 发新帖
查看: 71429 | 回复: 47
打印 上一主题 下一主题

[OpenStack] 跟着官方文档一步一步架设openstack [复制链接]

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-11-27 23:29 |只看该作者 |倒序浏览
本帖最后由 milujite 于 2014-02-10 08:49 编辑

好久没折腾了,最近突然兴起,决定折腾一把openstack havana,目前openstack还是官方第一手资料比较先进,打算跟着官方文档,一步一步架设openstack。并将整个过程整理出来。
11月27日:经历了两个晚上,终于将keystone,glance,nova部属完成
12月9日:回家了一周,今天回来迫不及待开机,完成dashboard安装配置
12月18日:玩了几天游戏,今天在办公室用teamview连接到家里电脑,完成了cinder block service,新增一台vmware虚拟机,作为block存储节点。
2月10日:最近很忙,换工作,婚嫁,驾考都搞在一起了,回头继续更新

文章如果被转载请注明出处http://bbs.chinaunix.net/forum.p ... ;extra=#pid24064569

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
2 [报告]
发表于 2013-11-27 23:30 |只看该作者
先上openstack架构图

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
3 [报告]
发表于 2013-11-27 23:32 |只看该作者
本帖最后由 milujite 于 2013-12-18 14:14 编辑

12月18日新增一个vmware虚拟机作为cinder服务器

我的实验环境:我的实验环境比较简单,自己的台式机电脑,controller和hypervisor都部署在vmware workstation里,每台虚拟机配置如下:
  CPU:2*2
  内存:2048MB
  硬盘:16GB
  CPU设置:


OS Version:RHEL 6.4 x86_64
Controller:eth0:192.168.1.100/24        eth1:192.168.2.100/24
Hypervisor:eth0:192.168.1.101/24        eth1:不配置
Block:eth0:192.168.1.102/24            eth1:不配置
GATEWAY:192.168.1.1
DNS:8.8.8.8
Openstack Version:openstack-havana
官方文档链接:http://docs.openstack.org/havana ... nstall/yum/content/

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
4 [报告]
发表于 2013-11-27 23:34 |只看该作者
本帖最后由 milujite 于 2013-12-18 14:17 编辑

12月18日新增准备工作关闭SELINUX

第一章:安装前的准备工作:
关闭 selinux
  1. [root@openstack ~]# vi /etc/selinux/config
  2. SELINUX=disabled
复制代码
配置hosts
  1. [root@openstack ~]# vi /etc/hosts
  2. 127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
  3. 192.168.1.100 openstack
  4. 192.168.1.101 node01
  5. 192.168.1.102 storage
复制代码
配置源
  1. [root@openstack ~]# vi /etc/yum.repo.d/rhel-epel.repo
  2. [RHEL-epel]
  3. name=epel
  4. baseurl=http://dl.fedoraproject.org/pub/epel/6/x86_64/
  5. enabled=1
  6. gpgcheck=0
  7. [root@openstack ~]# vi /etc/yum.repo.d/openstack-hanava.repo
  8. [openstack-havana]
  9. name=OpenStack Havana Repository for EPEL 6
  10. baseurl=http://repos.fedorapeople.org/repos/openstack/openstack-havana/epel-6
  11. enabled=1
  12. gpgcheck=0
复制代码
挂载iso到/iso目录,并设置以下源:
  1. [root@openstack ~]# vi /etc/yum.repos.d/rhel-iso.repo
  2. [RHEL-Server]
  3. name=Red Hat Enterprise Linux $releasever - $basearch - Server
  4. baseurl=file:///iso/Server
  5. enabled=1
  6. gpgcheck=0
  7. [RHEL-HighAvailability]
  8. name=Red Hat Enterprise Linux $releasever - $basearch - HighAvailability
  9. baseurl=file:///iso/HighAvailability
  10. enabled=1
  11. gpgcheck=0
  12. [RHEL-LoadBalancer]
  13. name=Red Hat Enterprise Linux $releasever - $basearch - LoadBalancer
  14. baseurl=file:///iso/LoadBalancer
  15. enabled=1
  16. gpgcheck=0
  17. [RHEL-ScalableFileSystem]
  18. name=Red Hat Enterprise Linux $releasever - $basearch - ScalableFileSystem
  19. baseurl=file:///iso/ScalableFileSystem
  20. enabled=1
  21. gpgcheck=0
  22. [RHEL-ResilientStorage]
  23. name=Red Hat Enterprise Linux $releasever - $basearch - ResilientStorage
  24. baseurl=file:///iso/ResilientStorage
  25. enabled=1
  26. gpgcheck=0
复制代码
ntp服务:
  1. [root@openstack ~]# yum install ntp
  2. [root@openstack ~]# /etc/init.d/ntpd start
  3. [root@openstack ~]# chkconfig ntpd on
复制代码
每台机器都需要以上配置

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
5 [报告]
发表于 2013-11-27 23:35 |只看该作者
本帖最后由 milujite 于 2013-11-28 00:28 编辑

第二章:MYSQL 部署:
  1. [root@openstack ~]# yum install mysql mysql-server mysql-python
  2. [root@openstack ~]# /etc/init.d/mysqld start
  3. [root@openstack ~]# chkconfig mysqld on
  4. [root@openstack ~]# /usr/bin/mysqladmin -u root password 'openstack'
  5. [root@openstack ~]# mysql -uroot -p
  6. mysql> use mysql
  7. Reading table information for completion of table and column names
  8. You can turn off this feature to get a quicker startup with -A

  9. Database changed
  10. mysql> update user set password=PASSWORD('openstack') where user='root';
  11. Query OK, 2 rows affected (0.00 sec)
  12. Rows matched: 3  Changed: 2  Warnings: 0

  13. mysql> select user,password,host from user;
  14. +------+-------------------------------------------+-----------+
  15. | user | password                                  | host      |
  16. +------+-------------------------------------------+-----------+
  17. | root | *3A4A03AC22526F6B591010973A741D59A71D728E | localhost |
  18. | root | *3A4A03AC22526F6B591010973A741D59A71D728E | openstack |
  19. | root | *3A4A03AC22526F6B591010973A741D59A71D728E | 127.0.0.1 |
  20. |      |                                           | localhost |
  21. |      |                                           | openstack |
  22. +------+-------------------------------------------+-----------+
  23. 5 rows in set (0.00 sec)

  24. mysql> flush privileges;
  25. Query OK, 0 rows affected (0.00 sec)
  26. [root@openstack ~]# mysql_secure_installation
  27. NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
  28.       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

  29. In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank,so you should just press enter here.

  30. Enter current password for root (enter for none):
  31. OK, successfully used password, moving on...

  32. Setting the root password ensures that nobody can log into the MySQL
  33. root user without the proper authorisation.

  34. You already have a root password set, so you can safely answer 'n'.

  35. Change the root password? [Y/n] n
  36. ... skipping.

  37. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them.  This is intended only for testing, and to make the installation go a bit smoother.  You should remove them before moving into a
  38. production environment.

  39. Remove anonymous users? [Y/n] y
  40. ... Success!

  41. Normally, root should only be allowed to connect from 'localhost'.  This ensures that someone cannot guess at the root password from the network.

  42. Disallow root login remotely? [Y/n] n
  43. ... skipping.

  44. By default, MySQL comes with a database named 'test' that anyone can access.  This is also intended only for testing, and should be removed before moving into a production environment.

  45. Remove test database and access to it? [Y/n] y
  46. - Dropping test database...
  47. ... Success!
  48. - Removing privileges on test database...
  49. ... Success!

  50. Reloading the privilege tables will ensure that all changes made so far
  51. will take effect immediately.

  52. Reload privilege tables now? [Y/n] y
  53. ... Success!

  54. Cleaning up...

  55. All done!  If you've completed all of the above steps, your MySQL installation should now be secure.

  56. Thanks for using MySQL!
复制代码

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
6 [报告]
发表于 2013-11-27 23:37 |只看该作者
本帖最后由 milujite 于 2013-11-28 00:29 编辑

第三章:安装openstack-utils和qpidd message
  1. [root@openstack ~]# yum install crudini
  2. [root@openstack ~]# yum install openstack-utils
  3. [root@openstack ~]# yum install qpid-cpp-server memcached
  4. [root@openstack ~]# vi /etc/qpidd.conf
  5. auth=no
  6. [root@openstack ~]# /etc/init.d/qpidd start
  7. [root@openstack ~]# chkconfig qpidd on
复制代码

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
7 [报告]
发表于 2013-11-27 23:41 |只看该作者
本帖最后由 milujite 于 2013-11-28 00:28 编辑

第四章:安装配置identity服务keystone
  1. [root@openstack ~]# yum install openstack-keystone python-keystoneclient
复制代码
设置keystone的MySQL连接数据库账户为keystone,密码为openstack,数据库主机名为openstack,数据库为keystone
  1. [root@openstack ~]# openstack-config --set /etc/keystone/keystone.conf \
  2. > sql connection mysql://keystone:openstack@openstack/keystone
复制代码
初始化keystone数据库,要求与以上的keystone.conf配置相符,创建MySQL数据库keystone,账户为keystone,密码为openstack
  1. [root@openstack ~]# openstack-db --init --service keystone --password openstack
  2. Please enter the password for the 'root' MySQL user:
  3. Verified connectivity to MySQL.
  4. Creating 'keystone' database.
  5. Updating 'keystone' database password in /etc/keystone/keystone.conf
  6. Initializing the keystone database, please wait...
  7. Complete!
复制代码
配置keystone token
  1. [root@openstack ~]# ADMIN_TOKEN=$(openssl rand -hex 10)
  2. [root@openstack ~]# echo $ADMIN_TOKEN
  3. d7942140d255a0a61a30
  4. [root@openstack ~]# openstack-config --set /etc/keystone/keystone.conf DEFAULT admin_token $ADMIN_TOKEN
  5. [root@openstack ~]# cat /etc/keystone/keystone.conf |grep 'admin_token ='
  6. admin_token = d7942140d255a0a61a30
复制代码
创建keystone PKI签名证书
  1. [root@openstack ~]# keystone-manage pki_setup --keystone-user keystone --keystone-group keystone
  2. 2013-11-26 20:34:32.777 2054 INFO keystone.common.openssl [-] openssl genrsa -out /etc/keystone/ssl/certs/cakey.pem 2048
  3. Generating RSA private key, 2048 bit long modulus
  4. .............................+++
  5. ......................................+++
  6. e is 65537 (0x10001)
  7. 2013-11-26 20:34:32.913 2054 INFO keystone.common.openssl [-] openssl req -new -x509 -extensions v3_ca -key /etc/keystone/ssl/certs/cakey.pem -out /etc/keystone/ssl/certs/ca.pem -days 3650 -config /etc/keystone/ssl/certs/openssl.conf -subj /C=US/ST=Unset/L=Unset/O=Unset/CN=www.example.com
  8. 2013-11-26 20:34:32.925 2054 INFO keystone.common.openssl [-] openssl genrsa -out /etc/keystone/ssl/private/signing_key.pem 2048
  9. Generating RSA private key, 2048 bit long modulus
  10. ........................+++
  11. ......................................+++
  12. e is 65537 (0x10001)
  13. 2013-11-26 20:34:33.051 2054 INFO keystone.common.openssl [-] openssl req -key /etc/keystone/ssl/private/signing_key.pem -new -out /etc/keystone/ssl/certs/req.pem -config /etc/keystone/ssl/certs/openssl.conf -subj /C=US/ST=Unset/L=Unset/O=Unset/CN=www.example.com
  14. 2013-11-26 20:34:33.062 2054 INFO keystone.common.openssl [-] openssl ca -batch -out /etc/keystone/ssl/certs/signing_cert.pem -config /etc/keystone/ssl/certs/openssl.conf -days 3650d -cert /etc/keystone/ssl/certs/ca.pem -keyfile /etc/keystone/ssl/certs/cakey.pem -infiles /etc/keystone/ssl/certs/req.pem
  15. Using configuration from /etc/keystone/ssl/certs/openssl.conf
  16. Check that the request matches the signature
  17. Signature ok
  18. The Subject's Distinguished Name is as follows
  19. countryName           :PRINTABLE:'US'
  20. stateOrProvinceName   :ASN.1 12:'Unset'
  21. localityName          :ASN.1 12:'Unset'
  22. organizationName      :ASN.1 12:'Unset'
  23. commonName            :ASN.1 12:'www.example.com'
  24. Certificate is to be certified until Nov 24 12:34:33 2023 GMT (3650 days)

  25. Write out database with 1 new entries
  26. Data Base Updated
  27. [root@openstack ~]# chown -R keystone:keystone /etc/keystone/* /var/log/keystone/keystone.log
复制代码
设置keystone服务启动
  1. [root@openstack ~]# service openstack-keystone start
  2. Starting keystone:                                         [  OK  ]
  3. [root@openstack ~]# chkconfig openstack-keystone on
复制代码

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
8 [报告]
发表于 2013-11-27 23:43 |只看该作者
配置users/tenants/roles关联
正常来说,identity service需要帐号密码验证,但是目前还未创建,因此需要使用之前创建的admin_token来验证。

定义环境变量:
  1. [root@openstack ~]# export OS_SERVICE_TOKEN=d7942140d255a0a61a30
  2. [root@openstack ~]# export OS_SERVICE_ENDPOINT=http://openstack:35357/v2.0
复制代码
创建管理用户以及其他openstack service使用的tenant
  1. [root@openstack ~]# keystone tenant-create --name=admin --description="Admin Tenant"
  2. +-------------+----------------------------------+
  3. |   Property  |              Value               |
  4. +-------------+----------------------------------+
  5. | description |           Admin Tenant           |
  6. |   enabled   |               True               |
  7. |      id     | 1632f40c58bb4f7594af0c00af2103ad |
  8. |     name    |              admin               |
  9. +-------------+----------------------------------+

  10. [root@openstack ~]# keystone tenant-create --name=service --description="Service Tenant"
  11. +-------------+----------------------------------+
  12. |   Property  |              Value               |
  13. +-------------+----------------------------------+
  14. | description |          Service Tenant          |
  15. |   enabled   |               True               |
  16. |      id     | f9c647dd8c9046e4a628e50cfeefb870 |
  17. |     name    |             service              |
  18. +-------------+----------------------------------+
复制代码
创建管理用户admin,帐号名为admin,密码为openstack,邮箱为keystone@localhost
  1. [root@openstack ~]# keystone user-create --name=admin --pass=openstack \
  2. --email=keystone@localhost
  3. +----------+----------------------------------+
  4. | Property |              Value               |
  5. +----------+----------------------------------+
  6. |  email   |        keystone@localhost        |
  7. | enabled  |               True               |
  8. |    id    | f81fa135a2cf4b35949b7e88ec99e0c1 |
  9. |   name   |              admin               |
  10. +----------+----------------------------------+
复制代码
创建管理role
  1. [root@openstack ~]# keystone role-create --name=admin
  2. +----------+----------------------------------+
  3. | Property |              Value               |
  4. +----------+----------------------------------+
  5. |    id    | 9b2d58bd31b6493fa200eee77bb9302f |
  6. |   name   |              admin               |
  7. +----------+----------------------------------+
复制代码
关联tenants/roles给admin用户
  1. [root@openstack ~]# keystone user-role-add --user=admin --tenant=admin --role=admin
复制代码

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
9 [报告]
发表于 2013-11-27 23:46 |只看该作者
定义identity service和api endpoint
  Identity service也用来追踪openstack service以及这个服务在网络中的位置。每个openstack服务在安装时,需要使用keystone service-create来创建服务,并使用keystone endpoint-create制定该服务的api endpoint。
  现在,我们需要创建identy service本身,这样以后的keystone命令将直接使用普通的身份验证来代替admin_token身份验证。

创建identity service
  1. [root@openstack ~]# keystone service-create --name=keystone --type=identity --description="Keystone Identity Service"
  2. +-------------+----------------------------------+
  3. |   Property  |              Value               |
  4. +-------------+----------------------------------+
  5. | description |    Keystone Identity Service     |
  6. |      id     | 75b34145ffa04951b4cf90e7ea175b0a |
  7. |     name    |             keystone             |
  8. |     type    |             identity             |
  9. +-------------+----------------------------------+
复制代码
指定identity service的api endpoint,需要用到以上创建identity service返回的id。制定endpoint时,需要提供相应的public API/internal API/admin API。
  1. [root@openstack ~]# keystone endpoint-create \
  2. > --service-id=75b34145ffa04951b4cf90e7ea175b0a \
  3. > --publicurl=http://openstack:5000/v2.0 \
  4. > --internalurl=http://openstack:5000/v2.0 \
  5. > --adminurl=http://openstack:35357/v2.0
  6. +-------------+----------------------------------+
  7. |   Property  |              Value               |
  8. +-------------+----------------------------------+
  9. |   adminurl  |   http://openstack:35357/v2.0    |
  10. |      id     | df4f25de3a8d41a3a996f6745d7cb295 |
  11. | internalurl |    http://openstack:5000/v2.0    |
  12. |  publicurl  |    http://openstack:5000/v2.0    |
  13. |    region   |            regionOne             |
  14. |  service_id | 75b34145ffa04951b4cf90e7ea175b0a |
  15. +-------------+----------------------------------+
复制代码
验证identity service和API endpoint绑定,执行以下命令将返回admin用户的tenant id、user id、证书等等信息。
  1. [root@openstack ~]# unset OS_SERVICE_TOKEN OS_SERVICE_ENDPOINT
  2. [root@openstack ~]# keystone --os-username=admin --os-password=openstack \ --os-auth-url=http://openstack:35357/v2.0 token-get
  3. [root@openstack ~]# keystone --os-username=admin --os-password=openstack \
  4. --os-tenant-name=admin --os-auth-url=http://openstack:35357/v2.0 token-get
复制代码
同样也可以这样来验证
  1.   以上验证也可以通过以下简单方式进行:
  2. [root@openstack ~]# vi keystonerc
  3. export OS_USERNAME=admin
  4. export OS_PASSWORD=openstack
  5. export OS_TENANT_NAME=admin
  6. export OS_AUTH_URL=http://openstack:35357/v2.0
  7. [root@openstack ~]# source keystonerc
  8. [root@openstack ~]# keystone token-get

  9. [root@openstack ~]# keystone user-list
  10. +----------------------------------+-------+---------+--------------------+
  11. |                id                |  name | enabled |       email        |
  12. +----------------------------------+-------+---------+--------------------+
  13. | f81fa135a2cf4b35949b7e88ec99e0c1 | admin |   True  | keystone@localhost |
  14. +----------------------------------+-------+---------+--------------------+
复制代码

论坛徽章:
7
双子座
日期:2013-09-09 15:55:31CU大牛徽章
日期:2013-09-18 15:22:06CU大牛徽章
日期:2013-09-18 15:22:20CU大牛徽章
日期:2013-09-18 15:22:26CU大牛徽章
日期:2013-09-18 15:22:31CU大牛徽章
日期:2013-09-18 15:22:37CU大牛徽章
日期:2013-09-18 15:22:46
10 [报告]
发表于 2013-11-27 23:52 |只看该作者
本帖最后由 milujite 于 2013-11-28 00:29 编辑

第五章:安装配置image service
      Image service包含两个服务glance-api和glance-registry,前者用于发现、传输和存储image,后者用于管理image的metadata。默认glance将image存储在/var/lib/glance/images/,因此需要保证/var挂载点有足够的空间。另外还有一个服务scrubber用于清理被删除的image。

安装openstack-glance
  1. [root@openstack ~]# yum install openstack-glance
复制代码
配置glance数据库,设置glance的MySQL连接数据库账户为glance,密码为openstack,数据库主机名为openstack,数据库为glance
  1. [root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf \
  2. DEFAULT sql_connection mysql://glance:openstack@openstack/glance
  3. [root@openstack ~]# openstack-config --set /etc/glance/glance-registry.conf \
  4. DEFAULT sql_connection mysql://glance:openstack@openstack/glance
复制代码
初始化openstack glance时,密码要与以上的glance-api.conf/glance-registry.conf相符合。
  1. [root@openstack ~]# openstack-db --init --service glance --password openstack
  2. Please enter the password for the 'root' MySQL user:
  3. Verified connectivity to MySQL.
  4. Creating 'glance' database.
  5. Updating 'glance' database password in /etc/glance/glance-registry.conf /etc/glance/glance-api.conf
  6. Initializing the glance database, please wait...
  7. 2013-11-26 21:56:38.019 2711 INFO glance.db.sqlalchemy.migration [-] Upgrading database to version latest
  8. 2013-11-26 21:56:38.033 2711 INFO migrate.versioning.api [-] 0 -> 1...
  9. 2013-11-26 21:56:38.036 2711 INFO glance.db.sqlalchemy.migrate_repo.schema [-] creating table images
  10. 2013-11-26 21:56:38.113 2711 INFO migrate.versioning.api [-] done
  11. 2013-11-26 21:56:38.113 2711 INFO migrate.versioning.api [-] 1 -> 2...
  12. 2013-11-26 21:56:38.117 2711 INFO glance.db.sqlalchemy.migrate_repo.schema [-] creating table image_properties
  13. 2013-11-26 21:56:38.163 2711 INFO migrate.versioning.api [-] done
  14. 2013-11-26 21:56:38.163 2711 INFO migrate.versioning.api [-] 2 -> 3...
  15. 2013-11-26 21:56:38.202 2711 INFO migrate.versioning.api [-] done
  16. 2013-11-26 21:56:38.203 2711 INFO migrate.versioning.api [-] 3 -> 4...
  17. 2013-11-26 21:56:38.218 2711 INFO migrate.versioning.api [-] done
  18. 2013-11-26 21:56:38.219 2711 INFO migrate.versioning.api [-] 4 -> 5...
  19. 2013-11-26 21:56:38.234 2711 INFO migrate.versioning.api [-] done
  20. 2013-11-26 21:56:38.234 2711 INFO migrate.versioning.api [-] 5 -> 6...
  21. 2013-11-26 21:56:38.272 2711 INFO migrate.versioning.api [-] done
  22. 2013-11-26 21:56:38.272 2711 INFO migrate.versioning.api [-] 6 -> 7...
  23. 2013-11-26 21:56:38.290 2711 INFO migrate.versioning.api [-] done
  24. 2013-11-26 21:56:38.290 2711 INFO migrate.versioning.api [-] 7 -> 8...
  25. 2013-11-26 21:56:38.293 2711 INFO glance.db.sqlalchemy.migrate_repo.schema [-] creating table image_members
  26. 2013-11-26 21:56:38.366 2711 INFO migrate.versioning.api [-] done
  27. 2013-11-26 21:56:38.366 2711 INFO migrate.versioning.api [-] 8 -> 9...
  28. 2013-11-26 21:56:38.394 2711 INFO migrate.versioning.api [-] done
  29. 2013-11-26 21:56:38.394 2711 INFO migrate.versioning.api [-] 9 -> 10...
  30. 2013-11-26 21:56:38.399 2711 INFO migrate.versioning.api [-] done
  31. 2013-11-26 21:56:38.399 2711 INFO migrate.versioning.api [-] 10 -> 11...
  32. 2013-11-26 21:56:38.430 2711 INFO migrate.versioning.api [-] done
  33. 2013-11-26 21:56:38.430 2711 INFO migrate.versioning.api [-] 11 -> 12...
  34. 2013-11-26 21:56:38.564 2711 INFO migrate.versioning.api [-] done
  35. 2013-11-26 21:56:38.565 2711 INFO migrate.versioning.api [-] 12 -> 13...
  36. 2013-11-26 21:56:38.594 2711 INFO migrate.versioning.api [-] done
  37. 2013-11-26 21:56:38.594 2711 INFO migrate.versioning.api [-] 13 -> 14...
  38. 2013-11-26 21:56:38.599 2711 INFO glance.db.sqlalchemy.migrate_repo.schema [-] creating table image_tags
  39. 2013-11-26 21:56:38.636 2711 INFO migrate.versioning.api [-] done
  40. 2013-11-26 21:56:38.636 2711 INFO migrate.versioning.api [-] 14 -> 15...
  41. 2013-11-26 21:56:38.646 2711 INFO migrate.versioning.api [-] done
  42. 2013-11-26 21:56:38.646 2711 INFO migrate.versioning.api [-] 15 -> 16...
  43. 2013-11-26 21:56:38.702 2711 INFO migrate.versioning.api [-] done
  44. 2013-11-26 21:56:38.702 2711 INFO migrate.versioning.api [-] 16 -> 17...
  45. 2013-11-26 21:56:38.772 2711 INFO 017_quote_encrypted_swift_credentials [-] 'metadata_encryption_key' was not specified in the config file or a config file was not specified. This means that this migration is a NOOP.
  46. 2013-11-26 21:56:38.775 2711 INFO migrate.versioning.api [-] done
  47. 2013-11-26 21:56:38.775 2711 INFO migrate.versioning.api [-] 17 -> 18...
  48. 2013-11-26 21:56:38.781 2711 INFO glance.db.sqlalchemy.migrate_repo.schema [-] creating table image_locations
  49. 2013-11-26 21:56:38.795 2711 INFO migrate.versioning.api [-] done
  50. 2013-11-26 21:56:38.795 2711 INFO migrate.versioning.api [-] 18 -> 19...
  51. 2013-11-26 21:56:38.805 2711 INFO migrate.versioning.api [-] done
  52. 2013-11-26 21:56:38.806 2711 INFO migrate.versioning.api [-] 19 -> 20...
  53. 2013-11-26 21:56:38.842 2711 INFO migrate.versioning.api [-] done
  54. 2013-11-26 21:56:38.842 2711 INFO migrate.versioning.api [-] 20 -> 21...
  55. 2013-11-26 21:56:38.853 2711 INFO migrate.versioning.api [-] done
  56. 2013-11-26 21:56:38.853 2711 INFO migrate.versioning.api [-] 21 -> 22...
  57. 2013-11-26 21:56:38.881 2711 INFO migrate.versioning.api [-] done
  58. 2013-11-26 21:56:38.881 2711 INFO migrate.versioning.api [-] 22 -> 23...
  59. 2013-11-26 21:56:38.884 2711 INFO migrate.versioning.api [-] done
  60. 2013-11-26 21:56:38.884 2711 INFO migrate.versioning.api [-] 23 -> 24...
  61. 2013-11-26 21:56:38.889 2711 INFO migrate.versioning.api [-] done
  62. 2013-11-26 21:56:38.889 2711 INFO migrate.versioning.api [-] 24 -> 25...
  63. 2013-11-26 21:56:38.893 2711 INFO migrate.versioning.api [-] done
  64. 2013-11-26 21:56:38.893 2711 INFO migrate.versioning.api [-] 25 -> 26...
  65. 2013-11-26 21:56:38.963 2711 INFO migrate.versioning.api [-] done
  66. 2013-11-26 21:56:38.963 2711 INFO migrate.versioning.api [-] 26 -> 27...
  67. 2013-11-26 21:56:38.991 2711 INFO migrate.versioning.api [-] done
  68. 2013-11-26 21:56:38.991 2711 INFO migrate.versioning.api [-] 27 -> 28...
  69. 2013-11-26 21:56:39.009 2711 INFO migrate.versioning.api [-] done
  70. 2013-11-26 21:56:39.009 2711 INFO migrate.versioning.api [-] 28 -> 29...
  71. 2013-11-26 21:56:39.055 2711 INFO migrate.versioning.api [-] done
  72. Complete!
复制代码
创建配置glance用户
  1. [root@openstack ~]# keystone user-create --name=glance --pass=openstack --email=glance@localhost
  2. +----------+----------------------------------+
  3. | Property |              Value               |
  4. +----------+----------------------------------+
  5. |  email   |         glance@localhost         |
  6. | enabled  |               True               |
  7. |    id    | e037938e162a4a7c8c8b305d2ceb9e72 |
  8. |   name   |              glance              |
  9. +----------+----------------------------------+
复制代码
关联tenants/roles给glance用户
  1. [root@openstack ~]# keystone user-role-add --user=glance --tenant=service --role=admin
复制代码
设置image service验证
  1. [root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken auth_host openstack
  2. [root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_user glance
  3. [root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_tenant_name service
  4. [root@openstack ~]# openstack-config --set /etc/glance/glance-api.conf keystone_authtoken admin_password openstack
  5. [root@openstack ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken auth_host openstack
  6. [root@openstack ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_user glance
  7. [root@openstack ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_tenant_name service
  8. [root@openstack ~]# openstack-config --set /etc/glance/glance-registry.conf keystone_authtoken admin_password openstack
  9.   修改etc/glance/glance-api-paste.ini和/etc/glance/glance-registry-paste.ini相应的验证参数。
  10. [root@openstack ~]# cp /usr/share/glance/glance-api-dist-paste.ini /etc/glance/glance-api-paste.ini
  11. [root@openstack ~]# cp /usr/share/glance/glance-registry-dist-paste.ini /etc/glance/glance-registry-paste.ini
  12.   编辑找到/etc/glance/glance-registry-paste.ini和/etc/glance/glance-api-paste.ini找到[filter:authtoken]字段,分别设置为:
  13. [root@openstack ~]# vi /etc/glance/glance-api-paste.ini
  14. [filter:authtoken]
  15. paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
  16. delay_auth_decision = true
  17. auth_host=openstack
  18. admin_user=glance
  19. admin_tenant_name=service
  20. admin_password=openstack
  21. [root@openstack ~]# vi /etc/glance/glance-registry-paste.ini
  22. [filter:authtoken]
  23. paste.filter_factory = keystoneclient.middleware.auth_token:filter_factory
  24. auth_host=openstack
  25. admin_user=glance
  26. admin_tenant_name=service
  27. admin_password=openstack
复制代码
在identity service中注册image service
  1. [root@openstack ~]# keystone service-create --name=glance --type=image --description="Glance Image Service"
  2. +-------------+----------------------------------+
  3. |   Property  |              Value               |
  4. +-------------+----------------------------------+
  5. | description |       Glance Image Service       |
  6. |      id     | 5cf53ad726e6485784e569dd55bcf5ff |
  7. |     name    |              glance              |
  8. |     type    |              image               |
  9. +-------------+----------------------------------+
复制代码
关联image service和api endpoint
  1. [root@openstack ~]# keystone endpoint-create \
  2. > --service-id=5cf53ad726e6485784e569dd55bcf5ff  \
  3. > --publicurl=http://openstack:9292 \
  4. > --internalurl=http://openstack:9292 \
  5. > --adminurl=http://openstack:9292
  6. +-------------+----------------------------------+
  7. |   Property  |              Value               |
  8. +-------------+----------------------------------+
  9. |   adminurl  |      http://openstack:9292       |
  10. |      id     | c41f39bbe6ae45c39929a9075e5b29e0 |
  11. | internalurl |      http://openstack:9292       |
  12. |  publicurl  |      http://openstack:9292       |
  13. |    region   |            regionOne             |
  14. |  service_id | 5cf53ad726e6485784e569dd55bcf5ff |
  15. +-------------+----------------------------------+
复制代码
设置image service相关服务启动
  1. [root@openstack ~]# service openstack-glance-api start
  2. Starting openstack-glance-api:                             [  OK  ]
  3. [root@openstack ~]# service openstack-glance-registry start
  4. Starting openstack-glance-registry:                        [  OK  ]
  5. [root@openstack ~]# /etc/init.d/openstack-glance-scrubber start
  6. Starting openstack-glance-scrubber:                        [  OK  ]
  7. [root@openstack ~]# chkconfig openstack-glance-api on
  8. [root@openstack ~]# chkconfig openstack-glance-registry on
  9. [root@openstack ~]# chkconfig openstack-glance-scrubber on
复制代码
验证glance service
  1. [root@openstack ~]#wget http://cdn.download.cirros-cloud.net/0.3.1/cirros-0.3.1-x86_64-disk.img

  2. [root@openstack ~]# glance image-create --name="CirrOS 0.3.1" --disk-format=qcow2 --container-format=bare --is-public=true < cirros-0.3.1-x86_64-disk.img
  3. +------------------+--------------------------------------+
  4. | Property         | Value                                |
  5. +------------------+--------------------------------------+
  6. | checksum         | d972013792949d0d3ba628fbe8685bce     |
  7. | container_format | bare                                 |
  8. | created_at       | 2013-11-26T15:02:40                  |
  9. | deleted          | False                                |
  10. | deleted_at       | None                                 |
  11. | disk_format      | qcow2                                |
  12. | id               | c2b6c28b-ac3f-47de-9bc0-e72ea752f658 |
  13. | is_public        | True                                 |
  14. | min_disk         | 0                                    |
  15. | min_ram          | 0                                    |
  16. | name             | CirrOS 0.3.1                         |
  17. | owner            | None                                 |
  18. | protected        | False                                |
  19. | size             | 13147648                             |
  20. | status           | active                               |
  21. | updated_at       | 2013-11-26T15:02:40                  |
  22. +------------------+--------------------------------------+

  23. [root@openstack ~]# glance image-list
  24. +--------------------------------------+--------------+-------------+------------------+----------+--------+
  25. | ID                                   | Name         | Disk Format | Container Format | Size     | Status |
  26. +--------------------------------------+--------------+-------------+------------------+----------+--------+
  27. | c2b6c28b-ac3f-47de-9bc0-e72ea752f658 | CirrOS 0.3.1 | qcow2       | bare             | 13147648 | active |
  28. +--------------------------------------+--------------+-------------+------------------+----------+--------+
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP