Merge "Nova and quantum configurations fixed. L3 and DHCP agents were added."

This commit is contained in:
Jenkins 2013-06-30 19:54:30 +00:00 committed by Gerrit Code Review
commit 000e41205b
13 changed files with 185 additions and 25 deletions

View File

@ -245,10 +245,10 @@ class NovaConfigurator(base.Configurator):
nova_conf.add("network_api_class", "nova.network.quantumv2.api.API")
nova_conf.add("quantum_admin_username", params['service_user'])
nova_conf.add("quantum_admin_password", params['service_password'])
nova_conf.add("quantum_admin_auth_url", params['endpoints']['public']['uri'])
nova_conf.add("quantum_admin_auth_url", params['endpoints']['admin']['uri'])
nova_conf.add("quantum_auth_strategy", "keystone")
nova_conf.add("quantum_admin_tenant_name", params['service_tenant'])
nova_conf.add("quantum_url", params['quantum']['endpoints']['uri'])
nova_conf.add("quantum_url", params['quantum']['endpoints']['admin']['uri'])
libvirt_vif_drivers = {
"linuxbridge": "nova.virt.libvirt.vif.QuantumLinuxBridgeVIFDriver",
"openvswitch": "nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver",

View File

@ -18,6 +18,8 @@ from anvil import shell as sh
from anvil import importer
from anvil.components.configurators import base
from anvil.components.configurators.quantum_plugins import l3
from anvil.components.configurators.quantum_plugins import dhcp
# Special generated conf
@ -37,18 +39,27 @@ class QuantumConfigurator(base.Configurator):
def __init__(self, installer):
super(QuantumConfigurator, self).__init__(installer, CONFIGS)
self.core_plugin = installer.get_option("core_plugin")
self.plugin_configurator = importer.import_entry_point(
"anvil.components.configurators.quantum_plugins.%s:%sConfigurator" %
(self.core_plugin, self.core_plugin.title()))(installer)
self.plugin_configurators = {
'core_plugin': importer.import_entry_point(
"anvil.components.configurators.quantum_plugins.%s:%sConfigurator" %
(self.core_plugin, self.core_plugin.title()))(installer),
'l3': l3.L3Configurator(installer),
'dhcp': dhcp.DhcpConfigurator(installer),
}
self.config_adjusters = {
PASTE_CONF: self._config_adjust_paste,
API_CONF: self._config_adjust_api,
}
self.config_adjusters.update(self.plugin_configurator.config_adjusters)
for plugin_configurator in self.plugin_configurators.values():
self.config_adjusters.update(plugin_configurator.config_adjusters)
@property
def config_files(self):
return list(CONFIGS) + self.plugin_configurator.config_files
config_files = list(CONFIGS)
for plugin_configurator in self.plugin_configurators.values():
config_files.extend(plugin_configurator.config_files)
return config_files
def source_config(self, config_fn):
if (config_fn.startswith("plugins") or
@ -65,7 +76,7 @@ class QuantumConfigurator(base.Configurator):
config.add(k, v)
def _config_adjust_api(self, config):
config.add("core_plugin", self.plugin_configurator.PLUGIN_CLASS)
config.add("core_plugin", self.plugin_configurators['core_plugin'].PLUGIN_CLASS)
config.add('auth_strategy', 'keystone')
config.add("api_paste_config", self.target_config(PASTE_CONF))
# TODO(aababilov): add debug to other services conf files
@ -97,8 +108,12 @@ class QuantumConfigurator(base.Configurator):
"auth_port": params["endpoints"]["admin"]["port"],
"auth_protocol": params["endpoints"]["admin"]["protocol"],
# This uses the public uri not the admin one...
"auth_uri": params["endpoints"]["public"]["uri"],
"auth_uri": params["endpoints"]["admin"]["uri"],
"admin_tenant_name": params["service_tenant"],
"admin_user": params["service_user"],
"admin_password": params["service_password"],
}
@property
def get_path_to_core_plugin_config(self):
return self.plugin_configurators['core_plugin'].get_plugin_config_file_path

View File

@ -25,14 +25,26 @@ class Configurator(base.Configurator):
PLUGIN_CLASS = "quantum.plugins.UNKNOWN"
def __init__(self, installer, configs, adjusters):
self.core_plugin = installer.get_option("core_plugin")
super(Configurator, self).__init__(
installer,
["plugins/%s/%s" % (self.core_plugin, name) for name in configs])
self.config_adjusters = dict(
("plugins/%s/%s" % (self.core_plugin, key), value)
for key, value in adjusters.iteritems())
installer, configs)
self.config_adjusters = adjusters
@property
def config_files(self):
return list(self.configs)
@property
def get_plugin_config_file_path(self):
return ""
class CorePluginConfigurator(Configurator):
def __init__(self, installer, configs, adjusters):
self.core_plugin = installer.get_option("core_plugin")
super(CorePluginConfigurator, self).__init__(
installer,
["plugins/%s/%s" % (self.core_plugin, name) for name in configs],
dict(
("plugins/%s/%s" % (self.core_plugin, key), value)
for key, value in adjusters.iteritems()))

