Chapter 4. Image service with multiple stores The Red Hat OpenStack Platform (RHOSP) Image service (glance) supports using multiple stores with distributed edge architecture so that you can have an image pool at every edge site. 4.1. Image copies on multiple stores When you use multiple stores with distributed edge architecture, you can have an image pool at every edge site. You can copy images between the central site, which is also known as the hub site, and the edge sites. The image metadata contains the location of each copy. For example, an image present on two edge sites is exposed as a single UUID with three locations: the central site plus the two edge sites. This means you can have copies of image data that share a single UUID on many stores. For more information about locations, see Understanding the location of images . With a RADOS Block Device (RBD) image pool at every edge site, you can boot Virtual Machines (VMs) quickly by using Ceph RBD copy-on-write (COW) and snapshot layering technology. This means that you can boot VMs from volumes and have live migration. For more information about layering with Ceph RBD, see Ceph block device layering in the Block Device Guide . When you launch an instance at an edge site, the required image is copied to the local Image service (glance) store automatically. However, you can copy images in advance from the central Image store to edge sites by using glance multistore to save time during instance launch. 4.2. Requirements of storage edge architecture Refer to the following requirements to use images with edge sites: A copy of each image must exist in the Image service (glance) at the central location. You must copy images from an edge site to the central location before you can copy them to other edge sites. You must use raw images when deploying a Distributed Compute Node (DCN) architecture with Red Hat Ceph Storage. RADOS Block Device (RBD) must be the storage driver for the Image, Compute, and Block Storage services. For each site, you must assign the same value to the NovaComputeAvailabilityZone and CinderStorageAvailabilityZone parameters. 4.3. Import an image to multiple stores Use the interoperable image import workflow to import image data into multiple Ceph Storage clusters. You can import images into the Image service (glance) that are available on the local file system or through a web server. If you import an image from a web server, the image can be imported into multiple stores at once. If the image is not available on a web server, you can import the image from a local file system into the central store and then copy it to additional stores. For more information, see Copy an existing image to multiple stores . Use the Image service command-line client for image management. Important Always store an image copy on the central site, even if there are no instances using the image at the central location. For more information about importing images into the Image service, see the Distributed compute node and storage deployment guide. 4.3.1. Manage image import failures You can manage failures of the image import operation by using the --allow-failure parameter: If the value of the --allow-failure parameter to true , the image status becomes active after the first store successfully imports the data. This is the default setting. You can view a list of stores that failed to import the image data by using the os_glance_failed_import image property. If you set the value of the --allow-failure parameter to false , the image status only becomes active after all specified stores successfully import the data. Failure of any store to import the image data results in an image status of failed . The image is not imported into any of the specified stores. 4.3.2. Importing image data to multiple stores Because the default setting of the --allow-failure parameter is true , you do not need to include the parameter in the command if it is acceptable for some stores to fail to import the image data. Note This procedure does not require all stores to successfully import the image data. Procedure Import image data to multiple, specified stores: Replace IMAGE-NAME with the name of the image you want to import. Replace URI with the URI of the image. Replace STORE1 , STORE2 , and STORE3 with the names of the stores to which you want to import the image data. Alternatively, replace --stores with --all-stores true to upload the image to all the stores. Note The glance image-create-via-import command, which automatically converts the QCOW2 image to RAW format, works only with the web-download method. The glance-direct method is available, but it works only in deployments with a configured shared file system. 4.3.3. Importing image data to multiple stores without failure This procedure requires all stores to successfully import the image data. Procedure Import image data to multiple, specified stores: Replace IMAGE-NAME with the name of the image you want to import. Replace URI with the URI of the image. Replace STORE1 , STORE2 , and STORE3 with the names of stores to which you want to copy the image data. Alternatively, replace --stores with --all-stores true to upload the image to all the stores. Note With the --allow-failure parameter set to false , the Image service does not ignore stores that fail to import the image data. You can view the list of failed stores with the image property os_glance_failed_import . For more information see Checking the progress of the image import operation . Verify that the image data was added to specific stores: Replace IMAGE-ID with the ID of the original existing image. The output displays a comma-delimited list of stores. 4.3.4. Importing image data to a single store You can import image data to a single store. Procedure Import image data to a single store: Replace IMAGE-NAME with the name of the image you want to import. Replace URI with the URI of the image. Replace STORE with the name of the store to which you want to copy the image data. Note If you do not include the options of --stores , --all-stores , or --store in the command, the Image service creates the image in the central store. Verify that the image data was added to specific store: Replace IMAGE-ID with the ID of the original existing image. The output displays a comma-delimited list of stores. 4.3.5. Checking the progress of the image import operation The interoperable image import workflow sequentially imports image data into stores. The size of the image, the number of stores, and the network speed between the central site and the edge sites impact how long it takes for the image import operation to complete. You can follow the progress of the image import by looking at two image properties, which appear in notifications sent during the image import operation: The os_glance_importing_to_stores property lists the stores that have not imported the image data. At the beginning of the import, all requested stores show up in the list. Each time a store successfully imports the image data, the Image service removes the store from the list. The os_glance_failed_import property lists the stores that fail to import the image data. This list is empty at the beginning of the image import operation. Note In the following procedure, the environment has three Ceph Storage clusters: the central store and two stores at the edge, dcn0 and dcn1 . Procedure Verify that the image data was added to specific stores: Replace IMAGE-ID with the ID of the original existing image. The output displays a comma-delimited list of stores similar to the following example snippet: Monitor the status of the image import operation. When you precede a command with watch , the command output refreshes every two seconds. Replace IMAGE-ID with the ID of the original existing image. The status of the operation changes as the image import operation progresses: Output that shows that an image failed to import resembles the following example: After the operation completes, the status changes to active: 4.4. Copy an existing image to multiple stores This feature enables you to copy existing images using Red Hat OpenStack Image service (glance) image data into multiple Ceph Storage stores at the edge by using the interoperable image import workflow. Note The image must be present at the central site before you copy it to any edge sites. Only the image owner or administrator can copy existing images to newly added stores. You can copy existing image data either by setting --all-stores to true or by specifying specific stores to receive the image data. The default setting for the --all-stores option is false . If --all-stores is false , you must specify which stores receive the image data by using --stores STORE1,STORE2 . If the image data is already present in any of the specified stores, the request fails. If you set all-stores to true , and the image data already exists in some of the stores, then those stores are excluded from the list. After you specify which stores receive the image data, the Image service copies data from the central site to a staging area. Then the Image service imports the image data by using the interoperable image import workflow. For more information, see Importing an image to multiple stores . Use the Image service command-line client for image management. Important Red Hat recommends that administrators carefully avoid closely timed image copy requests. Two closely timed copy-image operations for the same image causes race conditions and unexpected results. Existing image data remains as it is, but copying data to new stores fails. 4.4.1. Copying an image to all stores Use the following procedure to copy image data to all available stores. Procedure Copy image data to all available stores: Replace IMAGE-ID with the name of the image you want to copy. Confirm that the image data successfully replicated to all available stores: For information about how to check the status of the image import operation, see Checking the progress of the image import operation . 4.4.2. Copying an image to specific stores Use the following procedure to copy image data to specific stores. Procedure Copy image data to specific stores: Replace IMAGE-ID with the name of the image you want to copy. Replace STORE1 and STORE2 with the names of the stores to which you want to copy the image data. Confirm that the image data successfully replicated to the specified stores: For information about how to check the status of the image import operation, see Checking the progress of the image import operation . 4.5. Deleting an image from a specific store Delete an existing image copy on a specific store by using the Red Hat OpenStack Image service (glance). Use the Image service command-line client for image management. Procedure Delete an image from a specific store: Replace _STORE_ID with the name of the store on which the image copy should be deleted. Replace IMAGE_ID with the ID of the image you want to delete. Warning Using glance image-delete will permanently delete the image across all the sites. All image copies will be deleted, as well as the image instance and metadata. 4.6. Understanding the locations of images Although an image can be present on multiple sites, there is only a single Universal Unique Identifier (UUID) for a given image. The image metadata contains the locations of each copy. For example, an image present on two edge sites is exposed as a single UUID with three locations: the central site and the two edge sites. Note Use the Image service (glance) command-line client instead of the OpenStack command-line client for image management. However, use the openstack image show command to list image location properties. The glance image-show command output does not include locations. Procedure Show the sites on which a copy of the image exists: In the example, the image is present on the central site, the default_backend , and on the two edge sites dcn1 and dcn2 . Alternatively, you can run the glance image-list command with the --include-stores option to see the sites where the images exist: List the image locations properties to show the details of each location: The image properties show the different Ceph RBD URIs for the location of each image. In the example, the central image location URI is: The URI is composed of the following data: 79b70c32-df46-4741-93c0-8118ae2ae284 corresponds to the central Ceph FSID. Each Ceph cluster has a unique FSID. The default value for all sites is images , which corresponds to the Ceph pool on which the images are stored. 2bd882e7-1da0-4078-97fe-f1bb81f61b00 corresponds to the image UUID. The UUID is the same for a given image regardless of its location. The metadata shows the glance store to which this location maps. In this example, it maps to the default_backend , which is the central hub site.

