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.conffile. 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_rolesis 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. -
injectis a comma-separated list of properties and values that will be injected into the image record for the imported image.
Procedure
Open your
OpenStackControlPlaneCR file,openstack_control_plane.yaml, and add the following parameters to theglancetemplate: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.
-
Replace
Update the control plane:
$ oc apply -f openstack_control_plane.yaml -n openstackWait until RHOCP creates the resources related to the
OpenStackControlPlaneCR. Run the following command to check the status:$ oc get openstackcontrolplane -n openstackThe
OpenStackControlPlaneresources are created when the status is "Setup complete".提示Append the
-woption to the end of thegetcommand to track deployment progress.