#NEWLINE# def create( self , name , img_format = None , img_container_format = None , data = None , container = None , obj = None , metadata = None ) : #NEWLINE# #INDENT# '\n        Creates a new image with the specified name. The image data can either\n        be supplied directly in the \'data\' parameter, or it can be an image\n        stored in the object storage service. In the case of the latter, you\n        can either supply the container and object names, or simply a\n        StorageObject reference.\n\n        You may specify the image and image container formats; if unspecified,\n        the default of "vhd" for image format and "bare" for image container\n        format will be used.\n\n        NOTE: This is blocking, and may take a while to complete.\n        ' #NEWLINE# if ( img_format is None ) : #NEWLINE# #INDENT# img_format = 'vhd' #NEWLINE# #UNINDENT# if ( img_container_format is None ) : #NEWLINE# #INDENT# img_container_format = 'bare' #NEWLINE# #UNINDENT# headers = { #NEWLINE# #INDENT# 'X-Image-Meta-name' : data , #NEWLINE# 'X-Image-Meta-disk_format' : img_format , #NEWLINE# 'X-Image-Meta-container_format' : img_container_format , #NEWLINE# #UNINDENT# } #NEWLINE# if data : #NEWLINE# #INDENT# img_data = data #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ident = self . api . identity #NEWLINE# region = self . api . region_name #NEWLINE# clt = ident . get_client ( 'object_store' , region ) #NEWLINE# if ( not isinstance ( obj , StorageObject ) ) : #NEWLINE# #INDENT# obj = clt . get_object ( container , obj ) #NEWLINE# #UNINDENT# img_data = obj . fetch ( ) #NEWLINE# #UNINDENT# uri = ( '%s/images' % self . uri_base ) #NEWLINE# ( resp , resp_body ) = self . api . method_post ( uri , headers = headers , data = img_data )