def create(self, name, img_format=None, img_container_format=None,
            data=None, container=None, obj=None, metadata=None):
        """
        Creates a new image with the specified name. The image data can either
        be supplied directly in the 'data' parameter, or it can be an image
        stored in the object storage service. In the case of the latter, you
        can either supply the container and object names, or simply a
        StorageObject reference.

        You may specify the image and image container formats; if unspecified,
        the default of "vhd" for image format and "bare" for image container
        format will be used.

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

        You may specify the image and image container formats; if unspecified,
        the default of "vhd" for image format and "bare" for image container
        format will be used.

        NOTE: This is blocking, and may take a while to complete.