diff options
author | Zuul <zuul@review.openstack.org> | 2019-03-26 06:42:59 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2019-03-26 06:42:59 +0000 |
commit | 40b7a0f0ba939aedd1b4a38395dc084d10bed958 (patch) | |
tree | e075b0dd796b08d6087293bbc4a0b37fdd78282e | |
parent | 6efe7b979b2ae6e6abfc1584ae49fc46b1eaea20 (diff) | |
parent | e61b1d7d72470a95068470d67779e08ececdb2e5 (diff) | |
download | nova-40b7a0f0ba939aedd1b4a38395dc084d10bed958.tar.gz |
Merge "Handle unbound vif plug errors on compute restart" into stable/ocata
-rw-r--r-- | nova/compute/manager.py | 10 | ||||
-rw-r--r-- | nova/network/os_vif_util.py | 12 | ||||
-rw-r--r-- | nova/tests/unit/network/test_os_vif_util.py | 11 |
3 files changed, 28 insertions, 5 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index ed1a337170..bc7c9eade6 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -955,11 +955,11 @@ class ComputeManager(manager.Manager): LOG.debug(e, instance=instance) except exception.VirtualInterfacePlugException: # 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. + # in the cache is "binding_failed" or "unbound". The only way to + # fix this 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 ' diff --git a/nova/network/os_vif_util.py b/nova/network/os_vif_util.py index 2b0e536a2f..8f6c79247c 100644 --- a/nova/network/os_vif_util.py +++ b/nova/network/os_vif_util.py @@ -411,6 +411,18 @@ def _nova_to_osvif_vif_binding_failed(vif): raise NotImplementedError() +# VIF_TYPE_UNBOUND = 'unbound' +def _nova_to_osvif_vif_unbound(vif): + """Special handler for the "unbound" vif type. + + The "unbound" vif type indicates a port has not been hooked up to backend + network driver (OVS, linux bridge, ...). 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 2abef4a267..a2dc63a543 100644 --- a/nova/tests/unit/network/test_os_vif_util.py +++ b/nova/tests/unit/network/test_os_vif_util.py @@ -828,3 +828,14 @@ class OSVIFUtilTestCase(test.NoDBTestCase): label="Demo Net", subnets=[]),) self.assertIsNone(os_vif_util.nova_to_osvif_vif(vif)) + + def test_nova_to_osvif_vif_unbound(self): + vif = model.VIF( + id="dc065497-3c8d-4f44-8fb4-e1d33c16a536", + type="unbound", + 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)) |