OpenStack版本升级之Glance

来源:互联网 发布:python3 人工智能 编辑:程序博客网 时间:2024/05/18 23:13

F版的一些变化

对依赖库的变化主要是添加了一个jsonschema并去掉了对xattr、pysendfile及swift1.4.8的依赖,如果采用swift作为存储后端需要有python-swiftclient,另外还需要F版的Keystone。配置方面主要把认证中间件的配置从paste配置中移到了server配置中。功能上添加了V2版的api接口。

备份与安装

停止现有服务,并备份数据

[plain] view plaincopy
  1. [root@stackcc update_glance]# service glance-api stop  
  2. [root@stackcc update_glance]# service glance-registry stop  
  3. [root@stackcc update_glance]# cp -R /etc/glance ./glance-etc  
  4. [root@stackcc update_glance]# mysqldump -uglance -p glance > glance.sql  

下载并安装相关软件,因为我之前已经升级完了Keystone及Swift,这里只要安装jsonschema及Glance就可以了。

[plain] view plaincopy
  1. [root@stackcc update_glance]# pip install jsonschema  
  2. [root@stackcc update_glance]# git clone git://github.com/openstack/glance.git  
  3. [root@stackcc update_glance]# cd glance  
  4. [root@stackcc glance]# git checkout -b folsom origin/stable/folsom  
  5. [root@stackcc glance]# python setup.py install > install.info  

补充:如果还要在这台服务器上安装python-glanceclient的话,这里用pip install jsonschema==0.2安装就好,不然也会被删除重装的。原本采用以下方式安装glance的,安装后版本号不对成了0.0.0,我提了个bug在这(详情)

[plain] view plaincopy
  1. [root@stackcc update_glance]# wget https://github.com/openstack/glance/archive/stable/folsom.zip  
  2. [root@stackcc update_glance]# unzip folsom   
  3. [root@stackcc update_glance]# cd glance-stable-folsom/  
  4. [root@stackcc glance-stable-folsom]# python setup.py install  
  5. [root@stackcc glance-stable-folsom]# ll /usr/lib/python2.6/site-packages/ | grep glance  
  6. drwxr-xr-x 4 root root 4096 Nov 14 17:00 glance-0.0.0-py2.6.egg  
  7. drwxr-xr-x. 4 root root 4096 Jun 2 21:56 glance-2012.1-py2.6.egg  

配置Glance

将F的配置文件拷入到/etc/glance下替换掉原来的文件并修改相关配置,我的修改如下:

