Adding neutron support in openstack-compute

Adding neutron support. It is a search and replace of
quantum with neutron in all the files. Also, set 8.0.0
as the version in metadata.rb. The version was not bumped
when stable/grizzly was branched. Also, updated the
dependency cookbook versions in metadata.rb.

Change-Id: Ia53ffcb0a6fbf322784fb6409adc5386b3e7dd40
Implemented: blueprint neutron-support
This commit is contained in:
salmanbaset 2013-12-11 07:17:00 +08:00
parent 37621e56fc
commit 4b2ec7198a
12 changed files with 67 additions and 63 deletions

View File

@ -2,6 +2,9 @@
This file is used to list changes made in each version of cookbook-openstack-compute.
## 8.0.0
* Branch for Havana. Add neutron support by search/replace quantum with neutron
## 7.3.0
* Add new attributes: auto_assign_floating_ip, disk_allocation_ratio, allow_resize_to_same_host
and force_dhcp_release

View File

@ -276,6 +276,7 @@ License and Author
| **Author** | Ionut Artarisi (<iartarisi@suse.cz>) |
| **Author** | JieHua Jin (<jinjhua@cn.ibm.com>) |
| **Author** | David Geng (<gengjh@cn.ibm.com>) |
| **Author** | Salman Baset (<sabaset@us.ibm.com>) |
| | |
| **Copyright** | Copyright (c) 2012-2013, Rackspace US, Inc. |
| **Copyright** | Copyright (c) 2012-2013, Opscode, Inc. |

View File

