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(透傳)