View File

@ -0,0 +1,51 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from anvil.components.configurators import quantum_plugins
# Special generated conf
PLUGIN_CONF = "dhcp_agent.ini"
CONFIGS = [PLUGIN_CONF]
class DhcpConfigurator(quantum_plugins.Configurator):
def __init__(self, installer):
super(DhcpConfigurator, self).__init__(
installer, CONFIGS, {PLUGIN_CONF: self._config_adjust_plugin})
def _config_adjust_plugin(self, plugin_conf):
params = self.get_keystone_params('quantum')
plugin_conf.add("dhcp_agent_manager", "quantuquantum.agent.dhcp_agent.DhcpAgentWithStateReport")
plugin_conf.add("dhcp_driver", "quantum.agent.linux.dhcp.Dnsmasq")
plugin_conf.add("admin_password", params["service_password"])
plugin_conf.add("admin_user", params["service_user"])
plugin_conf.add("admin_tenant_name", params["service_tenant"])
plugin_conf.add("auth_url", params["endpoints"]["admin"]["uri"])
plugin_conf.add("root_helper", "sudo quantum-rootwrap /etc/quantum/rootwrap.conf")
plugin_conf.add("use_namespaces", "True")
plugin_conf.add("debug", "False")
plugin_conf.add("verbose", "True")
if self.installer.get_option("core_plugin") == 'openvswitch':
plugin_conf.add("interface_driver", "quantum.agent.linux.interface.OVSInterfaceDriver")
@property
def get_plugin_config_file_path(self):
return PLUGIN_CONF

View File

@ -0,0 +1,48 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from anvil.components.configurators import quantum_plugins
# Special generated conf
PLUGIN_CONF = "l3_agent.ini"
CONFIGS = [PLUGIN_CONF]
class L3Configurator(quantum_plugins.Configurator):
def __init__(self, installer):
super(L3Configurator, self).__init__(
installer, CONFIGS, {PLUGIN_CONF: self._config_adjust_plugin})
def _config_adjust_plugin(self, plugin_conf):
params = self.get_keystone_params('quantum')
plugin_conf.add("l3_agent_manager", "quantum.agent.l3_agent.L3NATAgentWithStateReport")
plugin_conf.add("external_network_bridge", "br-ex")
plugin_conf.add("admin_password", params["service_password"])
plugin_conf.add("admin_user", params["service_user"])
plugin_conf.add("admin_tenant_name", params["service_tenant"])
plugin_conf.add("auth_url", params["endpoints"]["admin"]["uri"])
plugin_conf.add("root_helper", "sudo quantum-rootwrap /etc/quantum/rootwrap.conf")
plugin_conf.add("use_namespaces", "False")
plugin_conf.add("debug", "False")
plugin_conf.add("verbose", "True")
if self.installer.get_option("core_plugin") == 'openvswitch':
plugin_conf.add("interface_driver", "quantum.agent.linux.interface.OVSInterfaceDriver")
@property
def get_plugin_config_file_path(self):
return PLUGIN_CONF

