1. 程式人生 > >KVM虛擬機遷移至VMware

KVM虛擬機遷移至VMware

col 配置ip DEV1 pub pri gamedev vim nbsp mas

1.將kvm下虛擬機關機;

[root@localhost ~]# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     gamedev10                      shut off
 -     gamedev11                      shut off
 -     gamedev12                      shut off
 -     gamedev13                      shut off
 
- gamedev2 shut off - gamedev6 shut off - gamedev7 shut off - gamedev8 shut off - gamedev9 shut off - gamedevtpl shut off - yunwei shut off

2.將kvm下img文件格式的虛擬機轉換成vmdk格式,命令如下:

qemu-img convert /data/img/gamedev2.dsk  -O vmdk /data/img/gamedev2.vmdk 

#轉換完成後會有一個 gamedev2.vmdk 的文件,將此文件上傳到VMware vSphere

#/data/img/ 磁盤文件的路徑
[root@localhost ~]# ls /data/img/
gamedev10.dsk gamedev12.dsk gamedev2.vmdk gamedev7.dsk gamedev9.dsk git.dsk
gamedev11.dsk gamedev2.dsk gamedev6.dsk gamedev8.dsk gamedevtpl.dsk test.img

3.在VMware vSphere環境裏創建一個虛擬機 “選擇自定義”,不用創建磁盤使用剛剛轉換的vmdk文件,開啟虛擬機即可

IP地址可能會變,配置IP

[root@pub network-scripts]# mv ifcfg-eth0 ifcfg-ens160
[root@pub network-scripts]# vim ifcfg-ens160 
 TYPE="Ethernet"
 BOOTPROTO="none"
 DEFROUTE="yes"
 IPV4_FAILURE_FATAL="no"
 IPV6INIT="yes"
 IPV6_AUTOCONF="yes"
 IPV6_DEFROUTE="yes"
 IPV6_FAILURE_FATAL="no"
 IPV6_ADDR_GEN_MODE="stable-privacy"
 NAME="ens160"
 UUID="bf79d93a-2c0e-418d-a341-a2268c5e7da0"
 DEVICE="ens160"
 ONBOOT="yes"
 IPADDR=10.0.3.44
 NETMASK=255.255.255.0
 GATEWAY=10.0.3.1
[root@pub network-scripts]# /etc/init.d/network restart

KVM虛擬機遷移至VMware