Retire repository

Fuel repositories are all retired in openstack namespace, retire
remaining fuel repos in x namespace since they are unused now.

This change removes all content from the repository and adds the usual
README file to point out that the repository is retired following the
process from
https://docs.openstack.org/infra/manual/drivers.html#retiring-a-project

See also
http://lists.openstack.org/pipermail/openstack-discuss/2019-December/011675.html

A related change is: https://review.opendev.org/699752 .

Change-Id: I2dbf54ef911c2c746544266c724a8e65aa29db4b
This commit is contained in:
Andreas Jaeger 2019-12-18 19:33:31 +01:00
parent 54656eddf2
commit 479fc6e294
525 changed files with 10 additions and 46133 deletions

37
.gitignore vendored
View File

@ -1,37 +0,0 @@
.DS_Store
.tox
.build
*.pyc
repositories/centos/*
repositories/ubuntu/*
deployment_scripts/puppet/modules/inifile
deployment_scripts/puppet/modules/stdlib
build.sh
*.rpm
logs
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
.idea
# Local example
example_local.py
# Local settings
local_settings.py
# Logs
sys_test.log

4
.gitmodules vendored
View File

@ -1,4 +0,0 @@
[submodule "plugin_test/fuel-qa"]
path = plugin_test/fuel-qa
url = https://git.openstack.org/openstack/fuel-qa
branch = stable/mitaka

176
LICENSE
View File

@ -1,176 +0,0 @@
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

View File

@ -1,21 +0,0 @@
Mirantis Fuel Contrail plugin
=============================
Compatible versions:
- Mirantis Fuel 9.2
- Juniper Contrail 3.2.0.0
How to build plugin:
- Install fuel plugin builder (fpb)
- Clone plugin repo and run fpb there:
git clone https://github.com/openstack/fuel-plugin-contrail
cd fuel-plugin-contrail/
fpb --build .
- Check if file contrail-5.1-5.1.0-1.noarch.rpm was created.

10
README.rst Normal file
View File

@ -0,0 +1,10 @@
This project is no longer maintained.
The contents of this repository are still available in the Git
source code management system. To see the contents of this
repository before it reached its end of life, please check out the
previous commit with "git checkout HEAD^1".
For any further questions, please email
openstack-discuss@lists.openstack.org or join #openstack-dev on
Freenode.

View File

@ -1,9 +0,0 @@
- name: 'network:neutron:contrail'
label: 'Contrail'
description: 'Contrail SDN networking'
bind: !!pairs
- "cluster:net_provider": "neutron"
- "cluster:net_segment_type": "tun"
compatible:
- name: 'hypervisor:kvm'
- name: 'hypervisor:qemu'

View File

@ -1,70 +0,0 @@
#!/usr/bin/env python
# Copyright 2016 Mirantis, Inc.
#
# 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.
#
# This scipr is used to genereta all TSN certificates per claster
#
# Example: $0 <env_id>
# Example: ./generate_tsn_certificates.py 1
#
# By pszypowicz@mirantis.com
import yaml
import sys, os
import logging
from fuelclient.objects import Environment
from subprocess import call
try:
cluster_id = sys.argv[1]
except Exception:
logging.warning('Provide cluster id as first parameter')
sys.exit(1)
env = Environment(cluster_id)
data = env.get_settings_data()
try:
tor_configurations = data['editable']['contrail']['metadata']['versions'][0]['tor_agents_configurations']['value']
except Exception:
logging.warning('Cannot read tor agents configuration')
sys.exit(2)
certificate_path = '/var/lib/fuel/certificates'
if not os.path.exists(certificate_path):
os.makedirs(certificate_path)
directory = certificate_path + '/' + cluster_id + '/'
#generate certificates ca
call(['ovs-pki','init','--dir',directory])
if not os.path.exists(directory + 'certs/'):
os.makedirs(directory + 'certs/')
tor_configurations_yaml = yaml.load(tor_configurations)
for i in tor_configurations_yaml:
#tor_agent path
tor_agent_directory = directory + 'certs/' + 'tor_agent_' + str(i)
if not os.path.exists(tor_agent_directory):
os.makedirs(tor_agent_directory)
call(['ovs-pki','req+sign','tor_agent_' + str(i),'--dir',directory],cwd=tor_agent_directory)
vtep_directory = directory + 'certs/' + 'vtep_' + str(i)
if not os.path.exists(vtep_directory):
os.makedirs(vtep_directory)
call(['ovs-pki','req+sign','vtep_' + str(i),'--dir',directory],cwd=vtep_directory)

View File

@ -1,22 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/common-repo.pp')
$settings = hiera('contrail', {})
$plugin_version = regsubst($settings['metadata']['plugin_version'], '..$' , '')
file { "/etc/apt/preferences.d/contrail-${plugin_version}.pref":
ensure => absent,
}

View File

@ -1,35 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/compute-hiera.pp')
# prevent to install and run open vSwitch on compute nodes
file { '/etc/hiera/plugins/contrail.yaml':
ensure => file,
} ->
file_line { '/etc/hiera/plugins/contrail.yaml':
path => '/etc/hiera/plugins/contrail.yaml',
line => ' use_ovs: false',
}
if roles_include('dpdk') {
file_line {'contrail-vrouter-override_ns':
path => '/etc/hiera.yaml',
line => ' - plugins/contrail-vrouter-override_ns',
after => ' !ruby/sym hierarchy:',
}
}

View File

@ -1,18 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-analytics-db-wait.pp')
include contrail
class { 'contrail::analytics_db_wait': }

View File

@ -1,18 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-analytics-provision.pp')
include contrail
class { 'contrail::provision::analytics': }

View File

@ -1,19 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-analytics.pp')
include contrail
class { 'contrail::analytics': }

View File

@ -1,19 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-compute-aggregate.pp')
include contrail
class { 'contrail::compute::aggregate': }

View File

@ -1,23 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-compute-dpdkonvf.pp')
include contrail
# Create virtual functions for DPDK VF
if $contrail::compute_dpdk_on_vf {
$sriov_hash = get_sriov_devices($contrail::phys_dev)
create_resources(contrail::create_vfs, $sriov_hash)
}

View File

@ -1,18 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-compute-firewall.pp')
include contrail
class { 'contrail::compute::firewall': }

View File

@ -1,18 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-compute-hugepages.pp')
include contrail
class { 'contrail::compute::hugepages': }

View File

@ -1,18 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-compute-netconfig-override.pp')
include contrail
class { 'contrail::compute::compute_netconfig_override': }

View File

@ -1,18 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-compute-network.pp')
include contrail
class { 'contrail::compute::network': }

View File

@ -1,18 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-compute-nova.pp')
include contrail
class { 'contrail::compute::nova': }

View File

@ -1,18 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-compute-override.pp')
include contrail
class { 'contrail::compute::override': }

View File

@ -1,18 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-compute-provision.pp')
include contrail
class { 'contrail::provision::compute': }

View File

@ -1,48 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-compute-repo.pp')
include contrail
apt::pin { 'contrail-main':
explanation => 'Set priority for common contrail packages',
priority => 200,
label => 'contrail',
}
if $contrail::compute_dpdk_enabled {
$configure_default_route = '/etc/puppet/modules/osnailyfacter/modular/netconfig/configure_default_route.pp'
$netconfig = '/etc/puppet/modules/osnailyfacter/modular/netconfig/netconfig.pp'
exec {'no_defualt_route_reconfigure':
command => "/bin/echo '#NOOP here. Modified by contrail plugin' > ${configure_default_route}",
}
exec {'no_netconfig':
path => '/usr/local/bin:/bin:/usr/bin/',
command => "/bin/echo '#NOOP here. Modified by contrail plugin' > ${netconfig}",
onlyif => 'dpkg -l | grep contrail-vrouter-dpdk-init'
}
$nova_params = '/etc/puppet/modules/nova/manifests/params.pp'
$libvirt_from_contrail = 'dpkg -l | grep libvirt0 | grep contrail'
exec {'libvirt name fix':
path => '/usr/local/bin:/bin:/usr/bin/',
command => "sed -i 's/libvirtd/libvirt-bin/g' ${nova_params}",
onlyif => $libvirt_from_contrail,
}
}

View File

@ -1,19 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-compute-vmware-pkg.pp')
include contrail
class { 'contrail::compute::vmware_pkg': }

View File

@ -1,18 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-compute-vmware-repo.pp')
include contrail
class { 'contrail::compute::vmware_repo': }

View File

@ -1,19 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-compute-vmware.pp')
include contrail
class { 'contrail::compute::vmware': }

View File

@ -1,18 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-compute-vrouter.pp')
include contrail
class { 'contrail::compute::vrouter': }

View File

@ -1,18 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-config-provision.pp')
include contrail
class { 'contrail::provision::config': }

View File

@ -1,19 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-config.pp')
include contrail
class { 'contrail::config': }
class { 'contrail::webui': }

View File

@ -1,18 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-control-provision.pp')
include contrail
class { 'contrail::provision::control': }

View File

@ -1,18 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-control.pp')
include contrail
class { 'contrail::control': }

View File

@ -1,19 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-controller-aggregate.pp')
include contrail
class { 'contrail::controller::aggregate': }

View File

@ -1,18 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-db-provision.pp')
include contrail
class { 'contrail::provision::db': }

View File

@ -1,18 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-db.pp')
include contrail
class { 'contrail::database': }

View File

@ -1,18 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-tsn-provision.pp')
include contrail
class { 'contrail::provision::tsn': }

View File

@ -1,18 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-utils.pp')
include contrail
class { 'contrail::utils': }

View File

@ -1,18 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-vmware.pp')
include contrail
class { 'contrail::contrail_vmware': }

View File

@ -1,19 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/contrail-webui')
include ::contrail
class { '::contrail::contrail_webui': }

View File

@ -1,18 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/controller-config.pp')
include contrail
class { 'contrail::controller': }

View File

@ -1,24 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/controller-hiera-post.pp')
include contrail
# Post-install
# Create predefined_networks for OSTF-nets in controller-provision.pp
file { '/etc/hiera/plugins/contrail.yaml':
ensure => file,
content => template('contrail/plugins.yaml.erb'),
}

View File

@ -1,23 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/controller-hiera-pre.pp')
# Pre-deploy
# Empty predefined_networks to skip OSTF nets creation
# in openstack-network-controller.pp
file { '/etc/hiera/plugins/contrail.yaml':
ensure => file,
content => 'neutron_config: { predefined_networks: [] }',
}

View File

@ -1,18 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/controller-provision.pp')
include contrail
class { 'contrail::provision::controller': }

View File

@ -1,19 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/controller-scheduler.pp')
include contrail
class { 'contrail::controller::scheduler': }

View File

@ -1,18 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/controller-vip.pp')
include contrail
class { 'contrail::vip': }

View File

@ -1,18 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('MODULAR: contrail/reconfigure-contrail-tsn-vrouter.pp')
include contrail
class { 'contrail::tsn': }

View File

@ -1,3 +0,0 @@
Package: *
Pin: release l=contrail
Pin-Priority: 1200

View File

@ -1,4 +0,0 @@
sun-java6-plugin shared/accepted-sun-dlj-v1-1 boolean true
sun-java6-bin shared/accepted-sun-dlj-v1-1 boolean true
debconf shared/accepted-oracle-license-v1-1 select true
debconf shared/accepted-oracle-license-v1-1 seen true

View File

@ -1,41 +0,0 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: fixup-vrouter
# Required-Start: $network contrail-vrouter-agent
# Required-Stop: $network contrail-vrouter-agent
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: fixup-vrouter
# Description: This file starts opencontrail vrouter fixup for kernels > 3.13.0-62
#
### END INIT INFO
# Copyright 2015 Mirantis, Inc.
#
# 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.
case "$1" in
start)
sleep 10
for i in `ip link | egrep 'pkt[0-9]' | awk -F': ' '{print $2}'`; do
ip link set dev $i up
done
;;
stop)
exit 0
;;
*)
echo "Usage: fixup-vrouter {start|stop}" >&2
exit 3
;;
esac

View File

@ -1,442 +0,0 @@
#
# This is the "master security properties file".
#
# In this file, various security properties are set for use by
# java.security classes. This is where users can statically register
# Cryptography Package Providers ("providers" for short). The term
# "provider" refers to a package or set of packages that supply a
# concrete implementation of a subset of the cryptography aspects of
# the Java Security API. A provider may, for example, implement one or
# more digital signature algorithms or message digest algorithms.
#
# Each provider must implement a subclass of the Provider class.
# To register a provider in this master security properties file,
# specify the Provider subclass name and priority in the format
#
# security.provider.<n>=<className>
#
# This declares a provider, and specifies its preference
# order n. The preference order is the order in which providers are
# searched for requested algorithms (when no specific provider is
# requested). The order is 1-based; 1 is the most preferred, followed
# by 2, and so on.
#
# <className> must specify the subclass of the Provider class whose
# constructor sets the values of various properties that are required
# for the Java Security API to look up the algorithms or other
# facilities implemented by the provider.
#
# There must be at least one provider specification in java.security.
# There is a default provider that comes standard with the JDK. It
# is called the "SUN" provider, and its Provider subclass
# named Sun appears in the sun.security.provider package. Thus, the
# "SUN" provider is registered via the following:
#
# security.provider.1=sun.security.provider.Sun
#
# (The number 1 is used for the default provider.)
#
# Note: Providers can be dynamically registered instead by calls to
# either the addProvider or insertProviderAt method in the Security
# class.
#
# List of providers and their preference orders (see above):
#
security.provider.1=sun.security.provider.Sun
security.provider.2=sun.security.rsa.SunRsaSign
security.provider.3=sun.security.ec.SunEC
security.provider.4=com.sun.net.ssl.internal.ssl.Provider
security.provider.5=com.sun.crypto.provider.SunJCE
security.provider.6=sun.security.jgss.SunProvider
security.provider.7=com.sun.security.sasl.Provider
security.provider.8=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.9=sun.security.smartcardio.SunPCSC
# the NSS security provider was not enabled for this build; it can be enabled
# if NSS (libnss3) is available on the machine. The nss.cfg file may need
# editing to reflect the location of the NSS installation.
security.provider.10=sun.security.pkcs11.SunPKCS11 ${java.home}/lib/security/nss.cfg
#
# Select the source of seed data for SecureRandom. By default an
# attempt is made to use the entropy gathering device specified by
# the securerandom.source property. If an exception occurs when
# accessing the URL then the traditional system/thread activity
# algorithm is used.
#
# On Solaris and Linux systems, if file:/dev/urandom is specified and it
# exists, a special SecureRandom implementation is activated by default.
# This "NativePRNG" reads random bytes directly from /dev/urandom.
#
# On Windows systems, the URLs file:/dev/random and file:/dev/urandom
# enables use of the Microsoft CryptoAPI seed functionality.
#
securerandom.source=file:/dev/urandom
#
# The entropy gathering device is described as a URL and can also
# be specified with the system property "java.security.egd". For example,
# -Djava.security.egd=file:/dev/urandom
# Specifying this system property will override the securerandom.source
# setting.
#
# Class to instantiate as the javax.security.auth.login.Configuration
# provider.
#
login.configuration.provider=com.sun.security.auth.login.ConfigFile
#
# Default login configuration file
#
#login.config.url.1=file:${user.home}/.java.login.config
#
# Class to instantiate as the system Policy. This is the name of the class
# that will be used as the Policy object.
#
policy.provider=sun.security.provider.PolicyFile
# The default is to have a single system-wide policy file,
# and a policy file in the user's home directory.
policy.url.1=file:${java.home}/lib/security/java.policy
policy.url.2=file:${user.home}/.java.policy
# whether or not we expand properties in the policy file
# if this is set to false, properties (${...}) will not be expanded in policy
# files.
policy.expandProperties=true
# whether or not we allow an extra policy to be passed on the command line
# with -Djava.security.policy=somefile. Comment out this line to disable
# this feature.
policy.allowSystemProperty=true
# whether or not we look into the IdentityScope for trusted Identities
# when encountering a 1.1 signed JAR file. If the identity is found
# and is trusted, we grant it AllPermission.
policy.ignoreIdentityScope=false
#
# Default keystore type.
#
keystore.type=jks
#
# List of comma-separated packages that start with or equal this string
# will cause a security exception to be thrown when
# passed to checkPackageAccess unless the
# corresponding RuntimePermission ("accessClassInPackage."+package) has
# been granted.
package.access=sun.,\
org.GNOME.Accessibility.,\
com.sun.xml.internal.,\
com.sun.imageio.,\
com.sun.istack.internal.,\
com.sun.jmx.,\
com.sun.naming.internal.,\
com.sun.proxy.,\
com.sun.corba.se.,\
com.sun.script.,\
com.sun.org.apache.bcel.internal.,\
com.sun.org.apache.regexp.internal.,\
com.sun.org.apache.xerces.internal.,\
com.sun.org.apache.xpath.internal.,\
com.sun.org.apache.xalan.internal.extensions.,\
com.sun.org.apache.xalan.internal.lib.,\
com.sun.org.apache.xalan.internal.res.,\
com.sun.org.apache.xalan.internal.templates.,\
com.sun.org.apache.xalan.internal.utils.,\
com.sun.org.apache.xalan.internal.xslt.,\
com.sun.org.apache.xalan.internal.xsltc.cmdline.,\
com.sun.org.apache.xalan.internal.xsltc.compiler.,\
com.sun.org.apache.xalan.internal.xsltc.trax.,\
com.sun.org.apache.xalan.internal.xsltc.util.,\
com.sun.org.apache.xml.internal.res.,\
com.sun.org.apache.xml.internal.serializer.utils.,\
com.sun.org.apache.xml.internal.utils.,\
com.sun.org.apache.xml.internal.security.,\
com.sun.org.glassfish.,\
org.jcp.xml.dsig.internal.,\
oracle.jrockit.jfr.
#
# List of comma-separated packages that start with or equal this string
# will cause a security exception to be thrown when
# passed to checkPackageDefinition unless the
# corresponding RuntimePermission ("defineClassInPackage."+package) has
# been granted.
#
# by default, none of the class loaders supplied with the JDK call
# checkPackageDefinition.
#
package.definition=sun.,\
com.sun.xml.internal.,\
com.sun.imageio.,\
com.sun.istack.internal.,\
com.sun.jmx.,\
com.sun.naming.internal.,\
com.sun.proxy.,\
com.sun.corba.se.,\
com.sun.script.,\
com.sun.org.apache.bcel.internal.,\
com.sun.org.apache.regexp.internal.,\
com.sun.org.apache.xerces.internal.,\
com.sun.org.apache.xpath.internal.,\
com.sun.org.apache.xalan.internal.extensions.,\
com.sun.org.apache.xalan.internal.lib.,\
com.sun.org.apache.xalan.internal.res.,\
com.sun.org.apache.xalan.internal.templates.,\
com.sun.org.apache.xalan.internal.utils.,\
com.sun.org.apache.xalan.internal.xslt.,\
com.sun.org.apache.xalan.internal.xsltc.cmdline.,\
com.sun.org.apache.xalan.internal.xsltc.compiler.,\
com.sun.org.apache.xalan.internal.xsltc.trax.,\
com.sun.org.apache.xalan.internal.xsltc.util.,\
com.sun.org.apache.xml.internal.res.,\
com.sun.org.apache.xml.internal.serializer.utils.,\
com.sun.org.apache.xml.internal.utils.,\
com.sun.org.apache.xml.internal.security.,\
com.sun.org.glassfish.,\
org.jcp.xml.dsig.internal.,\
oracle.jrockit.jfr.
#
# Determines whether this properties file can be appended to
# or overridden on the command line via -Djava.security.properties
#
security.overridePropertiesFile=true
#
# Determines the default key and trust manager factory algorithms for
# the javax.net.ssl package.
#
ssl.KeyManagerFactory.algorithm=SunX509
ssl.TrustManagerFactory.algorithm=PKIX
#
# The Java-level namelookup cache policy for successful lookups:
#
# any negative value: caching forever
# any positive value: the number of seconds to cache an address for
# zero: do not cache
#
# default value is forever (FOREVER). For security reasons, this
# caching is made forever when a security manager is set. When a security
# manager is not set, the default behavior in this implementation
# is to cache for 30 seconds.
#
# NOTE: setting this to anything other than the default value can have
# serious security implications. Do not set it unless
# you are sure you are not exposed to DNS spoofing attack.
#
#networkaddress.cache.ttl=-1
# The Java-level namelookup cache policy for failed lookups:
#
# any negative value: cache forever
# any positive value: the number of seconds to cache negative lookup results
# zero: do not cache
#
# In some Microsoft Windows networking environments that employ
# the WINS name service in addition to DNS, name service lookups
# that fail may take a noticeably long time to return (approx. 5 seconds).
# For this reason the default caching policy is to maintain these
# results for 10 seconds.
#
#
networkaddress.cache.negative.ttl=10
#
# Properties to configure OCSP for certificate revocation checking
#
# Enable OCSP
#
# By default, OCSP is not used for certificate revocation checking.
# This property enables the use of OCSP when set to the value "true".
#
# NOTE: SocketPermission is required to connect to an OCSP responder.
#
# Example,
# ocsp.enable=true
#
# Location of the OCSP responder
#
# By default, the location of the OCSP responder is determined implicitly
# from the certificate being validated. This property explicitly specifies
# the location of the OCSP responder. The property is used when the
# Authority Information Access extension (defined in RFC 3280) is absent
# from the certificate or when it requires overriding.
#
# Example,
# ocsp.responderURL=http://ocsp.example.net:80
#
# Subject name of the OCSP responder's certificate
#
# By default, the certificate of the OCSP responder is that of the issuer
# of the certificate being validated. This property identifies the certificate
# of the OCSP responder when the default does not apply. Its value is a string
# distinguished name (defined in RFC 2253) which identifies a certificate in
# the set of certificates supplied during cert path validation. In cases where
# the subject name alone is not sufficient to uniquely identify the certificate
# then both the "ocsp.responderCertIssuerName" and
# "ocsp.responderCertSerialNumber" properties must be used instead. When this
# property is set then those two properties are ignored.
#
# Example,
# ocsp.responderCertSubjectName="CN=OCSP Responder, O=XYZ Corp"
#
# Issuer name of the OCSP responder's certificate
#
# By default, the certificate of the OCSP responder is that of the issuer
# of the certificate being validated. This property identifies the certificate
# of the OCSP responder when the default does not apply. Its value is a string
# distinguished name (defined in RFC 2253) which identifies a certificate in
# the set of certificates supplied during cert path validation. When this
# property is set then the "ocsp.responderCertSerialNumber" property must also
# be set. When the "ocsp.responderCertSubjectName" property is set then this
# property is ignored.
#
# Example,
# ocsp.responderCertIssuerName="CN=Enterprise CA, O=XYZ Corp"
#
# Serial number of the OCSP responder's certificate
#
# By default, the certificate of the OCSP responder is that of the issuer
# of the certificate being validated. This property identifies the certificate
# of the OCSP responder when the default does not apply. Its value is a string
# of hexadecimal digits (colon or space separators may be present) which
# identifies a certificate in the set of certificates supplied during cert path
# validation. When this property is set then the "ocsp.responderCertIssuerName"
# property must also be set. When the "ocsp.responderCertSubjectName" property
# is set then this property is ignored.
#
# Example,
# ocsp.responderCertSerialNumber=2A:FF:00
#
# Policy for failed Kerberos KDC lookups:
#
# When a KDC is unavailable (network error, service failure, etc), it is
# put inside a blacklist and accessed less often for future requests. The
# value (case-insensitive) for this policy can be:
#
# tryLast
# KDCs in the blacklist are always tried after those not on the list.
#
# tryLess[:max_retries,timeout]
# KDCs in the blacklist are still tried by their order in the configuration,
# but with smaller max_retries and timeout values. max_retries and timeout
# are optional numerical parameters (default 1 and 5000, which means once
# and 5 seconds). Please notes that if any of the values defined here is
# more than what is defined in krb5.conf, it will be ignored.
#
# Whenever a KDC is detected as available, it is removed from the blacklist.
# The blacklist is reset when krb5.conf is reloaded. You can add
# refreshKrb5Config=true to a JAAS configuration file so that krb5.conf is
# reloaded whenever a JAAS authentication is attempted.
#
# Example,
# krb5.kdc.bad.policy = tryLast
# krb5.kdc.bad.policy = tryLess:2,2000
krb5.kdc.bad.policy = tryLast
# Algorithm restrictions for certification path (CertPath) processing
#
# In some environments, certain algorithms or key lengths may be undesirable
# for certification path building and validation. For example, "MD2" is
# generally no longer considered to be a secure hash algorithm. This section
# describes the mechanism for disabling algorithms based on algorithm name
# and/or key length. This includes algorithms used in certificates, as well
# as revocation information such as CRLs and signed OCSP Responses.
#
# The syntax of the disabled algorithm string is described as this Java
# BNF-style:
# DisabledAlgorithms:
# " DisabledAlgorithm { , DisabledAlgorithm } "
#
# DisabledAlgorithm:
# AlgorithmName [Constraint]
#
# AlgorithmName:
# (see below)
#
# Constraint:
# KeySizeConstraint
#
# KeySizeConstraint:
# keySize Operator DecimalInteger
#
# Operator:
# <= | < | == | != | >= | >
#
# DecimalInteger:
# DecimalDigits
#
# DecimalDigits:
# DecimalDigit {DecimalDigit}
#
# DecimalDigit: one of
# 1 2 3 4 5 6 7 8 9 0
#
# The "AlgorithmName" is the standard algorithm name of the disabled
# algorithm. See "Java Cryptography Architecture Standard Algorithm Name
# Documentation" for information about Standard Algorithm Names. Matching
# is performed using a case-insensitive sub-element matching rule. (For
# example, in "SHA1withECDSA" the sub-elements are "SHA1" for hashing and
# "ECDSA" for signatures.) If the assertion "AlgorithmName" is a
# sub-element of the certificate algorithm name, the algorithm will be
# rejected during certification path building and validation. For example,
# the assertion algorithm name "DSA" will disable all certificate algorithms
# that rely on DSA, such as NONEwithDSA, SHA1withDSA. However, the assertion
# will not disable algorithms related to "ECDSA".
#
# A "Constraint" provides further guidance for the algorithm being specified.
# The "KeySizeConstraint" requires a key of a valid size range if the
# "AlgorithmName" is of a key algorithm. The "DecimalInteger" indicates the
# key size specified in number of bits. For example, "RSA keySize <= 1024"
# indicates that any RSA key with key size less than or equal to 1024 bits
# should be disabled, and "RSA keySize < 1024, RSA keySize > 2048" indicates
# that any RSA key with key size less than 1024 or greater than 2048 should
# be disabled. Note that the "KeySizeConstraint" only makes sense to key
# algorithms.
#
# Note: This property is currently used by Oracle's PKIX implementation. It
# is not guaranteed to be examined and used by other implementations.
#
# Example:
# jdk.certpath.disabledAlgorithms=MD2, DSA, RSA keySize < 2048
#
#
jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024
# Algorithm restrictions for Secure Socket Layer/Transport Layer Security
# (SSL/TLS) processing
#
# In some environments, certain algorithms or key lengths may be undesirable
# when using SSL/TLS. This section describes the mechanism for disabling
# algorithms during SSL/TLS security parameters negotiation, including
# protocol version negotiation, cipher suites selection, peer authentication
# and key exchange mechanisms.
#
# Disabled algorithms will not be negotiated for SSL/TLS connections, even
# if they are enabled explicitly in an application.
#
# For PKI-based peer authentication and key exchange mechanisms, this list
# of disabled algorithms will also be checked during certification path
# building and validation, including algorithms used in certificates, as
# well as revocation information such as CRLs and signed OCSP Responses.
# This is in addition to the jdk.certpath.disabledAlgorithms property above.
#
# See the specification of "jdk.certpath.disabledAlgorithms" for the
# syntax of the disabled algorithm string.
#
# Note: This property is currently used by Oracle's JSSE implementation.
# It is not guaranteed to be examined and used by other implementations.
#
# Example:
# jdk.tls.disabledAlgorithms=MD5, SSLv3, DSA, RSA keySize < 2048
# jdk.tls.disabledAlgorithms=SSLv3

View File

@ -1,94 +0,0 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You 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.
kafka.logs.dir=logs
log4j.rootLogger=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.appender.kafkaAppender=org.apache.log4j.RollingFileAppender
log4j.appender.kafkaAppender.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.kafkaAppender.File=${kafka.logs.dir}/server.log
log4j.appender.kafkaAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.kafkaAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.appender.stateChangeAppender=org.apache.log4j.RollingFileAppender
log4j.appender.stateChangeAppender.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.stateChangeAppender.File=${kafka.logs.dir}/state-change.log
log4j.appender.stateChangeAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.stateChangeAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.appender.requestAppender=org.apache.log4j.RollingFileAppender
log4j.appender.requestAppender.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.requestAppender.File=${kafka.logs.dir}/kafka-request.log
log4j.appender.requestAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.requestAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.appender.cleanerAppender=org.apache.log4j.RollingFileAppender
log4j.appender.cleanerAppender.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.cleanerAppender.File=${kafka.logs.dir}/log-cleaner.log
log4j.appender.cleanerAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.cleanerAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.appender.controllerAppender=org.apache.log4j.RollingFileAppender
log4j.appender.controllerAppender.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.controllerAppender.File=${kafka.logs.dir}/controller.log
log4j.appender.controllerAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.controllerAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
log4j.appender.authorizerAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.authorizerAppender.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.authorizerAppender.File=${kafka.logs.dir}/kafka-authorizer.log
log4j.appender.authorizerAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.authorizerAppender.layout.ConversionPattern=[%d] %p %m (%c)%n
# Turn on all our debugging info
#log4j.logger.kafka.producer.async.DefaultEventHandler=DEBUG, kafkaAppender
#log4j.logger.kafka.client.ClientUtils=DEBUG, kafkaAppender
#log4j.logger.kafka.perf=DEBUG, kafkaAppender
#log4j.logger.kafka.perf.ProducerPerformance$ProducerThread=DEBUG, kafkaAppender
#log4j.logger.org.I0Itec.zkclient.ZkClient=DEBUG
log4j.logger.kafka=INFO, kafkaAppender
log4j.logger.kafka.network.RequestChannel$=WARN, requestAppender
log4j.additivity.kafka.network.RequestChannel$=false
#log4j.logger.kafka.network.Processor=TRACE, requestAppender
#log4j.logger.kafka.server.KafkaApis=TRACE, requestAppender
#log4j.additivity.kafka.server.KafkaApis=false
log4j.logger.kafka.request.logger=WARN, requestAppender
log4j.additivity.kafka.request.logger=false
log4j.logger.kafka.controller=TRACE, controllerAppender
log4j.additivity.kafka.controller=false
log4j.logger.kafka.log.LogCleaner=INFO, cleanerAppender
log4j.additivity.kafka.log.LogCleaner=false
log4j.logger.state.change.logger=TRACE, stateChangeAppender
log4j.additivity.state.change.logger=false
#Change this to debug to get the actual audit log for authorizer.
log4j.logger.kafka.authorizer.logger=WARN, authorizerAppender
log4j.additivity.kafka.authorizer.logger=false
log4j.appender.kafkaAppender.MaxBackupIndex=10
log4j.appender.stateChangeAppender.MaxBackupIndex=10
log4j.appender.requestAppender.MaxBackupIndex=10
log4j.appender.cleanerAppender.MaxBackupIndex=10
log4j.appender.controllerAppender.MaxBackupIndex=10

View File

@ -1,27 +0,0 @@
# Set root logger level to DEBUG and its only appender to CONSOLE
log4j.rootLogger=TRACE, CONSOLE
log4j.error
log4j.logger.de.fhhannover.inform.irond.proc=TRACE, A1, A2
log4j.additivity.de.fhhannover.inform.irond.proc=false
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %x - %m%n
log4j.appender.A2=org.apache.log4j.FileAppender
log4j.appender.A2.File=/var/log/contrail/ifmap-server.log
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=%d [%t] %-5p %x - %m%n
log4j.logger.de.fhhannover.inform.irond.rawrequests=TRACE, A3
log4j.additivity.de.fhhannover.inform.irond.rawrequests=false
log4j.appender.A3=org.apache.log4j.FileAppender
log4j.appender.A3.file=irond_raw.log
log4j.appender.A3.layout=org.apache.log4j.PatternLayout
log4j.appender.A3.layout.ConversionPattern=%d %-5p %x - %m%n
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern=%-8r [%t] %-5p %C{1} %x - %m%n

View File

@ -1,42 +0,0 @@
<%-
contrail_data=scope.function_hiera(['contrail'])
-%>
[DEFAULT]
compute_driver=nova.virt.vmwareapi.contrailVCDriver
log_file=nova-compute-vmware-<%= @availability_zone_name %>-<%= @service_name %>.log
host=<%= @availability_zone_name %>-<%= @service_name %>
reserved_host_memory_mb = 0
force_config_drive=False
[vmware]
cache_prefix=$host
<% @vc_cluster.split(',').map(&:strip).each do |cluster_name| -%>
cluster_name=<%= cluster_name %>
<% end %>
vcenter_dvswitch=<%= contrail_data['dvs_internal'] %>
host_ip=<%= @vc_host %>
host_username=<%= @vc_user %>
host_password=<%= @vc_password %>
insecure=True
api_retry_count=<%= @api_retry_count %>
maximum_objects=<%= @maximum_objects %>
task_poll_interval=<%= @task_poll_interval %>
<% if @datastore_regex and !@datastore_regex.empty? -%>
datastore_regex=<%= @datastore_regex %>
<% end -%>
<% if @vlan_interface and !@vlan_interface.empty? -%>
vlan_interface=<%= @vlan_interface %>
<% end -%>
use_linked_clone=<%= @use_linked_clone %>
<% if @wsdl_location -%>
wsdl_location=<%= @wsdl_location %>
<% end -%>
[libvirt]
virt_type=vmwareapi

View File

@ -1,453 +0,0 @@
From c459180f790ef654c0c790930f0371b90758ba16 Mon Sep 17 00:00:00 2001
From: Michal Dubiel <md@semihalf.com>
Date: Tue, 8 Sep 2015 17:05:16 +0200
Subject: [PATCH] Add config option forcing hugepages memory backing
Setting 'libvirt_use_huge_pages' config option in nova.conf will result
in using QEMU's -mem-path option while spawning a VM.
This is necessary for DPDK vRouter support on Juno.
Change-Id: I2e8337f47d10689816c46971a97a6214e0322399
Partial-Bug: #1491525
Add support for vhost-user into vrouter vif driver
This is necessary for DPDK vRouter support on Juno.
Change-Id: I2e37292f699356da095562ec874dfdb8fa35e418
Closes-Bug: #1491525
libvirt: Support for 'shared' mapping of huge pages
Change imported from the Liberty's commit:
Commit: 25df2fae79c03a0335413e7a5de6b54c127e7926
Author: Daniel P. Berrange <berrange@redhat.com>
Subject: libvirt: mark NUMA huge page mappings as shared access
Change-Id: Ibf1a0cad939e5ba290af5a0e7c16ff23697b1ec5
Partial-Bug: #1504031
libvirt, vhostuser: Add support for OpenContrail vRouter
OpenContrail vRouter can be used as a userspace DPDK based virtual switch
application that uses QEMU's vhost-user interface types. This requires adding
support for vRouter in {plug, unplug}_vhostuser() methods similarly as it is
done for OVS.
This reverts commits:
- 70c23c2601c46f63d8e631044b81992088795698 "Add support for vhost-user into
vrouter vif driver"
- 396601daa1be3e58876ecdbb7dbbc23f4d8c8d2b "Add config option forcing hugepages
memory backing"
Change-Id: I3387795b59dd86838fb5c8ce6a447d5173e55bdb
Partial-Bug: #1504031
Handle exception in plug and unplug functions for vrouter and vhostuser
During delete of nova VM, linux_net functions like
delete_net_dev/create_tap_dev/create_ovs_vif_port/delete_ovs_vif_port can raise
ProcessExecutionError while executing system command. Handle these exceptions
Change-Id: I59e4160ee5404946d48139219a7156b918c2bee7
Closes-Bug: #1538207
Handle new command line options of vrouter-port-control
New command line options --vif_type and --vhostuser_socket has been added to
vrouter-port-control tool. Nova has to pass them appropriately.
Change-Id: Idde377f2cf72e35624befec09dd11c5f86f57ed8
Related-Bug: #1541952
---
nova/network/model.py | 3 +
nova/tests/unit/virt/libvirt/test_vif.py | 94 +++++++++++++++++++++++++++++-
nova/virt/libvirt/config.py | 4 ++
nova/virt/libvirt/driver.py | 43 +++++++++++++-
nova/virt/libvirt/vif.py | 99 ++++++++++++++++++++++----------
5 files changed, 210 insertions(+), 33 deletions(-)
diff --git a/nova/network/model.py b/nova/network/model.py
index fb9e009..2e1e437 100644
--- a/nova/network/model.py
+++ b/nova/network/model.py
@@ -64,6 +64,9 @@ VIF_DETAILS_VHOSTUSER_SOCKET = 'vhostuser_socket'
# Specifies whether vhost-user socket should be plugged
# into ovs bridge. Valid values are True and False
VIF_DETAILS_VHOSTUSER_OVS_PLUG = 'vhostuser_ovs_plug'
+# Specifies whether vhost-user mode should be used by vrouter.
+# Valid values are True and False
+VIF_DETAILS_VHOSTUSER_VROUTER_PLUG = 'vhostuser_vrouter_plug'
# Define supported virtual NIC types. VNIC_TYPE_DIRECT and VNIC_TYPE_MACVTAP
# are used for SR-IOV ports
diff --git a/nova/tests/unit/virt/libvirt/test_vif.py b/nova/tests/unit/virt/libvirt/test_vif.py
index 612efa3..1748b25 100644
--- a/nova/tests/unit/virt/libvirt/test_vif.py
+++ b/nova/tests/unit/virt/libvirt/test_vif.py
@@ -295,6 +295,16 @@ class LibvirtVifTestCase(test.NoDBTestCase):
ovs_interfaceid='aaa-bbb-ccc'
)
+ vif_vhostuser_vrouter = network_model.VIF(id='vif-xxx-yyy-zzz',
+ address='ca:fe:de:ad:be:ef',
+ network=network_bridge,
+ type=network_model.VIF_TYPE_VHOSTUSER,
+ details = {network_model.VIF_DETAILS_VHOSTUSER_MODE: 'client',
+ network_model.VIF_DETAILS_VHOSTUSER_SOCKET:
+ '/tmp/usv-xxx-yyy-zzz',
+ network_model.VIF_DETAILS_VHOSTUSER_VROUTER_PLUG: True},
+ )
+
vif_vhostuser_no_path = network_model.VIF(id='vif-xxx-yyy-zzz',
address='ca:fe:de:ad:be:ef',
network=network_bridge,
@@ -302,7 +312,8 @@ class LibvirtVifTestCase(test.NoDBTestCase):
details = {network_model.VIF_DETAILS_VHOSTUSER_MODE: 'client'}
)
- instance = objects.Instance(id=1, uuid='instance-uuid')
+ instance = objects.Instance(id=1, uuid='instance-uuid',
+ project_id=1, display_name='Instance 1')
bandwidth = {
'quota:vif_inbound_peak': '200',
@@ -1165,3 +1176,84 @@ class LibvirtVifTestCase(test.NoDBTestCase):
d = vif.LibvirtGenericVIFDriver()
d.unplug_vhostuser(None, self.vif_vhostuser_ovs)
delete_port.assert_has_calls(calls['delete_ovs_vif_port'])
+
+ def test_vhostuser_driver_vrouter(self):
+ d = vif.LibvirtGenericVIFDriver()
+ xml = self._get_instance_xml(d,
+ self.vif_vhostuser_vrouter)
+ node = self._get_node(xml)
+ self.assertEqual(node.get("type"),
+ network_model.VIF_TYPE_VHOSTUSER)
+
+ self._assertTypeEquals(node, network_model.VIF_TYPE_VHOSTUSER,
+ "source", "mode", "client")
+ self._assertTypeEquals(node, network_model.VIF_TYPE_VHOSTUSER,
+ "source", "path", "/tmp/usv-xxx-yyy-zzz")
+ self._assertTypeEquals(node, network_model.VIF_TYPE_VHOSTUSER,
+ "source", "type", "unix")
+ self._assertMacEquals(node, self.vif_vhostuser_vrouter)
+ self._assertModel(xml, network_model.VIF_MODEL_VIRTIO)
+
+ def test_vhostuser_vrouter_plug(self):
+ calls = {
+ '_vrouter_port_add': [mock.call(self.instance,
+ self.vif_vhostuser_vrouter)]
+ }
+ with mock.patch.object(vif.LibvirtGenericVIFDriver,
+ '_vrouter_port_add') as port_add:
+ d = vif.LibvirtGenericVIFDriver()
+ d.plug_vhostuser(self.instance, self.vif_vhostuser_vrouter)
+
+ port_add.assert_has_calls(calls['_vrouter_port_add'])
+
+ def test_vhostuser_vrouter_unplug(self):
+ calls = {
+ '_vrouter_port_delete': [mock.call(self.instance,
+ self.vif_vhostuser_vrouter)]
+ }
+ with mock.patch.object(vif.LibvirtGenericVIFDriver,
+ '_vrouter_port_delete') as delete_port:
+ d = vif.LibvirtGenericVIFDriver()
+ d.unplug_vhostuser(self.instance, self.vif_vhostuser_vrouter)
+
+ delete_port.assert_has_calls(calls['_vrouter_port_delete'])
+
+ def test_vrouter_port_add(self):
+ ip_addr = '0.0.0.0'
+ ip6_addr = None
+ ptype = 'NovaVMPort'
+ cmd_args = ("--oper=add --uuid=%s --instance_uuid=%s --vn_uuid=%s "
+ "--vm_project_uuid=%s --ip_address=%s --ipv6_address=%s"
+ " --vm_name=%s --mac=%s --tap_name=%s --port_type=%s "
+ "--tx_vlan_id=%d --rx_vlan_id=%d" %
+ (self.vif_vhostuser_vrouter['id'],
+ self.instance.uuid,
+ self.vif_vhostuser_vrouter['network']['id'],
+ self.instance.project_id, ip_addr, ip6_addr,
+ self.instance.display_name,
+ self.vif_vhostuser_vrouter['address'],
+ self.vif_vhostuser_vrouter['devname'], ptype, -1, -1))
+ calls = {
+ 'execute': [mock.call('vrouter-port-control', cmd_args,
+ run_as_root=True)]
+ }
+
+ with mock.patch.object(utils, 'execute') as execute_cmd:
+ d = vif.LibvirtGenericVIFDriver()
+ d._vrouter_port_add(self.instance, self.vif_vhostuser_vrouter)
+
+ execute_cmd.assert_has_calls(calls['execute'])
+
+ def test_vrouter_port_delete(self):
+ cmd_args = ("--oper=delete --uuid=%s" %
+ (self.vif_vhostuser_vrouter['id']))
+ calls = {
+ 'execute': [mock.call('vrouter-port-control', cmd_args,
+ run_as_root=True)]
+ }
+
+ with mock.patch.object(utils, 'execute') as execute_cmd:
+ d = vif.LibvirtGenericVIFDriver()
+ d._vrouter_port_delete(self.instance, self.vif_vhostuser_vrouter)
+
+ execute_cmd.assert_has_calls(calls['execute'])
diff --git a/nova/virt/libvirt/config.py b/nova/virt/libvirt/config.py
index d48abdc..94e7ca6 100644
--- a/nova/virt/libvirt/config.py
+++ b/nova/virt/libvirt/config.py
@@ -509,6 +509,7 @@ class LibvirtConfigGuestCPUNUMACell(LibvirtConfigObject):
self.id = None
self.cpus = None
self.memory = None
+ self.memAccess = None
def parse_dom(self, xmldoc):
if xmldoc.get("id") is not None:
@@ -517,6 +518,7 @@ class LibvirtConfigGuestCPUNUMACell(LibvirtConfigObject):
self.memory = int(xmldoc.get("memory"))
if xmldoc.get("cpus") is not None:
self.cpus = hardware.parse_cpu_spec(xmldoc.get("cpus"))
+ self.memAccess = xmldoc.get("memAccess")
def format_dom(self):
cell = super(LibvirtConfigGuestCPUNUMACell, self).format_dom()
@@ -528,6 +530,8 @@ class LibvirtConfigGuestCPUNUMACell(LibvirtConfigObject):
hardware.format_cpu_spec(self.cpus))
if self.memory is not None:
cell.set("memory", str(self.memory))
+ if self.memAccess is not None:
+ cell.set("memAccess", self.memAccess)
return cell
diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py
index 1cf6c89..48b21db 100644
--- a/nova/virt/libvirt/driver.py
+++ b/nova/virt/libvirt/driver.py
@@ -3424,7 +3424,8 @@ class LibvirtDriver(driver.ComputeDriver):
setattr(guest.cputune, name,
int(flavor.extra_specs[key]))
- def _get_cpu_numa_config_from_instance(self, instance_numa_topology):
+ def _get_cpu_numa_config_from_instance(self, instance_numa_topology,
+ wants_hugepages):
if instance_numa_topology:
guest_cpu_numa = vconfig.LibvirtConfigGuestCPUNUMA()
for instance_cell in instance_numa_topology.cells:
@@ -3432,6 +3433,20 @@ class LibvirtDriver(driver.ComputeDriver):
guest_cell.id = instance_cell.id
guest_cell.cpus = instance_cell.cpuset
guest_cell.memory = instance_cell.memory * units.Ki
+
+ # The vhost-user network backend requires file backed
+ # guest memory (ie huge pages) to be marked as shared
+ # access, not private, so an external process can read
+ # and write the pages.
+ #
+ # You can't change the shared vs private flag for an
+ # already running guest, and since we can't predict what
+ # types of NIC may be hotplugged, we have no choice but
+ # to unconditionally turn on the shared flag. This has
+ # no real negative functional effect on the guest, so
+ # is a reasonable approach to take
+ if wants_hugepages:
+ guest_cell.memAccess = "shared"
guest_cpu_numa.cells.append(guest_cell)
return guest_cpu_numa
@@ -3443,6 +3458,28 @@ class LibvirtDriver(driver.ComputeDriver):
'Invalid libvirt version %(version)s') % {'version': ver_})
return True
+ def _wants_hugepages(self, host_topology, instance_topology):
+ """Determine if the guest / host topology implies the
+ use of huge pages for guest RAM backing
+ """
+
+ if host_topology is None or instance_topology is None:
+ return False
+
+ avail_pagesize = [page.size_kb
+ for page in host_topology.cells[0].mempages]
+ avail_pagesize.sort()
+ # Remove smallest page size as that's not classed as a largepage
+ avail_pagesize = avail_pagesize[1:]
+
+ # See if we have page size set
+ for cell in instance_topology.cells:
+ if (cell.pagesize is not None and
+ cell.pagesize in avail_pagesize):
+ return True
+
+ return False
+
def _get_guest_numa_config(self, instance_numa_topology, flavor, pci_devs,
allowed_cpus=None):
"""Returns the config objects for the guest NUMA specs.
@@ -3483,9 +3520,11 @@ class LibvirtDriver(driver.ComputeDriver):
raise exception.NUMATopologyUnsupported()
topology = self._get_host_numa_topology()
+
# We have instance NUMA so translate it to the config class
guest_cpu_numa_config = self._get_cpu_numa_config_from_instance(
- instance_numa_topology)
+ instance_numa_topology,
+ self._wants_hugepages(topology, instance_numa_topology))
if not guest_cpu_numa_config:
# No NUMA topology defined for instance - let the host kernel deal
diff --git a/nova/virt/libvirt/vif.py b/nova/virt/libvirt/vif.py
index 2d79dea..f5b7803 100644
--- a/nova/virt/libvirt/vif.py
+++ b/nova/virt/libvirt/vif.py
@@ -535,25 +535,8 @@ class LibvirtGenericVIFDriver(object):
except processutils.ProcessExecutionError:
LOG.exception(_LE("Failed while plugging vif"), instance=instance)
- def plug_vhostuser(self, instance, vif):
- ovs_plug = vif['details'].get(
- network_model.VIF_DETAILS_VHOSTUSER_OVS_PLUG,
- False)
- if ovs_plug:
- iface_id = self.get_ovs_interfaceid(vif)
- port_name = os.path.basename(
- vif['details'][network_model.VIF_DETAILS_VHOSTUSER_SOCKET])
- linux_net.create_ovs_vif_port(self.get_bridge_name(vif),
- port_name, iface_id, vif['address'],
- instance.uuid)
- linux_net.ovs_set_vhostuser_port_type(port_name)
-
- def plug_vrouter(self, instance, vif):
- """Plug into Contrail's network port
-
- Bind the vif to a Contrail virtual port.
- """
- dev = self.get_vif_devname(vif)
+ @staticmethod
+ def _vrouter_port_add(instance, vif):
ip_addr = '0.0.0.0'
ip6_addr = None
subnets = vif['network']['subnets']
@@ -574,17 +557,60 @@ class LibvirtGenericVIFDriver(object):
if (cfg.CONF.libvirt.virt_type == 'lxc'):
ptype = 'NameSpacePort'
+ vif_type = 'Vrouter'
+ vhostuser_socket = ''
+ if vif['type'] == network_model.VIF_TYPE_VHOSTUSER:
+ vif_type = 'VhostUser'
+ vhostuser_socket = '--vhostuser_socket=%s' % \
+ vif['details'][network_model.VIF_DETAILS_VHOSTUSER_SOCKET]
+
cmd_args = ("--oper=add --uuid=%s --instance_uuid=%s --vn_uuid=%s "
"--vm_project_uuid=%s --ip_address=%s --ipv6_address=%s"
" --vm_name=%s --mac=%s --tap_name=%s --port_type=%s "
- "--tx_vlan_id=%d --rx_vlan_id=%d" % (vif['id'],
- instance.uuid, vif['network']['id'],
+ "--vif_type=%s %s --tx_vlan_id=%d --rx_vlan_id=%d" %
+ (vif['id'], instance.uuid, vif['network']['id'],
instance.project_id, ip_addr, ip6_addr,
instance.display_name, vif['address'],
- vif['devname'], ptype, -1, -1))
+ vif['devname'], ptype, vif_type, vhostuser_socket, -1, -1))
+
try:
- linux_net.create_tap_dev(dev)
utils.execute('vrouter-port-control', cmd_args, run_as_root=True)
+ except processutils.ProcessExecutionError as e:
+ raise exception.VirtualInterfacePlugException(_("Failed to create "
+ "the vRouter port with the command: vrouter-port-control %s" %
+ cmd_args))
+
+ def plug_vhostuser(self, instance, vif):
+ ovs_plug = vif['details'].get(
+ network_model.VIF_DETAILS_VHOSTUSER_OVS_PLUG,
+ False)
+ vrouter_plug = vif['details'].get(
+ network_model.VIF_DETAILS_VHOSTUSER_VROUTER_PLUG,
+ False)
+ try:
+ if ovs_plug:
+ iface_id = self.get_ovs_interfaceid(vif)
+ port_name = os.path.basename(
+ vif['details'][network_model.VIF_DETAILS_VHOSTUSER_SOCKET])
+ linux_net.create_ovs_vif_port(self.get_bridge_name(vif),
+ port_name, iface_id, vif['address'],
+ instance.uuid)
+ linux_net.ovs_set_vhostuser_port_type(port_name)
+
+ elif vrouter_plug:
+ self._vrouter_port_add(instance, vif)
+ except processutils.ProcessExecutionError:
+ LOG.exception(_LE("Failed while plugging vif"), instance=instance)
+
+ def plug_vrouter(self, instance, vif):
+ """Plug into Contrail's network port
+
+ Bind the vif to a Contrail virtual port.
+ """
+ dev = self.get_vif_devname(vif)
+ try:
+ linux_net.create_tap_dev(dev)
+ self._vrouter_port_add(instance, vif)
except processutils.ProcessExecutionError:
LOG.exception(_LE("Failed while plugging vif"), instance=instance)
@@ -741,15 +767,29 @@ class LibvirtGenericVIFDriver(object):
LOG.exception(_LE("Failed while unplugging vif"),
instance=instance)
+ @staticmethod
+ def _vrouter_port_delete(instance, vif):
+ cmd_args = ("--oper=delete --uuid=%s" % (vif['id']))
+ utils.execute('vrouter-port-control', cmd_args, run_as_root=True)
+
def unplug_vhostuser(self, instance, vif):
ovs_plug = vif['details'].get(
network_model.VIF_DETAILS_VHOSTUSER_OVS_PLUG,
False)
- if ovs_plug:
- port_name = os.path.basename(
- vif['details'][network_model.VIF_DETAILS_VHOSTUSER_SOCKET])
- linux_net.delete_ovs_vif_port(self.get_bridge_name(vif),
- port_name)
+ vrouter_plug = vif['details'].get(
+ network_model.VIF_DETAILS_VHOSTUSER_VROUTER_PLUG,
+ False)
+ try:
+ if ovs_plug:
+ port_name = os.path.basename(
+ vif['details'][network_model.VIF_DETAILS_VHOSTUSER_SOCKET])
+ linux_net.delete_ovs_vif_port(self.get_bridge_name(vif),
+ port_name)
+ elif vrouter_plug:
+ self._vrouter_port_delete(instance, vif)
+ except processutils.ProcessExecutionError:
+ LOG.exception(
+ _LE("Failed while unplugging vif"), instance=instance)
def unplug_vrouter(self, instance, vif):
"""Unplug Contrail's network port
@@ -757,9 +797,8 @@ class LibvirtGenericVIFDriver(object):
Unbind the vif from a Contrail virtual port.
"""
dev = self.get_vif_devname(vif)
- cmd_args = ("--oper=delete --uuid=%s" % (vif['id']))
try:
- utils.execute('vrouter-port-control', cmd_args, run_as_root=True)
+ self._vrouter_port_delete(instance, vif)
linux_net.delete_net_dev(dev)
except processutils.ProcessExecutionError:
LOG.exception(
--
2.5.0

View File

@ -1,4 +0,0 @@
#!/bin/bash
[ "$IFACE" != "vhost0" ] && exit 0
. /opt/contrail/bin/if-vhost0

View File

@ -1,15 +0,0 @@
visual=visual--1877135140-1
test=test--1870931913-1
test2=test2--1870931914-1
test3=test3--1870931915-1
api-server=api-server-1--0000000001-1
control-node-1=control-node-1--1870931921-1
control-node-2=control-node-1--1870931922-1
control-node-3=control-node-1--1870931923-1
control-node-4=control-node-1--1870931924-1
control-node-5=control-node-1--1870931925-1
control-node-6=control-node-1--1870931926-1
control-node-7=control-node-1--1870931927-1
control-node-8=control-node-1--1870931928-1
control-node-9=control-node-1--1870931929-1
control-node-10=control-node-10--1870931930-1

View File

@ -1,42 +0,0 @@
daemonize yes
pidfile /var/run/redis/redis-server.pid
port 6379
#bind 127.0.0.1
timeout 0
tcp-keepalive 0
loglevel notice
logfile /var/log/redis/redis-server.log
databases 16
#save 900 1
#save 300 10
#save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/lib/redis
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes

View File

@ -1,104 +0,0 @@
; Sample supervisor config file.
;
; For more information on the config file, please see:
; http://supervisord.org/configuration.html
;
; Note: shell expansion ("~" or "$HOME") is not supported. Environment
; variables can be expanded using this syntax: "%(ENV_HOME)s".
[unix_http_server]
file=/var/run/supervisord_config.sock ; (the path to the socket file)
chmod=0700 ; socket file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default
;port=127.0.0.1:9001 ; Port for analytics (ip_address:port specifier, *:port for all iface)
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
[supervisord]
logfile=/var/log/contrail/supervisord-config.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=3 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/var/run/supervisord-config.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=65535 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
;umask=022 ; (process file creation umask;default 022)
;user=chrism ; (default is current user, required if root)
;identifier=supervisor ; (supervisord identifier, default is 'supervisor')
;directory=/tmp ; (default is not to cd during start)
nocleanup=true ; (don't clean up tempfiles at start;default false)
childlogdir=/var/log/contrail ; ('AUTO' child log dir, default $TEMP)
;environment=KEY=value ; (key value pairs to add to environment)
;strip_ansi=false ; (strip ansi escape codes in logs; def. false)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisord_config.sock ; use a unix:// URL for a unix socket
;serverurl=http://127.0.0.1:9004 ; use an http:// url to specify an inet socket
;username=chris ; should be same as http_username if set
;password=123 ; should be same as http_password if set
;prompt=mysupervisor ; cmd line prompt (default "supervisor")
;history_file=~/.sc_history ; use readline history if available
; The below sample program section shows all possible program subsection values,
; create one or more 'real' program: sections to be able to control them under
; supervisor.
;[program:theprogramname]
;command=/bin/cat ; the program (relative uses PATH, can take args)
;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
;numprocs=1 ; number of processes copies to start (def 1)
;directory=/tmp ; directory to cwd to before exec (def no cwd)
;umask=022 ; umask for process (default None)
;priority=999 ; the relative start priority (default 999)
;autostart=true ; start at supervisord start (default: true)
;autorestart=unexpected ; whether/when to restart (default: unexpected)
;startsecs=1 ; number of secs prog must stay running (def. 1)
;startretries=3 ; max # of serial start failures (default 3)
;exitcodes=0,2 ; 'expected' exit codes for process (default 0,2)
;stopsignal=QUIT ; signal used to kill process (default TERM)
;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10)
;stopasgroup=false ; send stop signal to the UNIX process group (default false)
;killasgroup=false ; SIGKILL the UNIX process group (def false)
;user=chrism ; setuid to this UNIX account to run the program
;redirect_stderr=true ; redirect proc stderr to stdout (default false)
;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;stdout_logfile_backups=10 ; # of stdout logfile backups (default 10)
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
;stdout_events_enabled=false ; emit events on stdout writes (default false)
;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO
;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB)
;stderr_logfile_backups=10 ; # of stderr logfile backups (default 10)
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0)
;stderr_events_enabled=false ; emit events on stderr writes (default false)
;environment=A=1,B=2 ; process environment additions (def no adds)
;serverurl=AUTO ; override serverurl computation (childutils)
; The below sample group section shows all possible group values,
; create one or more 'real' group: sections to create "heterogeneous"
; process groups.
;[group:thegroupname]
;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions
;priority=999 ; the relative start priority (default 999)
; The [include] section can just contain the "files" setting. This
; setting can list multiple files (separated by whitespace or
; newlines). It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/contrail/supervisord_config_files/*.ini

View File

@ -1,31 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
# This facter returns the version and build for the python-contrail package.
# It may be used to detect a version of contrail used in the environment.
require 'facter'
require 'puppet'
version = nil
pkg = Puppet::Type.type(:package).new(:name => 'python-contrail')
v = pkg.retrieve[pkg.property(:ensure)].to_s
version=v unless ["purged", "absent"].include?(v)
Facter.add("contrail_version") do
setcode do
version
end
end

View File

@ -1,31 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
# This facter returns the version and build for the python-contrail package.
# It may be used to detect a version of contrail used in the environment.
require 'facter'
require 'puppet'
version = nil
pkg = Puppet::Type.type(:package).new(:name => 'libnl-3-200')
v = pkg.retrieve[pkg.property(:ensure)].to_s
version=v unless ["purged", "absent"].include?(v)
Facter.add("libnl_version") do
setcode do
version
end
end

View File

@ -1,43 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
require 'hiera'
Facter.add("mac_from_vrouter") do
setcode do
output=`vif --get 0`
hiera = Hiera.new(:config => '/etc/hiera.yaml')
network_scheme = hiera.lookup('network_scheme', {}, {}, nil, :hash)
phys_dev = vlan = ''
network_scheme['transformations'].each do |trans|
if trans['bridge'] == network_scheme['roles']['neutron/mesh']
phys_dev, vlan = trans['name'].split('.')
break
end
end
mac = `cat /sys/class/net/#{phys_dev}/address`.chomp
unless $?.success?
output.split('vif').each do |iface|
if iface.start_with?( '0/0')
mac = iface.split[8][7..-1]
end
end
end
mac
end
end

View File

@ -1,109 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
# This facter returns the version and build for the python-contrail package.
# It may be used to detect a version of contrail used in the environment.
require 'hiera'
Facter.add("supervisor_params") do
setcode do
res = []
vrouter_config = '/etc/contrail/supervisord_vrouter_files/contrail-vrouter-dpdk.ini'
mac_from_config = nil
if File.exist?(vrouter_config)
config_vrouter_params = File.readlines(vrouter_config).find { |line| line.include?('command=')}.split('--no-daemon')[-1].strip
mac_from_config = config_vrouter_params.split.find { |param| param.include?('mac') }
mac_from_config = mac_from_config.split(',').find { |param| param.include?('mac') }.split('=')
end
if `status supervisor-vrouter`.include?('stop/waiting')
# NOTE (dukov) We do not need to gather data from system in case vrouter has started
# Moreover these data may differ from data without vrouter service started
bond_policy_map = {
'layer2' => 'l2',
'layer3+4' => 'l34',
'layer2+3' => 'l23',
'encap2+3' => 'l23',
'encap3+4' => 'l34',
}
hiera = Hiera.new(:config => '/etc/hiera.yaml')
network_scheme = hiera.lookup('network_scheme', {}, {}, nil, :hash)
phys_dev = vlan = ''
network_scheme['transformations'].each do |trans|
if trans['bridge'] == network_scheme['roles']['neutron/mesh']
phys_dev, vlan = trans['name'].split('.')
break
end
end
bond_dir = "/sys/class/net/#{phys_dev}/bonding"
add_vdev = false
if File.exist?(bond_dir)
# NOTE(dukov) This chunk of code will return a Hash with bond slaves info
# Example
# {
# "enp67s0f1"=> {
# "numa_node"=>"1",
# "slave_pci"=>"0000:43:00.1"},
# "enp68s0f1"=> {
# "numa_node"=>"1",
# "slave_pci"=>"0000:44:00.1"}
# }
bond_slaves = Hash[`cat #{bond_dir}/slaves`.split.sort.collect do |slave|
slave_pci = `basename $(readlink /sys/class/net/#{slave}/device)`.chomp
numa_node = `cat /sys/class/net/#{slave}/device/numa_node`.chomp
[slave, {'numa_node' => numa_node == '-1' ? 0 : numa_node, 'slave_pci' => slave_pci}]
end]
add_vdev = !bond_slaves.values[-1]['numa_node'].empty?
end
# vdev
if add_vdev
res << '--vdev'
vdev_values = []
vdev_values << "eth_bond_#{phys_dev}"
vdev_values << "mode=#{`cat #{bond_dir}/mode`.split()[1]}"
bond_policy = `cat #{bond_dir}/xmit_hash_policy`.split()[0]
vdev_values << "xmit_policy=#{bond_policy_map[bond_policy]}"
vdev_values << "socket_id=#{bond_slaves.values[-1]['numa_node']}"
# NOTE(dukov) we should not change mac here to avoid vrouter restart
# which is why we need to grab this from Supervisor config
mac = !!mac_from_config ? mac_from_config[1] : `cat /sys/class/net/#{bond_slaves.keys[-1]}/address`.chomp
vdev_values << "mac=#{mac}"
vdev_values << bond_slaves.values.map {|slave_info| "slave=#{slave_info['slave_pci']}"}.join(',')
res << "\"#{vdev_values.join(',')}\""
end
# vlan_tci and vlan_fwd_intf_name
if !!vlan
res << "--vlan_tci \"#{vlan}\""
res << "--vlan_fwd_intf_name \"#{phys_dev}\""
end
# socket-mem
socket_mem = Dir["/sys/devices/system/node/node*/hugepages"].map{ |pages| 1024}.join(',')
res << "--socket-mem #{socket_mem}" unless socket_mem.empty?
else
# NOTE(dukov) Let's get data from Supervisor configfile
res << config_vrouter_params
end
res.join(' ')
end
end