@ -63,7 +63,7 @@ default["openstack"]["compute"]["region"] = "RegionOne"
default["openstack"]["compute"]["floating_cmd"] = "/usr/local/bin/add_floaters.py"
# Support multiple network types. Default network type is "nova"
# with the other option supported being "quantum"
# with the other option supported being "neutron"
default["openstack"]["compute"]["network"]["service_type"] = "nova"
# if the network type is not nova, we will load the following
@ -89,18 +89,18 @@ default["openstack"]["compute"]["mq"]["qpid"]["protocol"] = "tcp"
default["openstack"]["compute"]["mq"]["qpid"]["tcp_nodelay"] = true
# Quantum options
default["openstack"]["compute"]["network"]["quantum"]["network_api_class"] = "nova.network.quantumv2.api.API"
default["openstack"]["compute"]["network"]["quantum"]["auth_strategy"] = "keystone"
default["openstack"]["compute"]["network"]["quantum"]["admin_tenant_name"] = "service"
default["openstack"]["compute"]["network"]["quantum"]["admin_username"] = "quantum"
default["openstack"]["compute"]["network"]["quantum"]["libvirt_vif_driver"] = "nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"
default["openstack"]["compute"]["network"]["quantum"]["linuxnet_interface_driver"] = "nova.network.linux_net.LinuxOVSInterfaceDriver"
default["openstack"]["compute"]["network"]["quantum"]["security_group_api"] = "quantum"
default["openstack"]["compute"]["network"]["quantum"]["service_quantum_metadata_proxy"] = true
default["openstack"]["compute"]["network"]["quantum"]["metadata_secret_name"] = "quantum_metadata_shared_secret"
default["openstack"]["compute"]["network"]["quantum"]["public_network_name"] = "public"
default["openstack"]["compute"]["network"]["quantum"]["dns_server"] = "8.8.8.8"
# Neutron options
default["openstack"]["compute"]["network"]["neutron"]["network_api_class"] = "nova.network.neutronv2.api.API"
default["openstack"]["compute"]["network"]["neutron"]["auth_strategy"] = "keystone"
default["openstack"]["compute"]["network"]["neutron"]["admin_tenant_name"] = "service"
default["openstack"]["compute"]["network"]["neutron"]["admin_username"] = "neutron"
default["openstack"]["compute"]["network"]["neutron"]["libvirt_vif_driver"] = "nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"
default["openstack"]["compute"]["network"]["neutron"]["linuxnet_interface_driver"] = "nova.network.linux_net.LinuxOVSInterfaceDriver"
default["openstack"]["compute"]["network"]["neutron"]["security_group_api"] = "neutron"
default["openstack"]["compute"]["network"]["neutron"]["service_neutron_metadata_proxy"] = true
default["openstack"]["compute"]["network"]["neutron"]["metadata_secret_name"] = "neutron_metadata_shared_secret"
default["openstack"]["compute"]["network"]["neutron"]["public_network_name"] = "public"
default["openstack"]["compute"]["network"]["neutron"]["dns_server"] = "8.8.8.8"
# TODO(shep): This should probably be ["openstack"]["compute"]["network"]["fixed"]
default["openstack"]["compute"]["networks"] = [
@ -292,7 +292,7 @@ when "fedora", "redhat", "centos", "suse" # :pragma-foodcritic: ~FC024 - won't f
"api_os_compute_packages" => ["openstack-nova-api"],
"api_os_compute_service" => "openstack-nova-api",
"api_os_compute_process_name" => "nova-api",
"neutron_python_packages" => ["python-quantumclient", "pyparsing"],
"neutron_python_packages" => ["python-neutronclient", "pyparsing"],
"memcache_python_packages" => ["python-memcached"],
"compute_api_metadata_packages" => ["openstack-nova-api"],
"compute_api_metadata_process_name" => "nova-api",
@ -323,7 +323,7 @@ when "fedora", "redhat", "centos", "suse" # :pragma-foodcritic: ~FC024 - won't f
}
if platform == "suse"
default["openstack"]["compute"]["platform"]["dbus_service"] = "dbus"
default["openstack"]["compute"]["platform"]["neutron_python_packages"] = ["python-quantumclient", "python-pyparsing"]
default["openstack"]["compute"]["platform"]["neutron_python_packages"] = ["python-neutronclient", "python-pyparsing"]
default["openstack"]["compute"]["platform"]["common_packages"] = ["openstack-nova"]
default["openstack"]["compute"]["platform"]["kvm_packages"] = ["kvm"]
default["openstack"]["compute"]["platform"]["xen_packages"] = ["kernel-xen", "xen", "xen-tools"]
@ -341,7 +341,7 @@ when "ubuntu"
"api_os_compute_process_name" => "nova-api-os-compute",
"api_os_compute_service" => "nova-api-os-compute",
"memcache_python_packages" => ["python-memcache"],
"neutron_python_packages" => ["python-quantumclient", "python-pyparsing"],
"neutron_python_packages" => ["python-neutronclient", "python-pyparsing"],
"compute_api_metadata_packages" => ["nova-api-metadata"],
"compute_api_metadata_service" => "nova-api-metadata",
"compute_api_metadata_process_name" => "nova-api-metadata",

View File

