Error 412 between Glance and Swift - TempAuth

Asked by Warik on 2012-02-14

Hello!

I am having an issue when I am trying to upload an image to Glance. Glance is working fine when I am using the default_store =file.
Since I installed Swift, I wanted to upload my images there with Glance.
I changed the following fields in the glance-api.conf:

default_store = swift
swift_store_auth_address = http://192.168.100.203:8080/v1.0/
swift_store_user = system:root
swift_store_key = mypass
swift_store_container = glance
swift_store_create_container_on_put = True

Then I restarted Glance API, and used the glance command to upload an image, but I got this error:

-------------------------------------
        glance add -A stack0t name=ttylinux-kernel is_public=true container_format=aki disk_format=aki < ttylinux-vmlinux
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: (ClientException): Auth GET failed: http://192.168.100.203:8080/1.0 412 Precondition Failed
Note: Your image metadata may still be in the registry, but the image's status will likely be 'killed'.
-------------------------------------

I poked around a little, look at some Launchpad threads but none of the solutions worked for me.
I tried with a Glance stable/diablo and a Glance trunk version but the error is the same.

I am using Swift 1.4.5. I can check my installation with the "swift stat -v" and a curl command, they both work fine.

Does anyone had this issue before?
Thanks a ton for your help!

Warik

Question information

Language:
English Edit question
Status:
Solved
For:
Glance Edit question
Assignee:
No assignee Edit question
Solved by:
Warik
Solved:
2012-02-15
Last query:
2012-02-15
Last reply:
2012-02-14
Eoghan Glynn (eglynn) said : #1

Hi Warik,

Try:

  swift_store_auth_address = http://192.168.100.203:8080/auth/v1.0

i.e. note the "/auth" segment in the path.

Cheers,
Eoghan

Warik (warik) said : #2

Hello Eoghan,

Thanks for your reply, I tried your suggestion and now I get this one:

glance add -A stack0t name=ttylinux-kernel is_public=true container_format=aki disk_format=aki < /root/openstack-setup/ttylinux-vmlinux
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: (BackendException): Failed to add object to Swift. Got error from Swift: put_object('glance', '1', ...) failure and no ability to reset contents for reupload.
Note: Your image metadata may still be in the registry, but the image's status will likely be 'killed'.

Any thoughts ?
Thanks

Eoghan Glynn (eglynn) said : #3

Hi Warik,

Just to ask the obvious question, presumably you've already verified the username, key and container name via the swift CLI?

Cheers,
Eoghan

Warik (warik) said : #4

Eoghan,

Here are the result of the Swift command:

-----------------------
swift -A http://192.168.100.203:8080/auth/v1.0 -U system:root -K testpass stat
   Account: AUTH_system
Containers: 271
   Objects: 11
     Bytes: 14316679
Accept-Ranges: bytes
-----------------------

The curl command works as well:

-----------------------
curl -k -v -H 'X-Storage-User: system:root' -H 'X-Storage-Pass: testpass' http://192.168.100.203:8080/auth/v1.0
* About to connect() to 192.168.100.203 port 8080 (#0)
* Trying 192.168.100.203... connected
* Connected to 192.168.100.203 (192.168.100.203) port 8080 (#0)
> GET /auth/v1.0 HTTP/1.1
> User-Agent: curl/7.21.6 (x86_64-pc-linux-gnu) libcurl/7.21.6 OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 librtmp/2.3
> Host: 192.168.100.203:8080
> Accept: */*
> X-Storage-User: system:root
> X-Storage-Pass: testpass
>
< HTTP/1.1 200 OK
< X-Storage-Url: http://192.168.100.203:8080/v1/AUTH_system
< X-Storage-Token: AUTH_tka2a8fac8647042d0bab03951ef651ab6
< X-Auth-Token: AUTH_tka2a8fac8647042d0bab03951ef651ab6
< Content-Length: 0
< Date: Wed, 15 Feb 2012 01:12:24 GMT
<
* Connection #0 to host 192.168.100.203 left intact
* Closing connection #0
-----------------------

It seems to be in a good shape. I can also upload/download with the swift command.

Do I need to test something else?
Thank you

Warik (warik) said : #5

Hi Eoghan,

I don't really know why but it's working now.

I add a new zone to my ring, rebalanced it and it's working...
Do you think that one of these steps can fix this issue?! That sounds will it should!

Anyway, if I found the root of the problem and the solution I will share it.
:)

Thanks for the time!
Warik