8.8. Transferring Volumes Between Projects

There is no direct way to migrate a virtual machine between different projects. However, you can transfer the VM boot volume, and then create a new VM from it. You can transfer both boot and non-boot volumes to projects within different domains.

Limitations:

  • You can only transfer volumes with the “Available” status.

  • Transferring volumes that have snapshots breaks the snapshots.

Prerequisites:

  • Access to the compute API depends on your provider’s settings. You need to obtain from your provider the instruction how to connect to the API.

  • You have login credentials for the source and destination projects.

  • If you want to transfer a boot volume that is attached to a VM, clone this volume first, as described in Cloning Volumes.

  • If you want to transfer a non-boot volume that is attached to a VM, detach it first, as described in Attaching and Detaching Volumes.

8.8.1. Transferring Volume Between Two Projects

  1. Log in to the source project by changing the environment variables to the project credentials. For example:

    export OS_PROJECT_DOMAIN_NAME=domain1
    export OS_USER_DOMAIN_NAME=domain1
    export OS_PROJECT_NAME=project1
    export OS_USERNAME=user1
    export OS_PASSWORD=password
    
  2. List all volumes within your project to find out the ID of the volume you want to transfer:

    # openstack --insecure volume list
    +--------------------------------------+-------------------+-----------+------+
    | ID                                   | Name              | Status    | Size |
    +--------------------------------------+-------------------+-----------+------+
    | 2c8386fa-331b-4ba8-9e4c-de690969a4c8 | win10/Boot volume | available |   64 |
    +--------------------------------------+-------------------+-----------+------+
    
  3. Create a transfer request by specifying the ID of the chosen volume. For example:

    # openstack --insecure volume transfer request create c0d4cf0e-48e3-417d-b6fc-f1fb36571c5f
    +------------+--------------------------------------+
    | Field      | Value                                |
    +------------+--------------------------------------+
    | auth_key   | 75fcf37d56f40182                     |
    | created_at | 2022-04-27T09:00:11.776511           |
    | id         | b9b835a3-ed41-489a-9552-483fae33c549 |
    | name       | None                                 |
    | volume_id  | c0d4cf0e-48e3-417d-b6fc-f1fb36571c5f |
    +------------+--------------------------------------+
    

    Save the request id and auth-key from the command output, to accept the transfer in the other project.

  4. Log in to the destination project by changing the environment variables to the project credentials. For example:

    export OS_PROJECT_DOMAIN_NAME=domain1
    export OS_USER_DOMAIN_NAME=domain1
    export OS_PROJECT_NAME=project2
    export OS_USERNAME=user2
    export OS_PASSWORD=password
    
  5. Accept the transfer request by specifying the request ID and authorization key. For example:

    # openstack --insecure volume transfer request accept --auth-key 75fcf37d56f40182 \
    b9b835a3-ed41-489a-9552-483fae33c549
    

Once the volume is moved to the other project, you can create a virtual machine from it, as described in Creating Virtual Machines.