Only setup iptables for metadata if using nova-net

As discussed in the bug report, we setup iptables rules for the metadata
service even if we're using neutron (which routes to metadata in a
different way). This is because of the split-brain behaviour of the
network driver interface versus the network API interface.

Instead, only setup iptables if we are _not_ using neutron.

Change-Id: I43df9200aba1018d2c7cd2f118864326af15fd42
Closes-Bug: #1687187
(cherry picked from commit b7cb3b7523)
This commit is contained in:
Michael Still 2017-07-04 18:19:44 +10:00 committed by Sam Yaple
parent 720611893b
commit 16505d8e6e
1 changed files with 8 additions and 2 deletions

View File

@ -16,6 +16,7 @@
from nova import manager
from nova.network import driver
from nova import utils
class MetadataManager(manager.Manager):
@ -26,5 +27,10 @@ class MetadataManager(manager.Manager):
"""
def __init__(self, *args, **kwargs):
super(MetadataManager, self).__init__(*args, **kwargs)
self.network_driver = driver.load_network_driver()
self.network_driver.metadata_accept()
if not utils.is_neutron():
# NOTE(mikal): we only add iptables rules if we're running
# under nova-network. This code should go away when the
# deprecation of nova-network is complete.
self.network_driver = driver.load_network_driver()
self.network_driver.metadata_accept()