| Importing Virtual Machines with virt-v2vEdition 11 Legal NoticeCopyright © 2012 Red Hat, Inc. The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution-Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version. Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries. Linux® is the registered trademark of Linus Torvalds in the United States and other countries. Java® is a registered trademark of Oracle and/or its affiliates. XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries. MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries. All other trademarks are the property of their respective owners. 1801 Varsity Drive Raleigh, NC 27606-2072 USA Phone: +1 919 754 3700 Phone: 888 733 4281 Fax: +1 919 754 3701
Daftar IsiAbstract This book is a guide to importing virtual machines from foreign hypervisors to Red Hat Enterprise Virtualization and KVM managed by libvirt. The Red Hat Enterprise Virtualization platform is a richly featured virtualization management solution providing fully integrated management across virtual machines. It is based on the leading open source virtualization platform and provides superior technical capabilities. The platform offers scalability in the management of large numbers of virtual machines. This guide describes how to import virtual machines from foreign hypervisors to Red Hat Enterprise Virtualization and KVM managed by libvirt. The Red Hat Enterprise Virtualization documentation suite provides information on installation, development of applications, configuration and usage of the Red Hat Enterprise Virtualization platform and its related products. Red Hat Enterprise Virtualization - Administration Guide describes how to set up, configure and manage Red Hat Enterprise Virtualization. It assumes that you have successfully installed the Red Hat Enterprise Virtualization Manager and hosts. Red Hat Enterprise Virtualization - Evaluation Guide enables prospective customers to evaluate the features of Red Hat Enterprise Virtualization. Use this guide if you have an evaluation license. Red Hat Enterprise Virtualization - Installation Guide describes the installation prerequisites and procedures. Read this if you need to install Red Hat Enterprise Virtualization. The installation of hosts, Manager and storage are covered in this guide. You will need to refer to the Red Hat Enterprise Virtualization Administration Guide to configure the system before you can start using the platform. Red Hat Enterprise Virtualization - Manager Release Notes contain release specific information for Red Hat Enterprise Virtualization Managers. Red Hat Enterprise Virtualization - Power User Portal Guide describes how power users can create and manage virtual machines from the Red Hat Enterprise Virtualization User Portal. Red Hat Enterprise Virtualization - Quick Start Guide provides quick and simple instructions for first time users to set up a basic Red Hat Enterprise Virtualization environment. Red Hat Enterprise Virtualization - REST API Guide describes how to use the REST API to set up and manage virtualization tasks. Use this guide if you wish to develop systems which integrate with Red Hat Enterprise Virtualization, using an open and platform independent API. Red Hat Enterprise Virtualization - Technical Reference Guide describes the technical architecture of Red Hat Enterprise Virtualization and its interactions with existing infrastructure. Red Hat Enterprise Virtualization - User Portal Guide describes how users of the Red Hat Enterprise Virtualization system can access and use virtual desktops from the User Portal. Red Hat Enterprise Linux - Hypervisor Deployment Guide describes how to deploy and install the Hypervisor. Read this guide if you need advanced information about installing and deploying Hypervisors. The basic installation of Hypervisor hosts is also described in the Red Hat Enterprise Virtualization Installation Guide. Red Hat Enterprise Linux - V2V Guide describes importing virtual machines from KVM, Xen and VMware ESX/ESX(i) to Red Hat Enterprise Virtualization and KVM managed by libvirt.
This guide is intended for system administrators who manage a virtualized environment using Red Hat Enterprise Virtualization or Red Hat Enterprise Linux. An advanced level of system administration, preferably including familiarity with virtual machine data center operations, is assumed. This document is not intended for beginners. This manual uses several conventions to highlight certain words and phrases and draw attention to specific pieces of information. In PDF and paper editions, this manual uses typefaces drawn from the Liberation Fonts set. The Liberation Fonts set is also used in HTML editions if the set is installed on your system. If not, alternative but equivalent typefaces are displayed. Note: Red Hat Enterprise Linux 5 and later includes the Liberation Fonts set by default. 2.1. Typographic ConventionsFour typographic conventions are used to call attention to specific words and phrases. These conventions, and the circumstances they apply to, are as follows. Mono-spaced Bold
Used to highlight system input, including shell commands, file names and paths. Also used to highlight keys and key combinations. For example: To see the contents of the file my_next_bestselling_novel in your current working directory, enter the cat my_next_bestselling_novel command at the shell prompt and press Enter to execute the command.
The above includes a file name, a shell command and a key, all presented in mono-spaced bold and all distinguishable thanks to context. Key combinations can be distinguished from an individual key by the plus sign that connects each part of a key combination. For example: Press Enter to execute the command. Press Ctrl+Alt+F2 to switch to a virtual terminal.
The first example highlights a particular key to press. The second example highlights a key combination: a set of three keys pressed simultaneously. If source code is discussed, class names, methods, functions, variable names and returned values mentioned within a paragraph will be presented as above, in mono-spaced bold . For example: File-related classes include filesystem for file systems, file for files, and dir for directories. Each class has its own associated set of permissions.
Proportional Bold This denotes words or phrases encountered on a system, including application names; dialog box text; labeled buttons; check-box and radio button labels; menu titles and sub-menu titles. For example: Choose ⤍ ⤍ from the main menu bar to launch Mouse Preferences. In the Buttons tab, click the Left-handed mouse check box and click Close to switch the primary mouse button from the left to the right (making the mouse suitable for use in the left hand). To insert a special character into a gedit file, choose ⤍ ⤍ from the main menu bar. Next, choose ⤍ from the Character Map menu bar, type the name of the character in the Search field and click Next. The character you sought will be highlighted in the Character Table. Double-click this highlighted character to place it in the Text to copy field and then click the Copy button. Now switch back to your document and choose ⤍ from the gedit menu bar.
The above text includes application names; system-wide menu names and items; application-specific menu names; and buttons and text found within a GUI interface, all presented in proportional bold and all distinguishable by context. Mono-spaced Bold Italic or Proportional Bold Italic
Whether mono-spaced bold or proportional bold, the addition of italics indicates replaceable or variable text. Italics denotes text you do not input literally or displayed text that changes depending on circumstance. For example: To connect to a remote machine using ssh, type ssh username @domain.name at a shell prompt. If the remote machine is example.com and your username on that machine is john, type ssh [email protected] . The mount -o remount file-system command remounts the named file system. For example, to remount the /home file system, the command is mount -o remount /home . To see the version of a currently installed package, use the rpm -q package command. It will return a result as follows: package-version-release .
Note the words in bold italics above - username, domain.name, file-system, package, version and release. Each word is a placeholder, either for text you enter when issuing a command or for text displayed by the system. Aside from standard usage for presenting the title of a work, italics denotes the first use of a new and important term. For example: Publican is a DocBook publishing system.
2.2. Pull-quote ConventionsTerminal output and source code listings are set off visually from the surrounding text. Output sent to a terminal is set in mono-spaced roman and presented thus: books Desktop documentation drafts mss photos stuff svnbooks_tests Desktop1 downloads images notes scripts svgs Source-code listings are also set in mono-spaced roman but add syntax highlighting as follows: package org.jboss.book.jca.ex1;import javax.naming.InitialContext;public class ExClient{ public static void main(String args[]) throws Exception { InitialContext iniCtx = new InitialContext(); Object ref = iniCtx.lookup("EchoBean"); EchoHome home = (EchoHome) ref; Echo echo = home.create(); System.out.println("Created Echo"); System.out.println("Echo.echo('Hello') = " + echo.echo("Hello")); }} Finally, we use three visual styles to draw attention to information that might otherwise be overlooked. Notes are tips, shortcuts or alternative approaches to the task at hand. Ignoring a note should have no negative consequences, but you might miss out on a trick that makes your life easier. Important boxes detail things that are easily missed: configuration changes that only apply to the current session, or services that need restarting before an update will apply. Ignoring a box labeled 'Important' will not cause data loss but may cause irritation and frustration. Warnings should not be ignored. Ignoring warnings will most likely cause data loss. If you find a typographical error in this manual, or if you have thought of a way to make this manual better, we would love to hear from you! Please submit a report in Bugzilla: http://bugzilla.redhat.com/ against the product Red Hat Enterprise Linux 6. When submitting a bug report, be sure to mention the manual's identifier: doc-V2V_Guide. If you have a suggestion for improving the documentation, try to be as specific as possible when describing it. If you have found an error, include the section number and some of the surrounding text so we can find it easily. Chapter 1. Introducing V2VV2V is an acronym for virtual to virtual, referring to the process of importing virtual machines from one virtualization platform to another. Red Hat Enterprise Virtualization and Red Hat Enterprise Linux are capable of performing V2V operations using the virt-v2v command. - virt-v2v
The virt-v2v command converts virtual machines from a foreign hypervisor to run on KVM, managed by Red Hat Enterprise Virtualization or libvirt. virt-v2v can currently convert Red Hat Enterprise Linux 4, Red Hat Enterprise Linux 5, Red Hat Enterprise Linux 6, Windows XP, Windows Vista, Windows 7, Windows Server 2003 and Windows Server 2008 virtual machines running on Xen, KVM and VMware ESX. virt-v2v enables para-virtualized (virtio ) drivers in the converted virtual machine if possible.
The following guest operating systems are supported by virt-v2v : Red Hat Enterprise Linux 3.9 Red Hat Enterprise Linux 4 Red Hat Enterprise Linux 5 Red Hat Enterprise Linux 6 Windows XP Windows Vista Windows 7 Windows Server 2003 Windows Server 2008
The following source hypervisors are supported by virt-v2v : virt-v2v is run from a Red Hat Enterprise Linux host. It must be installed on the host.
Procedure 1.1. Installing virt-v2v Subscribe to the virt-v2v RHN channel virt-v2v is available on Red Hat Network (RHN) in the Red Hat Enterprise Linux Server (v.6 for 64-bit x86_64) or Red Hat Enterprise Linux Workstation (v.6 for x86_64) channel. Ensure the system is subscribed to the appropriate channel before installing virt-v2v .
Install the pre-requisites If you are converting Windows virtual machines, you must install the libguestfs-winsupport and virtio-win packages. These packages provide support for NTFS and Windows para-virtualized block and network drivers. If you attempt to convert a virtual machine using NTFS without the libguestfs-winsupport package installed, the conversion will fail. If you attempt to convert a virtual machine running Windows without the virtio-win package installed, the conversion will fail giving an error message concerning missing files.
Log on to Red Hat Network The libguestfs-winsupport is available for Red Hat Enterprise Linux Server 6 in the Red Hat Enterprise Linux Server V2V Tools for Windows (v. 6) channel, while the virtio-win package is available in the Red Hat Enterprise Linux Server Supplementary (v. 6) channel. To install these packages, ensure that your system has the required permissions to subscribe to both channels and run the following command as root: rhn-channel -a -c rhel-x86_64-server-supplementary-6 --user USERNAME --password PASSWORD
rhn-channel -a -c rhel-x86_64-server-v2vwin-6 --user USERNAME --password PASSWORD
yum install libguestfs-winsupport virtio-win
Install virt-v2v package As root, run the command: yum install virt-v2v
Run virt-v2v as the root user from a Linux shell.
Chapter 2. Converting virtual machines to run on KVM managed by libvirtvirt-v2v can convert virtual machines to run on Red Hat Enterprise Linux, using KVM managed by libvirt. Virtual machines can be converted from Xen, KVM and VMware ESX / ESX(i) environments. The libvirt and virsh commands are documented in the Red Hat Enterprise Linux Virtualization Administration Guide. You may also use the command man virsh for more information.
2.1. Preparing to convert a virtual machinevirt-v2v converts virtual machines from a foreign hypervisor to run on Red Hat Enterprise Linux, using KVM managed by libvirt. It automatically creates a libvirt domain for the converted virtual machines.
Before a virtual machine can be converted, ensure that the following steps are completed: Procedure 2.1. Preparing to convert a virtual machine Create a local storage domain for transferred storage virt-v2v copies the guest virtual machine storage to a locally defined libvirt storage pool during import. This pool can be defined using any libvirt tool, and can be of any type. The simplest way to create a new pool is with virt-manager . Information for creating a storage pool can be found in the Red Hat Enterprise Linux Virtualization Administration Guide.
Create local network interfaces The local machine must have an appropriate network to which the converted virtual machine can connect. This is likely to be a bridge interface. A bridge interface can be created using standard tools on the host. virt-manager can also create and manage bridges. For more information on bridged networking with libvirt, see the Red Hat Enterprise Linux Virtualization Host Configuration and Guest Installation Guide or the Red Hat Enterprise Linux Virtualization Administration Guide. Specify network mappings in virt-v2v.conf . This step is optional, and is not required for most use cases. If your virtual machine has multiple network interfaces, /etc/virt-v2v.conf must be edited to specify the network mapping for all interfaces. You can specify an alternative virt-v2v.conf file with the -f parameter. If your virtual machine only has a single network interface, it is simpler to use the --network or --bridge parameters, rather than modifying virt-v2v.conf . Create a profile for the conversion in virt-v2v.conf . This step is optional. Profiles specify a conversion method, storage location, output format and allocation policy. When a profile is defined, it can be called using --profile rather than individually providing the -o , -os , -of and -oa parameters. See virt-v2v.conf(5) for details.
2.1.1. Preparing to convert a virtual machine running LinuxBefore a virtual machine running Linux can be converted, ensure that the following steps are completed: Obtain the software Install all required packages
As part of the conversion process, virt-v2v may install a new kernel and drivers on the virtual machine. If the virtual machine being converted is registered to Red Hat Network (RHN), the required packages will be automatically downloaded. If the virtual machine is not registered to RHN, the /var/lib/virt-v2v/virt-v2v.db XML file ships with a list of RPMs used for this purpose. The RPMs relevant to your virtual machine must be downloaded manually from RHN and made available on the host running virt-v2v . The RPMs should be saved in the directory specified by the path-root configuration element, which by default is /var/lib/virt-v2v/software/ . An error similar to Example 2.1, "Missing Package error" will be displayed by virt-v2v if the software it depends upon for a particular conversion is not available. Example 2.1. Missing Package error virt-v2v: Installation failed because the following files referenced in the configuration file are required, but missing:rhel/6/kernel-2.6.32-128.el6.x86_64.rpmrhel/6/ecryptfs-utils-82-6.el6.x86_64.rpmrhel/6/ecryptfs-utils-82-6.el6.i686.rpm To obtain the relevant RPMs for your environment, repeat these steps for each missing package: Select the Package Search tab. In the Search For field, type the package name exactly matching the one shown in the error message. For the example shown in Example 2.1, "Missing Package error", the first package is kernel-2.6.32-128.el6.x86_64 In the Where to search field, select In the following architectures and tick the x86_64 checkbox. Click Search. A list of packages displays. Click the package name identical to the one in the error message. You will be directed to the Details page, containing detailed descriptions of the package. Select Download Package at the bottom of the page Save the downloaded package to the appropriate directory in /var/lib/virt-v2v/software . For Red Hat Enterprise Linux 6, the directory is /var/lib/virt-v2v/software/rhel/6 2.1.2. Preparing to convert a virtual machine running Windowsvirt-v2v does not support conversion of the Windows Recovery Console. If a guest virtual machine has a recovery console installed and VirtIO was enabled during conversion, attempting to boot the recovery console will result in a stop error. Windows XP x86 does not support the Windows Recovery Console on VirtIO systems, so there is no resolution to this. However, on Windows XP AMD64 and Windows 2003 (x86 and AMD64), the recovery console can be re-installed after conversion. The re-installation procedure is the same as the initial installation procedure. It is not necessary to remove the recovery console first. Following re-installation, the recovery console will work as intended. Before a virtual machine running Windows can be converted, ensure that the following steps are completed. Install the libguestfs-winsupport package on the host running virt-v2v . This package provides support for NTFS, which is used by many Windows systems. The libguestfs-winsupport package is provided by the RHEL V2VWIN (v. 6 for 64-bit x86_64) channel. Ensure your system is subscribed to this channel, then run the following command as root: yum install libguestfs-winsupport
Example 2.2. Error message when converting a Windows virtual machine without libguestfs-winsupport installed No operating system could be detected inside this disk image.This may be because the file is not a disk image, or is not a virtual machineimage, or because the OS type is not understood by virt-inspector.If you feel this is an error, please file a bug report including as muchinformation about the disk image as possible.
Install the virtio-win package on the host running virt-v2v . This package provides para-virtualized block and network drivers for Windows guests. The virtio-win package is provided by the RHEL Server Supplementary (v. 6 64-bit x86_64) channel. Ensure your system is subscribed to this channel, then run the following command as root: yum install virtio-win
Example 2.3. Error message when converting a Windows virtual machine without virtio-win installed virt-v2v: Installation failed because the following files referenced in the configuration file are required, but missing: /usr/share/virtio-win/drivers/i386/Win2008
When virtual machines running Windows are converted for output to Red Hat Enterprise Virtualization, post-processing of the virtual machine image will be performed by the Red Hat Enterprise Virtualization Manager to install updated drivers. See Section 7.2.2, "Configuration changes for Windows virtual machines" for details of the process. This step will be omitted when virtual machines running Windows are converted for output to libvirt. 2.1.3. Preparing to convert a local Xen virtual machineThe following is required when converting virtual machine on a host which used to run Xen, but has been updated to run KVM. It is not required when converting a Xen guest imported directly from a running libvirt/Xen instance. Obtain the XML for the guest virtual machine virt-v2v uses a libvirt domain description to determine the current configuration of the virtual machine, including the location of its storage. Before starting the conversion, obtain this from the host running the virtual machine with the following command: virsh dumpxml guest_name > guest_name.xml This will require booting into a Xen kernel to obtain the XML, as libvirt needs to connect to a running Xen hypervisor to obtain its metadata. The conversion process is optimized for KVM, so obtaining domain data while running a Xen kernel, then performing the conversion using a KVM kernel will be more efficient than running the conversion on a Xen kernel.
2.2. Converting virtual machinesOnce you have prepared to convert the virtual machines, use virt-v2v to perform the actual conversions. This section provides the steps to convert the virtual machines, and command syntax for virt-v2v . Note that conversions are resource intensive processes, involving copying the whole disk image for a virtual machine. In typical environments, converting a single virtual machine takes approximately 5-10 minutes. virt-v2v converts guest virtual machines from a foreign hypervisor to run on KVM, managed by libvirt. The general command syntax for converting machines to run on KVM managed by libvirt is:
virt-v2v -i libvirtxml -os pool --bridge bridge_name guest_name.xml virt-v2v -ic xen+ssh://[email protected] -os pool --bridge bridge_name guest_name.xml virt-v2v -ic esx://esx.example.com/?no_verify=1 -os pool --bridge bridge_name guest_name.xml 2.2.2. Converting a local Xen virtual machineEnsure that the virtual machine's XML is available locally, and that the storage referred to in the XML is available locally at the same paths. To convert the virtual machine from an XML file, run: virt-v2v -i libvirtxml -os pool --bridge bridge_name guest_name.xml Where pool is the local storage pool to hold the image, bridge_name is the name of a local network bridge to connect the converted virtual machine's network to, and guest_name.xml is the path to the guest virtual machine's exported XML. You may also use the --network parameter to connect to a locally managed network, or specify multiple mappings in /etc/virt-v2v.conf . If your guest uses a Xen para-virtualized kernel (it would be called something like kernel-xen or kernel-xenU), virt-v2v will attempt to install a new kernel during the conversion process. You can avoid this requirement by installing a regular kernel, which won't reference a hypervisor in its name, alongside the Xen kernel prior to conversion. You should not make this newly installed kernel your default kernel, because Xen will not boot it. virt-v2v will make it the default during conversion. 2.2.3. Converting a remote Xen virtual machineXen virtual machines can be converted remotely using SSH. Ensure that the host running the virtual machine is accessible via SSH. Even on a guest with multiple disks, each virtual disk transfer requires a separate SSH session. It is recommended to set up SSH keys for authentication prior to the remote virtual machine conversion. Otherwise, a user will be required to manually enter SSH credentials for each guest disk being transferred. Failure to enter a password manually in the time after the transfer completes but before the SSH negotiation times out will cause virt-v2v to fail. This is especially important for large disks, as the disk transfer can take an unspecified length of time. To convert the virtual machine, run: virt-v2v -ic xen+ssh://[email protected] -os pool --bridge bridge_name guest_name Where vmhost.example.com is the host running the virtual machine, pool is the local storage pool to hold the image, bridge_name is the name of a local network bridge to connect the converted guest virtual machine's network to, and guest_name is the domain of the Xen virtual machine. You may also use the --network parameter to connect to a locally managed network, or specify multiple mappings in /etc/virt-v2v.conf . You will be prompted to enter the password for the user specified in the connection string, which is root in the example above. If your guest uses a Xen para-virtualized kernel (it would be called something like kernel-xen or kernel-xenU), virt-v2v will attempt to install a new kernel during the conversion process. You can avoid this requirement by installing a regular kernel, which won't reference a hypervisor in its name, alongside the Xen kernel prior to conversion. You should not make this newly installed kernel your default kernel, because Xen will not boot it. virt-v2v will make it the default during conversion. 2.2.4. Converting a VMware ESX / ESX(i) virtual machineWhen converting a Windows virtual machine from VMware ESX / ESX(i), ensure that VMware Tools is not installed on the virtual machine. The VMware Tools must be uninstalled prior to the conversion process. If a virtual machine is converted with the VMware Tools installed, it will not function correctly. Ensure that the virtual machine is stopped prior to running the v2v process. To convert the virtual machine, run: virt-v2v -ic esx://esx.example.com/ -os pool --bridge bridge_name guest_name Where esx.example.com is the VMware ESX / ESX(i) server, pool is the local storage pool to hold the image, bridge_name is the name of a local network bridge to connect the converted guest virtual machine's network to, and guest_name is the name of the virtual machine. You may also use the --network parameter to connect to a locally managed network, or specify multiple mappings in /etc/virt-v2v.conf . The progress of the conversion process will be displayed in percent as it runs. 2.2.5. Running converted virtual machinesOn successful completion, virt-v2v will create a new libvirt domain for the converted virtual machine with the same name as the original virtual machine. It can be started as usual using libvirt tools, for example virt-manager . |
| |