openstack基于centos显卡透传:
1、查看显卡ID
在有双显卡的计算节点compute上,使用lspci -nn|grep NVIDIA命令查看显卡设备product_id 和 vendor_id
2、控制节点配置
控制节点controller 编辑配置文件:/etc/nova/nova.conf
[scheduler]标签下:
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
[pci]标签下
alias = {"name": "a1","product_id": "104c","vendor_id": "10de","device_type": "type-PCI"}
配置完之后重启服务
systemctl restart openstack-nova-scheduler.service
systemctl restart openstack-nova-api.service
3、计算节点配置
计算节点compute编辑配置文件:/etc/nova/nova.conf
[pci]标签下
alias = {"name": "a1","product_id": "104c","vendor_id": "10de","device_type": "type-PCI"}
passthrough_whitelist = {"vendor_id": "10de","product_id": "104c"}
配置完之后重启服务
systemctl restart openstack-nova-api.service
4、UEFI配置修改
UEFI不受支持,日志报错uefinotsupported: uefi不受支持,需要修改源码
安装ovmf及win10镜像见之前文章:openstack的kvm win10镜像制作_胡铁威的博客-CSDN博客
计算节点compute /usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py 改源码
改成OVMF现在目录。
DEFAULT_UEFI_LOADER_PATH = {
"x86_64": "/usr/share/edk2.git/ovmf-x64/OVMF_CODE-pure-efi.fd",
"aarch64": "/usr/share/AAVMF/AAVMF_CODE.fd"
}
5、显卡驱动43解决
NVIDIA驱动报错43,解决方式。需要修改源码。
计算节点compute /usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py 改源码
<hyperv>
<relaxed state='on'/>
<vapic state='on'/>
<spinlocks state='on' retries='8191'/>
</hyperv>
改为
<hyperv>
<relaxed state='on'/>
<vapic state='on'/>
<spinlocks state='on' retries='8191'/>
<vendor_id state='on' value='1234567890ab'/>
</hyperv>
加入这一行<vendor_id state='on' value='1234567890ab'/>
重启服务:systemctl restart openstack-nova-api.service
6、更改镜像类型
openstack image set 8211fd9c-92c4-4f8b-be6d-6215d9be4c3b --property hw_firmware_type=uefi
openstack image set 8211fd9c-92c4-4f8b-be6d-6215d9be4c3b --property img_hide_hypervisor_id=true
openstack image set 8211fd9c-92c4-4f8b-be6d-6215d9be4c3b --property os_secure_boot=required
openstack image set 8211fd9c-92c4-4f8b-be6d-6215d9be4c3b --property hw_cpu_cores=1
7、创建实例
使用openstack的dashboard创建新实例类型passthrough,更新元数据
添加以下几个:
pci_passthrough:alias a1:1
img_hide_hypervisor_id true
hw_firmware_type uefi
添加完如下图,
8、在双显卡计算节点上建立win10系统
openstack server create --flavor passthrough --image win10 --nic net-id=0e025936-a568-43fe-a32c-01f8b75472ae --availability-zone nova:compute1:compute1 win10
在指定节点建实例参考之前文章:openstack创建实例到指定计算节点_胡铁威的博客-CSDN博客
参考文章:
OpenStack Pike版本+KVM+Passthrough+NVIDIA显卡1060透传_u010845350的博客-CSDN博客_openstack 显卡 OpenStack Pike版本+KVM+Passthrough+NVIDIA显卡1060透传
OpenStack下利用透传技术(passthrough)对GPU实现虚拟化_金锐谈云-CSDN博客 OpenStack下利用透传技术(passthrough)对GPU实现虚拟化
OpenStack Docs: Attaching physical PCI devices to guests 官网
Ubuntu 16.04 KVM中实现PCI Passthrough_未选之路-CSDN博客 Ubuntu 16.04 KVM中实现PCI Passthrough
Centos 7 + Openstack + PCI passthrough(透传)_tianxin的专栏-CSDN博客 Centos 7 + Openstack + PCI passthrough(透传)