View File

@ -1,45 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
require 'yaml'
module Puppet::Parser::Functions
newfunction(:add_data_to_yaml, :type => :rvalue, :doc => <<-EOS
Append yaml file with additional data
example:
add_data_to_yaml(file, key, value)
EOS
) do |args|
file_path = args[0]
key = args[1]
value = args[2]
if File.file?(file_path)
yaml_string = File.read file_path
current_data = YAML.load yaml_string
current_data[key] = value
else
current_data = Hash.new
current_data[key] = value
end
yaml_string = YAML.dump current_data
File.write(file_path, yaml_string)
return current_data
end
end

View File

@ -1,69 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
require 'json'
module Puppet::Parser::Functions
newfunction(:generate_passthrough_whitelist, :type => :rvalue, :doc => <<-EOS
Returns pci_passthrough_whitelist for nova config
EOS
) do |args|
physnet = args[0]
dpdk_on_vf = args[1]
#sriov_hash = function_get_sriov_devices([])
network_scheme = function_hiera_hash(['network_scheme', {}])
interfaces = Array.new()
list = []
if function_get_nic_passthrough_whitelist(['sriov'])
list += function_get_nic_passthrough_whitelist(['sriov'])
end
if dpdk_on_vf
hiera_data_key = "priv_int_vfn_wl"
interface = args[2].split('.').first
dpdk_vf_number = args[3]
network_scheme = function_hiera_hash(['network_scheme', {}])
network_scheme['transformations'].each do |entry|
if entry['name'] == interface and entry.has_key?('bond_properties') and entry['action'] == "add-bond"
interfaces.push(*entry['interfaces'])
elsif entry['action'] == 'add-port' and entry['name'] == args[0]
interfaces << interface
end
end
interfaces.each do |interface|
if (File.exists?("/sys/class/net/#{interface}"))
vfn = Dir.glob "/sys/class/net/#{interface}/device/virtfn*"
vfn_wl = vfn.map { |f|
if not f.end_with? "virtfn#{dpdk_vf_number}"
pci_address = File.readlink(f).split("/")[1]
Hash["address" => pci_address, "physical_network" => physnet]
end
}
list += vfn_wl.compact
function_add_data_to_yaml(["/etc/hiera/plugins/contrail.yaml", hiera_data_key, vfn_wl.compact])
elsif not function_hiera_array([hiera_data_key, []]).empty?
vfn_wl = function_hiera_array([hiera_data_key, []])
list = vfn_wl
end
end
end
return list.to_json
end
end

