Adopting the {image_service}

To adopt the {image_service_first_ref} you patch an existing OpenStackControlPlane custom resource (CR) that has the {image_service} disabled. The patch starts the service with the configuration parameters that are provided by the {rhos_prev_long} ({OpenStackShort}) environment.

The {image_service} adoption is complete if you see the following results:

  • The GlanceAPI service up and running.

  • The {identity_service} endpoints are updated, and the same back end of the source cloud is available.

To complete the {image_service} adoption, ensure that your environment meets the following criteria:

  • You have a running {OpenStackPreviousInstaller} environment (the source cloud).

Adopting the {image_service} that is deployed with an NFS back end

Adopt the {image_service_first_ref} that you deployed with an NFS back end. To complete the following procedure, ensure that your environment meets the following criteria:

  • The Storage network is propagated to the {rhos_prev_long} ({OpenStackShort}) control plane.

  • The {image_service} can reach the Storage network and connect to the nfs-server through the port 2049.

Prerequisites
  • You have completed the previous adoption steps.

  • In the source cloud, verify the NFS parameters that the overcloud uses to configure the {image_service} back end. Specifically, in your{OpenStackPreviousInstaller} heat templates, find the following variables that override the default content that is provided by the glance-nfs.yaml file in the /usr/share/openstack-tripleo-heat-templates/environments/storage directory:

    GlanceBackend: file
    
    GlanceNfsEnabled: true
    
    GlanceNfsShare: 172.18.0.13:/nfs/glance
    Procedure
    1. Adopt the {image_service} and create a new default GlanceAPI instance that is connected with the existing NFS share:

      cat << EOF > glance_nfs_patch.yaml
      spec:
        extraMounts:
        - extraVol:
          - extraVolType: Nfs
            mounts:
            - mountPath: /var/lib/glance/images
              name: nfs
            propagation:
            - Glance
            volumes:
            - name: nfs
              nfs:
                path: /nfs/glance
                server: 172.18.0.13
          name: r1
          region: r1
        glance:
          enabled: true
          template:
            databaseInstance: openstack
            customServiceConfig: |
              [DEFAULT]
              enabled_backends = default_backend:file
              [glance_store]
              default_backend = default_backend
              [default_backend]
              filesystem_store_datadir = /var/lib/glance/images/
            storage:
              storageRequest: 10G
            glanceAPIs:
              default:
                replicas: 1
                type: single
                override:
                  service:
                    internal:
                      metadata:
                        annotations:
                          metallb.universe.tf/address-pool: internalapi
                          metallb.universe.tf/allow-shared-ip: internalapi
                          metallb.universe.tf/loadBalancerIPs: 172.17.0.89
                      spec:
                        type: LoadBalancer
                networkAttachments:
                - storage
      EOF
  • Replace <ip_address> with the IP address that you use to reach the nfs-server.

  • Replace <exported_path> with the exported path in the nfs-server.

    1. Patch the OpenStackControlPlane CR to deploy the {image_service} with an NFS back end:

      oc patch openstackcontrolplane openstack --type=merge --patch-file glance_nfs_patch.yaml
Verification
  • When GlanceAPI is active, confirm that you can see a single API instance:

    oc get pods -l service=glance
    NAME                      READY   STATUS    RESTARTS
    glance-default-single-0   3/3     Running   0
    ```
  • Ensure that the description of the pod reports the following output:

    Mounts:
    ...
      nfs:
        Type:      NFS (an NFS mount that lasts the lifetime of a pod)
        Server:    {{ server ip address }}
        Path:      {{ nfs export path }}
        ReadOnly:  false
    ...
  • Check that the mountpoint that points to /var/lib/glance/images is mapped to the expected nfs server ip and nfs path that you defined in the new default GlanceAPI instance:

    oc rsh -c glance-api glance-default-single-0
    
    sh-5.1# mount
    ...
    ...
    {{ ip address }}:/var/nfs on /var/lib/glance/images type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=172.18.0.5,local_lock=none,addr=172.18.0.5)
    ...
    ...
  • Confirm that the UUID is created in the exported directory on the NFS node. For example:

    oc rsh openstackclient
    openstack image list
    
    sh-5.1 curl -L -o /tmp/cirros-0.5.2-x86_64-disk.img http://download.cirros-cloud.net/0.5.2/cirros-0.5.2-x86_64-disk.img
    ...
    ...
    
    sh-5.1openstack image create --container-format bare --disk-format raw --file /tmp/cirros-0.5.2-x86_64-disk.img cirros
    ...
    ...
    
    sh-5.1openstack image list
    +--------------------------------------+--------+--------+
    | ID                                   | Name   | Status |
    +--------------------------------------+--------+--------+
    | 634482ca-4002-4a6d-b1d5-64502ad02630 | cirros | active |
    +--------------------------------------+--------+--------+
    [source,bash,role=execute,subs=attributes]
  • On the nfs-server node, the same uuid is in the exported /nfs/glance:

    ls /nfs/glance/
    634482ca-4002-4a6d-b1d5-64502ad02630