OpenStack版本升級之Glance

F版的一些變化

對依賴庫的變化主要是添加了一個jsonschema並去掉了對xattr、pysendfile及swift1.4.8的依賴,如果採用swift作爲存儲後端需要有python-swiftclient,另外還需要F版的Keystone。配置方面主要把認證中間件的配置從paste配置中移到了server配置中。功能上添加了V2版的api接口。

備份與安裝

停止現有服務,並備份數據

[root@stackcc update_glance]# service glance-api stop
[root@stackcc update_glance]# service glance-registry stop
[root@stackcc update_glance]# cp -R /etc/glance ./glance-etc
[root@stackcc update_glance]# mysqldump -uglance -p glance > glance.sql

下載並安裝相關軟件,因爲我之前已經升級完了Keystone及Swift,這裏只要安裝jsonschema及Glance就可以了。

[root@stackcc update_glance]# pip install jsonschema
[root@stackcc update_glance]# git clone git://github.com/openstack/glance.git
[root@stackcc update_glance]# cd glance
[root@stackcc glance]# git checkout -b folsom origin/stable/folsom
[root@stackcc glance]# python setup.py install > install.info

補充:如果還要在這臺服務器上安裝python-glanceclient的話,這裏用pip install jsonschema==0.2安裝就好,不然也會被刪除重裝的。原本採用以下方式安裝glance的,安裝後版本號不對成了0.0.0,我提了個bug在這(詳情

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

配置Glance

將F的配置文件拷入到/etc/glance下替換掉原來的文件並修改相關配置,我的修改如下:

[root@stackcc etc]# for file in *; do diff -u $file /etc/glance/$file; done
--- glance-api.conf    2012-11-14 19:12:12.011623218 +0800
+++ /etc/glance/glance-api.conf    2012-11-16 09:44:37.534701521 +0800
@@ -9,7 +9,7 @@
 # in a request to add a new image to Glance? Known schemes are determined
 # by the known_stores option below.
 # Default: 'file'
-default_store = file
+default_store = swift
 
 # List of which store classes and store class locations are
 # currently known to glance at startup.
@@ -46,7 +46,7 @@
 # SQLAlchemy connection string for the reference implementation
 # registry server. Any valid SQLAlchemy connection string is fine.
 # See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine
-sql_connection = sqlite:///glance.sqlite
+sql_connection = mysql://glance:glance@localhost/glance
 
 # Period in seconds after which SQLAlchemy should reestablish its connection
 # to the database.
@@ -137,7 +137,7 @@
 # There are three methods of sending notifications, logging (via the
 # log_file directive), rabbit (via a rabbitmq queue), qpid (via a Qpid
 # message queue), or noop (no notifications sent, the default)
-notifier_strategy = noop
+notifier_strategy = qpid
 
 # Configuration options if sending notifications via rabbitmq (these are
 # the defaults)
@@ -192,7 +192,7 @@
 # If you use Swift authentication service, set it to 'account':'user'
 # where 'account' is a Swift storage account and 'user'
 # is a user in that account
-swift_store_user = jdoe:jdoe
+swift_store_user = service:glance
 
 # Auth key for the user authenticating against the
 # Swift authentication service
@@ -203,7 +203,7 @@
 swift_store_container = glance
 
 # Do we create the container if it does not exist?
-swift_store_create_container_on_put = False
+swift_store_create_container_on_put = True
 
 # What size, in MB, should Glance start chunking image files
 # and do a large object manifest in Swift? By default, this is
@@ -311,16 +311,16 @@
 auth_host = 127.0.0.1
 auth_port = 35357
 auth_protocol = http
-admin_tenant_name = %SERVICE_TENANT_NAME%
-admin_user = %SERVICE_USER%
-admin_password = %SERVICE_PASSWORD%
+admin_tenant_name = service
+admin_user = glance
+admin_password = service123
 
 [paste_deploy]
 # Name of the paste configuration file that defines the available pipelines
-#config_file = glance-api-paste.ini
+config_file = /etc/glance/glance-api-paste.ini
 
 # Partial name of a pipeline in your paste configuration file with the
 # service name removed. For example, if your paste section name is
 # [pipeline:glance-api-keystone], you would configure the flavor below
 # as 'keystone'.
-#flavor=
+flavor=keystone
--- glance-registry.conf    2012-11-14 19:10:51.688606629 +0800
+++ /etc/glance/glance-registry.conf    2012-11-14 19:48:43.600719378 +0800
@@ -25,7 +25,7 @@
 # SQLAlchemy connection string for the reference implementation
 # registry server. Any valid SQLAlchemy connection string is fine.
 # See: http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/connections.html#sqlalchemy.create_engine
-sql_connection = sqlite:///glance.sqlite
+sql_connection = mysql://glance:glance@localhost/glance
 
 # Period in seconds after which SQLAlchemy should reestablish its connection
 # to the database.
@@ -71,16 +71,16 @@
 auth_host = 127.0.0.1
 auth_port = 35357
 auth_protocol = http
-admin_tenant_name = %SERVICE_TENANT_NAME%
-admin_user = %SERVICE_USER%
-admin_password = %SERVICE_PASSWORD%
+admin_tenant_name = service
+admin_user = glance
+admin_password = service123
 
 [paste_deploy]
 # Name of the paste configuration file that defines the available pipelines
-#config_file = glance-registry-paste.ini
+config_file = /etc/glance/glance-registry-paste.ini
 
 # Partial name of a pipeline in your paste configuration file with the
 # service name removed. For example, if your paste section name is
 # [pipeline:glance-registry-keystone], you would configure the flavor below
 # as 'keystone'.
-#flavor=
+flavor=keystone

注意這裏的config_file文件的路徑要寫絕對路徑,不然在用glance index命令時就只出了個標題行,就沒其它內容了,也不返回。

補充:使用swift作爲存儲後端時還要修改swift_store_auth_address和swift_store_key兩項,第一項要指明協議http不然採用默認的https協議的話會報:

Error uploading image: (AuthorizationFailure): Authorization Failed: Unable to communicate with identity service: [Errno 1] _ssl.c:490: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol. (HTTP 400)
第二項應修改爲swift_store_user用戶的密碼,否則會報:
Error uploading image: (Unauthorized): Unable to communicate with identity service: {"error": {"message": "Invalid user / password", "code": 401, "title": "Not Authorized"}}. (HTTP 401)

同步數據庫並啓動相關服務

[root@stackcc glance]# glance-manage db_sync
[root@stackcc glance]# glance-manage db_version
15
[root@stackcc glance]# service glance-api start
[root@stackcc glance]# service glance-registry start
[root@stackcc glance]# service glance-api status
glance-api (pid  13218) is running...
[root@stackcc glance]# service glance-registry status
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。

北方工業大學 | 雲計算研究中心 | 姜永

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章