View File

@ -1,46 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
module L23network
module Puppet::Parser::Functions
newfunction(:get_bond_name, :type => :rvalue, :doc => <<-EOS
Returns bond name, if overrides are not applied
1) Get network_scheme including overrides
2) Check if bond is present in scheme
3) If yes, return raw bond name, otherwise return undef
example:
get_bond_name($network_scheme, $contrail::phys_dev, $contrail::compute_dpdk_on_vf)
used in dpdk-on-vf to determine if bond needs to be created
EOS
) do |argv|
cfg_hash, interface, dpdk_enabled = argv
interface_real = interface.split('.').first
rv = nil
# this part is a copy from prepare_network_config.rb
ns = L23network.sanitize_bool_in_hash(L23network.sanitize_keys_in_hash(cfg_hash))
ns = L23network.override_transformations(ns)
ns = L23network.remove_empty_members(ns)
ns[:transformations].each do |t|
if t[:action] == 'add-bond' and t[:name] == interface_real and dpdk_enabled
rv = interface_real
end
end
return rv
end
end
end

View File

@ -1,39 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
require 'yaml'
module Puppet::Parser::Functions
newfunction(:get_dev_pci_addr, :type => :rvalue, :doc => <<-EOS
Returns interface's PCI address, else returns "0000:00:00.0"
Arguments: interface name, network_scheme
EOS
) do |args|
# Get the real interface name if argument is '<ifname>.<vlanid>'
if_name = args[0].split('.').first
network_scheme = args[1]
raise ArgumentError, 'No interface name is provided!' unless if_name and if_name.length > 0
raise ArgumentError, 'network_scheme should be a hash!' unless network_scheme.is_a? Hash
raise ArgumentError, 'There is no "interfaces" section in the network_scheme!' unless network_scheme.key? 'interfaces'
if_yml = network_scheme['interfaces'][if_name]
if if_yml and if_yml['vendor_specific']
if_yml['vendor_specific']['bus_info']
else
'0000:00:00.0'
end
end
end

