]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
sriov: update port state even if ip link fails
authorRoman Bogorodskiy <rbogorodskiy@mirantis.com>
Wed, 24 Jun 2015 12:40:35 +0000 (14:40 +0200)
committerRoman Bogorodskiy <rbogorodskiy@mirantis.com>
Thu, 3 Sep 2015 17:35:41 +0000 (19:35 +0200)
commit9c466f4d0effa4686ca6744d7b9d015857830cb7
tree8f11312b550690bb9ef949018761f9778bab623b
parent3ce9473bab1c054aa027ca9f84e8a2586e297958
sriov: update port state even if ip link fails

Some SRIOV drivers/devices don't support link state setting,
meaning that 'ip link' fails like this when trying to set state:

 # ip l set dev p2p1 vf 6 state disable
 RTNETLINK answers: Operation not supported

The sriov-nic-agent tries to do that in
SriovNicSwitchAgent.treat_device() and fails because of non-zero
exit status from 'ip link' and, therefore, doesn't reach the code
that updates the actual port status, so port could hang in a BUILD
state even if binding was successful.

This patch fixes problem of nova not being able to successfully bind
or cleanup such a port. It does not fix a case when user manually
updates admin_state_up for a port via API, it's subject to a separate
fix.

Also, replace LOG.exception with LOG.warning for set_device_state()
as the exception would be logged by PciDeviceIPWrapper.set_vf_state()
anyway.

Closes-bug: #1468332
Change-Id: Ifa7c128d369ced60b5986aa0ed92527868f7efab
neutron/plugins/ml2/drivers/mech_sriov/agent/common/exceptions.py
neutron/plugins/ml2/drivers/mech_sriov/agent/pci_lib.py
neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py
neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_pci_lib.py
neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_sriov_nic_agent.py