OpenStack配置使用sriov

环境说明:OpenStack版本为pike

一、开启SRIOV(bios中默认开启)请先做好备份

[博主对控制和计算节点都做了修改,如有问题,还请指正]

①在/etc/default/grub中增加 “intel_iommu=on”

vi /etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto rhgb quiet intel_iommu=on"


②执行
grub2-mkconfig -o /boot/grub2/grub.cfg
reboot

③确定你要使用的物理口 本例使用eth0 eth1

echo 4 > /sys/class/net/eth0/device/sriov_numvfs 
echo 4 > /sys/class/net/eth1/device/sriov_numvfs 

二、计算节点

安装sriov-agent

yum install openstack-neutron-sriov-nic-agent

编辑sriov-agent配置文件

vi /etc/neutron/plugins/ml2/sriov_agent.ini

[sriov_nic]
physical_device_mappings = sriov1:eth0,sriov2:eth1

启动sriov-agent服务

systemctl restart neutron-sriov-nic-agent.service

修改nova配置

vi /etc/nova/nova.conf
passthrough_whitelist = [{"devname":"eth0", "physical_network":"sriov1"},{"devname":"eth1", "physical_network":"sriov2"}]

重启nova-compute服务

systemctl restart openstack-nova-compute.service

三、控制节点

编辑nova配置文件

vi /etc/nova/nova.conf

available_filters=nova.scheduler.filters.all_filters
enabled_filters=RetryFilter,AvailabilityZoneFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,PciPassthroughFilter

重启nova-scheduler服务

systemctl restart openstack-nova-scheduler.service

编辑neutron配置文件

vi /etc/neutron/plugins/ml2/ml2_conf.ini

mechanism_drivers = openvswitch,l2population,sriovnicswitch

编辑/etc/neutron/plugins/ml2/ml2_conf_sriov.ini配置文件【不存在则新建】

lspci -nn |grep net查看vendor and product id

vi /etc/neutron/plugins/ml2/ml2_conf_sriov.ini

[ml2_sriov]
supported_pci_vendor_devs = 8086:1520
agent_required = True

增加config-file

vi  /usr/lib/systemd/system/neutron-server.service

--config-file /etc/neutron/plugins/ml2/ml2_conf_sriov.ini
 

添加映射关系(相信大家使用flat网络和vlan网络的话,比较熟悉)

vi /etc/neutron/plugins/ml2/ml2_conf.ini

[ml2_type_vlan]
flat_networks = provider1,sriov1,sriov2

重启neutron服务

systemctl daemon-reload
systemctl restart neutron-server.service 

四、创建云主机

以上配置已完成,接下来我们进行网络创建,云主机使用此网络。

①创建网络flat_sriov192

neutron net-create flat_sriov192 --provider:network_type vlan --provider:physical_network sriov1  --provider:segmentation_id  192

②创建子网sriov_subnet192
neutron subnet-create flat_sriov192 --name sriov_subnet192 --allocation-pool start=192.85.1.1,end=192.85.1.253 --gateway 192.85.1.254 192.85.1.0/24 --disable-dhcp


③创建网络flat_sriov193

neutron net-create flat_sriov193 --provider:network_type vlan --provider:physical_network sriov2  --provider:segmentation_id 193

④创建子网sriov_subnet193
neutron subnet-create flat_sriov193 --name sriov_subnet193 --allocation-pool start=193.85.1.1,end=193.85.1.253 --gateway 193.85.1.254 193.85.1.0/24 --disable-dhcp

⑤创建port riov-192-1

neutron port-create  flat_sriov192  --name sriov-192-1 --binding:vnic-type direct

⑥创建port riov-193-1
neutron port-create  flat_sriov193  --name sriov-193-1 --binding:vnic-type direct 

⑦使用port启动云主机(可自行添加管理网络,便于管理)

nova boot  --flavor m1.mid \
  --image 3ae6ba6d-cf3e-49e2-9521-ad6e49f598a0 \
  --nic port-id=1245fgdf-a665-42b4-a046-264c07dbad43 \
  --nic port-id=0gfd44c9-d4bb-470c-b370-05b8197af463 \
  sriov-vm1

flavor:云主机类型名称

image:镜像id

port_id:步骤⑤⑥所创建port对应id

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值