Configure Image service quotas

You can configure quotas for the Image service (glance) in the glance template in your OpenStackControlPlane custom resource (CR) file.

Procedure

  1. Open your OpenStackControlPlane CR file, openstack_control_plane.yaml, and add the following parameters to the glance template to configure image quotas to apply to all glanceAPI instances:
    apiVersion: core.openstack.org/v1beta1
    kind: OpenStackControlPlane
    metadata:
      name: openstack
    spec:
      glance:
        template:
          ...
          quotas:
            imageSizeTotal: 1000
            imageStageTotal: 1000
            imageCountUpload: 1000
            imageCountTotal: 1000
    ...
    • Setting quota limits to 0 has different implications depending on the quota type, for example:
      • imageCountTotal: 0: Prevents users from creating any images
      • imageCountUpload: 0: Allows users to upload data to any image
  2. To ensure glance user access to image quotas that are registered in the Identity service, assign and verify reader role access.
    1. Access the remote shell for openstackclient:
      $ oc rsh openstackclient
    2. Assign reader role access to the glance user:
      $ openstack role add --user glance --system all reader
    3. Access the glance CLI:
      $ source /home/cloud-admin/cloudrc
    4. Verify glance user access to image quotas:
      $ glance usage
      +-----------------------+-------+-------+
      | Quota                 | Limit | Usage |
      +-----------------------+-------+-------+
      | image_size_total      | 10    | 0     |
      | image_stage_total     | 10    | 0     |
      | image_count_total     | 10    | 0     |
      | image_count_uploading | 10    | 0     |
      +-----------------------+-------+-------+
    5. Exit the openstackclient pod:
      $ exit
  3. Optional: Add the following parameter to the customServiceConfig section of the glance template to configure image_size_cap:
    apiVersion: core.openstack.org/v1beta1
    kind: OpenStackControlPlane
    metadata:
      name: openstack
    spec:
      glance:
        template:
          ...
          quotas:
            ...
          customServiceConfig |
            [DEFAULT]
            ...
            image_size_cap = 1099511627776
    ...
    • You can replace the default value of 1099511627776 (1 TB) with a value up to the maximum value of 9223372036854775808. Depending on the available back-end storage capacity, a low value might cause image upload failures, and a high value results in increased consumption of storage.
  4. Update the control plane:
    $ oc apply -f openstack_control_plane.yaml -n openstack
  5. Wait until RHOCP creates the resources related to the OpenStackControlPlane CR. Run the following command to check the status:
    $ oc get openstackcontrolplane -n openstack

    The OpenStackControlPlane resources are created when the status is "Setup complete".

    Tip
    Append the -w option to the end of the get command to track deployment progress.

Image service quota types

You can configure and customize image quotas for projects in your OpenStackControlPlane custom resource (CR) file.

You configure the following quotas by using the quotas field in the glance template. When you configure these quotas, the glance-operator registers the quotas in the Identity service (keystone).

You can set a registered limit or a project-specific resource limit to an integer value from -1 to 2,147,483,647. A value of -1 indicates that no limit is set, and 2,147,483,647 is the maximum limit you can set.

Table 1. Image quota types and default limits
Quota Description Default

imageSizeTotal

The maximum amount of storage (in MiB) that the project has for active images. Images with multiple locations contribute to this count, for example, if you have a single 1GiB image stored in four locations, the usage is 4 GiB. Set the value to at least the size of the largest image you expect a user to use.

1,000 MiB

imageStageTotal

The total amount of staging space that might be used. Set the value to at least the size of the largest image you expect a user to use, and allow or limit a user to import one or more images at the same time.

1,000 MiB

imageCountUpload

The number of parallel upload operations that can be in progress at any single point in time.

0

imageCountTotal

The maximum number of image objects that the user might have, regardless of the size of individual or collective image objects.

0

image_size_cap
The image_size_cap limit is the global limit on the size of a single image, and this limit is not registered in the Identity service. You configure image_size_cap in the customServiceConfig section of the glance template in your OpenStackControlPlane CR file. The default value is 1 TB.