Ask Your Question
0

glance does not work when working with swift

asked 2011-08-09 15:36:16 -0500

gyliu gravatar image

My swift server is working well, and also glance server also works well when using file "default_store = file", but when I change to "default_store = swift", "glance add" will not work, can any of you help check why?

Thanks in advance!

root@glance-node:/tmp# glance add name="swift2" is_public=true < /tmp/test.iso Failed to add image. Got error: 400 Bad Request

The server could not comply with the request since it is either malformed or otherwise incorrect.

Error uploading image: global name 'swift_client' is not defined
Note: Your image metadata may still be in the registry, but the image's status will likely be 'killed'. root@glance-node:/tmp# cat /etc/glance/glance-api.conf [DEFAULT]

Show more verbose log output (sets INFO log level output)

verbose = True

Show debugging output in logs (sets DEBUG log level output)

debug = False

Which backend store should Glance use by default is not specified

in a request to add a new image to Glance? Default: 'file'

Available choices are 'file', 'swift', and 's3'

default_store = swift

Address to bind the API server

bind_host = 0.0.0.0

Port the bind the API server to

bind_port = 9292

Address to find the registry server

registry_host = 0.0.0.0

Port the registry server is listening on

registry_port = 9191

Log to this file. Make sure you do not set the same log

file for both the API and registry servers!

log_file = /var/log/glance/api.log

============ Filesystem Store Options ========================

Directory that the Filesystem backend store

writes image data to

filesystem_store_datadir = /var/lib/glance/images/

============ Swift Store Options =============================

Address where the Swift authentication service lives

swift_store_auth_address = 172.17.1.125:443/v1.0/

User to authenticate against the Swift authentication service

swift_store_user = tester

Auth key for the user authenticating against the

Swift authentication service

swift_store_key = tk361dc384f1214cae898e8271109dad3f

Container within the account that the account should use

for storing images in Swift

swift_store_container = CONTAINER

Do we create the container if it does not exist?

swift_store_create_container_on_put = True

Whether to use ServiceNET to communicate with the Swift storage servers.

