From 7a02d715ce4f510a22b68160cf3b078db130039e Mon Sep 17 00:00:00 2001 From: Ryan O'Hara Date: Tue, 2 Apr 2013 20:31:09 -0500 Subject: [PATCH] Add Quantum support to Packstack This is the combined work of Terry Wilson and Ryan O'Hara. It has been squashed into a single commit for ease of review. Change-Id: Icf37555a30f9ba4a9c53f57f7cd3d5d311ffeb3b --- .gitmodules | 6 + packstack/plugins/mysql_001.py | 2 + packstack/plugins/nova_300.py | 20 +- packstack/plugins/prescript_000.py | 12 + packstack/plugins/puppet_950.py | 4 +- packstack/plugins/quantum_350.py | 364 ++++++++++++++++++ packstack/plugins/serverprep_901.py | 1 - packstack/puppet/modules/quantum | 1 + packstack/puppet/modules/vswitch | 1 + .../puppet/templates/keystone_quantum.pp | 7 + packstack/puppet/templates/mysql_quantum.pp | 4 + packstack/puppet/templates/nova_quantum.pp | 17 + packstack/puppet/templates/quantum.pp | 19 + packstack/puppet/templates/quantum_dhcp.pp | 4 + packstack/puppet/templates/quantum_l3.pp | 5 + .../puppet/templates/quantum_lb_agent.pp | 2 + .../puppet/templates/quantum_metadata.pp | 6 + .../puppet/templates/quantum_ovs_agent.pp | 2 + .../puppet/templates/quantum_ovs_bridge.pp | 4 + .../puppet/templates/quantum_ovs_plugin.pp | 5 + 20 files changed, 482 insertions(+), 4 deletions(-) create mode 100644 packstack/plugins/quantum_350.py create mode 160000 packstack/puppet/modules/quantum create mode 160000 packstack/puppet/modules/vswitch create mode 100644 packstack/puppet/templates/keystone_quantum.pp create mode 100644 packstack/puppet/templates/mysql_quantum.pp create mode 100644 packstack/puppet/templates/nova_quantum.pp create mode 100644 packstack/puppet/templates/quantum.pp create mode 100644 packstack/puppet/templates/quantum_dhcp.pp create mode 100644 packstack/puppet/templates/quantum_l3.pp create mode 100644 packstack/puppet/templates/quantum_lb_agent.pp create mode 100644 packstack/puppet/templates/quantum_metadata.pp create mode 100644 packstack/puppet/templates/quantum_ovs_agent.pp create mode 100644 packstack/puppet/templates/quantum_ovs_bridge.pp create mode 100644 packstack/puppet/templates/quantum_ovs_plugin.pp diff --git a/.gitmodules b/.gitmodules index f60ea7693..589558631 100644 --- a/.gitmodules +++ b/.gitmodules @@ -61,3 +61,9 @@ [submodule "packstack/puppet/modules/vlan"] path = packstack/puppet/modules/vlan url = https://github.com/derekhiggins/puppet-vlan.git +[submodule "packstack/puppet/modules/vswitch"] + path = packstack/puppet/modules/vswitch + url = https://github.com/packstack/puppet-vswitch.git +[submodule "packstack/puppet/modules/quantum"] + path = packstack/puppet/modules/quantum + url = https://github.com/stackforge/puppet-quantum.git diff --git a/packstack/plugins/mysql_001.py b/packstack/plugins/mysql_001.py index 7ac786c0d..35cec6562 100644 --- a/packstack/plugins/mysql_001.py +++ b/packstack/plugins/mysql_001.py @@ -98,5 +98,7 @@ def createmanifest(config): append_for("cinder") if controller.CONF['CONFIG_GLANCE_INSTALL'] == "y": append_for("glance") + if controller.CONF['CONFIG_QUANTUM_INSTALL'] == 'y': + append_for("quantum") appendManifestFile(manifestfile, "\n".join(manifestdata), 'pre') diff --git a/packstack/plugins/nova_300.py b/packstack/plugins/nova_300.py index 1d845f774..cf7cc93b6 100644 --- a/packstack/plugins/nova_300.py +++ b/packstack/plugins/nova_300.py @@ -264,11 +264,16 @@ def initSequences(controller): {'title': 'Adding Nova Cert manifest entries', 'functions':[createcertmanifest]}, {'title': 'Adding Nova Conductor manifest entries', 'functions':[createconductormanifest]}, {'title': 'Adding Nova Compute manifest entries', 'functions':[createcomputemanifest]}, - {'title': 'Adding Nova Network manifest entries', 'functions':[createnetworkmanifest]}, {'title': 'Adding Nova Scheduler manifest entries', 'functions':[createschedmanifest]}, {'title': 'Adding Nova VNC Proxy manifest entries', 'functions':[createvncproxymanifest]}, {'title': 'Adding Nova Common manifest entries', 'functions':[createcommonmanifest]}, ] + + if controller.CONF['CONFIG_QUANTUM_INSTALL']: + novaapisteps.append({'title': 'Adding Openstack Network-related Nova manifest entries', 'functions':[createquantummanifest]}) + else: + novaapisteps.append({'title': 'Adding Nova Network manifest entries', 'functions':[createnetworkmanifest]}) + controller.addSequence("Installing OpenStack Nova API", [], [], novaapisteps) @@ -349,6 +354,9 @@ def createcomputemanifest(config): def createnetworkmanifest(config): + if controller.CONF['CONFIG_QUANTUM_INSTALL'] == "y": + return + host = controller.CONF['CONFIG_NOVA_NETWORK_HOST'] for i in ('CONFIG_NOVA_NETWORK_PRIVIF', 'CONFIG_NOVA_NETWORK_PUBIF'): check_ifcfg(host, controller.CONF[i]) @@ -390,3 +398,13 @@ def createcommonmanifest(config): if manifestfile.endswith("_nova.pp"): data = getManifestTemplate("nova_common.pp") appendManifestFile(os.path.split(manifestfile)[1], data) + + +def createquantummanifest(config): + if controller.CONF['CONFIG_QUANTUM_INSTALL'] != "y": + return + + for manifestfile, marker in manifestfiles.getFiles(): + if manifestfile.endswith("_nova.pp"): + data = getManifestTemplate("nova_quantum.pp") + appendManifestFile(os.path.split(manifestfile)[1], data) diff --git a/packstack/plugins/prescript_000.py b/packstack/plugins/prescript_000.py index ed6cb3418..9a41ce95c 100644 --- a/packstack/plugins/prescript_000.py +++ b/packstack/plugins/prescript_000.py @@ -61,6 +61,18 @@ def initConfig(controllerObject): "USE_DEFAULT" : False, "NEED_CONFIRM" : False, "CONDITION" : False }, + {"CMD_OPTION" : "os-quantum-install", + "USAGE" : "Set to 'y' if you would like Packstack to install Quantum", + "PROMPT" : "Should Packstack install Quantum compute service", + "OPTION_LIST" : ["y", "n"], + "VALIDATORS" : [validators.validate_options], + "DEFAULT_VALUE" : "y", + "MASK_INPUT" : False, + "LOOSE_VALIDATION": False, + "CONF_NAME" : "CONFIG_QUANTUM_INSTALL", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False }, {"CMD_OPTION" : "os-horizon-install", "USAGE" : "Set to 'y' if you would like Packstack to install Horizon", "PROMPT" : "Should Packstack install Horizon dashboard", diff --git a/packstack/plugins/puppet_950.py b/packstack/plugins/puppet_950.py index 9f0c1ebf2..79a27ca86 100644 --- a/packstack/plugins/puppet_950.py +++ b/packstack/plugins/puppet_950.py @@ -79,8 +79,8 @@ def copyPuppetModules(config): 'glance', 'horizon', 'inifile', 'keystone', 'memcached', 'mysql', 'nova', 'openstack', 'packstack', - 'qpid', 'rsync', 'ssh', 'stdlib', - 'swift', 'sysctl', 'vlan', 'xinetd')) + 'qpid', 'quantum', 'rsync', 'ssh', 'stdlib', + 'swift', 'sysctl', 'vlan', 'vswitch', 'xinetd')) # write puppet manifest to disk manifestfiles.writeManifests() diff --git a/packstack/plugins/quantum_350.py b/packstack/plugins/quantum_350.py new file mode 100644 index 000000000..5c91fbf6a --- /dev/null +++ b/packstack/plugins/quantum_350.py @@ -0,0 +1,364 @@ +""" +Installs and configures quantum +""" + +import logging +import os +import uuid + +from packstack.installer import utils +from packstack.installer import validators + +from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile + +# Controller object will be initialized from main flow +controller = None + +# Plugin name +PLUGIN_NAME = "OS-QUANTUM" + +logging.debug("plugin %s loaded", __name__) + +def initConfig(controllerObject): + global controller + controller = controllerObject + + logging.debug("Adding OpenStack Quantum configuration") + + conf_params = { + "QUANTUM" : [ + {"CMD_OPTION" : "quantum-server-host", + "USAGE" : "The IP addresses of the server on which to install the Quantum server", + "PROMPT" : "Enter the IP address of the Quantum server", + "OPTION_LIST" : [], + "VALIDATORS" : [validators.validate_ip, validators.validate_ssh], + "DEFAULT_VALUE" : utils.get_localhost_ip(), + "MASK_INPUT" : False, + "LOOSE_VALIDATION": True, + "CONF_NAME" : "CONFIG_QUANTUM_SERVER_HOST", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False }, + {"CMD_OPTION" : "quantum-use-namespaces", + "USAGE" : "Enable network namespaces for Quantum", + "PROMPT" : "Should Quantum use network namespaces?", + "OPTION_LIST" : ["y", "n"], + "VALIDATORS" : [validators.validate_options], + "DEFAULT_VALUE" : "y", + "MASK_INPUT" : False, + "LOOSE_VALIDATION": True, + "CONF_NAME" : "CONFIG_QUANTUM_USE_NAMESPACES", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False }, + {"CMD_OPTION" : "quantum-ks-password", + "USAGE" : "The password to use for Quantum to authenticate with Keystone", + "PROMPT" : "Enter the password for Quantum Keystone access", + "OPTION_LIST" : [], + "VALIDATORS" : [validators.validate_not_empty], + "DEFAULT_VALUE" : uuid.uuid4().hex[:16], + "MASK_INPUT" : True, + "LOOSE_VALIDATION": False, + "CONF_NAME" : "CONFIG_QUANTUM_KS_PW", + "USE_DEFAULT" : True, + "NEED_CONFIRM" : True, + "CONDITION" : False }, + {"CMD_OPTION" : "quantum-db-password", + "USAGE" : "The password to use for Quantum to access DB", + "PROMPT" : "Enter the password for Quantum DB access", + "OPTION_LIST" : [], + "VALIDATORS" : [validators.validate_not_empty], + "DEFAULT_VALUE" : uuid.uuid4().hex[:16], + "MASK_INPUT" : True, + "LOOSE_VALIDATION": False, + "CONF_NAME" : "CONFIG_QUANTUM_DB_PW", + "USE_DEFAULT" : True, + "NEED_CONFIRM" : True, + "CONDITION" : False }, + {"CMD_OPTION" : "quantum-l3-hosts", + "USAGE" : "A comma separated list of IP addresses on which to install Quantum L3 agent", + "PROMPT" : "Enter a comma separated list of IP addresses on which to install the Quantum L3 agent", + "OPTION_LIST" : [], + "VALIDATORS" : [validators.validate_multi_ssh], + "DEFAULT_VALUE" : utils.get_localhost_ip(), + "MASK_INPUT" : False, + "LOOSE_VALIDATION": True, + "CONF_NAME" : "CONFIG_QUANTUM_L3_HOSTS", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False }, + {"CMD_OPTION" : "quantum-l3-ext-bridge", + "USAGE" : "The name of the bridge that the Quantum L3 agent will use for external traffic", + "PROMPT" : "Enter the name of the bridge that the Quantum L3 agent will use for external traffic", + "OPTION_LIST" : [], + "VALIDATORS" : [validators.validate_not_empty], + "DEFAULT_VALUE" : "br-ex", + "MASK_INPUT" : False, + "LOOSE_VALIDATION": True, + "CONF_NAME" : "CONFIG_QUANTUM_L3_EXT_BRIDGE", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False }, + {"CMD_OPTION" : "quantum-dhcp-hosts", + "USAGE" : "A comma separated list of IP addresses on which to install Quantum DHCP plugin", + "PROMPT" : "Enter a comma separated list of IP addresses on which to install Quantum DHCP plugin", + "OPTION_LIST" : [], + "VALIDATORS" : [validators.validate_multi_ssh], + "DEFAULT_VALUE" : utils.get_localhost_ip(), + "MASK_INPUT" : False, + "LOOSE_VALIDATION": True, + "CONF_NAME" : "CONFIG_QUANTUM_DHCP_HOSTS", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False }, + {"CMD_OPTION" : "quantum-l2-plugin", + "USAGE" : "The name of the L2 plugin to be used with Quantum", + "PROMPT" : "Enter the name of the L2 plugin to be used with Quantum", + "OPTION_LIST" : ["linuxbridge", "openvswitch"], + "VALIDATORS" : [validators.validate_options], + "DEFAULT_VALUE" : "openvswitch", + "MASK_INPUT" : False, + "LOOSE_VALIDATION": False, + "CONF_NAME" : "CONFIG_QUANTUM_L2_PLUGIN", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False }, + {"CMD_OPTION" : "quantum-metadata-hosts", + "USAGE" : "A comma separated list of IP addresses on which to install Quantum metadata agent", + "PROMPT" : "Enter a comma separated list of IP addresses on which to install the Quantum metadata agent", + "OPTION_LIST" : [], + "VALIDATORS" : [validators.validate_multi_ssh], + "DEFAULT_VALUE" : utils.get_localhost_ip(), + "MASK_INPUT" : False, + "LOOSE_VALIDATION": True, + "CONF_NAME" : "CONFIG_QUANTUM_METADATA_HOSTS", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False }, + {"CMD_OPTION" : "quantum-metadata-pw", + "USAGE" : "A comma separated list of IP addresses on which to install Quantum metadata agent", + "PROMPT" : "Enter a comma separated list of IP addresses on which to install the Quantum metadata agent", + "OPTION_LIST" : [], + "VALIDATORS" : [validators.validate_not_empty], + "DEFAULT_VALUE" : uuid.uuid4().hex[:16], + "MASK_INPUT" : True, + "LOOSE_VALIDATION": False, + "CONF_NAME" : "CONFIG_QUANTUM_METADATA_PW", + "USE_DEFAULT" : True, + "NEED_CONFIRM" : True, + "CONDITION" : False }, + ], + "QUANTUM_LB_PLUGIN" : [ + {"CMD_OPTION" : "quantum-lb-tenant-network-type", + "USAGE" : "The type of network to allocate for tenant networks", + "PROMPT" : "Enter the type of network to allocate for tenant networks", + "OPTION_LIST" : ["local", "vlan"], + "VALIDATORS" : [validators.validate_options], + "DEFAULT_VALUE" : "local", + "MASK_INPUT" : False, + "LOOSE_VALIDATION": False, + "CONF_NAME" : "CONFIG_QUANTUM_LB_TENANT_NETWORK_TYPE", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False }, + {"CMD_OPTION" : "quantum-lb-vlan-ranges", + "USAGE" : "A comma separated list of VLAN ranges for the Quantum linuxbridge plugin", + "PROMPT" : "Enter a comma separated list of VLAN ranges for the Quantum linuxbridge plugin", + "OPTION_LIST" : [], + "VALIDATORS" : [], + "DEFAULT_VALUE" : "", + "MASK_INPUT" : False, + "LOOSE_VALIDATION": True, + "CONF_NAME" : "CONFIG_QUANTUM_LB_VLAN_RANGES", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False }, + {"CMD_OPTION" : "quantum-lb-interface-mappings", + "USAGE" : "A comma separated list of interface mappings for the Quantum linuxbridge plugin", + "PROMPT" : "Enter a comma separated list of interface mappings for the Quantum linuxbridge plugin", + "OPTION_LIST" : [], + "VALIDATORS" : [], + "DEFAULT_VALUE" : "", + "MASK_INPUT" : False, + "LOOSE_VALIDATION": True, + "CONF_NAME" : "CONFIG_QUANTUM_LB_INTERFACE_MAPPINGS", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False }, + ], + "QUANTUM_OVS_PLUGIN" : [ + {"CMD_OPTION" : "quantum-ovs-tenant-network-type", + "USAGE" : "Type of network to allocate for tenant networks", + "PROMPT" : "Enter the type of network to allocate for tenant networks", + "OPTION_LIST" : ["local", "vlan", "gre"], + "VALIDATORS" : [validators.validate_options], + "DEFAULT_VALUE" : "local", + "MASK_INPUT" : False, + "LOOSE_VALIDATION": False, + "CONF_NAME" : "CONFIG_QUANTUM_OVS_TENANT_NETWORK_TYPE", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False }, + {"CMD_OPTION" : "quantum-ovs-vlan-ranges", + "USAGE" : "A comma separated list of VLAN ranges for the Quantum openvswitch plugin", + "PROMPT" : "Enter a comma separated list of VLAN ranges for the Quantum openvswitch plugin", + "OPTION_LIST" : [], + "VALIDATORS" : [], + "DEFAULT_VALUE" : "", + "MASK_INPUT" : False, + "LOOSE_VALIDATION": True, + "CONF_NAME" : "CONFIG_QUANTUM_OVS_VLAN_RANGES", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False }, + {"CMD_OPTION" : "quantum-ovs-bridge-mappings", + "USAGE" : "A comma separated list of bridge mappings for the Quantum openvswitch plugin", + "PROMPT" : "Enter a comma separated list of bridge mappings for the Quantum openvswitch plugin", + "OPTION_LIST" : [], + "VALIDATORS" : [], + "DEFAULT_VALUE" : "physnet1:1000:2000", + "MASK_INPUT" : False, + "LOOSE_VALIDATION": True, + "CONF_NAME" : "CONFIG_QUANTUM_OVS_BRIDGE_MAPPINGS", + "USE_DEFAULT" : False, + "NEED_CONFIRM" : False, + "CONDITION" : False }, + ], + } + + conf_groups = [ + { "GROUP_NAME" : "QUANTUM", + "DESCRIPTION" : "Quantum config", + "PRE_CONDITION" : "CONFIG_QUANTUM_INSTALL", + "PRE_CONDITION_MATCH" : "y", + "POST_CONDITION" : False, + "POST_CONDITION_MATCH" : True }, + { "GROUP_NAME" : "QUANTUM_LB_PLUGIN", + "DESCRIPTION" : "Quantum LB plugin config", + "PRE_CONDITION" : "CONFIG_QUANTUM_L2_PLUGIN", + "PRE_CONDITION_MATCH" : "linuxbridge", + "POST_CONDITION" : False, + "POST_CONDITION_MATCH" : True }, + { "GROUP_NAME" : "QUANTUM_OVS_PLUGIN", + "DESCRIPTION" : "Quantum OVS plugin config", + "PRE_CONDITION" : "CONFIG_QUANTUM_L2_PLUGIN", + "PRE_CONDITION_MATCH" : "openvswitch", + "POST_CONDITION" : False, + "POST_CONDITION_MATCH" : True }, + ] + + for group in conf_groups: + paramList = conf_params[group["GROUP_NAME"]] + controller.addGroup(group, paramList) + + +def getInterfaceDriver(): + if controller.CONF["CONFIG_QUANTUM_L2_PLUGIN"] == "openvswitch": + return 'quantum.agent.linux.interface.OVSInterfaceDriver' + elif controller.CONF['CONFIG_QUANTUM_L2_PLUGIN'] == 'linuxbridge': + return 'quantum.agent.linux.interface.BridgeInterfaceDriver' + + +def initSequences(controller): + if controller.CONF['CONFIG_QUANTUM_INSTALL'] != 'y': + return + if controller.CONF['CONFIG_QUANTUM_USE_NAMESPACES'] == 'y': + controller.CONF['CONFIG_QUANTUM_USE_NAMESPACES'] = 'True' + else: + controller.CONF['CONFIG_QUANTUM_USE_NAMESPACES'] = 'False' + + global api_hosts, l3_hosts, dhcp_hosts, compute_hosts, meta_hosts, q_hosts + api_hosts = set(controller.CONF['CONFIG_QUANTUM_SERVER_HOST'].split(',')) + l3_hosts = set(controller.CONF['CONFIG_QUANTUM_L3_HOSTS'].split(',')) + dhcp_hosts = set(controller.CONF['CONFIG_QUANTUM_DHCP_HOSTS'].split(',')) + meta_hosts = set(controller.CONF['CONFIG_QUANTUM_METADATA_HOSTS'].split(',')) + compute_hosts = set(controller.CONF['CONFIG_NOVA_COMPUTE_HOSTS'].split(',')) + q_hosts = api_hosts | l3_hosts | dhcp_hosts | compute_hosts | meta_hosts + + quantum_steps = [ + {'title': 'Adding Quantum API manifest entries', 'functions':[createManifest]}, + {'title': 'Adding Quantum Keystone manifest entries', 'functions':[createKeystoneManifest]}, + {'title': 'Adding Quantum L3 manifest entries', 'functions':[createL3Manifests]}, + {'title': 'Adding Quantum L2 Agent manifest entries', 'functions':[createL2AgentManifests]}, + {'title': 'Adding Quantum DHCP Agent manifest entries', 'functions':[createDHCPManifests]}, + {'title': 'Adding Quantum Metadata Agent manifest entries', 'functions':[createMetadataManifests]}, + ] + controller.addSequence("Installing OpenStack Quantum", [], [], quantum_steps) + + +def createManifest(config): + global q_hosts + for host in q_hosts: + if host in api_hosts: + controller.CONF['CONFIG_QUANTUM_SERVER_ENABLE'] = 'true' + else: + controller.CONF['CONFIG_QUANTUM_SERVER_ENABLE'] = 'false' + manifest_file = "%s_quantum.pp" % (host,) + manifest_data = getManifestTemplate("quantum.pp") + appendManifestFile(manifest_file, manifest_data, 'quantum') + + # Set up any l2 plugin configs we need anywhere we install quantum + # XXX I am not completely sure about this, but it seems necessary + if controller.CONF['CONFIG_QUANTUM_L2_PLUGIN'] == 'openvswitch': + manifest_data = getManifestTemplate("quantum_ovs_plugin.pp") + appendManifestFile(manifest_file, manifest_data, 'quantum') + elif controller.CONF['CONFIG_QUANTUM_L2_PLUGIN'] == 'linuxbridge': + # Eventually linuxbridge module will need to spearate plugin/agent functionality + pass + +def createKeystoneManifest(config): + manifestfile = "%s_keystone.pp"%controller.CONF['CONFIG_KEYSTONE_HOST'] + manifestdata = getManifestTemplate("keystone_quantum.pp") + appendManifestFile(manifestfile, manifestdata) + +def createL3Manifests(config): + global l3_hosts + for host in l3_hosts: + controller.CONF['CONFIG_QUANTUM_L3_HOST'] = host + controller.CONF['CONFIG_QUANTUM_L3_INTERFACE_DRIVER'] = getInterfaceDriver() + manifestdata = getManifestTemplate("quantum_l3.pp") + manifestfile = "%s_quantum.pp" % (host,) + appendManifestFile(manifestfile, manifestdata + '\n') + if controller.CONF['CONFIG_QUANTUM_L2_PLUGIN'] == 'openvswitch' and controller.CONF['CONFIG_QUANTUM_L3_EXT_BRIDGE']: + controller.CONF['CONFIG_QUANTUM_OVS_BRIDGE'] = controller.CONF['CONFIG_QUANTUM_L3_EXT_BRIDGE'] + manifestdata = getManifestTemplate('quantum_ovs_bridge.pp') + appendManifestFile(manifestfile, manifestdata + '\n') + +def createDHCPManifests(config): + global dhcp_hosts + for host in dhcp_hosts: + controller.CONF["CONFIG_QUANTUM_DHCP_HOST"] = host + controller.CONF['CONFIG_QUANTUM_DHCP_INTERFACE_DRIVER'] = getInterfaceDriver() + manifestdata = getManifestTemplate("quantum_dhcp.pp") + manifestfile = "%s_quantum.pp" % (host,) + + appendManifestFile(manifestfile, manifestdata + "\n") + +def createL2AgentManifests(config): + global compute_hosts, dhcp_host, l3_hosts + + if controller.CONF["CONFIG_QUANTUM_L2_PLUGIN"] == "openvswitch": + host_var = 'CONFIG_QUANTUM_OVS_HOST' + template_name = 'quantum_ovs_agent.pp' + elif controller.CONF["CONFIG_QUANTUM_L2_PLUGIN"] == "linuxbridge": + host_var = 'CONFIG_QUANTUM_LB_HOST' + template_name = 'quantum_lb_agent.pp' + else: + raise KeyError("Unknown layer2 agent") + + # Install l2 agents on every compute host in addition to any hosts listed + # specifically for the l2 agent + for host in compute_hosts | dhcp_hosts | l3_hosts: + controller.CONF[host_var] = host + manifestdata = getManifestTemplate(template_name) + manifestfile = "%s_quantum.pp" % (host,) + appendManifestFile(manifestfile, manifestdata + "\n") + +def createMetadataManifests(config): + global meta_hosts + + for host in meta_hosts: + controller.CONF['CONFIG_QUANTUM_METADATA_HOST'] = host + manifestdata = getManifestTemplate('quantum_metadata.pp') + manifestfile = "%s_quantum.pp" % (host,) + appendManifestFile(manifestfile, manifestdata + "\n") diff --git a/packstack/plugins/serverprep_901.py b/packstack/plugins/serverprep_901.py index cb6d2c2bc..f5357273c 100644 --- a/packstack/plugins/serverprep_901.py +++ b/packstack/plugins/serverprep_901.py @@ -399,7 +399,6 @@ def serverprep(config): 'proxy_user': sat_proxy_user.strip(), 'proxy_pass': sat_proxy_pass.strip(), 'flags': sat_flags} - for hostname in gethostlist(config): if '/' in hostname: hostname = hostname.split('/')[0] diff --git a/packstack/puppet/modules/quantum b/packstack/puppet/modules/quantum new file mode 160000 index 000000000..f45be92f3 --- /dev/null +++ b/packstack/puppet/modules/quantum @@ -0,0 +1 @@ +Subproject commit f45be92f341bb5300eb96a0ca98abd281128beab diff --git a/packstack/puppet/modules/vswitch b/packstack/puppet/modules/vswitch new file mode 160000 index 000000000..6e6b94626 --- /dev/null +++ b/packstack/puppet/modules/vswitch @@ -0,0 +1 @@ +Subproject commit 6e6b9462695e383423462d1321b1c0865524a408 diff --git a/packstack/puppet/templates/keystone_quantum.pp b/packstack/puppet/templates/keystone_quantum.pp new file mode 100644 index 000000000..756d6e36b --- /dev/null +++ b/packstack/puppet/templates/keystone_quantum.pp @@ -0,0 +1,7 @@ + +class {"quantum::keystone::auth": + password => "%(CONFIG_QUANTUM_KS_PW)s", + public_address => "%(CONFIG_QUANTUM_SERVER_HOST)s", + admin_address => "%(CONFIG_QUANTUM_SERVER_HOST)s", + internal_address => "%(CONFIG_QUANTUM_SERVER_HOST)s", +} diff --git a/packstack/puppet/templates/mysql_quantum.pp b/packstack/puppet/templates/mysql_quantum.pp new file mode 100644 index 000000000..f8fb038ef --- /dev/null +++ b/packstack/puppet/templates/mysql_quantum.pp @@ -0,0 +1,4 @@ +class {"quantum::db::mysql": + password => "%(CONFIG_QUANTUM_DB_PW)s", + allowed_hosts => "%%", +} diff --git a/packstack/puppet/templates/nova_quantum.pp b/packstack/puppet/templates/nova_quantum.pp new file mode 100644 index 000000000..dc328fd25 --- /dev/null +++ b/packstack/puppet/templates/nova_quantum.pp @@ -0,0 +1,17 @@ + +class {"nova::network::quantum": + quantum_admin_password => "%(CONFIG_QUANTUM_KS_PW)s", + quantum_auth_strategy => "keystone", + quantum_url => "http://%(CONFIG_QUANTUM_SERVER_HOST)s:9696", + quantum_admin_tenant_name => "services", + quantum_admin_auth_url => "http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0", +} + +class {"nova::compute::quantum": + libvirt_vif_driver => "nova.virt.libvirt.vif.LibvirtGenericVifDriver", +} + +nova_config { + 'DEFAULT/service_quantum_metadata_proxy': value => 'True'; + 'DEFAULT/quantum_metadata_proxy_shared_secret': value => '%(CONFIG_QUANTUM_METADATA_PW)s'; +} diff --git a/packstack/puppet/templates/quantum.pp b/packstack/puppet/templates/quantum.pp new file mode 100644 index 000000000..0079e6671 --- /dev/null +++ b/packstack/puppet/templates/quantum.pp @@ -0,0 +1,19 @@ +$quantum_db_host = '%(CONFIG_MYSQL_HOST)s' +$quantum_db_name = 'quantum' +$quantum_db_user = 'quantum' +$quantum_db_password = '%(CONFIG_QUANTUM_DB_PW)s' +$quantum_sql_connection = "mysql://${quantum_db_user}:${quantum_db_password}@${quantum_db_host}/${quantum_db_name}" + +$quantum_user_password = '%(CONFIG_QUANTUM_KS_PW)s' + +# set up a quantum server +class { 'quantum': + rpc_backend => 'quantum.openstack.common.rpc.impl_qpid', + qpid_hostname => '%(CONFIG_QPID_HOST)s', +} + +class { 'quantum::server': + auth_password => $quantum_user_password, + auth_host => '%(CONFIG_KEYSTONE_HOST)s', + enabled => '%(CONFIG_QUANTUM_SERVER_ENABLE)s', +} diff --git a/packstack/puppet/templates/quantum_dhcp.pp b/packstack/puppet/templates/quantum_dhcp.pp new file mode 100644 index 000000000..fa0db1b59 --- /dev/null +++ b/packstack/puppet/templates/quantum_dhcp.pp @@ -0,0 +1,4 @@ +class { 'quantum::agents::dhcp': + use_namespaces => '%(CONFIG_QUANTUM_USE_NAMESPACES)s', + interface_driver => '%(CONFIG_QUANTUM_DHCP_INTERFACE_DRIVER)s', +} diff --git a/packstack/puppet/templates/quantum_l3.pp b/packstack/puppet/templates/quantum_l3.pp new file mode 100644 index 000000000..b1bf97f42 --- /dev/null +++ b/packstack/puppet/templates/quantum_l3.pp @@ -0,0 +1,5 @@ +class { 'quantum::agents::l3': + use_namespaces => '%(CONFIG_QUANTUM_USE_NAMESPACES)s', + interface_driver => '%(CONFIG_QUANTUM_L3_INTERFACE_DRIVER)s', + external_network_bridge => '%(CONFIG_QUANTUM_L3_EXT_BRIDGE)s', +} diff --git a/packstack/puppet/templates/quantum_lb_agent.pp b/packstack/puppet/templates/quantum_lb_agent.pp new file mode 100644 index 000000000..7022fc154 --- /dev/null +++ b/packstack/puppet/templates/quantum_lb_agent.pp @@ -0,0 +1,2 @@ +class {'quantum::agents::linuxbridge': +} diff --git a/packstack/puppet/templates/quantum_metadata.pp b/packstack/puppet/templates/quantum_metadata.pp new file mode 100644 index 000000000..ed74b5ff1 --- /dev/null +++ b/packstack/puppet/templates/quantum_metadata.pp @@ -0,0 +1,6 @@ +class {'quantum::agents::metadata': + auth_password => '%(CONFIG_QUANTUM_KS_PW)s', + auth_url => 'http://%(CONFIG_KEYSTONE_HOST)s:35357/v2.0', + shared_secret => '%(CONFIG_QUANTUM_METADATA_PW)s', + metadata_ip => '%(CONFIG_NOVA_API_HOST)s', +} diff --git a/packstack/puppet/templates/quantum_ovs_agent.pp b/packstack/puppet/templates/quantum_ovs_agent.pp new file mode 100644 index 000000000..c54b824de --- /dev/null +++ b/packstack/puppet/templates/quantum_ovs_agent.pp @@ -0,0 +1,2 @@ +class { 'quantum::agents::ovs': +} diff --git a/packstack/puppet/templates/quantum_ovs_bridge.pp b/packstack/puppet/templates/quantum_ovs_bridge.pp new file mode 100644 index 000000000..591713319 --- /dev/null +++ b/packstack/puppet/templates/quantum_ovs_bridge.pp @@ -0,0 +1,4 @@ +vs_bridge { '%(CONFIG_QUANTUM_OVS_BRIDGE)s': + ensure => present, + require => Service['quantum-plugin-ovs-service'] +} diff --git a/packstack/puppet/templates/quantum_ovs_plugin.pp b/packstack/puppet/templates/quantum_ovs_plugin.pp new file mode 100644 index 000000000..5c7641a9b --- /dev/null +++ b/packstack/puppet/templates/quantum_ovs_plugin.pp @@ -0,0 +1,5 @@ +class { 'quantum::plugins::ovs': + tenant_network_type => '%(CONFIG_QUANTUM_OVS_TENANT_NETWORK_TYPE)s', + network_vlan_ranges => '%(CONFIG_QUANTUM_OVS_VLAN_RANGES)s', + sql_connection => $quantum_sql_connection +}