Preparing import-only migration

You can initiate the import-only live migration process by running the rbd migration prepare command with the --import-only flag and either the --source-spec or --source-spec-path options. The import-only process is implemented by passing a JSON document that describes how to access the source image data directly on the command line or from a file.

Before you begin

Before you begin, make sure that you have the following prerequisites in place:
  • A running IBM Storage Ceph cluster.
  • A bucket and an S3 object are created.

Procedure

  1. Create a JSON file.
    For example,
    [ceph: root@rbd-client /]# cat testspec.json
     {
       "type": "raw",
        "stream": {
            "type": "s3",
            "url": "http:10.74.253.18:80/testbucket1/image.raw",
           "access_key": "RLJOCP6345BGB38YQXI5",
           "secret_key": "oahWRB2ote2rnLy4dojYjDrsvaBADriDDgtSfk6o"
      }
  2. Prepare the import-only live migration process.
    rbd migration prepare --import-only --source-spec-path "JSON_FILE" TARGET_POOL_NAME/SOURCE_IMAGE_NAME
    For example,
    [ceph: root@rbd-client /]# rbd migration prepare --import-only --source-spec-path "testspec.json" targetpool1/sourceimage1

What to do next

  1. Check the current state of the import-only live migration process.
    rbd status TARGET_POOL_NAME/SOURCE_IMAGE_NAME
    For example,
    [ceph: root@rbd-client /]# rbd status targetpool1/sourceimage1
    Watchers: none
    Migration:
    source: {"stream":{"access_key":"RLJOCP6345BGB38YQXI5","secret_key":"oahWRB2ote2rnLy4dojYjDrsvaBADriDDgtSfk6o","type":"s3","url":"http://10.74.253.18:80/testbucket1/image.raw"},"type":"raw"}
    destination: targetpool1/sourceimage1 (b13865345e66)
    state: prepared
    The following example shows migrating data from Ceph cluster c1 to Ceph cluster c2:
    [ceph: root@rbd-client /]# cat /tmp/native_spec
    {
      "cluster_name": "c1",
      "type": "native",
      "pool_name": "pool1",
      "image_name": "image1",
      "snap_name": "snap1"
    }
    ceph: root@rbd-client /]# rbd migration prepare --import-only --source-spec-path /tmp/native_spec c2pool1/c2image1 --cluster c2
    ceph: root@rbd-client /]# rbd migration execute c2pool1/c2image1 --cluster c2
    Image migration: 100% complete...done.
    ceph: root@rbd-client /]# rbd migration commit c2pool1/c2image1 --cluster c2
    Commit image migration: 100% complete...done.
  2. Run the live migration. For more information, see Running the live migration.