View File

@ -1,27 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
require 'ipaddr'
module Puppet::Parser::Functions
newfunction(:get_first_ip, :type => :rvalue, :doc => <<-EOS
Returns first ip in subnet. ARG1 - subnet in CIDR notation (i.e. 192.168.1.0/24)
EOS
) do |args|
cidr = IPAddr.new(args[0])
return cidr.succ.to_s
end
end

View File

@ -1,59 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
require 'ipaddr'
module Puppet::Parser::Functions
newfunction(:get_ip_from_range, :type => :rvalue, :doc => <<-EOS
Returns ip address from range ARG1 to ARG2 with shift of ARG4.
Netmask in short form (i.e. "24") is passed as ARG3.
ARG5 "first" or "last" sets the direction of address shift in range: first-to-last or last-to-first.
get_ip_from_range("range_start","range_end","cidr_netmask","offset","first|last")
EOS
) do |args|
ip_start = IPAddr.new(args[0].to_s)
ip_end = IPAddr.new(args[1].to_s)
subnet = IPAddr.new(args[0].to_s+"/"+args[2].to_s)
offset = args[3].to_i
case args[4]
when "last"
rv = ip_end
offset.times do
rv = rv.prev
end
when "first"
rv = ip_start
offset.times do
rv = rv.succ
end
else
raise Puppet::ParseError, "Wrong argument " + args[4].to_s
end
if not subnet.include?(rv) then
raise Puppet::ParseError, "IP " + rv.to_s + " is out of subnet " + subnet.to_s
end
if rv > ip_end then
raise Puppet::ParseError, "IP " + rv.to_s + " is out of allowed ip range. " + ip_end.to_s + " is the max"
end
return rv.to_s
end
end

