Move metadata_interface to df_metadata config group

Before the configuration options are refactored in df, config options
will only be registered when app is loaded. And metadata_interface
needs to be used in a common file(ovsdb/impl_idl.py), so the config
option is moved to common config group.

With the configuration options refactor, this config option can be
moved back to the metadata specific group.

Change-Id: I7662f9491d4e010226b3c95bac50c11976e59fcf
This commit is contained in:
Hong Hui Xiao 2017-05-01 19:31:47 +08:00 committed by Li Ma
parent 0dd3f1c666
commit 6d22ca73f8
7 changed files with 14 additions and 14 deletions

View File

@ -145,7 +145,7 @@ function configure_df_metadata_service {
iniset $NEUTRON_CONF DEFAULT metadata_proxy_shared_secret $METADATA_PROXY_SHARED_SECRET
iniset $DRAGONFLOW_CONF df_metadata ip "$DF_METADATA_SERVICE_IP"
iniset $DRAGONFLOW_CONF df_metadata port "$DF_METADATA_SERVICE_PORT"
iniset $DRAGONFLOW_CONF df metadata_interface "$DF_METADATA_SERVICE_INTERFACE"
iniset $DRAGONFLOW_CONF df_metadata metadata_interface "$DF_METADATA_SERVICE_INTERFACE"
fi
}

View File

@ -31,7 +31,7 @@ METADATA_ROUTE_TABLE_ID = '2'
def environment_setup():
bridge = cfg.CONF.df.integration_bridge
interface = cfg.CONF.df.metadata_interface
interface = cfg.CONF.df_metadata.metadata_interface
if ip_lib.device_exists(interface):
LOG.info("Device %s already exists", interface)
# Destroy the environment when the device exists.
@ -59,7 +59,7 @@ def environment_setup():
def environment_destroy():
bridge = cfg.CONF.df.integration_bridge
interface = cfg.CONF.df.metadata_interface
interface = cfg.CONF.df_metadata.metadata_interface
cmd = ["ovs-vsctl", "del-port", bridge, interface]
utils.execute(cmd, run_as_root=True, check_exit_code=[0])

View File

@ -157,11 +157,6 @@ df_opts = [
default="/var/run/openvswitch",
help=_("The directory in which vhost virtio socket"
"is created by all the vswitch daemons")),
cfg.StrOpt(
'metadata_interface',
default='tap-metadata',
help=_('The name of the interface to bind the metadata'
'service proxy')),
cfg.IntOpt('neutron_listener_report_interval',
default=25,
help=_('Neutron report heart beat every this number in seconds'

View File

@ -30,6 +30,11 @@ df_metadata_opts = [
default='18080',
help=_('The port to which the DF metadata service proxy is bound'),
),
cfg.StrOpt(
'metadata_interface',
default='tap-metadata',
help=_('The name of the interface to bind the metadata'
'service proxy'))
]

View File

@ -57,7 +57,7 @@ class MetadataServiceApp(df_base_app.DFlowApp):
self._interface_mac = ""
self._ip = cfg.CONF.df_metadata.ip
self._port = cfg.CONF.df_metadata.port
self._interface = cfg.CONF.df.metadata_interface
self._interface = cfg.CONF.df_metadata.metadata_interface
def switch_features_handler(self, ev):
if self._interface_mac and self._ofport and self._ofport > 0:
@ -66,7 +66,7 @@ class MetadataServiceApp(df_base_app.DFlowApp):
self._add_tap_metadata_port(self._ofport, self._interface_mac)
def ovs_port_updated(self, ovs_port):
if ovs_port.get_name() != cfg.CONF.df.metadata_interface:
if ovs_port.get_name() != cfg.CONF.df_metadata.metadata_interface:
return
ofport = ovs_port.get_ofport()
@ -85,7 +85,7 @@ class MetadataServiceApp(df_base_app.DFlowApp):
self._interface_mac = mac
def ovs_port_deleted(self, ovs_port):
if ovs_port.get_name() != cfg.CONF.df.metadata_interface:
if ovs_port.get_name() != cfg.CONF.df_metadata.metadata_interface:
return
self._remove_metadata_interface_flows()

View File

@ -76,7 +76,7 @@ class DFIdl(idl.Idl):
constants.OVS_BRIDGE_INTERFACE)
def _is_handle_interface_update(self, interface):
if interface.name == cfg.CONF.df.metadata_interface:
if interface.name == cfg.CONF.df_metadata.metadata_interface:
return True
if interface.type not in self.interface_type:
return False

View File

@ -30,7 +30,7 @@ class TestMetadataService(test_base.DFTestBase):
df_metadata_service_conf.register_opts()
# Override defaults to avoid collision with existing metadata service
cfg.CONF.df_metadata.ip = '1.1.1.1'
cfg.CONF.df.metadata_interface = 'tap-md-test'
cfg.CONF.df_metadata.metadata_interface = 'tap-md-test'
df_metadata_service.METADATA_ROUTE_TABLE_ID = '3'
self.metadata_ip = cfg.CONF.df_metadata.ip
self.isTornDown = False
@ -51,7 +51,7 @@ class TestMetadataService(test_base.DFTestBase):
def tearDown(self):
if not self.isTornDown:
bridge = cfg.CONF.df.integration_bridge
interface = cfg.CONF.df.metadata_interface
interface = cfg.CONF.df_metadata.metadata_interface
cmd = ["ovs-vsctl", "del-port", bridge, interface]
try:
utils.execute(cmd, run_as_root=True, check_exit_code=[0])