[plain] view plaincopy
  1. [root@stackcc etc]# for file in *; do diff -u $file /etc/glance/$file; done  
  2. --- glance-api.conf    2012-11-14 19:12:12.011623218 +0800  
  3. +++ /etc/glance/glance-api.conf    2012-11-16 09:44:37.534701521 +0800  
  4. @@ -9,7 +9,7 @@  
  5.  # in a request to add a new image to Glance? Known schemes are determined  
  6.  # by the known_stores option below.  
  7.  # Default: 'file'  
  8. -default_store = file  
  9. +default_store = swift  
  10.    
  11.  # List of which store classes and store class locations are  
  12.  # currently known to glance at startup.  
  13. @@ -46,7 +46,7 @@  
  14.  # SQLAlchemy connection string for the reference implementation  
  15.  # registry server. Any valid SQLAlchemy connection string is fine.  
  16.  # See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine  
  17. -sql_connection = sqlite:///glance.sqlite  
  18. +sql_connection = mysql://glance:glance@localhost/glance  
  19.    
  20.  # Period in seconds after which SQLAlchemy should reestablish its connection  
  21.  # to the database.  
  22. @@ -137,7 +137,7 @@  
  23.  # There are three methods of sending notifications, logging (via the  
  24.  # log_file directive), rabbit (via a rabbitmq queue), qpid (via a Qpid  
  25.  # message queue), or noop (no notifications sent, the default)  
  26. -notifier_strategy = noop  
  27. +notifier_strategy = qpid  
  28.    
  29.  # Configuration options if sending notifications via rabbitmq (these are  
  30.  # the defaults)  
  31. @@ -192,7 +192,7 @@  
  32.  # If you use Swift authentication service, set it to 'account':'user'  
  33.  # where 'account' is a Swift storage account and 'user'  
  34.  # is a user in that account  
  35. -swift_store_user = jdoe:jdoe  
  36. +swift_store_user = service:glance  
  37.    
  38.  # Auth key for the user authenticating against the  
  39.  # Swift authentication service  
  40. @@ -203,7 +203,7 @@  
  41.  swift_store_container = glance  
  42.    
  43.  # Do we create the container if it does not exist?  
  44. -swift_store_create_container_on_put = False  
  45. +swift_store_create_container_on_put = True  
  46.    
  47.  # What size, in MB, should Glance start chunking image files  
  48.  # and do a large object manifest in Swift? By default, this is  
  49. @@ -311,16 +311,16 @@  
  50.  auth_host = 127.0.0.1  
  51.  auth_port = 35357  
  52.  auth_protocol = http  
  53. -admin_tenant_name = %SERVICE_TENANT_NAME%  
  54. -admin_user = %SERVICE_USER%  
  55. -admin_password = %SERVICE_PASSWORD%  
  56. +admin_tenant_name = service  
  57. +admin_user = glance  
  58. +admin_password = service123  
  59.    
  60.  [paste_deploy]  
  61.  # Name of the paste configuration file that defines the available pipelines  
  62. -#config_file = glance-api-paste.ini  
  63. +config_file = /etc/glance/glance-api-paste.ini  
  64.    
  65.  # Partial name of a pipeline in your paste configuration file with the  
  66.  # service name removed. For example, if your paste section name is  
  67.  # [pipeline:glance-api-keystone], you would configure the flavor below  
  68.  # as 'keystone'.  
  69. -#flavor=  
  70. +flavor=keystone  
  71. --- glance-registry.conf    2012-11-14 19:10:51.688606629 +0800  
  72. +++ /etc/glance/glance-registry.conf    2012-11-14 19:48:43.600719378 +0800  
  73. @@ -25,7 +25,7 @@  
  74.  # SQLAlchemy connection string for the reference implementation  
  75.  # registry server. Any valid SQLAlchemy connection string is fine.  
  76.  # See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine  
  77. -sql_connection = sqlite:///glance.sqlite  
  78. +sql_connection = mysql://glance:glance@localhost/glance  
  79.    
  80.  # Period in seconds after which SQLAlchemy should reestablish its connection  
  81.  # to the database.  
  82. @@ -71,16 +71,16 @@  
  83.  auth_host = 127.0.0.1  
  84.  auth_port = 35357  
  85.  auth_protocol = http  
  86. -admin_tenant_name = %SERVICE_TENANT_NAME%  
  87. -admin_user = %SERVICE_USER%  
  88. -admin_password = %SERVICE_PASSWORD%  
  89. +admin_tenant_name = service  
  90. +admin_user = glance  
  91. +admin_password = service123  
  92.    
  93.  [paste_deploy]  
  94.  # Name of the paste configuration file that defines the available pipelines  
  95. -#config_file = glance-registry-paste.ini  
  96. +config_file = /etc/glance/glance-registry-paste.ini  
  97.    
  98.  # Partial name of a pipeline in your paste configuration file with the  
  99.  # service name removed. For example, if your paste section name is  
  100.  # [pipeline:glance-registry-keystone], you would configure the flavor below  
  101.  # as 'keystone'.  
  102. -#flavor=  
  103. +flavor=keystone  

注意这里的config_file文件的路径要写绝对路径,不然在用glance index命令时就只出了个标题行,就没其它内容了,也不返回。

同步数据库并启动相关服务

[plain] view plaincopy
  1. [root@stackcc glance]# glance-manage db_sync  
  2. [root@stackcc glance]# glance-manage db_version  
  3. 15  
  4. [root@stackcc glance]# service glance-api start  
  5. [root@stackcc glance]# service glance-registry start  
  6. [root@stackcc glance]# service glance-api status  
  7. glance-api (pid  13218) is running...  
  8. [root@stackcc glance]# service glance-registry status  
  9. glance-registry (pid  13331) is running...  

测试命令glance index发现有警告,可以通过pip install python-glanceclient安装新版的glanceclient并且会依赖安装python-keystoneclient,替换我刚安装的jsonschema为0.2版本,升级prettytable==0.6.1,如果机器上安装有E版的novaclient会冲突,可以用pip uninstall python-novaclient直接卸载再用pip install python-novaclient安装新版(这里我尝试不卸载老版直接安装没有反应)。最后如果要使用v2版api还需要调整Keystone中的endpoint。

原创粉丝点击