82143754 2020-01-31
1 [ ~]# virsh shutdown vm01-centos6.8 #关闭需要迁移的虚机 2 [ ~]# virsh list --all #查看虚机情况
1 [ ~]# virsh domblklist vm01-centos6.8 #查看虚机磁盘
1 [ ~]# virsh dumpxml vm01-centos6.8 > /tmp/vm01-cloud-centos6.8.xml
1 [ ~]# scp /tmp/vm01-cloud-centos6.8.xml :/etc/libvirt/qemu
1 [ ~]# scp /data/images/vm01-centos6.8.img :/data/images/vm01-cloud-centos6.8.img
1 [ ~]# virsh list --all #查看虚机列表
[ ~]# vi /etc/libvirt/qemu/vm01-cloud-centos6.8.xml …… <name>vm01-cloud-centos6.8</name> <uuid>5130c447-8f43-4f84-bc90-4f51db2023f8</uuid> #修改UUID …… <disk type=‘file‘ device=‘disk‘> <driver name=‘qemu‘ type=‘qcow2‘/> <source file=‘/data/images/vm01-cloud-centos6.8.img‘/> #修改对应的磁盘路径及名字 <target dev=‘vda‘ bus=‘virtio‘/> <address type=‘pci‘ domain=‘0x0000‘ bus=‘0x00‘ slot=‘0x04‘ function=‘0x0‘/> </disk> …… <mac address=‘52:54:00:16:d3:96‘/> #修改对应的mac地址
1 [ ~]# virsh define /etc/libvirt/qemu/vm01-cloud-centos6.8.xml
1 [ ~]# virsh list --all
1 [ ~]# virsh list --all