[Openstack-operators] openstack sdk: how to update image (create image with properties)

George Shuklin george.shuklin at gmail.com
Wed Nov 23 21:55:15 UTC 2016


Hello.

I'm trying to use openstack SDK in my python code.

I want to upload image and set few properties. And I can't.

My code (without properties):

from openstack import connection
import os
con=connection.Connection(auth_url=os.environ['OS_AUTH_URL'], 
project_name = os.environ['OS_TENANT_NAME'], 
username=os.environ['OS_USERNAME'], password=os.environ['OS_PASSWORD']
con.image.upload_image(name='killme', data=file('/tmp/1','r'), 
disk_format="qcow2", container_format="bare")


with properties (few different attempts):

con.image.upload_image(name='killme', data=file('/tmp/1','r'), 
disk_format="qcow2", container_format="bare", foo="bar")  #ignored

con.image.upload_image(name='killme', data=file('/tmp/1','r'), 
disk_format="qcow2", container_format="bare", properties="foo=bar")  
#set property 'properties' to 'foo=bar'

con.image.upload_image(name='killme', data=file('/tmp/1','r'), 
disk_format="qcow2", container_format="bare", properties={"foo":"bar"})  
#return http error


How can I set properties for images via openstack SDK? This behavior is 
bug or feature?




More information about the OpenStack-operators mailing list