1 2 |
yum install centos-release-qemu-ev yum install -y libvirt AAVMF virt-install qemu-guest-agent |
1
|
yum localinstall -y *.rpm |
软件包如下所示:
1
|
vim /etc/libvirt/qemu.conf
|
user = "root" # The group for QEMU processes run by the system instance. It can be # specified in a similar way to user. group = "root" # Whether libvirt should dynamically change file ownership
1 2 |
systemctl start libvirtd systemctl enable libvirtd |
1 2 3 |
mkdir -p /home/kvm/images chown root:root /home/kvm/images chmod 755 /home/kvm/images |
1 2 3 4 |
virsh pool-define-as StoragePool --type dir --target /home/kvm/images virsh pool-build StoragePool virsh pool-start StoragePool virsh pool-autostart StoragePool |
1 2 |
virsh pool-info StoragePool virsh pool-list |
1 2 3 |
virt-install --name=vm1 --vcpus=4 --ram=8192 \ --disk path=/home/kvm/images/1.img,format=qcow2,size=50,bus=virtio \ --cdrom /home/iso/CentOS-7-aarch64-Everything-1810.iso |
1
|
virsh edit vm1 |
将<interface type='network'>xxx</interface>删掉,在</devices>前添加如下内容:
1 2 3 4 5 |
<hostdev mode='subsystem' type='pci' managed='yes'> <source> <address domain='0x0000' bus='0x01' slot='0x01' function='0x2'/> </source> </hostdev> |
<address domain='0x0000' bus='0x01' slot='0x01' function='0x2'/>中domain、bus、slot、function的值对应VF的PCI端口号0000:01:01.2。
修改后效果如下:
配置其它虚拟机的PCI端口号时,需绑定到未使用的VF端口上。