From c098aa43baf861c80377df4b6138629e6f3727c3 Mon Sep 17 00:00:00 2001 From: Bob Kukura Date: Fri, 17 Feb 2012 17:00:52 -0500 Subject: [PATCH] Cleanup the source distribution. Missing text files such as LICENSE and various READMEs are now included in the tarball source distribution. The Makefile and shell script for installing the openvswitch agent on xen are also now included. The openvswitch and linuxbridge agents are included, and executable wrapper scripts for the agents are provided. The cisco and linuxbridge nova drivers are now setup to be run from the quantum namespace rather than copied to nova. Finally, the setup_*.py scripts have been removed from the project. Fixes bug 925074. Test by running "python setup.py sdist" and examining the generated tarball. Change-Id: I33d336a5eb13678e6d527b575958393b337b6f3d Signed-off-by: Bob Kukura --- MANIFEST.in | 13 ++- bin/quantum-linuxbridge-agent | 24 +++++ bin/quantum-openvswitch-agent | 24 +++++ quantum/plugins/linuxbridge/README | 19 +--- .../agent/linuxbridge_quantum_agent.py | 7 +- quantum/plugins/linuxbridge/nova/__init__.py | 0 .../nova/linux_net_linux_bridge.py | 2 +- .../nova/vif_linuxbridge_quantum.py | 4 +- quantum/plugins/openvswitch/agent/__init__.py | 0 .../openvswitch/agent/ovs_quantum_agent.py | 6 +- setup.py | 4 + setup_cisco_plugin.py | 74 --------------- setup_openvswitch_plugin.py | 65 ------------- setup_sample_plugin.py | 51 ---------- setup_server.py | 92 ------------------- 15 files changed, 78 insertions(+), 307 deletions(-) create mode 100755 bin/quantum-linuxbridge-agent create mode 100755 bin/quantum-openvswitch-agent create mode 100644 quantum/plugins/linuxbridge/nova/__init__.py create mode 100644 quantum/plugins/openvswitch/agent/__init__.py delete mode 100644 setup_cisco_plugin.py delete mode 100644 setup_openvswitch_plugin.py delete mode 100644 setup_sample_plugin.py delete mode 100644 setup_server.py diff --git a/MANIFEST.in b/MANIFEST.in index 3d36e9b0e0..9d77adccb8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,13 @@ +include README LICENSE TESTING +include run_tests.py run_tests.sh +include .pylintrc include bin/* include etc/* include etc/init.d/* -include etc/quantum/plugins/openvswitch/* -include etc/quantum/plugins/cisco/* -include etc/quantum/plugins/linuxbridge/* +include etc/quantum/plugins/openvswitch/*.ini +include etc/quantum/plugins/cisco/*.ini +include etc/quantum/plugins/cisco/quantum.conf.ciscoext +include etc/quantum/plugins/linuxbridge/*.ini +include quantum/plugins/*/README +include quantum/plugins/openvswitch/Makefile +include quantum/plugins/openvswitch/agent/xenserver_install.sh diff --git a/bin/quantum-linuxbridge-agent b/bin/quantum-linuxbridge-agent new file mode 100755 index 0000000000..92f7ca2501 --- /dev/null +++ b/bin/quantum-linuxbridge-agent @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2012 Red Hat +# All Rights Reserved. +# +# 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. + +import os +import sys +sys.path.insert(0, os.getcwd()) +from quantum.plugins.linuxbridge.agent.linuxbridge_quantum_agent import main + +main() diff --git a/bin/quantum-openvswitch-agent b/bin/quantum-openvswitch-agent new file mode 100755 index 0000000000..4948542654 --- /dev/null +++ b/bin/quantum-openvswitch-agent @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2012 Red Hat +# All Rights Reserved. +# +# 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. + +import os +import sys +sys.path.insert(0, os.getcwd()) +from quantum.plugins.openvswitch.agent.ovs_quantum_agent import main + +main() diff --git a/quantum/plugins/linuxbridge/README b/quantum/plugins/linuxbridge/README index c439099469..a5e722f110 100644 --- a/quantum/plugins/linuxbridge/README +++ b/quantum/plugins/linuxbridge/README @@ -43,23 +43,8 @@ service with the Linux Bridge plugin. --connection_type=libvirt --libvirt_type=qemu --libvirt_vif_type=ethernet ---libvirt_vif_driver=nova.virt.libvirt.vif_linuxbridge_quantum.QuantumLibvirtLinuxBridgeDriver ---linuxnet_interface_driver=nova.network.quantum.linux_net_linux_bridge.QuantumLibvirtLinuxBridgeDriver - -The above two drivers are packaged with Quantum in the location: -quantum/plugins/linuxbridge/nova - -These need to copied to the compute node in the appropriate locations. - -a) Copy: - quantum/plugins/linuxbridge/nova/vif_linuxbridge_quantum.py - to: - nova/virt/libvirt/vif_linuxbridge_quantum.py - -b) Copy: - quantum/plugins/linuxbridge/nova/linux_net_linux_bridge.py - to: - nova/network/quantum/linux_net_linux_bridge.py +--libvirt_vif_driver=quantum.plugins.linuxbridge.nova.vif_linuxbridge_quantum.QuantumLibvirtLinuxBridgeVIFDriver +--linuxnet_interface_driver=quantum.plugins.linuxbridge.nova.linux_net_linux_bridge.QuantumLinuxBridgeInterfaceDriver 2) If you want a DHCP server to be run for the VMs to acquire IPs, add the following flag to your nova.conf file: diff --git a/quantum/plugins/linuxbridge/agent/linuxbridge_quantum_agent.py b/quantum/plugins/linuxbridge/agent/linuxbridge_quantum_agent.py index 3481754056..a9fa0b9c1c 100755 --- a/quantum/plugins/linuxbridge/agent/linuxbridge_quantum_agent.py +++ b/quantum/plugins/linuxbridge/agent/linuxbridge_quantum_agent.py @@ -411,7 +411,8 @@ class LinuxBridgeQuantumAgent: old_port_bindings = bindings[PORT_BINDINGS] time.sleep(self.polling_interval) -if __name__ == "__main__": + +def main(): usagestr = "%prog [OPTIONS] " parser = OptionParser(usage=usagestr) parser.add_option("-v", "--verbose", dest="verbose", @@ -439,6 +440,7 @@ if __name__ == "__main__": physical_interface = config.get("LINUX_BRIDGE", "physical_interface") polling_interval = config.get("AGENT", "polling_interval") 'Establish database connection and load models' + global DB_CONNECTION DB_CONNECTION = config.get("DATABASE", "connection") if DB_CONNECTION == 'sqlite': LOG.info("Connecting to sqlite DB") @@ -468,3 +470,6 @@ if __name__ == "__main__": conn.close() sys.exit(0) + +if __name__ == "__main__": + main() diff --git a/quantum/plugins/linuxbridge/nova/__init__.py b/quantum/plugins/linuxbridge/nova/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/quantum/plugins/linuxbridge/nova/linux_net_linux_bridge.py b/quantum/plugins/linuxbridge/nova/linux_net_linux_bridge.py index 1c8e6ae980..6fba34e8d3 100755 --- a/quantum/plugins/linuxbridge/nova/linux_net_linux_bridge.py +++ b/quantum/plugins/linuxbridge/nova/linux_net_linux_bridge.py @@ -46,7 +46,7 @@ def _device_exists(device): # plugs interfaces using Linux Bridge when using QuantumManager -class QuantumLibvirtLinuxBridgeDriver(LinuxNetInterfaceDriver): +class QuantumLinuxBridgeInterfaceDriver(LinuxNetInterfaceDriver): def plug(self, network, mac_address, gateway=True): LOG.debug(_("inside plug()")) diff --git a/quantum/plugins/linuxbridge/nova/vif_linuxbridge_quantum.py b/quantum/plugins/linuxbridge/nova/vif_linuxbridge_quantum.py index 1e2a40fb54..729c06ab27 100644 --- a/quantum/plugins/linuxbridge/nova/vif_linuxbridge_quantum.py +++ b/quantum/plugins/linuxbridge/nova/vif_linuxbridge_quantum.py @@ -31,12 +31,12 @@ from nova import utils from nova.virt.vif import VIFDriver from nova import exception -LOG = logging.getLogger('nova.virt.libvirt.vif_linuxbridge_quantum') +LOG = logging.getLogger(__name__) FLAGS = flags.FLAGS -class QuantumLibvirtLinuxBridgeDriver(VIFDriver): +class QuantumLibvirtLinuxBridgeVIFDriver(VIFDriver): """VIF driver for Linux Bridge.""" def get_dev_name(_self, iface_id): diff --git a/quantum/plugins/openvswitch/agent/__init__.py b/quantum/plugins/openvswitch/agent/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py b/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py index 6609a68748..5cfbeac43e 100755 --- a/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py +++ b/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py @@ -262,7 +262,8 @@ class OVSQuantumAgent: db.commit() time.sleep(2) -if __name__ == "__main__": + +def main(): usagestr = "%prog [OPTIONS] " parser = OptionParser(usage=usagestr) parser.add_option("-v", "--verbose", dest="verbose", @@ -298,3 +299,6 @@ if __name__ == "__main__": plugin.daemon_loop(db) sys.exit(0) + +if __name__ == "__main__": + main() diff --git a/setup.py b/setup.py index 788be9f26b..dace785c61 100644 --- a/setup.py +++ b/setup.py @@ -106,6 +106,10 @@ setup( eager_resources=EagerResources, entry_points={ 'console_scripts': [ + 'quantum-linuxbridge-agent = \ +quantum.plugins.linuxbridge.agent.linuxbridge_quantum_agent:main', + 'quantum-openvswitch-agent = \ +quantum.plugins.openvswitch.agent.ovs_quantum_agent:main', 'quantum-server = quantum.server:main', ] }, diff --git a/setup_cisco_plugin.py b/setup_cisco_plugin.py deleted file mode 100644 index 2bf6eb32da..0000000000 --- a/setup_cisco_plugin.py +++ /dev/null @@ -1,74 +0,0 @@ -try: - from setuptools import setup, find_packages -except ImportError: - from ez_setup import use_setuptools - use_setuptools() - from setuptools import setup, find_packages - -import sys -from quantum import version - -Name = 'quantum-cisco-plugin' -ProjecUrl = "" -Version = version.version_string() -License = 'Apache License 2.0' -Author = 'Cisco Systems' -AuthorEmail = '' -Maintainer = '' -Summary = 'Cisco plugin for Quantum' -ShortDescription = Summary -Description = Summary - -requires = [ - 'quantum-common', - 'quantum-server', -] - -EagerResources = [ - 'quantum', -] - -ProjectScripts = [ -] - -PackageData = { -} - -# If we're installing server-wide, use an aboslute path for config -# if not, use a relative path -config_path = '/etc/quantum/plugins/cisco' -relative_locations = ['--user', '--virtualenv', '--venv'] -if [x for x in relative_locations if x in sys.argv]: - config_path = 'etc/quantum/plugins/cisco' - -DataFiles = [ - (config_path, - ['etc/quantum/plugins/cisco/credentials.ini', - 'etc/quantum/plugins/cisco/l2network_plugin.ini', - 'etc/quantum/plugins/cisco/nexus.ini', - 'etc/quantum/plugins/cisco/ucs.ini', - 'etc/quantum/plugins/cisco/cisco_plugins.ini', - 'etc/quantum/plugins/cisco/db_conn.ini']) -] - -setup( - name=Name, - version=Version, - author=Author, - author_email=AuthorEmail, - description=ShortDescription, - long_description=Description, - license=License, - scripts=ProjectScripts, - install_requires=requires, - include_package_data=True, - packages=["quantum.plugins.cisco"], - package_data=PackageData, - data_files=DataFiles, - eager_resources=EagerResources, - entry_points={ - 'console_scripts': [ - 'cisco-quantum = quantum.plugins.cisco.client.cli:main' - ] - }, -) diff --git a/setup_openvswitch_plugin.py b/setup_openvswitch_plugin.py deleted file mode 100644 index 54b1a10d2e..0000000000 --- a/setup_openvswitch_plugin.py +++ /dev/null @@ -1,65 +0,0 @@ -try: - from setuptools import setup, find_packages -except ImportError: - from ez_setup import use_setuptools - use_setuptools() - from setuptools import setup, find_packages - -from quantum import version - -import sys - -Name = 'quantum-openvswitch-plugin' -ProjecUrl = "" -Version = version.version_string() -License = 'Apache License 2.0' -Author = 'Open vSwitch Team' -AuthorEmail = 'discuss@openvswitch.org' -Maintainer = '' -Summary = 'OpenVSwitch plugin for Quantum' -ShortDescription = Summary -Description = Summary - -requires = [ - 'quantum-common', - 'quantum-server', -] - -EagerResources = [ - 'quantum', -] - -ProjectScripts = [ -] - -PackageData = { -} - -# If we're installing server-wide, use an aboslute path for config -# if not, use a relative path -config_path = '/etc/quantum/plugins/openvswitch' -relative_locations = ['--user', '--virtualenv', '--venv'] -if [x for x in relative_locations if x in sys.argv]: - config_path = 'etc/quantum/plugins/openvswitch' - -DataFiles = [ - (config_path, - ['etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini']) -] - -setup( - name=Name, - version=Version, - author=Author, - author_email=AuthorEmail, - description=ShortDescription, - long_description=Description, - license=License, - scripts=ProjectScripts, - install_requires=requires, - include_package_data=True, - packages=["quantum.plugins.openvswitch"], - package_data=PackageData, - data_files=DataFiles, - eager_resources=EagerResources, -) diff --git a/setup_sample_plugin.py b/setup_sample_plugin.py deleted file mode 100644 index 3379c67e13..0000000000 --- a/setup_sample_plugin.py +++ /dev/null @@ -1,51 +0,0 @@ -try: - from setuptools import setup, find_packages -except ImportError: - from ez_setup import use_setuptools - use_setuptools() - from setuptools import setup, find_packages - -from quantum import version -import sys - -Name = 'quantum-sample-plugin' -Summary = 'Sample plugin for Quantum' -Url = "https://launchpad.net/quantum" -Version = version.version_string() -License = 'Apache License 2.0' -Author = 'Netstack' -AuthorEmail = 'netstack@lists.launchpad.net' -Maintainer = '' -ShortDescription = Summary -Description = Summary - -requires = [ - 'quantum-common', - 'quantum-server', -] - -EagerResources = [ - 'quantum', -] - -ProjectScripts = [ -] - -PackageData = { -} - -setup( - name=Name, - version=Version, - author=Author, - author_email=AuthorEmail, - description=ShortDescription, - long_description=Description, - license=License, - scripts=ProjectScripts, - install_requires=requires, - include_package_data=True, - packages=["quantum.plugins.sample"], - package_data=PackageData, - eager_resources=EagerResources, -) diff --git a/setup_server.py b/setup_server.py deleted file mode 100644 index 563e3c815d..0000000000 --- a/setup_server.py +++ /dev/null @@ -1,92 +0,0 @@ -try: - from setuptools import setup, find_packages -except ImportError: - from ez_setup import use_setuptools - use_setuptools() - from setuptools import setup, find_packages - -import os -import sys -from quantum import version - -Name = 'quantum-server' -Url = "https://launchpad.net/quantum" -Version = version.version_string() -License = 'Apache License 2.0' -Author = 'Netstatck' -AuthorEmail = 'netstack@lists.launchpad.net' -Maintainer = '' -Summary = 'Server functionalities for Quantum' -ShortDescription = Summary -Description = Summary - -requires = [ - 'quantum-common' -] - -EagerResources = [ - 'quantum', -] - -ProjectScripts = [ -] - -PackageData = { -} - -# If we're installing server-wide, use an aboslute path for config -# if not, use a relative path -config_path = '/etc/quantum' -init_path = '/etc/init.d' - -relative_locations = ['--user', '--virtualenv', '--venv'] -if [x for x in relative_locations if x in sys.argv]: - config_path = 'etc/quantum/' - init_path = 'etc/init.d' - -import os -from distutils.command.build_py import build_py as _build_py - - -class build_py(_build_py): - def find_data_files(self, package, src_dir): - files = [] - for p in _build_py.find_data_files(self, package, src_dir): - if os.path.isdir(p): - files.extend(os.path.join(par, f) - for par, dirs, files in os.walk(p) - for f in files) - else: - files.append(p) - return files - -print "config_path: %s" % config_path -DataFiles = [ - (config_path, - ['etc/quantum.conf', 'etc/quantum.conf.test', 'etc/plugins.ini']), - (init_path, ['etc/init.d/quantum-server']) -] - -setup( - name=Name, - version=Version, - url=Url, - author=Author, - author_email=AuthorEmail, - description=ShortDescription, - long_description=Description, - license=License, - scripts=ProjectScripts, - install_requires=requires, - include_package_data=True, - packages=["quantum.server"], - package_data=PackageData, - data_files=DataFiles, - package_dir={'quantum': 'quantum'}, - eager_resources=EagerResources, - entry_points={ - 'console_scripts': [ - 'quantum-server = quantum.server:main' - ] - }, -)