You can use the Cloud Images service to import custom virtual machine disk images into the Rackspace® Open Cloud. For these images to boot correctly, prepare them according to the following requirements and instructions.
Overview#
Difficulty: Advanced
Time: 1-2 hours
Skills needed: Linux® command-line interface (CLI)
Tools used:
Beginning with an on-premises virtual machine (VM), we demonstrate how to import and boot a Linux VM into the Rackspace Public Cloud.
Note: The VM’s system disk size must be 160 GB or smaller, or you cannot import it into the Rackspace Cloud.
Microsoft Windows#
Microsoft® product use rights do not allow the use of License Mobility for Windows® licenses.
Note: Because of the limitations related to this software platform, import is not available for Windows images.
Prepare your Linux VM#
Use the following steps to prepare your Linux VM.
Make a user with sudo privileges#
When the server boots in the Rackspace Cloud, it might not have networking. Make a local user with sudo privileges, so you can log in via the emergency console and manually set the network configuration.
Export your VM as an image#
After you complete these steps, stop your current VM, and export its image to a format that the
qemu-img
tool can handle, such as .vmdk (VMWare), .qcow2 (KVM), .img (RAW), and so on.
Copy and convert to the dynamic VHD format#
Use the following steps to convert the image format to the virtual hard disk (VHD) format.
Build a new CentOS 7 Rackspace Cloud Server and copy your image there#
Choose the Rackspace Cloud region in which you want to import your image (such as IAD, DFW, SYD, and so on). Next, build a Rackspace Cloud CentOS® 7 server in that region. To avoid potential memory starvation issues and speed up image conversion, build the server as a 4 GB General Purpose server. Use this server to convert the image into a Rackspace Cloud-compatible format.
Log in to your image-conversion server, switch to the root user, and execute the following steps:
Use a secure method (such as
scp
) to copy your VM image to the image-conversion server.If the image does not fit onto your 4 GB General Purpose server’s disk (80 GB), then add a Cloud Block Storage volume to hold the image. The VM’s system disk size must be 160 GB or smaller; you cannot import it into the Rackspace Cloud.
Install the xcp-ng repos#
xcp-ng is a hypervisor-based Citrix®’s commercial offering (XenServer®).
Because the Rackspace Cloud runs on Citrix XenServer, xcp-ng
is the best freely available choice to
convert the image.
Use the following steps:
Import and check the xcp-ng repository signing key. See https://xcp-ng.org/docs/mirrors.html#security for details.
Create a repository file for
xcp-ng
repositories and install packages. As root, create a file /etc/yum.repos.d/xcp-ng.repo, which should look exactly the same as the repository file posted under WANT TO TEST IT ALREADY? at this xcp-ng forum thread.Install image conversion packages. The Rackspace Cloud uses a dynamic VHD format particular to XenServer and
xcp-ng
. Thus, you must install the associated packages from their repositoriess. Also, use the following instruction to installqemu-img
from the base repositories:$sudo yum -y install blktap vhd-tool qemu-img
Convert the image#
In this example, the exported VM image is called export.vmdk, and is sourced from a VMWare® hypervisor.
Convert to fixed VHD (Conversion step 1/2)#
$qemu-img convert -p -O vpc /root/export.vmdk /root/import.fixed.vhd
Convert to dynamic VHD (Conversion step 1/2)#
$vhd-util coalesce -n /root/import.fixed.vhd -o /root/import.dynamic.vhd
Confirm the correct format#
Use vhd-tool
to confirm that your VHD (import.dynamic.vhd, in the example) is in the correct format
for the Rackspace Cloud. You want to see a creator-application
of tap
.
Good example:
$vhd-tool info $GOOD | grep creator
creator-application |tap
Bad example: $vhd-tool info $BAD.vhd
creator-application |qemu
If the creator-application
is qemu
, the VHD doesn’t resize, and any builds from this image fail.
Upload the VHD image to the Rackspace Cloud Files#
For the next steps, you need Swiftly, a Rackspace Cloud Files client. Install and configure Swiftly according to the linked article.
Next, create a Cloud Files container, which receives your VHD image file. In this example, create a Cloud Files container called rs-img-build-00:
$ swiftly put rs-img-build-00
Now, upload the image itself. Note that Cloud Files only accepts files of 5 GB or smaller. If your image is larger than that, see the Swiftly documentation on how to segment uploads.
After you create the container, upload the file into the container:
$swiftly put -i export.dynamic.vhd rs-img-build-00/import.dynamic.vhd
Build a Rackspace Cloud Server from the image and verify the operation#
Use the Rackspace Cloud Control Panel to launch a server from the image.
Be sure to pick a flavor that has a large enough disk for your image. For example, if the server image is 40 GB, you should choose a 2 GB General Purpose server or larger because it has a 40 GB disk. Consult the portal for more details about flavors and disk size.
When the server reaches ACTIVE status, log in via SSH with the user you created in Step 1.
Ideally, cloud-init
set the IP address configuration properly, and you can log in. If so, your
image is finished.
If the login fails, networking is not set up properly. Use the following steps to correct the configuration.
Log in via the emergency console and configure your network#
Use the emergency console to log in to your new Rackspace Cloud Server and switch to the root user. Find the network configuration including DNS servers, routes, and so on on the server’s OpenStack config-drive (/dev/xvdd), in a file called network-data.json. To read the network-data.json file, execute the following commands as root:
#mkdir /mnt/cd
#mount -t iso9660 /dev/xvdd /mnt/cd/
#cd /mnt/cd/openstack/latest/
#cat network_data.json |python -m json.tool
If Python® is not available on your system, you might have to read the file manually. The specific commands for setting IP vary based on what Linux distribution you have chosen.
Verify operations#
After your server is up and responding, follow any other necessary steps to verify operation and complete the migration (update DNS records, monitoring configuration, and so on).