Commands:
glance image-create-via-import --container-format bare --name IMAGE-NAME --import-method web-download --uri URI --stores STORE1 , STORE2 , STORE3
glance image-create-via-import --container-format bare --name IMAGE-NAME --import-method web-download --uri URI --stores STORE1 , STORE2
glance image-show IMAGE-ID | grep stores
glance image-create-via-import --container-format bare --name IMAGE-NAME --import-method web-download --uri URI --store STORE
glance image-show IMAGE-ID | grep stores
glance image-show IMAGE-ID
| os_glance_failed_import | | os_glance_importing_to_stores | central,dcn0,dcn1 | status | importing
watch glance image-show IMAGE-ID
| os_glance_failed_import | | os_glance_importing_to_stores | dcn0,dcn1 | status | importing
| os_glance_failed_import | dcn0 | os_glance_importing_to_stores | dcn1 | status | importing
| os_glance_failed_import | dcn0 | os_glance_importing_to_stores | | status | active
glance image-import IMAGE-ID --all-stores true --import-method copy-image
glance image-list --include-stores
glance image-import IMAGE-ID --stores STORE1 , STORE2 --import-method copy-image
glance image-list --include-stores
glance stores-delete --store _STORE_ID_ _IMAGE_ID_
glance image-show ID | grep "stores" | stores | default_backend,dcn1,dcn2
glance image-list --include-stores | ID | Name | Stores | 2bd882e7-1da0-4078-97fe-f1bb81f61b00 | cirros | default_backend,dcn1,dcn2
openstack image show ID -c properties | properties | (--- cut ---) locations='[{'url': 'rbd://79b70c32-df46-4741-93c0-8118ae2ae284/images/2bd882e7-1da0-4078-97fe-f1bb81f61b00/snap', 'metadata': {'store': 'default_backend'}}, {'url': 'rbd://63df2767-8ddb-4e06-8186-8c155334f487/images/2bd882e7-1da0-4078-97fe-f1bb81f61b00/snap', 'metadata': {'store': 'dcn1'}}, {'url': 'rbd://1b324138-2ef9-4ef9-bd9e-aa7e6d6ead78/images/2bd882e7-1da0-4078-97fe-f1bb81f61b00/snap', 'metadata': {'store': 'dcn2'}}]', (--- cut --)
rbd://79b70c32-df46-4741-93c0-8118ae2ae284/images/2bd882e7-1da0-4078-97fe-f1bb81f61b00/snap', 'metadata': {'store': 'default_backend'}}