View File

@ -1,39 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
require 'ipaddr'
class IPAddr
# New method. Returns the previous ip addr
def prev
return self.clone.set(@addr - 1, @family)
end
end
module Puppet::Parser::Functions
newfunction(:get_last_ip, :type => :rvalue, :doc => <<-EOS
Returns last ip in subnet. ARG1 - subnet in CIDR notation (i.e. 192.168.1.0/24)
EOS
) do |args|
cidr = IPAddr.new(args[0])
prefix=args[0].split('/')[1]
netmask=IPAddr.new('255.255.255.255').mask(prefix)
broadcast=cidr.|(netmask.~())
return broadcast.prev.to_s
end
end

View File

@ -1,39 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
module Puppet::Parser::Functions
newfunction(:get_mac_from_vrouter, :type => :rvalue, :doc => <<-EOS
Returns mac address of interface used by DPDK vrouter
EOS
) do |args|
mac = "00:00:00:00:00:00"
begin
output=`vif --list`
result=$?.success?
if result
for int in output.split('vif')
if int.start_with?( '0/0')
mac = int.split[8][7..-1]
end
end
end
rescue Exception
warning 'Could not retrieve correct mac address from vrouter. Probably vrouter is running incorrectly.'
end
return mac
end
end

View File

@ -1,31 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
module Puppet::Parser::Functions
newfunction(:get_node_private_ip, :type => :rvalue, :doc => <<-EOS
Returns privat ip of node.
EOS
) do |args|
network_metadata = args[0]
admin_ip = args[1]
privat_ip = nil
network_metadata['nodes'].each do |_, v|
ips = v['network_roles']
if ips['admin/pxe'] == admin_ip then
privat_ip = ips['neutron/mesh']
end
end
return privat_ip
end
end

