For details on how to use image, see Using OpenStack Image
The image high-level interface is available through the image
member of a
Connection
object. The image
member will
only be added if the service is detected.
openstack.image.v2._proxy.
Proxy
(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)import_image
(image, method='glance-direct', uri=None, store=None, stores=None, all_stores=None, all_stores_must_succeed=None)Import data to an existing image
Interoperable image import process are introduced in the Image API v2.6. It mainly allow image importing from an external url and let Image Service download it by itself without sending binary data at image creation.
Parameters: |
|
---|---|
Returns: | None |
stage_image
(image, filename=None, data=None)Stage binary image data
Parameters: |
|
---|---|
Returns: | The results of image creation |
Return type: |
upload_image
(container_format=None, disk_format=None, data=None, **attrs)Create and upload a new image from attributes
Parameters: |
|
---|---|
Returns: | The results of image creation |
Return type: |
download_image
(image, stream=False, output=None, chunk_size=1024)Download an image
This will download an image to memory when stream=False
, or allow
streaming downloads using an iterator when stream=True
.
For examples of working with streamed responses, see
Downloading an Image with stream=True.
Parameters: |
|
---|---|
Returns: | When output is not given - the bytes comprising the given
Image when stream is False, otherwise a |
delete_image
(image, ignore_missing=True)Delete an image
Parameters: |
|
---|---|
Returns: |
|
find_image
(name_or_id, ignore_missing=True)Find a single image
Parameters: |
|
---|---|
Returns: | One |
get_image
(image)Get a single image
Parameters: | image – The value can be the ID of a image or a
Image instance. |
---|---|
Returns: | One Image |
Raises: | ResourceNotFound
when no resource can be found. |
images
(**query)Return a generator of images
Parameters: | query (kwargs) – Optional query parameters to be sent to limit the resources being returned. |
---|---|
Returns: | A generator of image objects |
Return type: | Image |
update_image
(image, **attrs)Update a image
Parameters: | image – Either the ID of a image or a
Image instance. |
---|---|
Attrs kwargs: | The attributes to update on the image represented
by value . |
Returns: | The updated image |
Return type: | Image |
deactivate_image
(image)Deactivate an image
Parameters: | image – Either the ID of a image or a
Image instance. |
---|---|
Returns: | None |
reactivate_image
(image)Deactivate an image
Parameters: | image – Either the ID of a image or a
Image instance. |
---|---|
Returns: | None |
add_tag
(image, tag)Add a tag to an image
Parameters: |
|
---|---|
Returns: | None |
remove_tag
(image, tag)Remove a tag to an image
Parameters: |
|
---|---|
Returns: | None |
create_image
(name, filename=None, container=None, md5=None, sha256=None, disk_format=None, container_format=None, disable_vendor_agent=True, allow_duplicates=False, meta=None, wait=False, timeout=3600, data=None, validate_checksum=False, use_import=False, stores=None, all_stores=None, all_stores_must_succeed=None, **kwargs)Upload an image.
Parameters: |
|
---|
Additional kwargs will be passed to the image creation as additional metadata for the image and will have all values converted to string except for min_disk, min_ram, size and virtual_size which will be converted to int.
If you are sure you have all of your data types correct or have an advanced need to be explicit, use meta. If you are just a normal consumer, using kwargs is likely the right choice.
If a value is in meta and kwargs, meta wins.
Returns: | A munch.Munch of the Image object |
---|---|
Raises: | SDKException if there are problems uploading |
openstack.image.v2._proxy.
Proxy
(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)add_member
(image, **attrs)Create a new member from attributes
Parameters: | |
---|---|
Returns: | The results of member creation |
Return type: |
remove_member
(member, image, ignore_missing=True)Delete a member
Parameters: |
|
---|---|
Returns: |
|
find_member
(name_or_id, image, ignore_missing=True)Find a single member
Parameters: |
|
---|---|
Returns: | One |
get_member
(member, image)Get a single member on an image
Parameters: | |
---|---|
Returns: | One |
Raises: |
|
members
(image)Return a generator of members
Parameters: | image – This is the image that the member belongs to,
the value can be the ID of a image or a
Image instance. |
---|---|
Returns: | A generator of member objects |
Return type: | Member |
update_member
(member, image, **attrs)Update the member of an image
Parameters: | |
---|---|
Attrs kwargs: | The attributes to update on the member represented
by |
Returns: | The updated member |
Return type: |
openstack.image.v2._proxy.
Proxy
(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)tasks
(**query)Return a generator of tasks
Parameters: | query (kwargs) – Optional query parameters to be sent to limit the resources being returned. |
---|---|
Returns: | A generator of task objects |
Return type: | Task |
get_task
(task)Get task details
Parameters: | task – The value can be the ID of a task or a
Task instance. |
---|---|
Returns: | One Task |
Raises: | ResourceNotFound
when no resource can be found. |
create_task
(**attrs)Create a new task from attributes
Parameters: | attrs (dict) – Keyword arguments which will be used to create
a Task ,
comprised of the properties on the Task class. |
---|---|
Returns: | The results of task creation |
Return type: | Task |
wait_for_task
(task, status='success', failures=None, interval=2, wait=120)Wait for a task to be in a particular status.
Parameters: |
|
---|---|
Returns: | The resource is returned on success. |
Raises: |
|
Raises: |
|
Raises: |
|
openstack.image.v2._proxy.
Proxy
(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)get_images_schema
()Get images schema
Returns: | One Schema |
---|---|
Raises: | ResourceNotFound
when no resource can be found. |
get_image_schema
()Get single image schema
Returns: | One Schema |
---|---|
Raises: | ResourceNotFound
when no resource can be found. |
get_members_schema
()Get image members schema
Returns: | One Schema |
---|---|
Raises: | ResourceNotFound
when no resource can be found. |
get_member_schema
()Get image member schema
Returns: | One Schema |
---|---|
Raises: | ResourceNotFound
when no resource can be found. |
get_tasks_schema
()Get image tasks schema
Returns: | One Schema |
---|---|
Raises: | ResourceNotFound
when no resource can be found. |
get_task_schema
()Get image task schema
Returns: | One Schema |
---|---|
Raises: | ResourceNotFound
when no resource can be found. |
openstack.image.v2._proxy.
Proxy
(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)stores
(**query)Return a generator of supported image stores
Returns: | A generator of store objects |
---|---|
Return type: | Store |
get_import_info
()Get a info about image constraints
Returns: | One Import |
---|---|
Raises: | ResourceNotFound
when no resource can be found. |
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.