1.修改虚机配置xml配置
vi /etc/libvirt/qemu/dns-run.xml
virsh shutdown dns-run
virsh create /etc/libvirt/qemu/dns-run.xml
2.查看cpu核心数
virsh dominfo dns-run | grep CPU
3.kvm虚机克隆(以飞腾环境为例)
虚机xml配置文件复制
cp LB-server-cc-10e53e15e63.xml dns-server-cc-10e53e15e69.xml
xml修改为修改为,默认网卡的mac地址随便改一个
<nvram>/var/lib/libvirt/qemu/nvram/dns-server-cc-10e53e15e69_VARS.fd</nvram>
<source file='/data/sata-sdb/dns-server-cc-10e53e15e69-sda.qcow2'/>
<source file='/data/sata-sdb/dns-server-cc-10e53e15e69_sdb.qcow2'/>
<source mode='bind' path='/var/lib/libvirt/qemu/dns-server-cc-10e53e15e69.agent'/>
cp LB-server-cc-10e53e15e63_VARS.fd dns-server-cc-10e53e15e69_VARS.fd
cp LB-server-cc-10e53e15e63_sdb.qcow2 dns-server-cc-10e53e15e69_sdb.qcow2
cp LB-server-cc-10e53e15e63-sda.qcow2 dns-server-cc-10e53e15e69-sda.qcow2
virsh define /etc/libvirt/qemu/dns-run-server-cc-10e53e15e69.xml
主机名 网卡0 修改
vi /etc/hostname
4.增加网卡
查看网卡信息
virsh domiflist dns-server-cc-10e53e15e69
virsh attach-interface dns-server-cc-10e53e15e69 --type bridge --source os_manage --model virtio --config
5.增加网卡队列数
<interface type='bridge'>
<mac address='52:54:00:24:2f:98'/>
<source bridge='os_manage'/>
<model type='virtio'/>
<driver queues='4'/>
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</interface>
6.查看镜像大小
qemu-img info dns-run-sda-mini.qcow2
7.镜像压缩 , 超级好用!!!
virt-sparsify --format qcow2 --compress dns-run-sda.qcow2 dns-run-sda-mini.qcow2
8.网卡重启
systemctl restart NetworkManager
ifup eth0
9.kvm修改虚机密码
virt-edit -d kvm-name /etc/shadow
# 只需要替换第一行root的密码 root:$1$bTPRDWwf$LpjUZmGTHw.hYFccl0/lK.:16804:0:99999:7:::
更换为 root:$1$hello$ZwmhCpcG.I1XIfVjdarKc1::16804:0:99999:7::