Fuel NSXv plugin

Plugin allows to use Neutron with VMware NSX plugin
(https://github.com/stackforge/vmware-nsx)

General plugin workflow:
* Disable nova-network
* Reconfigure nova-compute to use Neutron as network API
* Install neutron-server
* Install custom python-nova package (contains NSXv support for
  nova-compute)

Change-Id: Ibfac2c9210208de9171d7406afe30aa96e8c20a3
This commit is contained in:
OpenStack Project Creator 2015-08-09 03:40:29 +00:00 committed by Igor Zinovik
parent 4c830dd8b0
commit 08a26260e2
21 changed files with 1274 additions and 0 deletions

3
.gitignore vendored
View File

@ -1 +1,4 @@
.tox
.build
_build
*.pyc

202
LICENSE Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
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.

View File

@ -0,0 +1,7 @@
#!/bin/bash
override_file='/etc/hiera/override/plugins_nsxv.yaml'
symlink_file='/etc/hiera/override/plugins.yaml'
if [ -L "$symlink_file" -a "$(readlink -f $symlink_file)" == "$override_file" ]; then
rm -f "$symlink_file" "$override_file"
fi

View File

@ -0,0 +1,3 @@
notice('fuel-plugin-nsxv: disable-nova-network.pp')
class { '::nsxv::disable_nova_network': }

View File

@ -0,0 +1,3 @@
notice('fuel-plugin-nsxv: hiera-override.pp')
class { '::nsxv::hiera_override': }

View File

@ -0,0 +1,3 @@
notice('fuel-plugin-nsxv: neutron-install.pp')
class { 'nsxv::neutron_install': }

View File

@ -0,0 +1,3 @@
notice('fuel-plugin-nsxv: nova-config.pp')
class { 'nsxv::nova_config': }

View File

@ -0,0 +1,3 @@
notice('fuel-plugin-nsxv: nsxv-config.pp')
class { '::nsxv': }

View File

@ -0,0 +1,6 @@
notice('fuel-plugin-nsxv: repo-priority.pp')
class { '::nsxv::repo_priority':
plugin_name => "nsxv",
plugin_version => "1.0.0",
}

View File

@ -0,0 +1,143 @@
{
"context_is_admin": "role:admin",
"admin_or_owner": "rule:context_is_admin or tenant_id:%(tenant_id)s",
"context_is_advsvc": "role:advsvc",
"admin_or_network_owner": "rule:context_is_admin or tenant_id:%(network:tenant_id)s",
"admin_only": "rule:context_is_admin",
"regular_user": "",
"shared": "field:networks:shared=True",
"shared_firewalls": "field:firewalls:shared=True",
"external": "field:networks:router:external=True",
"default": "rule:admin_or_owner",
"create_subnet": "rule:admin_or_network_owner",
"get_subnet": "rule:admin_or_owner or rule:shared",
"update_subnet": "rule:admin_or_network_owner",
"delete_subnet": "rule:admin_or_network_owner",
"create_network": "",
"get_network": "rule:admin_or_owner or rule:shared or rule:external or rule:context_is_advsvc",
"get_network:router:external": "rule:regular_user",
"get_network:segments": "rule:admin_only",
"get_network:provider:network_type": "rule:admin_only",
"get_network:provider:physical_network": "rule:admin_only",
"get_network:provider:segmentation_id": "rule:admin_only",
"get_network:queue_id": "rule:admin_only",
"create_network:shared": "rule:admin_only",
"create_network:router:external": "rule:admin_only",
"create_network:segments": "rule:admin_only",
"create_network:provider:network_type": "rule:admin_only",
"create_network:provider:physical_network": "rule:admin_only",
"create_network:provider:segmentation_id": "rule:admin_only",
"update_network": "rule:admin_or_owner",
"update_network:segments": "rule:admin_only",
"update_network:shared": "rule:admin_only",
"update_network:provider:network_type": "rule:admin_only",
"update_network:provider:physical_network": "rule:admin_only",
"update_network:provider:segmentation_id": "rule:admin_only",
"update_network:router:external": "rule:admin_only",
"delete_network": "rule:admin_or_owner",
"create_port": "",
"create_port:mac_address": "rule:admin_or_network_owner or rule:context_is_advsvc",
"create_port:fixed_ips": "rule:admin_or_network_owner or rule:context_is_advsvc",
"create_port:port_security_enabled": "rule:admin_or_network_owner or rule:context_is_advsvc",
"create_port:binding:host_id": "rule:admin_only",
"create_port:binding:profile": "rule:admin_only",
"create_port:mac_learning_enabled": "rule:admin_or_network_owner or rule:context_is_advsvc",
"get_port": "rule:admin_or_owner or rule:context_is_advsvc",
"get_port:queue_id": "rule:admin_only",
"get_port:binding:vif_type": "rule:admin_only",
"get_port:binding:vif_details": "rule:admin_only",
"get_port:binding:host_id": "rule:admin_only",
"get_port:binding:profile": "rule:admin_only",
"update_port": "rule:admin_or_owner or rule:context_is_advsvc",
"update_port:fixed_ips": "rule:admin_or_network_owner or rule:context_is_advsvc",
"update_port:port_security_enabled": "rule:admin_or_network_owner or rule:context_is_advsvc",
"update_port:binding:host_id": "rule:admin_only",
"update_port:binding:profile": "rule:admin_only",
"update_port:mac_learning_enabled": "rule:admin_or_network_owner or rule:context_is_advsvc",
"delete_port": "rule:admin_or_owner or rule:context_is_advsvc",
"get_router:ha": "rule:admin_only",
"create_router": "rule:regular_user",
"create_router:external_gateway_info:enable_snat": "rule:admin_only",
"create_router:distributed": "rule:admin_only",
"create_router:ha": "rule:admin_only",
"get_router": "rule:admin_or_owner",
"get_router:distributed": "rule:admin_only",
"update_router:external_gateway_info:enable_snat": "rule:admin_only",
"update_router:distributed": "rule:admin_only",
"update_router:ha": "rule:admin_only",
"delete_router": "rule:admin_or_owner",
"add_router_interface": "rule:admin_or_owner",
"remove_router_interface": "rule:admin_or_owner",
"create_router:external_gateway_info:external_fixed_ips": "rule:admin_only",
"update_router:external_gateway_info:external_fixed_ips": "rule:admin_only",
"create_firewall": "",
"get_firewall": "rule:admin_or_owner",
"create_firewall:shared": "rule:admin_only",
"get_firewall:shared": "rule:admin_only",
"update_firewall": "rule:admin_or_owner",
"update_firewall:shared": "rule:admin_only",
"delete_firewall": "rule:admin_or_owner",
"create_firewall_policy": "",
"get_firewall_policy": "rule:admin_or_owner or rule:shared_firewalls",
"create_firewall_policy:shared": "rule:admin_or_owner",
"update_firewall_policy": "rule:admin_or_owner",
"delete_firewall_policy": "rule:admin_or_owner",
"create_firewall_rule": "",
"get_firewall_rule": "rule:admin_or_owner or rule:shared_firewalls",
"update_firewall_rule": "rule:admin_or_owner",
"delete_firewall_rule": "rule:admin_or_owner",
"create_qos_queue": "rule:admin_only",
"get_qos_queue": "rule:admin_only",
"update_agent": "rule:admin_only",
"delete_agent": "rule:admin_only",
"get_agent": "rule:admin_only",
"create_dhcp-network": "rule:admin_only",
"delete_dhcp-network": "rule:admin_only",
"get_dhcp-networks": "rule:admin_only",
"create_l3-router": "rule:admin_only",
"delete_l3-router": "rule:admin_only",
"get_l3-routers": "rule:admin_only",
"get_dhcp-agents": "rule:admin_only",
"get_l3-agents": "rule:admin_only",
"get_loadbalancer-agent": "rule:admin_only",
"get_loadbalancer-pools": "rule:admin_only",
"create_floatingip": "rule:regular_user",
"create_floatingip:floating_ip_address": "rule:admin_only",
"update_floatingip": "rule:admin_or_owner",
"delete_floatingip": "rule:admin_or_owner",
"get_floatingip": "rule:admin_or_owner",
"create_network_profile": "rule:admin_only",
"update_network_profile": "rule:admin_only",
"delete_network_profile": "rule:admin_only",
"get_network_profiles": "",
"get_network_profile": "",
"update_policy_profiles": "rule:admin_only",
"get_policy_profiles": "",
"get_policy_profile": "",
"create_metering_label": "rule:admin_only",
"delete_metering_label": "rule:admin_only",
"get_metering_label": "rule:admin_only",
"create_metering_label_rule": "rule:admin_only",
"delete_metering_label_rule": "rule:admin_only",
"get_metering_label_rule": "rule:admin_only",
"get_service_provider": "rule:regular_user",
"get_lsn": "rule:admin_only",
"create_lsn": "rule:admin_only"
}

View File

@ -0,0 +1,50 @@
class nsxv::disable_nova_network (
$nova_network_service_name = 'p_vcenter_nova_network',
$nova_network_config_ha = '/etc/nova/nova-network.d/nova-network-ha.conf',
) {
include ::nova::params
$access_hash = hiera_hash('access',{})
$controller_node = hiera('service_endpoint')
$os_username = $access_hash['user']
$os_password = $access_hash['password']
$os_auth_url = "http://${controller_node}:5000/v2.0/"
cs_resource { "${nova_network_service_name}":
ensure => absent,
notify => Exec["workaround_delete_${nova_network_service_name}"]
}
exec { "workaround_delete_${nova_network_service_name}":
path => '/usr/bin:/usr/sbin:/bin',
command => "pcs resource delete ${nova_network_service_name}",
refreshonly => true,
tries => 3,
try_sleep => 10,
}
package { 'nova-network':
name => $::nova::params::network_package_name,
ensure => purged,
require => Cs_resource["${nova_network_service_name}"],
}
file { "${nova_network_config_ha}":
ensure => absent,
}
exec { 'delete-nova-network':
path => '/usr/bin:/usr/sbin:/bin',
command => 'nova service-list --binary nova-network|awk \'/nova-network/ {print $2}\'|while read id; do nova service-delete $id; done',
onlyif => 'nova service-list --binary nova-network|grep \'nova-network\' 1>/dev/null',
provider => shell,
environment => [
'OS_TENANT_NAME=services',
"OS_USERNAME=${os_username}",
"OS_PASSWORD=${os_password}",
"OS_AUTH_URL=${os_auth_url}",
'OS_ENDPOINT_TYPE=internalURL'
],
tries => 3,
try_sleep => 10,
require => Cs_resource["${nova_network_service_name}"],
}
}

View File

@ -0,0 +1,59 @@
class nsxv::hiera_override (
$override_file = '/etc/hiera/override/plugins_nsxv.yaml',
$neutron_bridge = 'br-mgmt',
) {
$override_dir = dirname($override_file)
$network_roles_on_neutron_bridge = inline_template("<%-
network_scheme = scope.function_hiera(['network_scheme'])
roles = network_scheme['roles']
-%>
<%= roles.key(scope.lookupvar('neutron_bridge')) %>")
$network_scheme_patch = inline_template("<%-
require 'yaml'
network_scheme = {}
network_scheme['network_scheme'] = scope.function_hiera(['network_scheme'])
network_scheme['network_scheme']['roles']['neutron/api'] = scope.lookupvar('neutron_bridge')
-%>
<%= network_scheme.to_yaml %>")
$neutron_nodes = inline_template("<%-
require 'yaml'
neutron_nodes = {}
nodes = scope.function_hiera_hash(['neutron_nodes'])
neutron_nodes['neutron_nodes'] = nodes
nodes.each do |node, meta|
neutron_nodes['neutron_nodes'][node]['network_roles']['neutron/api'] = neutron_nodes['neutron_nodes'][node]['network_roles'][(scope.lookupvar('network_roles_on_neutron_bridge')).strip]
end
-%>
<%= neutron_nodes.to_yaml %>")
file { $override_dir:
ensure => directory,
} ->
concat { $override_file:
ensure => present,
ensure_newline => true,
order => 'numeric',
replace => true,
}
concat::fragment{ 'network_scheme':
ensure => present,
target => $override_file,
content => $network_scheme_patch,
order => '01'
}
concat::fragment{ 'neutron_nodes':
ensure => present,
target => $override_file,
content => regsubst($neutron_nodes,'---',''),
order => '10'
}
concat::fragment{ 'use_neutron':
ensure => present,
target => $override_file,
content => " use_neutron: true",
order => '20'
}
}

View File

@ -0,0 +1,45 @@
class nsxv (
$nsxv_config_dir = '/etc/neutron/plugins/vmware',
) {
$quantum_settings = hiera('quantum_settings')
$settings = hiera('nsxv')
# Do not remove unused variables: template nsx.ini.erb refers to them
$nova_metadata_ips = hiera('public_vip')
$nova_metadata_port = '8775'
$metadata_shared_secret = $quantum_settings['metadata']['metadata_proxy_shared_secret']
$nsxv_config_dirs = [ '/etc/neutron', '/etc/neutron/plugins', '/etc/neutron/plugins/vmware' ]
file { $nsxv_config_dirs:
ensure => directory
}
if ! $settings['nsxv_insecure'] {
$ca_certificate_content = $settings['nsxv_ca_file']['content']
$ca_file = "${nsxv_config_dir}/ca.pem"
file { "${ca_file}":
ensure => present,
content => $ca_certificate_content,
require => File[$nsxv_config_dirs],
}
}
package { 'python-vmware-nsx':
ensure => latest,
}
file { "${nsxv_config_dir}/nsx.ini":
ensure => file,
content => template("${module_name}/nsx.ini.erb"),
require => File[$nsxv_config_dirs],
}
file { '/etc/neutron/plugin.ini':
ensure => link,
target => "${nsxv_config_dir}/nsx.ini",
replace => true,
require => File[$nsxv_config_dirs],
}
}

View File

@ -0,0 +1,132 @@
class nsxv::neutron_install(
$core_plugin = 'vmware_nsx.neutron.plugins.vmware.plugin.NsxVPlugin',
$policy_file = '/etc/neutron/policy.json',
) {
$neutron_config = hiera_hash('quantum_settings')
$rabbit_hash = hiera_hash('rabbit_hash', {})
$ceilometer_hash = hiera('ceilometer',{})
$nova_hash = hiera_hash('nova', {})
$network_scheme = hiera('network_scheme', {})
prepare_network_config($network_scheme)
# Neutron DB settings
$neutron_db_password = $neutron_config['database']['passwd']
$neutron_db_user = pick($neutron_config['database']['user'], 'neutron')
$neutron_db_name = pick($neutron_config['database']['name'], 'neutron')
$neutron_db_host = pick($neutron_config['database']['host'], hiera('database_vip'))
$neutron_db_uri = "mysql://${neutron_db_user}:${neutron_db_password}@${neutron_db_host}/${neutron_db_name}?&read_timeout=60"
# Neutron Keystone settings
$neutron_user_password = $neutron_config['keystone']['admin_password']
$keystone_user = pick($neutron_config['keystone']['admin_user'], 'neutron')
$keystone_tenant = pick($neutron_config['keystone']['admin_tenant'], 'services')
# base
$neutron_local_address_for_bind = get_network_role_property('neutron/api', 'ipaddr') # prepare_network_config need
$region = hiera('region', 'RegionOne')
$service_workers = min(max($::processorcount, 2), 16)
$management_vip = hiera('management_vip')
# endpoints
$service_endpoint = hiera('service_endpoint')
$nova_endpoint = hiera('nova_endpoint', $management_vip)
$neutron_endpoint = hiera('neutron_endpoint', $management_vip)
# logs
$debug = hiera('debug', true)
$use_syslog = hiera('use_syslog', true)
$use_stderr = hiera('use_stderr', false)
$syslog_log_facility_neutron = hiera('syslog_log_facility_neutron', 'LOG_LOCAL4')
# Queue settings
$queue_provider = hiera('queue_provider', 'rabbitmq')
$amqp_hosts = split(hiera('amqp_hosts', ''), ',')
class { 'openstack::network':
network_provider => 'neutron',
agents => [],
ha_agents => false,
verbose => true,
debug => $debug,
use_syslog => $use_syslog,
use_stderr => $use_stderr,
syslog_log_facility => $syslog_log_facility_neutron,
neutron_server => true,
neutron_server_enable => true,
neutron_db_uri => $neutron_db_uri,
nova_neutron => true,
base_mac => undef,
core_plugin => $core_plugin,
service_plugins => [],
net_mtu => undef,
network_device_mtu => undef,
bind_host => $neutron_local_address_for_bind,
dvr => false,
l2_population => false,
service_workers => $service_workers,
#ovs
mechanism_drivers => undef,
local_ip => undef,
bridge_mappings => undef,
network_vlan_ranges => undef,
enable_tunneling => undef,
tunnel_id_ranges => undef,
vni_ranges => undef,
tunnel_types => undef,
tenant_network_types => undef,
floating_bridge => undef,
#Queue settings
queue_provider => $queue_provider,
amqp_hosts => $amqp_hosts,
amqp_user => $rabbit_hash['user'],
amqp_password => $rabbit_hash['password'],
# keystone
admin_password => $neutron_user_password,
auth_url => "http://${service_endpoint}:35357/v2.0",
identity_uri => "http://${service_endpoint}:35357",
neutron_url => "http://${neutron_endpoint}:9696",
admin_tenant_name => $keystone_tenant,
admin_username => $keystone_user,
region => $region,
# Ceilometer notifications
ceilometer => $ceilometer_hash['enabled'],
#metadata
shared_secret => undef,
metadata_ip => undef,
isolated_metadata => undef,
#nova settings
private_interface => undef,
public_interface => undef,
fixed_range => undef,
floating_range => undef,
network_manager => undef,
network_config => undef,
create_networks => undef,
num_networks => undef,
network_size => undef,
nameservers => undef,
enable_nova_net => undef,
nova_admin_username => $nova_hash['user'],
nova_admin_tenant_name => $nova_hash['tenant'],
nova_admin_password => $nova_hash['user_password'],
nova_url => "http://${nova_endpoint}:8774/v2",
}
file { "${policy_file}":
ensure => file,
source => "puppet:///modules/${module_name}/policy.json",
mode => 644,
require => Class['openstack::network'],
replace => true,
}
}

View File

@ -0,0 +1,118 @@
class nsxv::nova_config (
$metadata_ha_conf = '/etc/haproxy/conf.d/060-nova-metadata-api.cfg',
$nova_conf = '/etc/nova/nova.conf',
) {
include ::nova::params
$roles = hiera('roles')
$vcenter_hash = hiera('vcenter_hash')
$vcenter_settings = $vcenter_hash['computes']
$neutron_config = hiera_hash('quantum_settings')
$neutron_metadata_proxy_secret = $neutron_config['metadata']['metadata_proxy_shared_secret']
$nova_parameters = {
'neutron/service_metadata_proxy' => { value => 'True' },
'neutron/metadata_proxy_shared_secret' => { value => "${neutron_metadata_proxy_secret}" }
}
if 'primary-controller' in $roles or 'controller' in $roles {
include ::openstack::ha::haproxy_restart
$public_vip = hiera('public_vip')
$api_service_name = $::nova::params::api_service_name
$cert_service_name = $::nova::params::cert_service_name
$conductor_service_name = $::nova::params::conductor_service_name
$scheduler_service_name = $::nova::params::scheduler_service_name
file_line { 'metadata_public_listen':
path => $metadata_ha_conf,
after => 'listen nova-metadata-api',
line => " bind ${$public_vip}:8775",
notify => Exec['haproxy-restart'],
}
service { [$api_service_name,$cert_service_name,$conductor_service_name,$scheduler_service_name]:
ensure => 'running',
}
Nova_config<| |> ~> Service[$api_service_name,$cert_service_name,$conductor_service_name,$scheduler_service_name]
Nsxv::Delete_line<| |> ~> Service[$api_service_name,$cert_service_name,$conductor_service_name,$scheduler_service_name]
} elsif 'compute-vmware' in $roles {
$management_vip = hiera('management_vip')
$service_endpoint = hiera('service_endpoint')
$neutron_endpoint = hiera('neutron_endpoint', $management_vip)
$neutron_admin_username = pick($neutron_config['keystone']['admin_user'], 'neutron')
$neutron_admin_password = $neutron_config['keystone']['admin_password']
$neutron_admin_tenant_name = pick($neutron_config['keystone']['admin_tenant'], 'services')
$neutron_admin_auth_url = "http://${service_endpoint}:35357/v2.0"
$neutron_url = "http://${neutron_endpoint}:9696"
$region = hiera('region', 'RegionOne')
class {'nova::network::neutron':
neutron_admin_password => $neutron_admin_password,
neutron_admin_tenant_name => $neutron_admin_tenant_name,
neutron_region_name => $region,
neutron_admin_username => $neutron_admin_username,
neutron_admin_auth_url => $neutron_admin_auth_url,
neutron_url => $neutron_url,
neutron_ovs_bridge => '',
}
Nsxv::Delete_line<| |> { require => Class['nova::network::neutron'] }
}
nsxv::delete_line { ['network_manager','public_interface','force_snat_range','flat_network_bridge','flat_injected','flat_interface']:
path => $nova_conf,
}
create_resources(nova_config, $nova_parameters)
create_resources(nsxv::define_vmware_compute, parse_vcenter_settings($vcenter_settings))
Nova_config<| |> ~> Service<| tag == 'vcenter_compute' |>
Nsxv::Delete_line<| |> ~> Service<| tag == 'vcenter_compute' |>
}
define nsxv::delete_line (
$line = $name,
$path = undef,
) {
$file_name = basename($path)
exec { "delete_${line}_from_${file_name}":
path => '/usr/bin:/usr/sbin:/bin',
command => "sed -ri '/^\s*${line}.*$/d' $path",
onlyif => "grep -E '^\s*${line}.*$' $path 1>/dev/null",
provider => shell,
tries => 3,
try_sleep => 10,
}
}
define nsxv::define_vmware_compute (
$availability_zone_name,
$vc_cluster,
$vc_host,
$vc_user,
$vc_password,
$service_name,
$target_node,
$datastore_regex = undef,
){
$uid = hiera('uid')
$current_node = "node-$uid"
$roles = hiera('roles')
if ($target_node == 'controllers' and ('primary-controller' in $roles or 'controller' in $roles)) {
service { "p_nova_compute_vmware_${availability_zone_name}-${service_name}":
ensure => running,
enable => true,
provider => 'pacemaker',
tag => 'vcenter_compute',
}
} elsif ($target_node == $current_node and 'compute-vmware' in $roles ) {
service { 'nova-compute':
ensure => running,
name => $::nova::params::compute_service_name,
enable => true,
tag => 'vcenter_compute',
}
}
}

View File

@ -0,0 +1,28 @@
class nsxv::repo_priority (
$plugin_name = 'nsxv',
$plugin_version = '1.0.0',
) {
if $operatingsystem == 'Ubuntu' {
include apt
$pref_file = "/etc/apt/preferences.d/${plugin_name}-${plugin_version}.pref"
$source_file = "/etc/apt/sources.list.d/${plugin_name}-${plugin_version}.list"
$target_file = "/etc/apt/sources.list.d/1-${plugin_name}.list"
file_line { 'change_priority_to_nsxv_repo ':
path => $pref_file,
line => 'Pin-Priority: 500',
match => '^\s*Pin-Priority.*$',
notify => Exec['apt_update']
}
exec { "rename_nsxv_repo_file":
path => '/usr/bin:/usr/sbin:/bin',
command => "mv -f ${source_file} ${target_file}",
onlyif => "test ! -e ${target_file}",
provider => shell,
tries => 3,
try_sleep => 10,
notify => Exec['apt_update']
}
}
}

View File

@ -0,0 +1,148 @@
[nsxv]<% settings = scope.lookupvar('settings') %>
# URL for NSXv manager
manager_uri = https://<%= settings['nsxv_manager_host'] %>
# (Optional) If true, the NSXv server certificate is not verified.
# If false, then the default CA truststore is used for verification.
# This option is ignored if "ca_file" is set.
insecure = <%= settings['nsxv_insecure'] %>
# (Optional) Specify a CA bundle file to use in verifying the NSXv server certificate.
<% if not settings['nsxv_insecure'] -%>
ca_file = <%= scope.lookupvar('ca_file') %>
<% else -%>
# ca_file =
<% end -%>
# User name for NSXv manager
user = <%= settings['nsxv_user'] %>
# Password for NSXv manager
password = <%= settings['nsxv_password'] %>
# (Required) Datacenter ID for Edge deployment
datacenter_moid = <%= settings['nsxv_datacenter_moid'] %>
# (Required) Cluster IDs for clusters containing OpenStack hosts, comma separated
cluster_moid = <%= settings['nsxv_cluster_moid'] %>
# (Optional) Resource pool ID for NSX Edge deployment
resource_pool_id = <%= settings['nsxv_resource_pool_id'] %>
# (Optional) Datastore ID for NSX Edge deployment
datastore_id = <%= settings['nsxv_datastore_id'] %>
# (Required) UUID of logic switch for physical network connectivity
external_network = <%= settings['nsxv_external_network'] %>
# (Optional) Asynchronous task status check interval
# default is 2000 (millisecond)
<% if not (settings['nsxv_task_status_check_interval']).to_s.strip.empty? -%>
task_status_check_interval = <%= settings['nsxv_task_status_check_interval'] %>
<% else -%>
# task_status_check_interval =
<% end -%>
# (Optional) Network scope ID for VXLAN virtual wires
<% if not (settings['nsxv_vdn_scope_id']).to_s.strip.empty? -%>
vdn_scope_id = <%= settings['nsxv_vdn_scope_id'] %>
<% else -%>
# vdn_scope_id =
<% end -%>
# (Optional) DVS ID for VLANS
<% if not (settings['nsxv_dvs_id']).to_s.strip.empty? -%>
dvs_id = <%= settings['nsxv_dvs_id'] %>
<% else -%>
# dvs_id =
<% end -%>
# (ListOpt) Define backup edge pool's management range with the four-tuple:
# <edge_type>:[edge_size]:<minimum_pooled_edges>:<maximum_pooled_edges>.
# edge_type:'service'(service edge) or 'vdr'(distributed edge).
# edge_size: 'compact', 'large'(by default), 'xlarge' or 'quadlarge'.
#
# By default, edge pool manager would manage service edge
# with compact&&large size and distributed edge with large size as following:
# backup_edge_pool = service:large:4:10,service:compact:4:10,vdr:large:4:10
<% if not (settings['nsxv_backup_edge_pool']).to_s.strip.empty? -%>
backup_edge_pool = <%= settings['nsxv_backup_edge_pool'] %>
<% else -%>
# backup_edge_pool =
<% end -%>
# (Optional) Maximum number of sub interfaces supported per vnic in edge
# default is 20
<% if not (settings['nsxv_maximum_tunnels_per_vnic']).to_s.strip.empty? -%>
maximum_tunnels_per_vnic = <%= settings['nsxv_maximum_tunnels_per_vnic'] %>
<% else -%>
# maximum_tunnels_per_vnic =
<% end -%>
# Maximum number of API retries
<% if not (settings['nsxv_retries']).to_s.strip.empty? -%>
retries = <%= settings['nsxv_retries'] %>
<% else -%>
# retries =
<% end -%>
# (Optional) Network ID for management network connectivity
<% if not (settings['nsxv_mgt_net_moid']).to_s.strip.empty? -%>
mgt_net_moid = <%= settings['nsxv_mgt_net_moid'] %>
<% else -%>
# mgt_net_moid =
<% end -%>
# (Optional) Management network IP address for metadata proxy
<% if not (settings['nsxv_mgt_net_proxy_ips']).to_s.strip.empty? -%>
mgt_net_proxy_ips = <%= settings['nsxv_mgt_net_proxy_ips'] %>
<% else -%>
# mgt_net_proxy_ips =
<% end -%>
# (Optional) Management network netmask for metadata proxy
<% if not (settings['nsxv_mgt_net_proxy_netmask']).to_s.strip.empty? -%>
mgt_net_proxy_netmask = <%= settings['nsxv_mgt_net_proxy_netmask'] %>
<% else -%>
# mgt_net_proxy_netmask =
<% end -%>
# (Optional) Management network default gateway for metadata proxy
<% if not (settings['nsxv_mgt_net_default_gateway']).to_s.strip.empty? -%>
mgt_net_default_gateway = <%= settings['nsxv_mgt_net_default_gateway'] %>
<% else -%>
# mgt_net_default_gateway =
<% end -%>
# (Optional) IP addresses used by Nova metadata service
nova_metadata_ips = <%= scope.lookupvar('nova_metadata_ips') %>
# (Optional) TCP Port used by Nova metadata server
nova_metadata_port = <%= scope.lookupvar('nova_metadata_port') %>
# (Optional) Shared secret to sign metadata requests
metadata_shared_secret = <%= scope.lookupvar('metadata_shared_secret') %>
# (Optional) Indicates if Nsxv spoofguard component is used to implement
# port-security feature.
spoofguard_enabled = <%= settings['nsxv_spoofguard_enabled'] %>
# (ListOpt) Ordered list of router_types to allocate as tenant routers.
# It limits the router types Nsxv can support for tenants
# distributed: router is supported by distributed edge at the backend.
# shared: multiple routers shared one same service edge at the backend.
# exclusive: router exclusivly occupy one service edge at the backend.
# Nsxv would select the first availabe router type from tenant_router_types
# list if router-type is not specified.
# If tenant define the router type with "--distributed",
# "--router_type exclusive" or "--router_type shared", Nsxv would verify that
# the router type is in tenant_router_types.
# Admin supports all these three router types
<% if not (settings['nsxv_tenant_router_types']).to_s.strip.empty? -%>
tenant_router_types = <%= settings['nsxv_tenant_router_types'] %>
<% else -%>
# tenant_router_types =
<% end -%>
# Enable HA for NSX Edges
edge_ha = <%= settings['nsxv_edge_ha'] %>

198
environment_config.yaml Normal file
View File

@ -0,0 +1,198 @@
attributes:
# Show only if vcenter used
metadata:
restrictions:
- condition: 'settings:common.use_vcenter.value == false'
action: 'hide'
nsxv_manager_host:
value: ''
label: 'NSX Manager hostname (or IP)'
description: ''
weight: 5
type: 'text'
regex:
source: '^.+$'
error: 'Hostname must be specified'
nsxv_user:
value: ''
label: 'NSX Manager user'
description: ''
weight: 10
type: 'text'
regex:
source: '^.+$'
error: 'You must specify the user name'
nsxv_password:
value: ''
label: 'NSX Manager password'
description: ''
weight: 15
type: 'password'
regex:
source: '^.+$'
error: 'You must specify the password'
nsxv_datacenter_moid:
value: ''
label: 'Datacenter MoRef ID'
description: 'Datacenter MoRef ID for Edge deployment, e.g. datacenter-126'
weight: 20
type: 'text'
regex:
source: '^[a-z]+-[a-z0-9]+$'
error: 'Invalid datacenter MoRef ID'
nsxv_cluster_moid:
value: ''
label: 'Cluster MoRef IDs for OpenStack VMs'
description: 'Comma separated cluster MoRef IDs for OpenStack VMs, e.g. domain-c133,domain-c134'
weight: 25
type: 'text'
regex:
source: '^(?:[a-z]+-[a-z0-9]+)(?:,[a-z]+-[a-z0-9]+)*'
error: 'Invalid cluster MoRef IDs'
nsxv_resource_pool_id:
value: ''
label: 'Resource pool MoRef ID'
description: 'Resource pool MoRef ID for NSX Edge nodes deployment'
weight: 35
type: 'text'
regex:
source: '^[a-z]+-[a-z0-9]+$'
error: 'Invalid resource pool MoRef ID'
nsxv_datastore_id:
value: ''
label: 'Datastore MoRef ID'
description: 'Datastore MoRef ID for NSX Edge nodes deployment'
weight: 40
type: 'text'
regex:
source: '^[a-z]+-[a-z0-9]+$'
error: 'Invalid datastore MoRef ID'
nsxv_external_network:
value: ''
label: 'External portgroup MoRef ID'
description: 'External portgroup MoRef ID for NSX Edge physical connectivity'
weight: 45
type: 'text'
regex:
source: '^[a-z]+-[a-z0-9]+$'
error: 'Invalid portgroup MoRef ID'
nsxv_vdn_scope_id:
value: ''
label: 'Transport zone MoRef ID'
description: 'Transport zone MoRef ID for VXLAN networks'
weight: 50
type: 'text'
nsxv_dvs_id:
value: ''
label: 'Distributed virtual switch MoRef ID'
description: 'DVS MoRef ID connected to Edge cluster'
weight: 55
type: 'text'
nsxv_backup_edge_pool:
value: ''
label: 'NSX backup Edge pool'
description: 'Define backup edge pools management range with the four-tuple: <edge_type>:[edge_size]:<minimum_pooled_edges>:<maximum_pooled_edges>'
weight: 60
type: 'text'
regex:
source: '^(?:(?:service|vdr):(?:compact|large|xlarge|quadlarge):[0-9]+:[0-9]+)(?:,(?:service|vdr):(?:compact|large|xlarge|quadlarge):[0-9]+:[0-9]+)*$'
error: 'Invalid Edge pool'
nsxv_edge_ha:
value: true
label: 'Enable HA for NSX Edges'
description: 'Deploy NSX Edges in HA pair'
weight: 65
type: 'checkbox'
nsxv_insecure:
value: false
label: 'Verify NSX Manager certificate'
description: 'If true, the NSXv server certificate is not verified'
weight: 70
type: 'checkbox'
restrictions:
- condition: 'settings:nsxv.nsxv_additional.value == false'
action: 'hide'
nsxv_ca_file:
value: ''
label: 'CA certificate file'
description: 'Specify a CA certificate file to use in verifying NSX Manager certificate'
weight: 71
type: 'file'
restrictions:
- condition: 'settings:nsxv.nsxv_insecure.value == true'
action: 'hide'
nsxv_mgt_net_moid:
value: ''
label: 'Metadata portgroup MoRef ID'
description: 'Portgroup MoRef ID for metadata proxy management network'
weight: 80
type: 'text'
nsxv_mgt_net_proxy_ips:
value: ''
label: 'Metadata proxy IP addresses'
description: 'Management network IP address for metadata proxy, comma separated'
weight: 85
type: 'text'
nsxv_mgt_net_proxy_netmask:
value: ''
label: 'Management network netmask'
description: 'Management network netmask for metadata proxy'
weight: 90
type: 'text'
nsxv_mgt_net_default_gateway:
value: ''
label: 'Management network default gateway'
description: 'Management network default gateway for metadata proxy'
weight: 95
type: 'text'
nsxv_additional:
value: false
label: 'Additional settings'
description: ''
weight: 100
type: 'checkbox'
nsxv_task_status_check_interval:
value: ''
label: 'Task status check interval (millisecond)'
description: 'Asynchronous task status check interval'
weight: 105
type: 'text'
restrictions:
- condition: 'settings:nsxv.nsxv_additional.value == false'
action: 'hide'
nsxv_maximum_tunnels_per_vnic:
value: ''
label: 'Maximum tunnels per vnic'
description: 'Maximum number of sub interfaces supported per vnic in edge'
weight: 110
type: 'text'
restrictions:
- condition: 'settings:nsxv.nsxv_additional.value == false'
action: 'hide'
nsxv_retries:
value: ''
label: 'API retries'
description: 'Maximum number of API retries'
weight: 115
type: 'text'
restrictions:
- condition: 'settings:nsxv.nsxv_additional.value == false'
action: 'hide'
nsxv_spoofguard_enabled:
value: false
label: 'Enable SpoofGuard'
description: 'Indicates if NSXv SpoofGuard component is used to implement port-security feature'
weight: 120
type: 'checkbox'
restrictions:
- condition: 'settings:nsxv.nsxv_additional.value == false'
action: 'hide'
nsxv_tenant_router_types:
value: ''
label: 'Tenant router types'
description: 'Ordered list of router types to allocate as tenant routers'
weight: 125
type: 'text'
restrictions:
- condition: 'settings:nsxv.nsxv_additional.value == false'
action: 'hide'

25
metadata.yaml Normal file
View File

@ -0,0 +1,25 @@
# Plugin name
name: nsxv
# Human-readable name for your plugin
title: NSXv plugin
# Plugin version
version: 1.0.0
# Description
description: NSXv plugin for Fuel allows to integrate Mirantis OpenStack with VMware NSXv network virtualization platform.
# Required fuel version
fuel_version: ['7.0']
# The plugin is compatible with releases in the list
releases:
- os: ubuntu
version: 2015.1.0-7.0
mode: ['ha', 'multinode']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/ubuntu
# Version of plugin package
package_version: '2.0.0'
licenses: ['Apache 2.0']
authors: ['Artem Savinov, Mirantis', 'Igor Zinovik, Mirantis']
homepage: https://github.com/stackforge/fuel-plugin-nsxv
groups: ['network']

14
pre_build_hook Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# Add here any the actions which are required before plugin build
# like packages building, packages downloading from mirrors and so on.
# The script should return 0 if there were no errors.
set -eux
ROOT="$(dirname `readlink -f $0`)"
version=$(sed -rn 's/^version:\s*([0-9.])/\1/p' $ROOT/metadata.yaml)
name=$(sed -rn 's/^name:\s*(.*)/\1/p' $ROOT/metadata.yaml)
sed -i "s/NAME/$name/" $ROOT/deployment_scripts/puppet/manifests/repo-priority.pp
sed -i "s/VERSION/$version/" $ROOT/deployment_scripts/puppet/manifests/repo-priority.pp

81
tasks.yaml Normal file
View File

@ -0,0 +1,81 @@
- role: ['primary-controller','controller','compute-vmware']
stage: pre_deployment/4010
type: shell
parameters:
cmd: ./clean_overrides.sh
timeout: 30
- role: ['primary-controller','controller','compute-vmware']
stage: pre_deployment/4010
type: puppet
parameters:
puppet_manifest: puppet/manifests/repo-priority.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 120
- role: ['primary-controller','controller','compute-vmware']
stage: post_deployment/4010
type: puppet
parameters:
puppet_manifest: puppet/manifests/hiera-override.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 60
- role: ['primary-controller','controller','compute-vmware']
stage: post_deployment/4010
type: shell
parameters:
cmd: if [ -e /etc/hiera/override/plugins.yaml ]; then mv /etc/hiera/override/plugins.yaml /etc/hiera/override/plugins.yaml.nsxv ;fi ; ln -s /etc/hiera/override/plugins_nsxv.yaml /etc/hiera/override/plugins.yaml
timeout: 30
- role: ['primary-controller','controller']
stage: post_deployment/4010
type: puppet
parameters:
puppet_manifest: puppet/manifests/nsxv-config.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 300
- role: ['primary-controller']
stage: post_deployment/4010
type: puppet
parameters:
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/openstack-network/db.pp
puppet_modules: /etc/puppet/modules
timeout: 300
- role: ['primary-controller']
stage: post_deployment/4010
type: puppet
parameters:
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/openstack-network/keystone.pp
puppet_modules: /etc/puppet/modules
timeout: 300
- role: ['primary-controller','controller']
stage: post_deployment/4010
type: puppet
parameters:
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/openstack-haproxy/openstack-haproxy-neutron.pp
puppet_modules: /etc/puppet/modules
timeout: 300
- role: ['primary-controller','controller']
stage: post_deployment/4010
type: puppet
parameters:
puppet_manifest: puppet/manifests/neutron-install.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 900
- role: ['primary-controller','controller','compute-vmware']
stage: post_deployment/4010
type: puppet
parameters:
puppet_manifest: puppet/manifests/nova-config.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 300
- role: ['primary-controller','controller']
stage: post_deployment/4010
type: puppet
parameters:
puppet_manifest: puppet/manifests/disable-nova-network.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 300
- role: ['primary-controller','controller','compute-vmware']
stage: post_deployment/4010
type: shell
parameters:
cmd: if [ -e /etc/hiera/override/plugins.yaml.nsxv ]; then mv -f /etc/hiera/override/plugins.yaml.nsxv /etc/hiera/override/plugins.yaml; fi
timeout: 30