Using Swift as a Glance backend

Asked by Everett Toews

I'm trying to use Swift as a Glance backend but I'm running into errors when I try to add an image with glance add.

root@i-00000c7f:~# glance add --verbose name="ubuntu-10-10-server" is_public="True" < ubuntu-10.10-server-uec-amd64.tar.gz
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: Auth GET failed: https://127.0.0.1:8080/auth/v1.0/ 401 Unauthorized
Completed in 2.0094 sec.

I'm using Glance version: 2011.2-0ubuntu1

My relevant config in glance.conf

default_store = swift
swift_store_auth_address = https://127.0.0.1:8080/auth/v1.0/
swift_store_user = root
swift_store_key = testpass
swift_store_container = glance
swift_store_create_container_on_put = True

I'm fairly confident Swift is up and running as it should be since I can do the following.

swauth-prep -A https://127.0.0.1:8080/auth/ -K admin_key
swauth-add-user -A https://127.0.0.1:8080/auth/ -K admin_key -a system root testpass

root@i-00000c7f:~# st -A https://127.0.0.1:8080/auth/v1.0/ -U system:root -K testpass -v post glance

root@i-00000c7f:~# st -A https://127.0.0.1:8080/auth/v1.0/ -U system:root -K testpass -v upload glance ubuntu-10.10-server-uec-amd64.tar.gz
ubuntu-10.10-server-uec-amd64.tar.gz

root@i-00000c7f:~# st -A https://127.0.0.1:8080/auth/v1.0/ -U system:root -K testpass -v list glance
ubuntu-10.10-server-uec-amd64.tar.gz

root@i-00000c7f:~# st -A https://127.0.0.1:8080/auth/v1.0/ -U system:root -K testpass -v delete glance ubuntu-10.10-server-uec-amd64.tar.gz
ubuntu-10.10-server-uec-amd64.tar.gz

root@i-00000c7f:~# st -A https://127.0.0.1:8080/auth/v1.0/ -U system:root -K testpass -v list glance

Anyone have any thoughts as to what the problem could be?

Thanks,
Everett

Question information

Language:
English Edit question
Status:
Solved
For:
Glance Edit question
Assignee:
No assignee Edit question
Solved by:
Édouard Thuleau
Solved:
Last query:
Last reply:
Revision history for this message
Jay Pipes (jaypipes) said :
#1

Everett,

Barton just found me in the lobby... I haven't been getting any notifications about Glance Questions :( So, sorry about not responding until now.

I will work with a Swift dev to figure out what's going on here. AFAICT, your glance.conf is correct. Though, do you have logging enabled? Getting some log output with debug=True would be good...

-jay

Revision history for this message
Everett Toews (everett-toews) said :
#2

Hi Jay,

I just set debug=True and tried again

root@i-00000c7f:~# glance add --verbose
name="ubuntu-10-10-server-glance-add" is_public="True" <
ubuntu-10.10-server-uec-amd64.tar.gz

The results are here.

http://pastie.org/1835684

Thanks,
Everett

Revision history for this message
Best Édouard Thuleau (ethuleau) said :
#3

Hi,

The parameter 'swift_store_user' should not be set to 'system:root' instead of 'root' ?

Édouard.

Revision history for this message
Everett Toews (everett-toews) said :
#4

Yep. That was the secret sauce. Now I can see the file saved in Swift.

root@i-00000c7f:~# st -A https://127.0.0.1:8080/auth/v1.0/ -U system:root -K testpass -v list glance
10

To be totally paranoid I double checked that the Glance CLI and Swift st CLI are reporting the same size

root@i-00000c7f:~# st -A https://127.0.0.1:8080/auth/v1.0/ -U system:root -K testpass -v stat glance 10
       Account: AUTH_07ee438a-0881-4ae0-91d1-85f9d7e0b29b
     Container: glance
        Object: 10
  Content Type: application/octet-stream
Content Length: 185416400
 Last Modified: Tue, 26 Apr 2011 16:45:41 GMT
          ETag: 29c00454935fd1481496a9fb6c863670

root@i-00000c7f:~# glance show 10
URI: http://0.0.0.0/images/10
Id: 10
Public: Yes
Name: ubuntu-10-10-server-glance-add
Size: 185416400
Location: swift://system:root:testpass@https://127.0.0.1:8080/auth/v1.0//glance/10
Disk format: raw
Container format: ovf

I've reported a bug regarding this issue at https://bugs.launchpad.net/glance/+bug/771465

Thanks Édouard.

Everett

Revision history for this message
Everett Toews (everett-toews) said :
#5

Thanks Edouard Thuleau, that solved my question.

Revision history for this message
Édouard Thuleau (ethuleau) said :
#6

You're welcome.

Do you met problems to delete images in Glance repository with Swift backend ?

I opened a question : https://answers.launchpad.net/glance/+question/154323

Édouard.

Revision history for this message
Everett Toews (everett-toews) said :
#7

Hi Édouard,

Actually yes, I ran into that problem too. Thanks for posting another
question about it. I'm tracking it now too.

Everett

On Wed, Apr 27, 2011 at 2:46 AM, Edouard Thuleau <
<email address hidden>> wrote:

> Your question #154253 on Glance changed:
> https://answers.launchpad.net/glance/+question/154253
>
> Edouard Thuleau posted a new comment:
> You're welcome.
>
> Do you met problems to delete images in Glance repository with Swift
> backend ?
>
> I opened a question :
> https://answers.launchpad.net/glance/+question/154323
>
> Édouard.
>
> --
> You received this question notification because you are a direct
> subscriber of the question.
>

Revision history for this message
Jay Pipes (jaypipes) said :
#8

Everett and Edouard,

Hey, we're working on this. In the meantime, the fix would be to remove the https:// prefix from your swift_store_auth_address configuration option..

-jay

Revision history for this message
Édouard Thuleau (ethuleau) said :
#9

Hi Jay,

I try to remove the 'https://' prefix in 'swift_store_auth_address' option but the bug persists.

Chears,
Édouard.

Revision history for this message
Jay Pipes (jaypipes) said :
#10

Hi Edouard,

For the existing images in the registry database, you will want to execute the following:

UPDATE images SET location = REPLACE(location, "https://", "")
WHERE location LIKE 'swift%';

The above should work for MySQL, SQLIte and PostgreSQL registry databases.

The eventual bug fix will include the above as a migration file, FYI...

Cheers,
jay