赞
踩
显卡:GeForce GTX 1060
root@computer:~# lspci -nn | grep NVIDIA
01:00.0 VGA compatible controller : NVIDIA Corporation Device [10de:1c03] (rev a1)
01:00.1 Audio device : NVIDIA Corporation Device [10de:10f1] (rev a1)
本次配置,所犯错误:
1、创建含GPU的虚拟机失败,错误:nova.exception.PciRequestAliasNotDefined
答:请仔细检查/etc/nova/nova.conf是否配置错误,如pci_alias 是否在[default]下面或者是否存在拼写错误。
2、执行命令echo 10de 1c03 > /sys/bus/pci/drivers/vfio-pci/new_id后,终端卡死。
答:未安装NVIDIA相关的驱动,导致无法将显卡取消绑定,加入到vfio-pci中。(安装NVIDIA驱动,Ubuntu桌面版 系统设计->系统->软件和更新->附加驱动)
正确的配置过程:
1、在BIOS中enable VT-x, VT-d, Onboard VGA. Onboard VGA 的enable可以避免一些错误的出现,具体参考Not only for miners GPU integration in Nova environment。
2、编辑文件 /etc/default/grub
intel芯片:GRUB_CMDLINE_LINUX_DEFAULT="intel_iommu=on"
amd芯片:GRUB_CMDLINE_LINUX_DEFAULT="iommu=pt iommu=1"
3、运行sudo update-grub
4、查看PCI设备相关驱动,若无驱动显示,则容易出现错误2,应先安装相关驱动。
lspci -vv -s 01:00.0 | grep driver 和 lspci -vv -s 01:00.1 | grep driver
Kernel driver in use: nouveau Kernel driver in use: nvidia
5、将PCI设备相关驱动解绑
echo 0000:01:00.0 > /sys/bus/pci/devices/0000\:01\:00.0/driver/unbind
echo 0000:01:00.1 > /sys/bus/pci/devices/0000\:01\:00.1/driver/unbind
6、挂载VFIO驱动
echo 10de 1c03 > /sys/bus/pci/drivers/vfio-pci/new_id
echo 10de 10f1 > /sys/bus/pci/drivers/vfio-pci/new_id
7、检查VIFO驱动是否挂载成功
lspci -nnk -d 10de:1c03
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:1c03] (rev a1)
Subsystem: Micro-Star International Co., Ltd. [MSI] Device [1462:3609]
Kernel driver in use: vfio-pci
lspci -nnk -d 10de:10f1
01:00.1 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:10f1] (rev a1)
Subsystem: Micro-Star International Co., Ltd. [MSI] Device [1462:3609]
Kernel driver in use: vfio-pci
二、OpenStack相关配置
1. 配置nova-scheduler (controller节点),编辑文件 /etc/nova/nova.conf:
[DEFAULT]
scheduler_driver=nova.scheduler.filter_scheduler.FilterScheduler
scheduler_available_filters=nova.scheduler.filters.all_filters
scheduler_available_filters=nova.scheduler.filters.pci_passthrough_filter.PciPassthroughFilter
scheduler_default_filters=RamFilter,ComputeFilter,AvailabilityZoneFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,PciPassthroughFilter
2、重启nova-scheduler 服务
sudo service nova-scheduler restart
3、配置nova-api (controller节点),编辑文件 /etc/nova/nova.conf:
[DEFAULT]
pci_alias = { "name": "nvidia1060", "product_id": "1c03", "vendor_id": "10de", "device_type": "type-PCI" }
4、重启nova-api服务
sudo service nova-api restart
5. 配置nova-compute(compute 节点),编辑文件/etc/nova/nova.conf:
[DEFAULT]
pci_passthrough_whitelist = { "vendor_id": "10de", "product_id": "1b06" }
pci_alias = { "name": "nvidia1060", "product_id": "1c03", "vendor_id": "10de", "device_type": "type-PCI"}
6、重启nova-compute服务
sudo service nova-compute restart
三、验证
1. 创建设置flavor:
openstack flavor set m1.large --property "pci_passthrough:alias"="nvidia1060:1"
2、创建虚拟机(flavor 选择m1.large),并验证pci
lspci -k
00:05.0 Class 0300: 10de:1c03
参考资料:
OpenStack下利用透传技术(passthrough)对GPU实现虚拟化_passthrough 虚拟化_hhzzk的博客-CSDN博客
Centos 7 + Openstack + PCI passthrough(透传)_pci-stub.ids_iyelei的博客-CSDN博客
配置完成后,仍然有error43错误
建议参考我下一篇博客
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。