Migration of a VM to MyELITS

This is a tutorial showing how to perform a VM migration on OpenStack.

Global Steps

  1. Create a VM for the Image transformation
  2. Access the source hypervisor/VM environment
  3. Shutdown the VM
  4. Take a snapshot of the VM and export the VM
  5. Convert the image to "raw" format
  6. Prepare the OS (Windows: inject drivers, Linux: edit fstab)
  7. Create a bootable volume and Attach to the transformation VM
  8. Write raw file to the new bootable volume
  9. Detach the volume and use to boot server


  • Cloud platform: OpenStack
  • Cloud storage: Cinder
  • Cloud image: Glance
  • Cloud compute: Nova
  • VM instance: Fedora 22 or newer


  • A Linux migration VM (tested with Fedora 22)
  • Network Connection to the running OpenStack environment
  • Enough disk space and hardware power for the conversion
  • Permission to OpenStack environment
  • VirtIO drivers
  • Packages
    • Linux default packages
    • Python
    • Setuptools
    • pip
    • OpenStack Client
      • ceilometer – Telemetry API
      • cinder – Block Storage API and extensions
      • glance – Image Service API
      • heat – Orchestration API
      • keystone – Identity service API and extensions
      • neutron – Networking API
      • nova – Compute API and extensions
      • swift – Object Storage API


Create a VM for the transformation

  • Launch a Fedora 22 or newer VM and run the commands
    • Update the VM
      • # sudo dnf update

    • Make sure you have python 2.6 or later installed
    • Install the setuptools, which is a distribution/package manager used by pip
      • # sudo dnf install python-setuptools redhat-rpm-config python-devel
      • # sudo dnf group install "Development Tools"

    • Install OpenStack client
      • # easy_install pip
      • # sudo dnf install python-pip
      • # sudo pip install python-openstackclient

    • For Image manipulation, install the latest version of libguestfs-tools and virt-v2v.
      Note that you might have issues with older versions, so the migration can be more efficient.
      • # sudo dnf install libguestfs libguestfs-tools virt-v2v mingw32-srvany wget pv
  1. Access to the VM environment

    • Login to the VM migrating environment

  2. Shutdown the VM

    • The VM need to be shutdown properly
    • Windows guests which have been hibernated (instead of fully shut down) cannot be mounted.
      • On Windows 7 and earlier, shut the guest off properly instead of hibernating it.
      • On Windows 8, turn off fast startup. It is in the Control Panel → Power Options → Choose what the power buttons do → Change settings that are currently unavailable → Turn off fast startup

  3. Take a snapshot of the VM

    • Create a snapshot of the VM that you want to migrate

  4. Export the VM snapshot and store it on the Migration VM created for migration purposes

    • Create the export file and use scp or FileZilla to export it to the Migration VM (step 1).

  5. Convert the image to the raw format

    • Use the conversion tools at your disposal to convert into the raw format.
    • Example Conversion tool that we used

  6. Prepare the OS

    • Linux
      Linux kernels 2.6.25 and above have already built-in support for VirtIO
      hardware. So there is no need to inject VirtIO drivers.

      To manipulate the image file, use the command below
        export LIBGUESTFS_BACKEND=direct
        guestfish --rw -a $image_file -i
      # Make sure that the partitions in the guest are mounted by UUID in "/etc/fstab"
        sudo your_editor /etc/fstab

      # Do the conversion
        virt-v2v -i disk $image_file -o local -os /path/to/output-folder

    • Windows
      Injection of the drivers into the image or not already injected
      # Download and install the virtio drivers
        sudo wget -O /convertion-script-path/virtio-win.iso https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso

      # Do the conversion
        export VIRTIO_WIN=/convertion-script-path/virtio-win.iso
        export LIBGUESTFS_BACKEND=direct
        virt-v2v -i disk /path/to/input/raw-file -o local -os /path/to/output-folder

      # Check the imageBefore uploading the image to glance you might want to check that the drivers are properly injected.
        mkdir YOUR_TEST_DIR
        sudo mount -t ntfs -o loop,offset=368050176 sda-image YOUR_TEST_DIR
        sudo umount YOUR_TEST_DIR
        rmdir YOUR_TEST_DIR

  7. Get the OpenStack RC file

    The CLI clients look for environment variables to point themselves towards your cloud’s REST API entry points, 
    and to derive other info (like your username) needed to authenticate transactions. You could create the needed 
    environment variables manually, but it’s much easier to download a complete OpenStack RC script containing 
    all the necessary info (except your password).

    You can obtain your RC file through your Horizon console. 
    Just go to Infrastructure -> Servers -> Access & Security, click the API Access tab, and click the button 
    labeled Download OpenStack RC File. Save your RC file (Migration VM) in your home directory, or wherever you consider ‘toplevel’ 
    for your CLI work, and run it by entering:

    source your_rc.sh
    which opens and runs the file in the context of the current environment. 
    Enter your password when requested — this is the same password you use to log into Horizon.

  8. Create a bootable volume and Attach to the Migration VM
    • # openstack volume create --size $volume_size --availability-zone $zone_name --type $volume_type --bootable $volume_name
    • # openstack server add volume $server_name $volume_name
    • # sudo dd if=path-to-image-file bs=4M | pv | dd of=/dev/vdX bs=4M

  9. Detach the volume and create a new instance from it
    • # openstack server remove volume $server_name $volume_name
    • # openstack server create --flavor $flavor_type --volume $volume_name --nic net-id=$net_id $volume_name

XenServer to OpenStack

We have some internal scripts that we can share with our customers if migrating from our current XenServer infrastructure to Openstack. Send us a request and we'll get back to you with the scripts.

Was this article helpful?
0 out of 0 found this helpful



Article is closed for comments.