Virtual machine Migration technology provides a convenient way for server virtualization. Although business virtual software features are powerful, open source virtual machines such as Linux kernel virtual machines KVM and XEN are developing rapidly and migration technologies are becoming more sophisticated.
First, install the guest virtual machine
1, directly through the Virt-manager installation, management of virtual machines (slightly)
2, install the guest virtual machine through the command line
Qemu-img create-f qcow2/images/centos6.3-x86_64.img 10G
Chown qemu:qemu/images/centos6.3-x86_64.img
Virt-install--name centos6.3--ram=1024--arch=x86_64--vcpus=1--check-cpu--os-type=linux--os-variant= ' rhel6 '-c/ Tmp/centos-6.3-x86_64-minimal.iso--disk Path=/images/centos6.3-x86_64.img,device=disk,bus=virtio,size=10,format =qcow2--bridge=br100--noautoconsole--vnc--vncport=5902--vnclisten=0.0.0.0
Ii. using Virsh to manage virtual machines
2. Switch machine
Virsh Start centos6.3 #开机
Virsh Create/etc/libvirt/qemu/centos6.3.xml #直接通过主机配置文档启动主机
Virsh shutdown centos6.3 #关机
Virsh Destroy centos6.3 #强制关闭电源
Virsh List--all #查看虚拟机状态
3, add delete virtual machine
Virsh Define/etc/libvirt/qemu/node5.xml #根据主机配置文档添加虚拟机
Virsh List--all #node5已经添加
Virsh undefine NODE5 #移除虚拟机
Ls/etc/libvirt/qemu
Virsh List--all #node5已经被移除
4. Install a new virtual machine using the existing virtual machine configuration document
Qemu-img create-f qcow2/virhost/kvm_node/node6.img 20g# production of disk image files for new virtual machines
Virsh List
Virsh dumpxml node4 >/etc/libvirt/qemu/node6.xml# export virtual machine node6 hardware configuration information for/etc/libvirt/qemu/node6.xml
Vim/etc/libvirt/qemu/node6.xml
Id= ' > #修改node6的id号
Node6 #虚拟机node6的name
4b7e91eb-6521-c2c6-cc64-c1ba72707fc7 #uuid必须修改, or it will clash with Node4.
#指定新虚拟机的硬盘文件
Virsh Define/etc/libvirt/qemu/node6.xml #使用虚拟描述文档建立虚拟机,
Use Virsh edit Node6 to modify NODE6 configuration files
Virsh Start node6# virtual machine
5 open VNC for virtual machines
Virsh edit Node4 #编辑node4的配置文件, not recommended directly through VIM node4.xml modification.
#port = '-1 ': Port automatic allocation, listening Loop network (Virt-manager management requires listen= ' 127.0.0.1 '), no password
To
#固定vnc管理端口5904, do not automatically assign, VNC password Xiaobai, monitor all networks
Remote VNC access Address: 192.168.32.40:5904
Iii. Storage pools and storage volume management
1. Create a KVM host storage pool
1). Create a storage pool based on a folder (directory)
Virsh pool-define-as vmware_pool--type dir--target/virhost/vmware# defines a storage pool vmware_pool or
Virsh pool-create-as--name vmware_pool--type dir--target/virhost/vmware
#创建存储池vmware_pool, the type is a file directory,/virhost/vmware, the same as the pool-define-as result
2). Creating a storage pool based on a file system
Virsh pool-define-as--name vmware_pool--type fs--source-dev/dev/vg_target/logvol02--source-format EXT4--target/vir Host/vmware
Or
Virsh pool-create-as--name vmware_pool--type fs--source-dev/dev/vg_target/logvol02--source-format EXT4--target/vir Host/vmware
3. View Storage Pool Information
Virsh pool-info vmware_pool #查看存储域 (pool)
4). Start the storage pool
Virsh Pool-start Vmware_pool #启动存储池
Virsh pool-list
5 Destroy storage domain, cancel storage pool
Virsh Pool-destroy Vmware_pool #销毁存储池
Virsh pool-list--all
Virsh Pool-undefine Vmware_pool #取消存储池的定义
Virsh pool-list--all
2. Once you have created a storage pool, you can create a volume that is used to make a virtual machine's hard disk
Virsh vol-create-as--pool vmware_pool--name node6.img--capacity 10G--allocation 1G--format qcow2# Create volume node6.img where the storage pool is Vmware_pool, capacity 10G, initial allocation 1G, file format type Qcow2
Virsh vol-info/virhost/vmware/node6.img #查看卷信息名称: node6.img type: File capacity: 10.00 GB allocation: 136.00 KB
3. Install the virtual host on the storage volume
--connect qemu:///system \-n node7 \-r virt-install \-f/virhost/vmware/node7.img \--vnc \--os-type=linux \--os-varia Nt=rhel6 \--vcpus=1 \--network bridge=br0 \-c/mnt/rhel-server-6.0-x86_64-dvd.iso
Thank you for reading, I hope to help you, thank you for your support for this site!