After you copy the images folder to a new datastore, you must update the locations setting on each image to reflect the new datastore.

Prerequisites

  • Verify that the images folder has been copied to the new datastore.

  • Verify that the image folder name and relative path on the new datastore are the same as as on the previous datastore.

  • Verify that you know the image ID values of the images you want to update.

Procedure

  1. Repeat this procedure for all images that you want to migrate.
  2. Using SSH, log in as administrator to the VMware Integrated OpenStack manager.
  3. Using SSH, log in to the controller01 node.
  4. Switch to root user.
    sudo su -
  5. Execute the cloudadmin.rc file.
    source cloudadmin.rc
  6. (Optional) View a list of images.
    glance image-list
  7. (Optional) Get the location of a specific image.
    Note:

    You must know the image ID to specify the image.

    glance --os-image-api-version 2 image-show <image_id>

    The image location is the URL indicated by the locations parameter.

    vsphere://<vcenter_ip>/folder/<image_folder_name>/<image_id>dcPath=<path_to_datacenter>&dsName=<old_datastore_name>

    For example:

    vsphere://10.20.123.456/folder/images/6c4a7e0d-65e7-4f3c-9dde-0de75f729a0c
    ?dcPath=Datacenter1&dsName=old_ds
  8. Update the image's location URL to reflect the destination datastore to complete the migration of a single image.
    1. Add the new location to the image configuration.
      glance --os-image-api-version 2 location-add <image_id> --url <new_url>

      Option

      Description

      image_id

      Specifies the image to be modified.

      new_url

      The new URL is the same as the previous URL except the dsName argument specifies the name of the new datastore.

      vsphere://<vcenter_ip>/folder/<image_folder_name>/<image_id>dcPath=<path_to_datacenter>&dsName=<new_datastore_name>

      If the command returns a 400 Bad Request: Invalid Location message, verify that file path of the image on the destination datastore is correct.

    2. Remove the old location from the image configuration.
      glance --os-image-api-version 2 location-delete <image_id> --url <old_url>
    3. View the image information again to verify that the locations parameter correctly reflects the new datastore.
      glance --os-image-api-version 2 image-show <image_id>

    The image is successfully migrated.