View File

@ -22,7 +22,7 @@ PLUGIN_CONF = "linuxbridge_conf.ini"
CONFIGS = [PLUGIN_CONF]
class LinuxbridgeConfigurator(quantum_plugins.Configurator):
class LinuxbridgeConfigurator(quantum_plugins.CorePluginConfigurator):
PLUGIN_CLASS = "quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2"

View File

@ -22,7 +22,7 @@ PLUGIN_CONF = "ovs_quantum_plugin.ini"
CONFIGS = [PLUGIN_CONF]
class OpenvswitchConfigurator(quantum_plugins.Configurator):
class OpenvswitchConfigurator(quantum_plugins.CorePluginConfigurator):
PLUGIN_CLASS = "quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2"

View File

@ -21,12 +21,15 @@ def get_shared_params(ip, api_host, api_port=9696, protocol='http', **kwargs):
mp = {}
mp['service_host'] = ip
# Uri's of the various quantum endpoints
# Uri's of the http/https endpoints
mp['endpoints'] = {
'uri': utils.make_url(protocol, api_host, api_port),
'port': api_port,
'host': api_host,
'protocol': protocol,
'admin': {
'uri': utils.make_url(protocol, api_host, api_port),
'port': api_port,
'host': api_host,
'protocol': protocol,
},
}
mp['endpoints']['internal'] = dict(mp['endpoints']['admin'])
mp['endpoints']['public'] = dict(mp['endpoints']['admin'])
return mp

View File

@ -407,9 +407,21 @@ class YumDependencyHandler(base.DependencyHandler):
if sh.isfile(target_filename):
continue
bin_name = utils.strip_prefix_suffix(script, "openstack-", ".init")
if bin_name == "quantum-server":
daemon_args = ("'--config-file=/etc/quantum/plugin.ini"
" --config-file=/etc/quantum/quantum.conf'")
elif bin_name == "quantum-l3-agent":
daemon_args = ("'--config-file=/etc/quantum/l3_agent.ini"
" --config-file=/etc/quantum/quantum.conf'")
elif bin_name == "quantum-dhcp-agent":
daemon_args = ("'--config-file=/etc/quantum/dhcp_agent.ini"
" --config-file=/etc/quantum/quantum.conf'")
else:
daemon_args = ""
params = {
"bin": bin_name,
"package": bin_name.split("-", 1)[0],
"daemon_args": daemon_args,
}
sh.write_file(target_filename,
utils.expand_template(common_init_content, params))

View File

@ -53,7 +53,8 @@ subsystems:
- xvpvncproxy
quantum:
- server
- linuxbridge-agent
- agent
- l3-agent
cinder:
- api
- scheduler

View File

@ -63,6 +63,7 @@ subsystems:
quantum:
- server
- agent
- l3-agent
cinder:
- api
- scheduler

View File

@ -9,7 +9,7 @@ endpoints:
internal_url: "$nova.endpoints.ec2_cloud.uri"
public_url: "$nova.endpoints.ec2_cloud.uri"
region: RegionOne
- service: network
- service: quantum
admin_url: "$quantum.endpoints.admin.uri"
internal_url: "$quantum.endpoints.internal.uri"
public_url: "$quantum.endpoints.public.uri"

View File

@ -0,0 +1,17 @@
#!/bin/bash
# This is a sample script to configure OpenVSwitch for
# development needs.
echo 'Startig openvswitch service'
sudo /etc/init.d/openvswitch start
echo "Creating internal bridge 'br-int'"
sudo ovs-vsctl add-br br-int
echo "Creating external bridge 'br-ex'"
sudo ovs-vsctl add-br br-ex
echo "Adding a network interface 'eth1'"
sudo ovs-vsctl add-port br-ex eth1