openstack显卡透传(centos)

版权声明:转发请带出处 联系qq:1113997619 邮箱:[email protected] https://blog.csdn.net/hutiewei2008/article/details/86701247

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镜像见之前文章:https://blog.csdn.net/hutiewei2008/article/details/85986652

计算节点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

在指定节点建实例参考之前文章:https://blog.csdn.net/hutiewei2008/article/details/86573504

 

参考文章:

https://blog.csdn.net/u010845350/article/details/80599984 OpenStack Pike版本+KVM+Passthrough+NVIDIA显卡1060透传

https://blog.csdn.net/wangjinruifly/article/details/79620075#commentBox OpenStack下利用透传技术(passthrough)对GPU实现虚拟化

https://docs.openstack.org/nova/pike/admin/pci-passthrough.html 官网

https://blog.csdn.net/u012336567/article/details/74743168  Ubuntu 16.04 KVM中实现PCI Passthrough

https://blog.csdn.net/u011846257/article/details/52350369 Centos 7 + Openstack + PCI passthrough(透传)

 

猜你喜欢

转载自blog.csdn.net/hutiewei2008/article/details/86701247