(If you aren't RACKSPACE, leave this False!)

#

To use ServiceNET for authentication, prefix hostname of

swift_store_auth_address with 'snet-'.

Ex. https://example.com/v1.0/ -> https://snet-example.com/v1.0/

swift_enable_snet = False

============ S3 Store Options =============================

Address where the S3 authentication service lives

s3_store_host = 127.0.0.1:8080/v1.0/

User to authenticate against the S3 authentication service

s3_store_access_key = <20-char AWS access key>

Auth key for the user authenticating against the

S3 authentication service

s3_store_secret_key = <40-char AWS secret key>

Container within the account that the account should use

for storing images in S3. Note that S3 has a flat namespace,

so you need a unique bucket name for your glance images. An

easy way to do this is append your AWS access key to "glance".

S3 buckets in AWS must be lowercased, so remember to lowercase

your AWS access key if you use it in your bucket name below!

s3_store_bucket = <lowercased 20-char="" aws="" access="" key="">glance

Do we create the bucket if it does not ...

(more)
edit retag flag offensive close merge delete

13 answers

Sort by ยป oldest newest most voted
0

answered 2011-08-10 08:52:40 -0500

gyliu gravatar image

Clarify something:

The "curl" and "swift" command works well on swift node: root@saio:/home/swiftdemo# export ST_AUTH=https://172.17.1.125:443/auth/v1.0 root@saio:/home/swiftdemo# export ST_USER=test:tester root@saio:/home/swiftdemo# export ST_KEY=testing root@saio:/home/swiftdemo# swift list builders gholt myfiles root@saio:/home/swiftdemo# swift stat -v StorageURL: https://172.17.1.125:443/v1/AUTH_3852a9fd-b1e5-4498-8aa4-3a557cebff2e (https://172.17.1.125:443/v1/AUTH_3852...) Auth Token: AUTH_tk1a85a0af81364aa3ad104c9e035027c6 Account: AUTH_3852a9fd-b1e5-4498-8aa4-3a557cebff2e Containers: 3 Objects: 1 Bytes: 0 Accept-Ranges: bytes root@saio:/home/swiftdemo# root@saio:/home/swiftdemo# curl -k -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' https://172.17.1.125:443/auth/v1.0 * About to connect() to 172.17.1.125 port 443 (#0) * Trying 172.17.1.125... connected * Connected to 172.17.1.125 (172.17.1.125) port 443 (#0) * successfully set certificate verify locations: * CAfile: none CApath: /etc/ssl/certs * SSLv3, TLS handshake, Client hello (1): * SSLv3, TLS handshake, Server hello (2): * SSLv3, TLS handshake, CERT (11): * SSLv3, TLS handshake, Server finished (14): * SSLv3, TLS handshake, Client key exchange (16): * SSLv3, TLS change cipher, Client hello (1): * SSLv3, TLS handshake, Finished (20): * SSLv3, TLS change cipher, Client hello (1): * SSLv3, TLS handshake, Finished (20): * SSL connection using AES256-SHA * Server certificate: * subject: C=CH; ST=SHANXIN; L=XIAN; O=Platform; OU=DEV; CN=172.17.1.125; emailAddress=gyliu@platform.com * start date: 2011-08-08 03:29:29 GMT * expire date: 2011-09-07 03:29:29 GMT * common name: 172.17.1.125 (matched) * issuer: C=CH; ST=SHANXIN; L=XIAN; O=Platform; OU=DEV; CN=172.17.1.125; emailAddress=gyliu@platform.com * SSL certificate verify result: self signed certificate (18), continuing anyway.

GET /auth/v1.0 HTTP/1.1 User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15 Host: 172.17.1.125 Accept: / X-Storage-User: test:tester X-Storage-Pass: testing

< HTTP/1.1 200 OK < X-Storage-Url: https://172.17.1.125:443/v1/AUTH_3852a9fd-b1e5-4498-8aa4-3a557cebff2e (https://172.17.1.125:443/v1/AUTH_3852...) < X-Storage-Token: AUTH_tk1a85a0af81364aa3ad104c9e035027c6 < X-Auth-Token: AUTH_tk1a85a0af81364aa3ad104c9e035027c6 < Content-Length: 115 < Date: Wed, 10 Aug 2011 08:51:41 GMT < * Connection #0 to host 172.17.1.125 left intact * Closing connection #0 * SSLv3, TLS alert, Client hello (1):

{"storage": {"default": "local", "local": "https://172.17.1.125:443/v1/AUTH_3852a9fd-b1e5-4498-8aa4-3a557cebff2e"}}

Just make minor change on glance.conf, set log level to DEBUG,

========glance-api.conf================== default_store = swift swift_store_auth_address = 172.17.1.125:443/v1.0/ swift_store_user = test:tester swift_store_key = testing swift_store_container = glance swift_store_create_container_on_put = True

swift_enable_snet = False

root@glance-node:~# glance add name="s2" is_public=true < /tmp/test.iso Failed to add image. Got error: 400 Bad Request

The server could not comply with the request since it is either malformed or otherwise incorrect.

Error uploading image: global name 'swift_client' is not defined
Note: Your image metadata may still be in the registry, but the image's status will likely be 'killed'.

Log file of api.log: 2011-08-10 ... (more)

edit flag offensive delete link more
0

answered 2011-08-10 08:26:20 -0500

gyliu gravatar image

Thanks Dzung for the answer, but I'm still have some trouble to configure. Can you give more help?

On Swift host: root@saio:/home/swiftdemo# export ST_AUTH=https://172.17.1.125:443/auth/v1.0 root@saio:/home/swiftdemo# export ST_USER=test:tester root@saio:/home/swiftdemo# export ST_KEY=testing root@saio:/home/swiftdemo# swift stat -v StorageURL: https://172.17.1.125:443/v1/AUTH_3852a9fd-b1e5-4498-8aa4-3a557cebff2e (https://172.17.1.125:443/v1/AUTH_3852...) Auth Token: AUTH_tk1a85a0af81364aa3ad104c9e035027c6 Account: AUTH_3852a9fd-b1e5-4498-8aa4-3a557cebff2e Containers: 3 Objects: 1 Bytes: 0 Accept-Ranges: bytes

On Glance node:

vi /etc/glance/glance-api.conf

Which backend store should Glance use by default is not specified

in a request to add a new image to Glance? Default: 'file'

Available choices are 'file', 'swift', and 's3'

default_store = swift

============ Swift Store Options =============================

Address where the Swift authentication service lives

swift_store_auth_address = 172.17.1.125:443/v1.0/

User to authenticate against the Swift authentication service

swift_store_user = test:tester

Auth key for the user authenticating against the

Swift authentication service

swift_store_key = AUTH_tk1a85a0af81364aa3ad104c9e035027c6

Container within the account that the account should use

for storing images in Swift

swift_store_container = CONTAINER

Do we create the container if it does not exist?

swift_store_create_container_on_put = True

Whether to use ServiceNET to communicate with the Swift storage servers.

(If you aren't RACKSPACE, leave this False!)

#

To use ServiceNET for authentication, prefix hostname of

swift_store_auth_address with 'snet-'.

Ex. https://example.com/v1.0/ -> https://snet-example.com/v1.0/

swift_enable_snet = False

Then on glance node, try to add an image. root@glance-node:~# glance add name="swift2" is_public=true < /tmp/test.iso Failed to add image. Got error: 400 Bad Request

The server could not comply with the request since it is either malformed or otherwise incorrect.

Error uploading image: global name 'swift_client' is not defined
Note: Your image metadata may still be in the registry, but the image's status will likely be 'killed'.

edit flag offensive delete link more
0

answered 2011-08-10 13:39:27 -0500

jaypipes gravatar image

Hi again! Can you try this?

sudo easy_install swift

Might be easier than adding a PPA via add-apt-repository...

-jay

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2011-08-09 15:36:16 -0500

Seen: 273 times

Last updated: Aug 16 '11