@ -21,7 +21,7 @@ import subprocess
import netaddr
DESCRIPTION = "A `nova-manage floating create` and `quantum net create` wrapper."
DESCRIPTION = "A `nova-manage floating create` and `neutron net create` wrapper."
class FloatingAddress(object):
@ -31,7 +31,7 @@ class FloatingAddress(object):
network, nova-manage doesn't account for this.
TODO(retr0h): This should really be added to nova-manage.
TODO(jaypipes): Instead of subprocess calls, just use the quantumclient
TODO(jaypipes): Instead of subprocess calls, just use the neutronclient
"""
def __init__(self, args):
@ -72,18 +72,18 @@ class FloatingAddress(object):
cidr = netaddr.IPNetwork(cidr)
# ensure we have a public network and we only ever create one
cmd = "NETLIST=$(quantum net-list -c name); if [ $? -eq 0 ]; then if ! echo $NETLIST | grep -q %s; then quantum net-create %s -- --router:external=True; fi; fi;" % (self._args.pool, self._args.pool)
cmd = "NETLIST=$(neutron net-list -c name); if [ $? -eq 0 ]; then if ! echo $NETLIST | grep -q %s; then neutron net-create %s -- --router:external=True; fi; fi;" % (self._args.pool, self._args.pool)
try:
subprocess.check_call(cmd, shell=True)
except:
# we failed to query the quanutm api, we'll ignore this error
# and return now so any surrounding chef runs can continue
# since this script may actually be running on the quantum api
print "ERROR: Failed to query the quantum api for the public network"
# since this script may actually be running on the neutron api
print "ERROR: Failed to query the neutron api for the public network"
return
cmd = "quantum subnet-list -Fcidr -fcsv --quote=none | grep '%s'" % cidr
cmd = "neutron subnet-list -Fcidr -fcsv --quote=none | grep '%s'" % cidr
res = subprocess.call(cmd, shell=True)
if res == 0:
@ -95,7 +95,7 @@ class FloatingAddress(object):
ip_end = netaddr.IPAddress(cidr.last-1)
# create a new subnet
cmd = "quantum subnet-create --allocation-pool start=%s,end=%s %s %s -- --enable_dhcp=False" % \
cmd = "neutron subnet-create --allocation-pool start=%s,end=%s %s %s -- --enable_dhcp=False" % \
(ip_start, ip_end, self._args.pool, cidr)
subprocess.check_call(cmd, shell=True)

View File

@ -4,7 +4,7 @@ maintainer_email "matt@opscode.com"
license "Apache 2.0"
description "The OpenStack Compute service Nova."
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "7.3.0"
version "8.0.0"
recipe "openstack-compute::api-ec2", "Installs AWS EC2 compatible API"
recipe "openstack-compute::api-metadata", "Installs the nova metadata package"
@ -24,10 +24,10 @@ recipe "openstack-compute::vncproxy", "Installs and configures the vncproxy serv
supports os
end
depends "openstack-common", "~> 0.4.0"
depends "openstack-identity", "~> 7.0"
depends "openstack-image", "~> 7.0"
depends "openstack-network", "~> 7.0"
depends "openstack-common", "~> 8.0"
depends "openstack-identity", "~> 8.0"
depends "openstack-image", "~> 8.0"
depends "openstack-network", "~> 8.0"
depends "selinux"
depends "yum"
depends "python"

View File

@ -23,7 +23,7 @@ include_recipe "openstack-compute::nova-common"
platform_options = node["openstack"]["compute"]["platform"]
# the only type of network we process here is nova, otherwise for
# quantum, the network will be setup by the inclusion of
# neutron, the network will be setup by the inclusion of
# openstack-network recipes
if node["openstack"]["compute"]["network"]["service_type"] == "nova"

View File

@ -116,12 +116,12 @@ vnc_bind_ip = address_for node["openstack"]["compute"]["libvirt"]["bind_interfac
xvpvnc_proxy_ip = address_for node["openstack"]["compute"]["xvpvnc_proxy"]["bind_interface"]
novnc_proxy_ip = address_for node["openstack"]["compute"]["novnc_proxy"]["bind_interface"]
if node["openstack"]["compute"]["network"]["service_type"] == "quantum"
quantum_admin_password = service_password "openstack-network"
quantum_metadata_proxy_shared_secret = secret "secrets", "quantum_metadata_secret"
if node["openstack"]["compute"]["network"]["service_type"] == "neutron"
neutron_admin_password = service_password "openstack-network"
neutron_metadata_proxy_shared_secret = secret "secrets", "neutron_metadata_secret"
else
quantum_admin_password = nil
quantum_metadata_proxy_shared_secret = nil
neutron_admin_password = nil
neutron_metadata_proxy_shared_secret = nil
end
template "/etc/nova/nova.conf" do
@ -149,8 +149,8 @@ template "/etc/nova/nova.conf" do
:scheduler_default_filters => node["openstack"]["compute"]["scheduler"]["default_filters"].join(","),
:osapi_compute_link_prefix => compute_api_endpoint.to_s,
:network_endpoint => network_endpoint,
:quantum_admin_password => quantum_admin_password,
:quantum_metadata_proxy_shared_secret => quantum_metadata_proxy_shared_secret
:neutron_admin_password => neutron_admin_password,
:neutron_metadata_proxy_shared_secret => neutron_metadata_proxy_shared_secret
)
end

View File

@ -101,7 +101,7 @@ when "nova"
end
end
when "quantum", "neutron"
when "neutron"
platform_options = node["openstack"]["compute"]["platform"]
@ -123,9 +123,9 @@ when "quantum", "neutron"
if floating && floating["ipv4_cidr"]
cmd = ". /root/openrc && #{node["openstack"]["compute"]["floating_cmd"]} neutron --cidr=#{floating["ipv4_cidr"]} --pool=#{floating["public_network_name"]}"
execute "quantum floating create" do
execute "neutron floating create" do
command cmd
not_if ". /root/openrc && quantum floatingip-list |grep -E '.*([0-9]{1,3}[\.]){3}[0-9]{1,3}*'"
not_if ". /root/openrc && neutron floatingip-list |grep -E '.*([0-9]{1,3}[\.]){3}[0-9]{1,3}*'"
only_if { File.exists?("/root/openrc") }
action :run

View File

@ -21,10 +21,10 @@ describe "openstack-compute::network" do
expect(@chef_run).to set_service_to_start_on_boot "nova-network"
end
it "includes openstack-network recipes for quantum when service type is quantum" do
it "includes openstack-network recipes for neutron when service type is neutron" do
@chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
@node = @chef_run.node
@node.set["openstack"]["compute"]["network"]["service_type"] = "quantum"
@node.set["openstack"]["compute"]["network"]["service_type"] = "neutron"
@chef_run.converge "openstack-compute::network"
expect(@chef_run).to include_recipe "openstack-network::openvswitch"
end

View File

@ -27,10 +27,10 @@ describe "openstack-compute::nova-common" do
expect(chef_run).not_to include_recipe "openstack-common::logging"
end
it "can converge with quantum service type" do
it "can converge with neutron service type" do
chef_run = ::ChefSpec::ChefRunner.new ::UBUNTU_OPTS
node = chef_run.node
node.set["openstack"]["compute"]["network"]["service_type"] = "quantum"
node.set["openstack"]["compute"]["network"]["service_type"] = "neutron"
chef_run.converge "openstack-compute::nova-common"
end
@ -174,10 +174,10 @@ describe "openstack-compute::nova-common" do
end
end
describe "quantum network" do
describe "neutron network" do
before do
@file = @chef_run.template "/etc/nova/nova.conf"
@chef_run.node.set['openstack']['compute']['network']['service_type'] = "quantum"
@chef_run.node.set['openstack']['compute']['network']['service_type'] = "neutron"
end
it "has no auto_assign_floating_ip" do

View File

@ -39,7 +39,7 @@ def compute_stubs
with("secrets", "openstack_identity_bootstrap_token").
and_return "bootstrap-token"
::Chef::Recipe.any_instance.stub(:secret).
with("secrets", "quantum_metadata_secret").
with("secrets", "neutron_metadata_secret").
and_return "metadata-secret"
::Chef::Recipe.any_instance.stub(:db_password).and_return String.new
::Chef::Recipe.any_instance.stub(:user_password).and_return String.new
@ -52,7 +52,7 @@ def compute_stubs
::Chef::Recipe.any_instance.stub(:service_password).with("openstack-compute").
and_return "nova-pass"
::Chef::Recipe.any_instance.stub(:service_password).with("openstack-network").
and_return "quantum-pass"
and_return "neutron-pass"
::Chef::Recipe.any_instance.stub(:memcached_servers).and_return []
::Chef::Recipe.any_instance.stub(:system).
with("grub2-set-default 'openSUSE GNU/Linux, with Xen hypervisor'").

View File

@ -71,30 +71,30 @@ storage_availability_zone=<%= node["openstack"]["compute"]["config"]["storage_av
<% case node["openstack"]["compute"]["network"]["service_type"]
when "quantum" -%>
when "neutron" -%>
# N.B. due to https://bugs.launchpad.net/nova/+bug/1206330
# we override the endpoint scheme below, ignore the port
# and essentially force http
<% if @network_endpoint.port == 443 -%>
quantum_url=http://<%= @network_endpoint.host %>:80
neutron_url=http://<%= @network_endpoint.host %>:80
<% else -%>
quantum_url=http://<%= @network_endpoint.host %>:<%= @network_endpoint.port %>
neutron_url=http://<%= @network_endpoint.host %>:<%= @network_endpoint.port %>
<% end -%>
network_api_class=<%= node["openstack"]["compute"]["network"]["quantum"]["network_api_class"] %>
quantum_auth_strategy=<%= node["openstack"]["compute"]["network"]["quantum"]["auth_strategy"] %>
quantum_admin_tenant_name=<%= node["openstack"]["compute"]["network"]["quantum"]["admin_tenant_name"] %>
quantum_admin_username=<%= node["openstack"]["compute"]["network"]["quantum"]["admin_username"] %>
quantum_admin_password=<%= @quantum_admin_password %>
quantum_admin_auth_url=<%= @identity_endpoint.to_s %>
libvirt_vif_driver=<%= node["openstack"]["compute"]["network"]["quantum"]["libvirt_vif_driver"] %>
linuxnet_interface_driver=<%= node["openstack"]["compute"]["network"]["quantum"]["linuxnet_interface_driver"] %>
network_api_class=<%= node["openstack"]["compute"]["network"]["neutron"]["network_api_class"] %>
neutron_auth_strategy=<%= node["openstack"]["compute"]["network"]["neutron"]["auth_strategy"] %>
neutron_admin_tenant_name=<%= node["openstack"]["compute"]["network"]["neutron"]["admin_tenant_name"] %>
neutron_admin_username=<%= node["openstack"]["compute"]["network"]["neutron"]["admin_username"] %>
neutron_admin_password=<%= @neutron_admin_password %>
neutron_admin_auth_url=<%= @identity_endpoint.to_s %>
libvirt_vif_driver=<%= node["openstack"]["compute"]["network"]["neutron"]["libvirt_vif_driver"] %>
linuxnet_interface_driver=<%= node["openstack"]["compute"]["network"]["neutron"]["linuxnet_interface_driver"] %>
firewall_driver = nova.virt.firewall.NoopFirewallDriver
security_group_api=<%= node["openstack"]["compute"]["network"]["quantum"]["security_group_api"] %>
service_quantum_metadata_proxy=<%= node["openstack"]["compute"]["network"]["quantum"]["service_quantum_metadata_proxy"] %>
quantum_metadata_proxy_shared_secret=<%= @quantum_metadata_proxy_shared_secret %>
default_floating_pool=<%= node["openstack"]["compute"]["network"]["quantum"]["public_network_name"] %>
dns_server=<%= node["openstack"]["compute"]["network"]["quantum"]["dns_server"] %>
security_group_api=<%= node["openstack"]["compute"]["network"]["neutron"]["security_group_api"] %>
service_neutron_metadata_proxy=<%= node["openstack"]["compute"]["network"]["neutron"]["service_neutron_metadata_proxy"] %>
neutron_metadata_proxy_shared_secret=<%= @neutron_metadata_proxy_shared_secret %>
default_floating_pool=<%= node["openstack"]["compute"]["network"]["neutron"]["public_network_name"] %>
dns_server=<%= node["openstack"]["compute"]["network"]["neutron"]["dns_server"] %>
<% when "nova" -%>
multi_host=<%= node["openstack"]["compute"]["network"]["multi_host"] %>