View File

@ -1,24 +0,0 @@
require 'puppetx/l23_network_scheme'
Puppet::Parser::Functions::newfunction(:get_physdev_mtu, :type => :rvalue, :arity => 1, :doc => <<-EOS
Returns MTU of a physical interface, including cases where it's a bond
EOS
) do |argv|
physdev = argv[0]
cfg = L23network::Scheme.get_config(lookupvar('l3_fqdn_hostname'))
transformations = cfg[:transformations]
interfaces = cfg[:interfaces]
transformations.each do |transform|
if transform[:name] == physdev
mtu = transform[:mtu]
return mtu if mtu
end
end
if interfaces[physdev.to_sym]
mtu = interfaces[physdev.to_sym][:mtu]
return mtu if mtu
end
end

View File

@ -1,39 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
module Puppet::Parser::Functions
newfunction(:get_private_ifname, :type => :rvalue, :doc => <<-EOS
Returns interface selected as "Private network" in web UI
example:
get_private_ifname('br-mesh', $network_scheme)
EOS
) do |args|
br_name = args[0]
network_scheme = args[1]
raise ArgumentError, 'No bridge name is provided!' unless br_name and br_name.length > 0
raise ArgumentError, 'network_scheme should be a hash!' unless network_scheme.is_a? Hash
raise ArgumentError, 'There is no "transformations" section in the network_scheme!' unless network_scheme.key? 'transformations'
if_name = nil
network_scheme['transformations'].each do |entry|
if_name = entry['name'] if entry['bridge'] == br_name
end
if_name
end
end

View File

@ -1,53 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
module Puppet::Parser::Functions
newfunction(:get_sriov_devices, :type => :rvalue, :doc => <<-EOS
Returns sriov capable devices
example:
get_sriov_devices('phys_dev')
EOS
) do |args|
interface = args[0].split('.').first
interfaces = Array.new()
sriov_hash = Hash.new
network_scheme = function_hiera_hash(['network_scheme', {}])
network_scheme['transformations'].each do |entry|
if entry['name'] == interface and entry.has_key?('bond_properties') and entry['action'] == "add-bond"
interfaces.push(*entry['interfaces'])
elsif entry['action'] == 'add-port' and entry['name'] == args[0]
interfaces << interface
end
end
interfaces.each do |interface|
interface_path = "/sys/class/net/" + interface
if (File.exists?(interface_path + "/device/sriov_totalvfs"))
sriov_hash[interface] = Hash.new
sriov_hash[interface]["totalvfs"] = IO.read(interface_path + "/device/sriov_totalvfs").to_i - 1
sriov_hash[interface]["numvfs"] = IO.read(interface_path + "/device/sriov_numvfs").to_i
function_add_data_to_yaml(["/etc/hiera/plugins/contrail.yaml", "sriov_hash", sriov_hash])
elsif function_hiera_hash(['sriov_hash', {}]).has_key?(interface)
sriov_hiera = function_hiera_hash(['sriov_hash', {}])
sriov_hash[interface] = Hash.new
sriov_hash[interface]["totalvfs"] = sriov_hiera["totalvfs"]
sriov_hash[interface]["numvfs"] = sriov_hiera["numvfs"]
end
end
return sriov_hash
end
end

View File

@ -1,45 +0,0 @@
# Copyright 2015 Mirantis, Inc.
#
# 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.
module Puppet::Parser::Functions
newfunction(:get_vf_data, :type => :rvalue, :doc => <<-EOS
Returns interface name, pci address, mac address related to specific virtual function
example:
get_vf_data(pf_dev_name, vf_number)
EOS
) do |args|
pf_dev_name = args[0].split('.').first
vf_number = args[1]
vf_sys = "/sys/class/net/#{pf_dev_name}/device/virtfn#{vf_number}"
vf_data = Hash.new
vf_prefix = lookupvar('contrail::vf_prefix')
# this is what VF name would be after renaming
vf_name = vf_prefix + pf_dev_name
if (File.exists?("/sys/class/net/#{pf_dev_name}/device/virtfn#{vf_number}/net"))
# this is original VF name, before renaming
vf_dev_name = Dir.entries("#{vf_sys}/net/")[2]
vf_pci_addr = File.readlink(vf_sys).split("/")[1]
vf_mac_addr = File.open("#{vf_sys}/net/#{vf_dev_name}/address", "rb") { |f| f.read.strip }
vf_data = {"vf_dev_name" => vf_dev_name, "vf_pci_addr" => vf_pci_addr, "vf_mac_addr" => vf_mac_addr}
function_add_data_to_yaml(["/etc/hiera/plugins/contrail.yaml", vf_name, vf_data])
elsif not function_hiera_hash([vf_name, {}]).empty?
vf_data = function_hiera_hash([vf_name, {}])
end
return vf_data
end
end

View File

@ -1,50 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
module Puppet::Parser::Functions
newfunction(:get_vmware_devices, :type => :rvalue, :doc => <<-EOS
Returns device name for internal vmware traffic
example:
get_vmware_devices()
EOS
) do |args|
bridge_interfaces = Array.new()
bond_interfaces = Array.new()
network_scheme = function_hiera_hash(['network_scheme', {}])
network_scheme['transformations'].each do |entry|
if entry.has_key?('bridge') and entry['action'] == "add-port"
bridge_interfaces.push(entry['name'])
end
if entry.has_key?('bond_properties') and entry['action'] == "add-bond"
bond_interfaces.push(*entry['interfaces'])
end
end
Dir.foreach('/sys/class/net') do |network_interface|
next if network_interface == '.' or network_interface == '..'
network_interface_path = "/sys/class/net/" + network_interface
if (not bridge_interfaces.include?(network_interface) and
not bond_interfaces.include?(network_interface))
int_driver = network_interface_path + '/device/driver/module'
if File.exist?(int_driver)
path = File.readlink(network_interface_path + '/device/driver/module')
driver_name = path.split('/')[-1]
return network_interface
end
end
end
end
end

View File

@ -1,31 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
module Puppet::Parser::Functions
newfunction(:sriov_in_kernel, :type => :rvalue, :doc => <<-EOS
Returns true if sriov enable in kernel
example:
sriov_in_kernel()
EOS
) do |args|
params = File.read("/proc/cmdline")
if params.include? "intel_iommu=on" and params.include? "iommu=pt"
return true
else
return false
end
end
end

View File

@ -1,67 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
Puppet::Parser::Functions::newfunction( :vrouter_override_network_scheme,
:type => :rvalue, :arity => 3, :doc => <<-EOS
Override network_scheme to skip interfaces used by DPDK vrouter
1. Get real nic name
2. Check if interface is a bond
3. Override bond creation if it is
4. Override add-port to br-mesh
5. Override add-br for br-mesh
6. Override endpoint for br-mesh
EOS
) do |argv|
override = {'transformations' => [],
'endpoints' => {},
'roles' => {},
'interfaces' => {}}
orig_ns, interface, dpdk_enabled = argv
interface_real = interface.split('.').first
private_bridge = function_get_network_role_property(['neutron/mesh', 'interface'])
# Overriding transformations
orig_ns['transformations'].each do |tr|
if tr['action'] == 'add-bond' and tr['name'] == interface_real and dpdk_enabled
override['transformations'] << {'action' => 'override',
'override' => interface_real,
'override-action' => 'noop'}
elsif tr['action'] == 'add-port' and tr['name'] == interface
override['transformations'] << {'action' => 'override',
'override' => interface,
'override-action' => 'noop'}
elsif tr['action'] == 'add-br' and tr['name'] == private_bridge
override['transformations'] << {'action' => 'override',
'override' => private_bridge,
'override-action' => 'noop'}
end
end
# Overriding 'br-mesh' endpoint
orig_ns['endpoints'].each do |ep_name, ep_data|
if ep_name == private_bridge
override['endpoints'][private_bridge] = ''
override['endpoints']['vhost0'] = orig_ns['endpoints'][private_bridge]
end
end
# Overriding network roles
override['roles']['contrail/vhost0'] = 'vhost0'
# Overriding interfaces
override['interfaces']['vhost0'] = {}
{'network_scheme' => override}
end
# vim: set ts=2 sw=2 et :

View File

