diff options
author | Zuul <zuul@review.openstack.org> | 2019-03-26 06:42:50 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2019-03-26 06:42:51 +0000 |
commit | 6efe7b979b2ae6e6abfc1584ae49fc46b1eaea20 (patch) | |
tree | 828853031ecc41c3edc15573bcc6b2f833a4af2f | |
parent | b3ebbb3ff5ef6d4ab79e571386947c15f3c7a646 (diff) | |
parent | d6491167a4249bd6d57b8ba3597c021332ee7420 (diff) | |
download | nova-6efe7b979b2ae6e6abfc1584ae49fc46b1eaea20.tar.gz |
Merge "Handle binding_failed vif plug errors on compute restart" into stable/ocata
-rw-r--r-- | nova/compute/manager.py | 12 | ||||
-rw-r--r-- | nova/network/os_vif_util.py | 14 | ||||
-rw-r--r-- | nova/tests/unit/network/test_os_vif_util.py | 18 |
3 files changed, 39 insertions, 5 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index bf1def3b9d..ed1a337170 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -954,8 +954,16 @@ class ComputeManager(manager.Manager): except NotImplementedError as e: LOG.debug(e, instance=instance) except exception.VirtualInterfacePlugException: - # we don't want an exception to block the init_host - LOG.exception(_LE("Vifs plug failed"), instance=instance) + # NOTE(mriedem): If we get here, it could be because the vif_type + # in the cache is "binding_failed". The only way to fix that is to + # try and bind the ports again, which would be expensive here on + # host startup. We could add a check to _heal_instance_info_cache + # to handle this, but probably only if the instance task_state is + # None. + LOG.exception(_LE( + 'Virtual interface plugging failed for instance. ' + 'The port binding:host_id may need to be manually ' + 'updated.'), instance=instance) self._set_instance_obj_error_state(context, instance) return diff --git a/nova/network/os_vif_util.py b/nova/network/os_vif_util.py index bc75fbe231..2b0e536a2f 100644 --- a/nova/network/os_vif_util.py +++ b/nova/network/os_vif_util.py @@ -397,6 +397,20 @@ def _nova_to_osvif_vif_hostdev_physical(vif): raise NotImplementedError() +# VIF_TYPE_BINDING_FAILED = 'binding_failed' +def _nova_to_osvif_vif_binding_failed(vif): + """Special handler for the "binding_failed" vif type. + + The "binding_failed" vif type indicates port binding to a host failed + and we are trying to plug the vifs again, which will fail because we + do not know the actual real vif type, like ovs, bridge, etc. We raise + NotImplementedError to indicate to the caller that we cannot handle + this type of vif rather than the generic "Unsupported VIF type" error + in nova_to_osvif_vif. + """ + raise NotImplementedError() + + def nova_to_osvif_vif(vif): """Convert a Nova VIF model to an os-vif object diff --git a/nova/tests/unit/network/test_os_vif_util.py b/nova/tests/unit/network/test_os_vif_util.py index d426e7e25e..2abef4a267 100644 --- a/nova/tests/unit/network/test_os_vif_util.py +++ b/nova/tests/unit/network/test_os_vif_util.py @@ -13,6 +13,7 @@ # under the License. from os_vif import objects as osv_objects +import six from nova import exception from nova.network import model @@ -813,6 +814,17 @@ class OSVIFUtilTestCase(test.NoDBTestCase): subnets=[]), ) - self.assertRaises(exception.NovaException, - os_vif_util.nova_to_osvif_vif, - vif) + ex = self.assertRaises(exception.NovaException, + os_vif_util.nova_to_osvif_vif, vif) + self.assertIn('Unsupported VIF type wibble', six.text_type(ex)) + + def test_nova_to_osvif_vif_binding_failed(self): + vif = model.VIF( + id="dc065497-3c8d-4f44-8fb4-e1d33c16a536", + type="binding_failed", + address="22:52:25:62:e2:aa", + network=model.Network( + id="b82c1929-051e-481d-8110-4669916c7915", + label="Demo Net", + subnets=[]),) + self.assertIsNone(os_vif_util.nova_to_osvif_vif(vif)) |