6.6. Enabling plugins for the image import workflow


You can enable plugins for the image import workflow by configuring the image_import_plugins option in the glance-image-import.conf file. The plugins do not run in parallel; they run in the order in which they appear in the image_import_plugins list.

Image conversion is enabled by default when you use Red Hat Ceph Storage as the back end for the Image service.

Procedure

  • Configure plugins in the glance-image-import.conf file. In this example, you convert the images to RAW format before you inject metadata properties.

    [image_import_opts]
    image_import_plugins = ['image_conversion','inject_image_metadata']
    
    [image_conversion]
    output_format = raw
    
    [inject_metadata_properties]
    ignore_user_roles = admin,...
    inject = "property1":"value1","property2":"value2",...

6.6.1. Injecting metadata to control instance placement

You can enable the Inject Image Metadata plugin to apply metadata properties to images that are imported by cloud users so that instances that are launched from the images are located on specific Compute nodes.

The Inject Image Metadata plugin contains two parameters:

  • ignore_user_roles is a comma-separated list of Identity service (keystone) roles that the plugin will ignore. If the user making the image import call has any of these roles, the plugin will not inject any properties into the image.
  • inject is a comma-separated list of properties and values that will be injected into the image record for the imported image.

Procedure

  1. Open your OpenStackControlPlane CR file, openstack_control_plane.yaml, and add the following parameters to the glance template:

    apiVersion: core.openstack.org/v1beta1
    kind: OpenStackControlPlane
    spec:
        ...
      glance:
        enabled: true
        template:
          databaseInstance: openstack
          databaseUser: glance
          customServiceConfig: |
            [DEFAULT]
            enabled_backends = <backend_name>:rbd
            enabled_import_methods=[web-download,glance-direct]
            [image_import_opts]
            image_import_plugins = ['inject_image_metadata']
            [inject_metadata_properties]
            ignore_user_roles = <admin>,...
            inject = "<property1>":"<value1>","<property2>":"<value2>",...
      ...
    • Replace <backend_name> with the name of the default back end.
    • Replace <admin> with the user roles you want the plugin to ignore.
    • Replace <property1>, <value1>, <property2>, <value2>, and so on with the properties and values that you want to inject to the image.
  2. Update the control plane:

    $ oc apply -f openstack_control_plane.yaml -n openstack
  3. 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".

    提示

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

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部