@ -1,959 +0,0 @@
require 'augeas' if Puppet.features.augeas?
# Base Augeas provider
# Handles basics such as opening, accessing and saving changes via an Augeas
# handle, plus standard configuration from a Puppet resource (e.g. the `target`
# parameter).
#
# To use, include as parent provider:
#
# Puppet::Type.type(:example).provide(
# :augeas,
# :parent => Puppet::Type.type(:augeasprovider).provider(:default)
# ) do
# # [..]
# end
#
Puppet::Type.type(:augeasprovider).provide(:default) do
# Class methods automatically added to a Puppet provider by including the
# {AugeasProviders::Provider} mixin.
# Returns the Augeas version used
#
# @return [String] Augeas version in use
# @api public
def self.aug_version
@aug_version ||= Augeas.open(nil, nil, Augeas::NO_MODL_AUTOLOAD) { |aug| aug.get('/augeas/version') }
end
# Returns whether a feature is supported.
#
# The following features are currently supported:
#
# * `:regexpi`: whether Augeas supports an 'i' flag in regexp expressions
# * `:post_resource_eval`: whether Puppet supports `post_resource_eval` hooks
#
# @param [Symbol] feature the feature to check
# @return [Boolean] whether feature is supported
# @api public
def self.supported?(feature)
case feature
when :regexpi
Puppet::Util::Package.versioncmp(aug_version, '1.0.0') >= 0
when :post_resource_eval
Puppet::Util::Package.versioncmp(Puppet.version, '3.4.0') >= 0
else
raise Puppet::Error, "Unknown feature '#{feature}'"
end
end
# Returns a node label to use for creating a new entry in an Augeas sequence
# (seq), given the current list, e.g. '1' if it's the first. Supply
# aug.match('$target/*') or similar.
#
# @param [Array<String>] existing paths, from Augeas#match
# @return [String] new node label
def self.next_seq(matches)
last = matches.map {|p| path_label(nil, p).to_i }.max || 0
(last + 1).to_s
end
# Returns an Augeas handler.
#
# On Puppet >= 3.4, stores and returns a shared Augeas handler
# for all instances of the class
#
# @return [Augeas] Augeas shared Augeas handle
# @api private
def self.aug_handler
if supported?(:post_resource_eval)
@aug ||= Augeas.open(nil, loadpath, Augeas::NO_MODL_AUTOLOAD)
else
Augeas.open(nil, loadpath, Augeas::NO_MODL_AUTOLOAD)
end
end
# Close the shared Augeas handler.
#
# @param [Augeas] aug open Augeas handle
# @api public
def self.augclose!(aug)
aug.close
end
# Opens Augeas and returns a handle to use. It loads only the file
# identified by {#target} (and the supplied `resource`) using {#lens}.
#
# If called with a block, this will be yielded to and the Augeas handle
# closed after the block has executed (on Puppet < 3.4.0).
# Otherwise, the handle will be returned and not closed automatically.
# On Puppet >= 3.4, the handle will be closed by `post_resource_eval`.
# On older versions, the caller is responsible for closing it to free
# resources.
#
# If `yield_resource` is set to true, the supplied `resource` will be passed
# as a yieldparam to the block, after the `aug` handle. Any arguments passed
# after `yield_resource` will be added as yieldparams to the block.
#
# @param [Puppet::Resource] resource resource being evaluated
# @param [Boolean] yield_resource whether to send `resource` as a yieldparam
# @param [Splat] yield_params a splat of parameters to pass as yieldparams if `yield_resource` is true
# @return [Augeas] Augeas handle if no block is given
# @yield [aug, resource, *yield_params] block that uses the Augeas handle
# @yieldparam [Augeas] aug open Augeas handle
# @yieldparam [Puppet::Resource] resource the supplied Puppet resource, passed if `yield_resource` is set to true
# @yieldparam [Splat] *yield_params a splat of additional arguments sent to the block, if `yield_resource` is set to true
# @raise [Puppet::Error] if Augeas did not load the file
# @api public
def self.augopen(resource = nil, yield_resource = false, *yield_params, &block)
augopen_internal(resource, false, yield_resource, *yield_params, &block)
end
# Opens Augeas and returns a handle to use. It loads only the file
# for the current Puppet resource using {AugeasProviders::Provider::ClassMethods#lens}.
# #augsave! is called after the block is evaluated.
#
# If called with a block, this will be yielded to and the Augeas handle
# closed after the block has executed (on Puppet < 3.4.0).
# Otherwise, the handle will be returned and not closed automatically.
# On Puppet >= 3.4, the handle will be closed by `post_resource_eval`.
# On older versions, the caller is responsible for closing it to free
# resources.
#
# If `yield_resource` is set to true, the supplied `resource` will be passed
# as a yieldparam to the block, after the `aug` handle. Any arguments passed
# after `yield_resource` will be added as yieldparams to the block.
#
# @param [Puppet::Resource] resource resource being evaluated
# @param [Boolean] yield_resource whether to send `resource` as a yieldparam
# @param [Splat] yield_params a splat of parameters to pass as yieldparams if `yield_resource` is true
# @return [Augeas] Augeas handle if no block is given
# @yield [aug, resource, *yield_params] block that uses the Augeas handle
# @yieldparam [Augeas] aug open Augeas handle
# @yieldparam [Puppet::Resource] resource the supplied Puppet resource, passed if `yield_resource` is set to true
# @yieldparam [Splat] *yield_params a splat of additional arguments sent to the block, if `yield_resource` is set to true
# @raise [Puppet::Error] if Augeas did not load the file
# @api public
def self.augopen!(resource = nil, yield_resource = false, *yield_params, &block)
augopen_internal(resource, true, yield_resource, *yield_params, &block)
end
# Saves all changes made in the current Augeas handle and checks for any
# errors while doing so.
# Reloads the tree afterwards to remove specific changes for next resource.
#
# @param [Augeas] aug open Augeas handle
# @param [Boolean] reload whether to reload the tree after saving
# @raise [Augeas::Error] if saving fails
# @api public
def self.augsave!(aug, reload = false)
begin
aug.save!
rescue Augeas::Error
errors = []
aug.match("/augeas//error").each do |errnode|
aug.match("#{errnode}/*").each do |subnode|
subvalue = aug.get(subnode)
errors << "#{subnode} = #{subvalue}"
end
end
debug("Save failure details:\n" + errors.join("\n"))
raise Augeas::Error, 'Failed to save Augeas tree to file. See debug logs for details.'
ensure
aug.load! if reload
end
end
# Define a method with a block passed to #augopen
#
# @param [Symbol] method the name of the method to create
# @yield [aug, resource, *args] block that uses the Augeas handle
# @yieldparam [Augeas] aug open Augeas handle
# @yieldparam [Puppet::Resource] resource the supplied Puppet resource
# @yieldparam [Splat] *args a splat of additional arguments sent to the block
# @api public
def self.define_aug_method(method, &block)
define_method(method) do |*args|
# We are calling the resource's augopen here, not the class
augopen(true, *args, &block)
end
end
# Define a method with a block passed to #augopen!
#
# @param [Symbol] method the name of the method to create
# @yield [aug, resource, *args] block that uses the Augeas handle
# @yieldparam [Augeas] aug open Augeas handle
# @yieldparam [Puppet::Resource] resource the supplied Puppet resource
# @yieldparam [Splat] *args a splat of additional arguments sent to the block
# @api public
def self.define_aug_method!(method, &block)
define_method(method) do |*args|
# We are calling the resource's augopen! here, not the class
augopen!(true, *args, &block)
end
end
# Defines a property getter with a provided implementation. It works from
# a node identified with the given `label` beneath the resource.
#
# Supports three implementations based on the type specified:
#
# :string causes the getter to return the value of the node below
# resource with the label given in opts
#
# :array causes the getter to return an array of values matching the label.
# If sublabel is given, values of matching nodes beneath the
# label node will be returned in an array. If sublabel is :seq, values of
# nodes matching a numbered seq will be returned.
#
# :hash causes the getter to return a hash of the value of each matching
# label node against the value of each sublabel node.
#
# @param [String] name the name of the property
# @param [Hash] opts the options to create the setter
# @option opts [String] label node label to match beneath resource, default is `name.to_s`. When the value is `:resource`, `$resource` will be used as the path to the node
# @option opts [Symbol] type either :string, :array or :hash
# @option opts [String] default default value for hash values if sublabel doesn't exist
# @option opts [String] sublabel label of next node(s) beneath node label, used in array and hash values, or :seq for array values representing a numbered seq
# @api public
def self.attr_aug_reader(name, opts = {})
label = opts[:label] || name.to_s
default = opts[:default] || nil
type = opts[:type] || :string
sublabel = opts[:sublabel] || nil
rpath = label == :resource ? '$resource' : "$resource/#{label}"
if type == :hash and sublabel.nil?
fail "You must provide a sublabel for type hash"
end
unless [:string, :array, :hash].include? type
fail "Invalid type: #{type}"
end
# Class getter method using an existing aug handler
# Emulate define_singleton_method for Ruby 1.8
metaclass = class << self; self; end
metaclass.send(:define_method, "attr_aug_reader_#{name}") do |aug, *args|
case type
when :string
aug.get(rpath)
when :array
aug.match(rpath).map do |p|
if sublabel.nil?
aug.get(p)
else
if sublabel == :seq
sp = "#{p}/*[label()=~regexp('[0-9]+')]"
else
sp = "#{p}/#{sublabel}"
end
aug.match(sp).map { |spp| aug.get(spp) }
end
end.flatten
when :hash
values = {}
aug.match(rpath).each do |p|
sp = "#{p}/#{sublabel}"
values[aug.get(p)] = aug.get(sp) || default
end
values
end
end
# Instance getter method for the instance
define_method("attr_aug_reader_#{name}") do |aug, *args|
self.class.send("attr_aug_reader_#{name}", aug, *args)
end
# We are calling the resource's augopen here, not the class
define_method(name) do |*args|
augopen do |aug|
self.send("attr_aug_reader_#{name}", aug, *args)
end
end
end
# Defines a property setter using #augopen
#
# @param [String] name the name of the property
# @param [Hash] opts the options to create the setter
# @option opts [String] label node label to match beneath resource, default is `name.to_s`. When the value is `:resource`, `$resource` will be used as the path to the node
# @option opts [Symbol] type either :string, :array or :hash
# @option opts [String] default default value for hash values if sublabel doesn't exist
# @option opts [String] sublabel label of next node(s) beneath node label, used in array and hash values, or :seq for array values representing a numbered seq
# @option opts [Boolean] purge_ident whether to purge other matches (keeps the last one only)
# @option opts [Boolean] rm_node whether setting a string value to `nil` removes the node (default is to clear its value)
# @api public
def self.attr_aug_writer(name, opts = {})
label = opts[:label] || name.to_s
default = opts[:default] || nil
type = opts[:type] || :string
sublabel = opts[:sublabel] || nil
purge_ident = opts[:purge_ident] || false
rm_node = opts[:rm_node] || false
rpath = label == :resource ? '$resource' : "$resource/#{label}"
if type == :hash and sublabel.nil?
fail "You must provide a sublabel for type hash"
end
unless [:string, :array, :hash].include? type
fail "Invalid type: #{type}"
end
# Class setter method using an existing aug handler
# Emulate define_singleton_method for Ruby 1.8
metaclass = class << self; self; end
metaclass.send(:define_method, "attr_aug_writer_#{name}") do |aug, *args|
aug.rm("#{rpath}[position() != 1]") if purge_ident
case type
when :string
if args[0]
aug.set(rpath, args[0].to_s)
elsif rm_node
aug.rm(rpath)
else
aug.clear(rpath)
end
when :array
if args[0].nil?
aug.rm(rpath)
else
if sublabel.nil?
aug.rm(rpath)
count = 0
args[0].each do |v|
count += 1
aug.set("#{rpath}[#{count}]", v)
end
elsif sublabel == :seq
# Make sure only our values are used
aug.rm("#{rpath}/*[label()=~regexp('[0-9]+')]")
count = 0
args[0].each do |v|
count += 1
aug.set("#{rpath}/#{count}", v)
end
else
# Make sure only our values are used
aug.rm("#{rpath}/#{sublabel}")
count = 0
args[0].each do |v|
count += 1
aug.set("#{rpath}/#{sublabel}[#{count}]", v)
end
end
end
when :hash
# First get rid of all entries
aug.rm(rpath)
args[0].each do |k, v|
aug.set("#{rpath}[.='#{k}']", k)
unless v == default
aug.set("#{rpath}[.='#{k}']/#{sublabel}", v)
end
end
end
end
# Instance setter method for the instance
define_method("attr_aug_writer_#{name}") do |aug, *args|
self.class.send("attr_aug_writer_#{name}", aug, *args)
end
# We are calling the resource's augopen here, not the class
define_method("#{name}=") do |*args|
augopen! do |aug|
self.send("attr_aug_writer_#{name}", aug, *args)
end
end
end
# Define getter and setter for a property
#
# @param [Symbol] name the name of the property
# @param [Hash] opts the options to create the setter
# @option opts [String] label node label to match beneath resource, default is `name.to_s`. When the value is `:resource`, `$resource` will be used as the path to the node
# @option opts [Symbol] type either :string, :array or :hash
# @option opts [String] default default value for hash values if sublabel doesn't exist
# @option opts [String] sublabel label of next node(s) beneath node label, used in array and hash values, or :seq for array values representing a numbered seq
# @option opts [Boolean] purge_ident whether to purge other matches (keeps the last one only)
# @api public
def self.attr_aug_accessor(name, opts = {})
attr_aug_reader(name, opts)
attr_aug_writer(name, opts)
end
# Setter for the default file path managed by the provider.
#
# Takes a block to store, but doesn't yield. Will be called when it's
# needed.
#
# @yield block that identifies the default file path managed by the provider
# @yieldreturn [String] default file path
# @api public
def self.default_file(&block)
@default_file_block = block
end
# Getter and setter for the Augeas lens used for this provider.
#
# When called with a block, will only store the block - it doesn't yield.
#
# When called without a block, expects `resource` parameter which is
# passed into the block, which returns the lens to be used.
#
# @param resource [Puppet::Resource] required for getter, resource being evaluated
# @yield [resource] block that identifies the lens to use
# @yieldparam [Puppet::Resource] resource resource being evaluted
# @yieldreturn [String] Augeas lens to use, e.g. `'Hosts.lns'`
# @return [String] Augeas lens to use, e.g. `'Hosts.lns'`
# @raise [Puppet::Error] if no block has been set when getting
# @api public
def self.lens(resource = nil, &block)
if block_given?
@lens_block = block
else
fail 'Lens is not provided' unless @lens_block
@lens_block.call(resource)
end
end
# Wrapper around aug.label for older versions of Augeas
# and values not found in the tree.
#
# @param [Augeas] aug Augeas handler
# @param [String] path expression to get the label from
# @return [String] label of the given path
# @api public
def self.path_label(aug, path)
if aug.respond_to? :label
label = aug.label(path)
end
# Fallback
label || path.split("/")[-1].split("[")[0]
end
# Determine which quote is needed
#
# @param [String] value the value to quote
# @param [String] oldvalue the optional old value, used to auto-detect existing quoting
# @return [String] the quoted value
# @api public
def self.whichquote(value, resource = nil, oldvalue = nil)
oldquote = readquote oldvalue
if resource and resource.parameters.include? :quoted
quote = resource[:quoted]
else
quote = :auto
end
if quote == :auto
quote = if oldquote
oldquote
elsif value =~ /[|&;()<>\s]/
:double
else
:none
end
end
case quote
when :double
'"'
when :single
"'"
else
''
end
end
# Automatically quote a value
#
# @param [String] value the value to quote
# @param [String] oldvalue the optional old value, used to auto-detect existing quoting
# @return [String] the quoted value
# @api public
def self.quoteit(value, resource = nil, oldvalue = nil)
quote = whichquote(value, resource, oldvalue)
"#{quote}#{value}#{quote}"
end
# Detect what type of quoting a value uses
#
# @param [String] value the value to be analyzed
# @return [Symbol] the type of quoting used (:double, :single or nil)
# @api public
def self.readquote(value)
if value =~ /^(["'])(.*)(?:\1)$/
case $1
when '"' then :double
when "'" then :single
else nil end
else
nil
end
end
# Getter and setter for the Augeas path expression representing an
# individual resource inside a file, that's managed by this provider.
#
# When called with a block, will only store the block - it doesn't yield.
# The block is later used to generate the path expression.
#
# When called without a block, expects `resource` parameter which is
# passed into the block, which returns the path expression representing
# the supplied resource.
#
# If no block has already been set, it returns the path expression
# representing the top-level of the file.
#
# @param resource [Puppet::Resource] required for getter, resource being evaluated
# @yield [resource] block that identifies the path expression
# @yieldparam [Puppet::Resource] resource resource being evaluted
# @yieldreturn [String] Augeas path expression, e.g. `'/files/etc/hosts/1'`
# @return [String] Augeas path expression to use, e.g. `'/files/etc/hosts/1'`
# @raise [Puppet::Error] if no default file block is set and no resource is passed
# @see AugeasProviders::Provider#resource_path
# @see #target
# @api public
def self.resource_path(resource = nil, &block)
if block_given?
@resource_path_block = block
else
if @resource_path_block
path = "/files#{target(resource)}"
@resource_path_block.call(resource)
else
"#{target(resource)}/#{resource[:name]}"
end
end
end
# Sets useful Augeas variables for the session.
#
# * `$target` points to the root of the target file
# * `$resource` points to path defined by #resource_path
#
# It also sets `/augeas/context` to the target file so
# relative paths can be used, before the variables are set.
#
# If supplied with a resource, it will be used to determine the
# path to the used file.
#
# @param [Augeas] aug Augeas handle
# @param [Puppet::Resource] resource resource being evaluated
# @see #resource_path
# @api public
def self.setvars(aug, resource = nil)
aug.set('/augeas/context', "/files#{target(resource)}")
aug.defnode('target', "/files#{target(resource)}", nil)
aug.defvar('resource', resource_path(resource)) if resource
end
# Gets the path expression representing the file being managed.
#
# If supplied with a resource, this will represent the file identified by
# the resource, else the default file that the provider manages.
#
# @param [Puppet::Resource] resource resource being evaluated
# @return [String] path expression representing the file being managed
# @raise [Puppet::Error] if no default block is set and no resource is passed
# @see AugeasProviders::Provider#target
# @see #resource_path
# @api public
def self.target(resource = nil)
file = @default_file_block.call if @default_file_block
file = resource[:target] if resource and resource[:target]
fail 'No target file given' if file.nil?
file.chomp('/')
end
# Automatically unquote a value
#
# @param [String] value the value to unquote
# @return [String] the unquoted value
# @api public
def self.unquoteit(value)
if value =~ /^(["'])(.*)(?:\1)$/
$2
else
value
end
end
# Returns whether text is parsed as path using lens
#
# @param [String] text the text to test
# @param [String] path the relative path to test
# @param [String] lens the lens to use for parsing
# @return [Boolean] whether the path was found when parsing text with lens
# @api public
def self.parsed_as?(text, path, lens)
Augeas.open(nil, nil, Augeas::NO_MODL_AUTOLOAD) do |aug|
if aug.respond_to? :text_store
aug.set('/input', text)
if aug.text_store(lens, '/input', '/parsed')
return aug.match("/parsed/#{path}").any?
end
else
# ruby-augeas < 0.5 doesn't support text_store
Tempfile.open('aug_text_store') do |tmpfile|
tmpfile.write(text)
tmpfile.flush
aug.transform(
:lens => lens,
:name => 'Text_store',
:incl => tmpfile.path.to_s,
:excl => []
)
aug.load!
return aug.match("/files#{tmpfile.path.to_s}/#{path}").any?
end
end
end
return false
end
# Sets the post_resource_eval class hook for Puppet
# This is only used with Puppet > 3.4.0
# and allows to clean the shared Augeas handler.
def self.post_resource_eval
augclose!(aug_handler)
@aug = nil
end
# Returns a set of load paths to use when initialising Augeas.
#
# @return [String] colon-separated string of module paths, or nil if defaults are to be used
def self.loadpath
loadpath = nil
plugins = File.join(Puppet[:libdir], 'augeas', 'lenses')
if File.exists?(plugins)
loadpath = loadpath.to_s.split(File::PATH_SEPARATOR).push(plugins).join(File::PATH_SEPARATOR)
end
loadpath
end
# Opens Augeas and returns a handle to use. It loads only the file
# identified by {#target} (and the supplied `resource`) using {#lens}.
#
# If called with a block, this will be yielded to and the Augeas handle
# closed after the block has executed (on Puppet < 3.4.0).
# Otherwise, the handle will be returned and not closed automatically.
# On Puppet >= 3.4, the handle will be closed by `post_resource_eval`.
# On older versions, the caller is responsible for closing it to free
# resources.
#
# If `yield_resource` is set to true, the supplied `resource` will be passed
# as a yieldparam to the block, after the `aug` handle. Any arguments passed
# after `yield_resource` will be added as yieldparams to the block.
#
# @param [Puppet::Resource] resource resource being evaluated
# @param [Boolean] autosave whether to call augsave! automatically after the block evaluation
# @param [Boolean] yield_resource whether to send `resource` as a yieldparam
# @param [Splat] yield_params a splat of parameters to pass as yieldparams if `yield_resource` is true
# @return [Augeas] Augeas handle if no block is given
# @yield [aug, resource, *yield_params] block that uses the Augeas handle
# @yieldparam [Augeas] aug open Augeas handle
# @yieldparam [Puppet::Resource] resource the supplied Puppet resource, passed if `yield_resource` is set to true
# @yieldparam [Splat] *yield_params a splat of additional arguments sent to the block, if `yield_resource` is set to true
# @raise [Puppet::Error] if Augeas did not load the file
# @api private
def self.augopen_internal(resource = nil, autosave = false, yield_resource = false, *yield_params, &block)
aug = aug_handler
file = target(resource)
begin
lens_name = lens[/[^\.]+/]
if aug.match("/augeas/load/#{lens_name}").empty?
aug.transform(
:lens => lens,
:name => lens_name,
:incl => file,
:excl => []
)
aug.load!
elsif aug.match("/augeas/load/#{lens_name}/incl[.='#{file}']").empty?
# Only add missing file
aug.set("/augeas/load/#{lens_name}/incl[.='#{file}']", file)
aug.load!
end
if File.exist?(file) && aug.match("/files#{file}").empty?
message = aug.get("/augeas/files#{file}/error/message")
unless aug.match("/augeas/files#{file}/error/pos").empty?
line = aug.get("/augeas/files#{file}/error/line")
char = aug.get("/augeas/files#{file}/error/char")
message += " (line:#{line}, character:#{char})"
end
from = loadpath.nil? ? '' : " from #{loadpath}"
fail("Augeas didn't load #{file} with #{lens}#{from}: #{message}")
end
if block_given?
setvars(aug, resource)
if yield_resource
block.call(aug, resource, *yield_params)
else
block.call(aug)
end
else
aug
end
rescue
autosave = false
raise
ensure
if aug && block_given? && !supported?(:post_resource_eval)
augsave!(aug) if autosave
augclose!(aug)
end
end
end
# Returns the Augeas version used
#
# @return [String] Augeas version in use
# @api public
def aug_version
self.class.aug_version
end
# Returns whether a feature is supported.
#
# The following features are currently supported:
#
# * `:regexpi`: whether Augeas supports an 'i' flag in regexp expressions
# * `:post_resource_eval`: whether Puppet supports `post_resource_eval` hooks
#
# @param [Symbol] feature the feature to check
# @return [Boolean] whether feature is supported
# @api public
def supported?(feature)
self.class.supported?(feature)
end
# Opens Augeas and returns a handle to use. It loads only the file
# for the current Puppet resource using {AugeasProviders::Provider::ClassMethods#lens}.
#
# If called with a block, this will be yielded to and the Augeas handle
# closed after the block has executed (on Puppet < 3.4.0).
# Otherwise, the handle will be returned and not closed automatically.
# On Puppet >= 3.4, the handle will be closed by `post_resource_eval`.
# On older versions, the caller is responsible for closing it to free
# resources.
#
# If `yield_resource` is set to true, the supplied `resource` will be passed
# as a yieldparam to the block, after the `aug` handle. Any arguments passed
# after `yield_resource` will be added as yieldparams to the block.
#
# @return [Augeas] Augeas handle if no block is given
# @yield [aug, resource, *yield_params] block that uses the Augeas handle
# @yieldparam [Augeas] aug open Augeas handle
# @yieldparam [Puppet::Resource] resource the supplied Puppet resource, passed if `yield_resource` is set to true
# @yieldparam [Splat] *yield_params a splat of additional arguments sent to the block, if `yield_resource` is set to true
# @raise [Puppet::Error] if Augeas did not load the file
# @api public
def augopen(yield_resource = false, *yield_params, &block)
self.class.augopen(self.resource, yield_resource, *yield_params, &block)
end
# Opens Augeas and returns a handle to use. It loads only the file
# for the current Puppet resource using {AugeasProviders::Provider::ClassMethods#lens}.
# #augsave! is called after the block is evaluated.
#
# If called with a block, this will be yielded to and the Augeas handle
# closed after the block has executed (on Puppet < 3.4.0).
# Otherwise, the handle will be returned and not closed automatically.
# On Puppet >= 3.4, the handle will be closed by `post_resource_eval`.
# On older versions, the caller is responsible for closing it to free
# resources.
#
# @return [Augeas] Augeas handle if no block is given
# @yield [aug, resource, *yield_params] block that uses the Augeas handle
# @yieldparam [Augeas] aug open Augeas handle
# @yieldparam [Puppet::Resource] resource the supplied Puppet resource, passed if `yield_resource` is set to true
# @yieldparam [Splat] *yield_params a splat of additional arguments sent to the block, if `yield_resource` is set to true
# @raise [Puppet::Error] if Augeas did not load the file
# @api public
def augopen!(yield_resource = false, *yield_params, &block)
self.class.augopen!(self.resource, yield_resource, *yield_params, &block)
end
# Saves all changes made in the current Augeas handle and checks for any
# errors while doing so.
#
# @param [Augeas] aug open Augeas handle
# @param [Boolean] reload whether to reload the tree after saving
# @raise [Augeas::Error] if saving fails
# @api public
def augsave!(aug, reload = false)
self.class.augsave!(aug, reload)
end
# Close the shared Augeas handler.
#
# @param [Augeas] aug open Augeas handle
# @api public
def augclose!(aug)
self.class.augclose!(aug)
end
# Returns an Augeas handler.
#
# On Puppet >= 3.4, stores and returns a shared Augeas handler
# for all instances of the class
#
# @return [Augeas] Augeas shared Augeas handle
# @api private
def aug_handler
self.class.aug_handler
end
# Wrapper around Augeas#label for older versions of Augeas
#
# @param [Augeas] aug Augeas handler
# @param [String] path expression to get the label from
# @return [String] label of the given path
# @api public
def path_label(aug, path)
self.class.path_label(aug, path)
end
# Determine which quote is needed
#
# @param [String] value the value to quote
# @param [String] oldvalue the optional old value, used to auto-detect existing quoting
# @return [String] the quoted value
# @api public
def whichquote(value, oldvalue = nil)
self.class.whichquote(value, self.resource, oldvalue)
end
# Automatically quote a value
#
# @param [String] value the value to quote
# @param [String] oldvalue the optional old value, used to auto-detect existing quoting
# @return [String] the quoted value
# @api public
def quoteit(value, oldvalue = nil)
self.class.quoteit(value, self.resource, oldvalue)
end
# Detect what type of quoting a value uses
#
# @param [String] value the value to be analyzed
# @return [Symbol] the type of quoting used (:double, :single or nil)
# @api public
def readquote(value)
self.class.readquote(value)
end
# Gets the Augeas path expression representing the individual resource inside
# the file, that represents the current Puppet resource.
#
# If no block was set by the provider's class method, it returns the path
# expression representing the top-level of the file.
#
# @return [String] Augeas path expression to use, e.g. `'/files/etc/hosts/1'`
# @see AugeasProviders::Provider::ClassMethods#resource_path
# @see #target
# @api public
def resource_path
self.class.resource_path(self.resource)
end
# Sets useful Augeas variables for the session:
#
# * `$target` points to the root of the target file
# * `$resource` points to path defined by #resource_path
#
# It also sets `/augeas/context` to the target file so
# relative paths can be used, before the variables are set.
#
# If supplied with a resource, it will be used to determine the
# path to the used file.
#
# @param [Augeas] aug Augeas handle
# @see #resource_path
# @api public
def setvars(aug)
self.class.setvars(aug, self.resource)
end
# Gets the path expression representing the file being managed for the
# current Puppet resource.
#
# @return [String] path expression representing the file being managed
# @see AugeasProviders::Provider::ClassMethods#target
# @see #resource_path
# @api public
def target
self.class.target(self.resource)
end
# Automatically unquote a value
#
# @param [String] value the value to unquote
# @return [String] the unquoted value
# @api public
def unquoteit(value)
self.class.unquoteit(value)
end
# Returns whether text is parsed as path using lens
#
# @param [String] text the text to test
# @param [String] path the relative path to test
# @param [String] lens the lens to use for parsing
# @return [Boolean] whether the path was found when parsing text with lens
# @api public
def parsed_as?(text, path, lens = nil)
lens ||= self.class.lens(self.resource)
self.class.parsed_as?(text, path, lens)
end
# Default method to determine the existence of a resource
# can be overridden if necessary
def exists?
augopen do |aug|
not aug.match('$resource').empty?
end
end
# Default method to destroy a resource
# can be overridden if necessary
def destroy
augopen! do |aug|
aug.rm('$resource')
end
end
# Default method to flush a resource
#
# On Puppet >= 3.4, this takes care of
# saving the tree for the shared Augeas handler.
#
# This method can be overridden in your provider
# but you should make sure to call `super`
# to ensure that the tree will be saved in Puppet >= 3.4
def flush
augsave!(aug_handler, true) if supported?(:post_resource_eval)
end
# Returns a node label to use for creating a new entry in an Augeas sequence
# (seq), given the current list, e.g. '1' if it's the first. Supply
# aug.match('$target/*') or similar.
#
# @param [Array<String>] existing paths, from Augeas#match
# @return [String] new node label
def next_seq(matches)
self.class.next_seq(matches)
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_alarm_gen_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-alarm-gen.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_analytics_api_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-analytics-api.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_analytics_nodemgr_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-analytics-nodemgr.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_api_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-api.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_api_ini_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/supervisord_config_files/contrail-api.ini'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_collector_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-collector.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_config_nodemgr_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-config-nodemgr.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_control_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-control.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_control_nodemgr_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-control-nodemgr.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_database_nodemgr_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-database-nodemgr.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_device_manager_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-device-manager.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_discovery_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-discovery.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_discovery_ini_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/supervisord_config_files/contrail-discovery.ini'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_dns_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-dns.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_keystone_auth_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-keystone-auth.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_query_engine_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-query-engine.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_schema_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-schema.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_snmp_collector_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-snmp-collector.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_svc_monitor_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-svc-monitor.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_topology_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-topology.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_vrouter_agent_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-vrouter-agent.conf'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_vrouter_dpdk_ini_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/supervisord_vrouter_files/contrail-vrouter-dpdk.ini'
end
end

View File

@ -1,22 +0,0 @@
Puppet::Type.type(:contrail_vrouter_nodemgr_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/contrail/contrail-vrouter-nodemgr.conf'
end
end

Some files were not shown because too many files have changed in this diff Show More