Merge "make quantum plugin configurable on SUSE"
This commit is contained in:
@@ -110,6 +110,11 @@ default["openstack"]["network"]["interface_driver_map"] = {
|
||||
'bridgeinterfacedriver' => 'linuxbridge'
|
||||
}
|
||||
|
||||
default["openstack"]["network"]["plugin_conf_map"] = {
|
||||
'ovsinterfacedriver' => 'openvswitch/ovs_quantum_plugin.ini',
|
||||
'bridgeinterfacedriver' => 'linuxbridge/linuxbridge_conf.ini'
|
||||
}
|
||||
|
||||
# The agent can use other DHCP drivers. Dnsmasq is the simplest and requires
|
||||
# no additional setup of the DHCP server.
|
||||
default["openstack"]["network"]["dhcp_driver"] = 'quantum.agent.linux.dhcp.Dnsmasq'
|
||||
|
||||
@@ -48,6 +48,12 @@ platform_options["quantum_openvswitch_packages"].each do |pkg|
|
||||
end
|
||||
end
|
||||
|
||||
service "quantum-server" do
|
||||
service_name node["openstack"]["network"]["platform"]["quantum_server_service"]
|
||||
supports :status => true, :restart => true
|
||||
action :nothing
|
||||
end
|
||||
|
||||
service "quantum-openvswitch-switch" do
|
||||
service_name platform_options["quantum_openvswitch_service"]
|
||||
supports :status => true, :restart => true
|
||||
|
||||
@@ -70,3 +70,17 @@ if node["openstack"]["network"]["quantum_ha_cmd_cron"]
|
||||
command "sleep #{sleep_time} ; . /root/openrc && #{node["openstack"]["network"]["quantum_ha_cmd"]} --replicate-dhcp > /dev/null 2>&1"
|
||||
end
|
||||
end
|
||||
|
||||
# the default SUSE initfile uses this sysconfig file to determine the
|
||||
# quantum plugin to use
|
||||
template "/etc/sysconfig/quantum" do
|
||||
only_if { platform? "suse" }
|
||||
source "quantum.sysconfig.erb"
|
||||
owner "root"
|
||||
group "root"
|
||||
mode 00644
|
||||
variables(
|
||||
:plugin_conf => node["openstack"]["network"]["plugin_conf_map"][driver_name]
|
||||
)
|
||||
notifies :restart, "service[quantum-server]"
|
||||
end
|
||||
|
||||
@@ -28,5 +28,36 @@ describe 'openstack-network::server' do
|
||||
|
||||
expect(chef_run).not_to install_package "openstack-quantum-openvswitch"
|
||||
end
|
||||
|
||||
describe "/etc/sysconfig/quantum" do
|
||||
before do
|
||||
@file = @chef_run.template("/etc/sysconfig/quantum")
|
||||
end
|
||||
|
||||
it "has proper owner" do
|
||||
expect(@file).to be_owned_by "root", "root"
|
||||
end
|
||||
|
||||
it "has proper modes" do
|
||||
expect(sprintf("%o", @file.mode)).to eq "644"
|
||||
end
|
||||
|
||||
it "has the correct plugin config location - ovs by default" do
|
||||
expect(@chef_run).to create_file_with_content(
|
||||
@file.name, "/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini")
|
||||
end
|
||||
|
||||
it "uses linuxbridge when configured to use it" do
|
||||
chef_run = ::ChefSpec::ChefRunner.new ::OPENSUSE_OPTS do |n|
|
||||
n.set["openstack"]["network"]["interface_driver"] = "quantum.agent.linux.interface.BridgeInterfaceDriver"
|
||||
end
|
||||
chef_run.converge "openstack-network::server"
|
||||
|
||||
expect(chef_run).to create_file_with_content(
|
||||
"/etc/sysconfig/quantum",
|
||||
"/etc/quantum/plugins/linuxbridge/linuxbridge_conf.ini"
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -196,5 +196,13 @@ describe 'openstack-network::server' do
|
||||
@file.name, "/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini")
|
||||
end
|
||||
end
|
||||
|
||||
it "does not install sysconfig template" do
|
||||
chef_run = ::ChefSpec::ChefRunner.new(
|
||||
::UBUNTU_OPTS.merge(:evaluate_guards => true))
|
||||
chef_run.stub_command(/python/, true)
|
||||
chef_run.converge "openstack-network::server"
|
||||
expect(chef_run).not_to create_file "/etc/sysconfig/quantum"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
5
templates/default/quantum.sysconfig.erb
Normal file
5
templates/default/quantum.sysconfig.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
## Type: string
|
||||
#
|
||||
# location of the plugin configuration file
|
||||
|
||||
QUANTUM_PLUGIN_CONF="/etc/quantum/plugins/<%= @plugin_conf %>"
|
||||
Reference in New Issue
Block a user