Function: Create VM automately by virt-install cmd. The network and hostname will be set.
- Create VM
- Set up the IP
- Set up the hostname
- Modify the size of disk
All these functions run in an automatic way and controlled by /config/vm.csv.
- ubuntu
- The directory of image is /datapool/ on host.
- The name of lvm must be 'vmvg'.(If used)
- Libvirt, guestfish.
- Download the script:
git clone https://github.com/Second222None/toolkit
- Prepare the environment:
# bash /toolkit/scripts/first.sh
- Edit the /toolkit/config/vm.csv to customize your configuration.
- vm - qcow2, vmLvm - lvm, vmCpOnly - copy the image directly
- The name of the image in the /datapool/.
- The name of the VM.
- The password of the VM.
- The size of the first disk.
- The size of the second disk.
- The size of Memory.
- The number of vcpu.
- The virtualization of the first nic.(e1000,virtio)
- The birdge the first nic connected to.
- The birdge the second nic connected to.
- The VNC port.
- First IP.
- First netmask.
- First gateway.
- Second IP.
- Second netmask.
- Second gateway.
- Run the script:
python /toolkit/virtauto.py
ovs-vsctl add-br ovs_br
创建虚拟机过程中出现如下错误:
virt-install can not find the ovs bridge, so virsh net-define by ovs_br.xml
原因:virsh不支持ovs网桥,需要自己定义,告诉virsh网桥的存在
<netowrk>
<name>ovs_br</name>
<forward mode='bridge'/>
<bridge name='ovs_br'>
<virtualport type='openvswitch'/>
</network>
virsh net-define ovs_br.xml