Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to upload image via Python API?

Hello guys!

I have a problem with uploading Glance image via Python API. Here is my code:

def upload_image(image_name, path, desc=None):
glance = get_session(opt="glance")
image = glance.images.create(name=image_name)
glance.images.upload(image.id, open(path, 'rb'))
return 0

And when I run this I get this Error:

glanceclient.exc.CommunicationError: Error finding address for https://ostack........................../file: Unable to establish connection to https://ostack..................../file: [Errno 32] Broken pipe

I thought that the session was not created but I tested it out and everything works.

Please can you help me figure this out ?

Thanks!