Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

一、前言

随着虚拟化技术的快速发展,各厂商虚拟化产品也是百花齐放,企业或*机构在早期建设中会存在多个厂商虚拟化产品,随着虚拟化技术越来越成熟,带来的是企业私有云、政务云统一规划建设,进而对现有虚拟化产品统一整合、改造,已经成为私有云建设中重要环节。

在虚拟化整合过程中,经常会涉及以下整合:

1、物理机迁移至VMware虚拟化平台;

2、VMware ESXi 低版本虚拟机迁移至VMware ESXi 高版本虚拟化平台;

3、Citrix Xen Server虚拟机迁移至VMware ESXi 6.7虚拟化平台;

4、VMware虚拟机迁移至KVM虚拟化平台等等。

列举:Citrix Xen Server Linux虚拟机迁移至VMware ESXi 6.7虚拟化平台进行技总结。

二、迁移准备工作

一、环境说明

1、源虚拟化环境:Citrix Xen Server 6.1

2、目标虚拟化环境:VMware ESXi 6.7.0 U1

3、迁移虚拟机OS类型:CentOS 6.4、Windows 2008、Windows 2003

4、迁移工具:VMware-converter-en-6.2.0-8466193

5、VMware-converter server OS类型:Window2012 R2

二、迁移流程

由于都是生产业务系统迁移,迁移前应按照以下开展:

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

三、注意事项

1、进行VMware-converter服务端安装。

2、检查源虚拟机业务类型和操作系统版本,确认是否在converter兼容性列表里。

     1)、如果源是域控制器,应进行特殊考虑。VMware 不建议使用 Converter 虚拟化活动域控制器。

     2)、如果源是 Microsoft Exchange、SQL 或DB2、Oracle等其他数据库服务器,VMware 建议在转换之前关闭应用程序 (Microsoft Exchange/SQL) 和数据库服务。这将最大程度地减少任何损坏数据库表或使目标虚拟机中的数据失效的机会。

     3)、在转换期间禁用实时防病毒扫描。

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

3、迁移前对VMware-converter服务端、虚拟机源端相关防火墙进行关闭。

     Linux 迁移过程中,使用以下端口服务:

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

四、技术原理

1、远程热克隆在线运行的windows 虚拟机技术原理

1)、Converter Standalone prepares the source machine for the conversion.

          Converter Standalone为转换准备源计算机。


          Converter Standalone installs the agent on the source machine and the agent takes a snapshot of the source volumes.

          Converter Standalone在源计算机上安装代理,代理将获取源卷的快照。

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

2)、Converter Standalone prepares the virtual machine on the destination machine.

Converter Standalone creates a virtual machine on the destination machine and the agent copies volumes from the source machine to the destination machine.

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

3)、Converter Standalone finishes the conversion process.

The agent installs the drivers required for the operating system to start in a virtual machine and personalizes the virtual machine (changes the IP information, for example)

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

4)、Optionally, Converter Standalone uninstalls the agent from the source machine.

The virtual machine is ready to run on the destination server.

2、远程热克隆在线运行的Linux 虚拟机技术原理

In Linux conversions, no agent is deployed on the source machine. Instead, a helper virtual machine is created and deployed on the destination ESXi host. The source data is then copied from the source Linux machine to the helper virtual machine. After the conversion is complete, the helper virtual machine shuts down to become the destination virtual machine the next time you power it on.Converter Standalone supports conversion of Linux sources only to managed destinations.The following workflow demonstrates the principles of hot cloning powered on source machines that run

Linux to managed destinations.

1)、Converter Standalone uses SSH to connect to the source machine and retrieves source information.Converter Standalone creates an empty helper virtual machine based on your conversion task settings. The helper virtual machine serves as a container for the new virtual machine during conversion. Converter Standalone deploys the helper virtual machine on the managed destination, an ESXi host. The helper virtual machine boots from a *.iso file that is located on the Converter Standalone server machine.

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

2)、The helper virtual machine powers on, boots from the Linux image, connects to the source machine through SSH, and starts retrieving the selected data from the source. While you set up the conversion task, you can select which source volumes to be copied to the destination machine.

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

3)、Optionally, after data is copied, the destination virtual machine is reconfigured to allow the operating system to start in a virtual machine.

4)、 Converter Standalone shuts down the helper virtual machine. The conversion process is complete.You can configure Converter Standalone to power on the newly created virtual machine after the conversion is complete.

五、迁移实施步骤

一、Linux虚拟机进行热克隆迁移

本次Linux虚拟机热克隆迁移分为2个部分:

第1部分:使用 vmware converter 工具热克隆迁移虚拟机

第2部分:将迁移后的 Xen Server虚拟机更改系统配置文件,否则在vmware平台下无法启动系统!

第1部分:vmware converter 工具热克隆虚拟机

1、登录xen server 上的源Linux虚拟机,对虚拟机上数据库、中间件及其他应用程序进行关闭,以防在热克隆过程中数据产生增量及迁移后数据库无法正常启动。

2、登录 vmware converter 服务器,打开converter软件

3、选择 Convert machine

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

4、选择Powered on->Remote Linux machine, 输入源系统信息,IP地址、用户名、密码

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

5、选择YES ,在客户端安装脚本

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

6、输入VMware VC信息

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

7、输入新虚拟机名称,选择存储位置、版本、集群主机

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

8、配置虚拟机信息 ,选择虚拟网卡对于网络

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

9、配置Helper信息, 给Helper 分配IP地址,建议分配源虚拟机同网段IP地址

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

10、配置概况,finish确认,热克隆开始迁移。

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

第2部分 修改迁移后虚拟机内核,更改系统配置文件

更改迁移后的虚拟机内核,否则虚拟机无法运行,因为经过xenserver虚拟化修改过的Linux内核不能在vmkernel上运行!

1、通过引导源Linux版本对应 ISO系统,引导进入救援模式,进行修改。

2、设置克隆过来的虚拟机添加 iso 镜像文件,强制引导进入BIOS设置。

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

3、设置启动项首先是CD-ROM Drive启动

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

4、选择进入linux rescue救援模式安装

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

5、输入 # chroot /mnt/sysimage

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

6、强制更新非 xen 内核文件

rpm –Uvh –force /mnt/cdrom/CentOS/ Packages/ kernel-2.6.32-358.el6.x86_64.rpm

7、卸载 xen server 相关工具

8、修改系统引导grub.conf配置文件

vi /boot/grub/grub.conf

kernel /boot/vmlinuz-2.6.32-358.el6.x86_64 ro root=/dev/sda2 rhgb quiet

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

9、编辑 /etc/inittab 文件,

vi /etc/inittab 文件, 去掉0-6

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

10、重启操作系统,系统可以正常启动

reboot

Citrix Xen Server 虚拟机迁移至 VMware 虚拟化平

11、对虚拟机安装VMware tools工具。

二、Windows虚拟机进行热克隆迁移

1)、Windows 虚拟机迁移与Linux迁移相比,简单多了,没有Helper需要配置,也不需要修改内核配置。

2)、迁移前也需对业务和数据库进行关闭,防火墙也需要关闭,迁移后就可以正常启动系统了,迁移步骤就不再重复描述了。

3)、迁移后也需要进行VMware tools工具安装。