# glanceclient.v2.images module

class glanceclient.v2.images.Controller(http_client, schema_client)

  Bases: `object`

  add_image_location(image_id, location_url, validation_data={})

    Add a new location to an image.

    Parameters:

      - image_id – ID of image to which the location is to be added.

      - location_url – URL of the location to add.

      - validation_data – Validation data for the image.

  add_location(image_id, url, metadata, validation_data=None)

    Add a new location entry to an image’s list of locations.

    It is an error to add a URL that is already present in the list of locations.

    Parameters:

      - image_id – ID of image to which the location is to be added.

      - url – URL of the location to add.

      - metadata – Metadata associated with the location.

      - validation_data – Validation data for the image.

    Returns:

      The updated image

  create(**kwargs)

    Create an image.

  data(image_id, do_checksum=True, allow_md5_fallback=False, prefer=None)

    Retrieve data of an image.

    When do_checksum is enabled, validation proceeds as follows:

    1. if the image has a ‘os_hash_value’ property, the algorithm specified in the image’s ‘os_hash_algo’ property will be used to validate against the ‘os_hash_value’ value. If the specified hash algorithm is not available AND allow_md5_fallback is True, then continue to step #2

    2. else if the image has a checksum property, MD5 is used to validate against the ‘checksum’ value. (If MD5 is not available to the client, the download fails.)

    3. else if the download response has a ‘content-md5’ header, MD5 is used to validate against the header value. (If MD5 is not available to the client, the download fails.)

    4. if none of 1-3 obtain, the data is not validated (this is compatible with legacy behavior)

    Parameters:

      - image_id – ID of the image to download

      - do_checksum – Enable/disable checksum validation

      - allow_md5_fallback – Use the MD5 checksum for validation if the algorithm specified by the image’s ‘os_hash_algo’ property is not available

      - prefer – List of store identifiers suggesting the ordering of stores to try when downloading

    Returns:

      An iterable body or `None`

  deactivate(image_id)

    Deactivate an image.

  delete(image_id)

    Delete an image.

  delete_from_store(store_id, image_id)

    Delete image data from specific store.

  delete_locations(image_id, url_set)

    Remove one or more location entries of an image.

    Parameters:

      - image_id – ID of image from which locations are to be removed.

      - url_set – set of URLs of location entries to remove.

    Returns:

      None

  get(image_id)
  get_associated_image_tasks(image_id)

    Get the tasks associated with an image.

    Parameters:

      image_id – ID of the image

    Raises:

      exc.HTTPNotImplemented if Glance is not new enough to support this API (v2.12).

  get_image_locations(image_id)

    Fetch list of locations associated to the Image.

    Parameters:

      image_id – ID of image to which the location is to be fetched.

  get_import_info()

    Get Import info from discovery endpoint.

  get_stores_info()

    Get available stores info from discovery endpoint.

  get_stores_info_detail()

    Get available stores info from discovery endpoint.

  image_import(image_id, method='glance-direct', uri=None, remote_region=None, remote_image_id=None, remote_service_interface=None, backend=None, stores=None, allow_failure=True, all_stores=None)

    Import Image via method.

  list(**kwargs)

    Retrieve a listing of Image objects.

    Parameters:

      page_size – Number of images to request in each paginated request.

    Returns:

      generator over list of Images.

  property model
  reactivate(image_id)

    Reactivate an image.

  stage(image_id, image_data, image_size=None)

    Upload the data to image staging.

    Parameters:

      - image_id – ID of the image to upload data for.

      - image_data – File-like object supplying the data to upload.

      - image_size – If present pass it to upload call

  property unvalidated_model
  update(image_id, remove_props=None, **kwargs)

    Update attributes of an image.

    Parameters:

      - image_id – ID of the image to modify.

      - remove_props – List of property names to remove

      - kwargs – Image attribute names and their new values.

  update_location(image_id, url, metadata)

    Update an existing location entry in an image’s list of locations.

    The URL specified must be already present in the image’s list of locations.

    Parameters:

      - image_id – ID of image whose location is to be updated.

      - url – URL of the location to update.

      - metadata – Metadata associated with the location.

    Returns:

      The updated image

  upload(image_id, image_data, image_size=None, u_url=None, backend=None)

    Upload the data for an image.

    Parameters:

      - image_id – ID of the image to upload data for.

      - image_data – File-like object supplying the data to upload.

      - image_size – If present pass it as header

      - u_url – Upload url to upload the data to.

      - backend – Backend store to upload image to.

this page last updated: 2026-07-15 07:15:16

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.

found an error? report a bug