nova/doc/source/admin/migrate-instance-with-snapshot.rst
Matt Riedemann 1a4cc6c96d Document using service user tokens for long running operations
A recent thread in the mailing list [1] reminded me that we
don't have any documentation for the service user token feature
added back in ocata under blueprint use-service-tokens.

This change adds a troubleshooting entry for when using service
user tokens would be useful, and links to it from two known
trouble spots: live migration timeouts and creating images.

[1] http://lists.openstack.org/pipermail/openstack-discuss/2018-December/001130.html

Change-Id: I1dda889038ffe67d53ceb35049aa1f2a9da39ae8
Closes-Bug: #1809165
2018-12-19 15:31:16 -05:00

5.3 KiB

Use snapshots to migrate instances

This guide can be used to migrate an instance between different clouds.

To use snapshots to migrate instances from OpenStack projects to clouds, complete these steps.

In the source project:

  1. Create_a_snapshot_of_the_instance
  2. Download_the_snapshot_as_an_image

In the destination project:

  1. Import_the_snapshot_to_the_new_environment
  2. Boot_a_new_instance_from_the_snapshot

Note

Some cloud providers allow only administrators to perform this task.

Create a snapshot of the instance

  1. Shut down the source VM before you take the snapshot to ensure that all data is flushed to disk. If necessary, list the instances to view the instance name:

    $ openstack server list
    +--------------------------------------+------------+--------+------------------+--------------------+-------------------------+
    | ID                                   | Name       | Status | Networks         | Image              | Flavor                  |
    +--------------------------------------+------------+--------+------------------+--------------------+-------------------------+
    | d0d1b7d9-a6a5-41d3-96ab-07975aadd7fb | myInstance | ACTIVE | private=10.0.0.3 | ubuntu-16.04-amd64 | general.micro.tmp.linux |
    +--------------------------------------+------------+--------+------------------+--------------------+-------------------------+
  2. Use the openstack server stop command to shut down the instance:

    $ openstack server stop myInstance
  3. Use the openstack server list command to confirm that the instance shows a SHUTOFF status:

    $ openstack server list
    +--------------------------------------+------------+---------+------------------+--------------------+-------------------------+
    | ID                                   | Name       | Status  | Networks         | Image              | Flavor                  |
    +--------------------------------------+------------+---------+------------------+--------------------+-------------------------+
    | d0d1b7d9-a6a5-41d3-96ab-07975aadd7fb | myInstance | SHUTOFF | private=10.0.0.3 | ubuntu-16.04-amd64 | general.micro.tmp.linux |
    +--------------------------------------+------------+---------+------------------+--------------------+-------------------------+
  4. Use the openstack server image create command to take a snapshot:

    $ openstack server image create --name myInstanceSnapshot myInstance

    If snapshot operations routinely fail because the user token times out while uploading a large disk image, consider configuring nova to use service user tokens <user_token_timeout>.

  5. Use the openstack image list command to check the status until the status is ACTIVE:

    $ openstack image list
    +--------------------------------------+---------------------------+--------+
    | ID                                   | Name                      | Status |
    +--------------------------------------+---------------------------+--------+
    | ab567a44-b670-4d22-8ead-80050dfcd280 | myInstanceSnapshot        | active |
    +--------------------------------------+---------------------------+--------+

Download the snapshot as an image

  1. Get the image ID:

    $ openstack image list
    +--------------------------------------+---------------------------+--------+
    | ID                                   | Name                      | Status |
    +--------------------------------------+---------------------------+--------+
    | ab567a44-b670-4d22-8ead-80050dfcd280 | myInstanceSnapshot        | active |
    +--------------------------------------+---------------------------+--------+
  2. Download the snapshot by using the image ID that was returned in the previous step:

    $ openstack image save --file snapshot.raw ab567a44-b670-4d22-8ead-80050dfcd280

    Note

    The openstack image save command requires the image ID and cannot use the image name. Check there is sufficient space on the destination file system for the image file.

  3. Make the image available to the new environment, either through HTTP or direct upload to a machine (scp).

Import the snapshot to the new environment

In the new project or cloud environment, import the snapshot:

$ openstack image create --container-format bare --disk-format qcow2 \
  --file snapshot.raw myInstanceSnapshot

Boot a new instance from the snapshot

In the new project or cloud environment, use the snapshot to create the new instance:

$ openstack server create --flavor m1.tiny --image myInstanceSnapshot myNewInstance