[openstack-quantum] Add upstream patch: remove pep8 and strict lxml version from setup.py

Robert A. Kukura rkukura at fedoraproject.org
Fri Mar 9 20:47:54 UTC 2012


commit 08f6b6a965103cf6c9a701e315dc70c6ddf4d76e
Author: Bob Kukura <rkukura at redhat.com>
Date:   Fri Mar 9 15:47:07 2012 -0500

    Add upstream patch: remove pep8 and strict lxml version from setup.py
    
    - Remove old fix for pep8 dependency
    - Add upstream patch: Bug #949261 Removing nova drivers for Linux Bridge Plugin
    - Add openvswitch dependency

 openstack-quantum.spec                             |   22 ++-
 ...-82138245694b452341cc41638058adb3972a9926.patch |   54 ++++
 ...-f614a7ddf57a2a4c30d9410671622caca6f4e434.patch |  264 ++++++++++++++++++++
 3 files changed, 337 insertions(+), 3 deletions(-)
---
diff --git a/openstack-quantum.spec b/openstack-quantum.spec
index b22f796..a7c55f3 100644
--- a/openstack-quantum.spec
+++ b/openstack-quantum.spec
@@ -7,7 +7,7 @@
 
 Name:		openstack-quantum
 Version:	2012.1
-Release:	0.2.%{release_letter}%{milestone}%{?dist}
+Release:	0.3.%{release_letter}%{milestone}%{?dist}
 Summary:	Virtual network service for OpenStack (quantum)
 
 Group:		Applications/System
@@ -20,6 +20,12 @@ Source3:	quantum-linuxbridge-agent.service
 Source4:	quantum-openvswitch-agent.service
 Source5:	quantum-ryu-agent.service
 
+# Merged upstream patch https://review.openstack.org/#change,4235
+Patch1:		quantum.git-82138245694b452341cc41638058adb3972a9926.patch
+
+# Proposed upstream patch for https://bugs.launchpad.net/quantum/+bug/949261
+Patch2:		quantum.git-f614a7ddf57a2a4c30d9410671622caca6f4e434.patch
+
 BuildArch:	noarch
 
 BuildRequires:	python2-devel
@@ -123,7 +129,7 @@ Summary:	Quantum openvswitch plugin
 Group:		Applications/System
 
 Requires:	openstack-quantum = %{version}-%{release}
-#Requires:	openvswitch
+Requires:	openvswitch
 
 
 %description -n openstack-quantum-openvswitch
@@ -152,12 +158,16 @@ networks using the Ryu Network Operating System.
 %prep
 %setup -q -n quantum-%{version}
 
+%patch1 -p1
+%patch2 -p1
+
 find quantum -name \*.py -exec sed -i '/\/usr\/bin\/env python/d' {} \;
 
 chmod 644 quantum/plugins/cisco/README
 dos2unix quantum/plugins/cisco/README
 
-sed -i '/pep8>=/d' setup.py
+# patch2 does not remove this for some reason
+rm quantum/plugins/linuxbridge/nova/__init__.py
 
 %build
 %{__python} setup.py build
@@ -366,6 +376,12 @@ fi
 
 
 %changelog
+* Fri Mar  9 2012 Robert Kukura <rkukura at redhat.com> - 2012.1-0.3.e4
+- Add upstream patch: remove pep8 and strict lxml version from setup.py
+- Remove old fix for pep8 dependency
+- Add upstream patch: Bug #949261 Removing nova drivers for Linux Bridge Plugin
+- Add openvswitch dependency
+
 * Mon Mar  5 2012 Robert Kukura <rkukura at redhat.com> - 2012.1-0.2.e4
 - Update to essex milestone 4
 - Move plugins to sub-packages
diff --git a/quantum.git-82138245694b452341cc41638058adb3972a9926.patch b/quantum.git-82138245694b452341cc41638058adb3972a9926.patch
new file mode 100644
index 0000000..955ef68
--- /dev/null
+++ b/quantum.git-82138245694b452341cc41638058adb3972a9926.patch
@@ -0,0 +1,54 @@
+From 82138245694b452341cc41638058adb3972a9926 Mon Sep 17 00:00:00 2001
+From: =?utf8?q?Ionu=C8=9B=20Ar=C8=9B=C4=83ri=C8=99i?= <iartarisi at suse.cz>
+Date: Thu, 16 Feb 2012 13:11:04 +0100
+Subject: [PATCH] remove pep8 and strict lxml version from setup.py
+
+Change-Id: I671f3e924641cdfdfb5d20d0b0e3c77e1dc714e2
+---
+ quantum/wsgi.py    |    1 +
+ setup.py           |    3 +--
+ tools/pip-requires |    2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/quantum/wsgi.py b/quantum/wsgi.py
+index dfd1bd7..6783910 100644
+--- a/quantum/wsgi.py
++++ b/quantum/wsgi.py
+@@ -284,6 +284,7 @@ class XMLDictSerializer(DictSerializer):
+ 
+     def _to_xml(self, root):
+         """Convert the xml object to an xml string."""
++        # we use lxml here instead of xml.minidom for performance reasons
+         return etree.tostring(root, encoding='UTF-8', xml_declaration=True)
+ 
+ 
+diff --git a/setup.py b/setup.py
+index 0bc8d6a..f294a3e 100644
+--- a/setup.py
++++ b/setup.py
+@@ -50,8 +50,7 @@ requires = [
+     'PasteDeploy',
+     'Routes>=1.12.3',
+     'eventlet>=0.9.12',
+-    'lxml==2.3',
+-    'pep8>=0.6.1',
++    'lxml',
+     'python-gflags',
+     'simplejson',
+     'sqlalchemy',
+diff --git a/tools/pip-requires b/tools/pip-requires
+index f13ef0d..ac357fa 100644
+--- a/tools/pip-requires
++++ b/tools/pip-requires
+@@ -2,7 +2,7 @@ Paste
+ PasteDeploy==1.5.0
+ Routes>=1.12.3
+ eventlet>=0.9.12
+-lxml==2.3
++lxml
+ mox==0.5.3
+ python-gflags==1.3
+ simplejson
+-- 
+1.7.4.1
+
diff --git a/quantum.git-f614a7ddf57a2a4c30d9410671622caca6f4e434.patch b/quantum.git-f614a7ddf57a2a4c30d9410671622caca6f4e434.patch
new file mode 100644
index 0000000..dbdb516
--- /dev/null
+++ b/quantum.git-f614a7ddf57a2a4c30d9410671622caca6f4e434.patch
@@ -0,0 +1,264 @@
+From f614a7ddf57a2a4c30d9410671622caca6f4e434 Mon Sep 17 00:00:00 2001
+From: Sumit Naiksatam <snaiksat at cisco.com>
+Date: Wed, 7 Mar 2012 10:25:18 -0800
+Subject: [PATCH] Bug #949261 Removing nova drivers for Linux Bridge Plugin
+
+These have been added to nova, so they need not be in the Quantum
+code base any more.
+
+Change-Id: Ibbd88792bfb0f58b2d9d347298964bf0b77baa95
+---
+ quantum/plugins/linuxbridge/README                 |   16 ++--
+ .../linuxbridge/nova/linux_net_linux_bridge.py     |  117 --------------------
+ .../linuxbridge/nova/vif_linuxbridge_quantum.py    |   73 ------------
+ 3 files changed, 8 insertions(+), 198 deletions(-)
+ delete mode 100644 quantum/plugins/linuxbridge/nova/__init__.py
+ delete mode 100755 quantum/plugins/linuxbridge/nova/linux_net_linux_bridge.py
+ delete mode 100644 quantum/plugins/linuxbridge/nova/vif_linuxbridge_quantum.py
+
+diff --git a/quantum/plugins/linuxbridge/README b/quantum/plugins/linuxbridge/README
+index a5e722f..39b8146 100644
+--- a/quantum/plugins/linuxbridge/README
++++ b/quantum/plugins/linuxbridge/README
+@@ -31,25 +31,25 @@ service with the Linux Bridge plugin.
+ 
+ # -- Nova configuration (controller node)
+ 
+-1) Make sure to set up nova using the quantum network manager in the
++1) Ensure that the quantum network manager is configured in the
+    nova.conf on the node that will be running nova-network.
+ 
+---network_manager=nova.network.quantum.manager.QuantumManager
++network_manager=nova.network.quantum.manager.QuantumManager
+ 
+ # -- Nova configuration (compute node(s))
+ 
+ 1) Configure the vif driver, and libvirt/vif type
+ 
+---connection_type=libvirt
+---libvirt_type=qemu
+---libvirt_vif_type=ethernet
+---libvirt_vif_driver=quantum.plugins.linuxbridge.nova.vif_linuxbridge_quantum.QuantumLibvirtLinuxBridgeVIFDriver
+---linuxnet_interface_driver=quantum.plugins.linuxbridge.nova.linux_net_linux_bridge.QuantumLinuxBridgeInterfaceDriver
++connection_type=libvirt
++libvirt_type=qemu
++libvirt_vif_type=ethernet
++libvirt_vif_driver=nova.virt.libvirt.vif.QuantumLinuxBridgeVIFDriver
++linuxnet_interface_driver=nova.network.linux_net.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:
+ 
+---quantum_use_dhcp
++quantum_use_dhcp=true
+ 
+ (Note: For more details on how to work with Quantum using Nova, i.e. how to create networks and such,
+  please refer to the top level Quantum README which points to the relevant documentation.)
+diff --git a/quantum/plugins/linuxbridge/nova/__init__.py b/quantum/plugins/linuxbridge/nova/__init__.py
+deleted file mode 100644
+index e69de29..0000000
+diff --git a/quantum/plugins/linuxbridge/nova/linux_net_linux_bridge.py b/quantum/plugins/linuxbridge/nova/linux_net_linux_bridge.py
+deleted file mode 100755
+index 6fba34e..0000000
+--- a/quantum/plugins/linuxbridge/nova/linux_net_linux_bridge.py
++++ /dev/null
+@@ -1,117 +0,0 @@
+-# vim: tabstop=4 shiftwidth=4 softtabstop=4
+-#
+-# Copyright 2012 Cisco Systems, Inc.
+-# 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.
+-#
+-# Extends the linux_net.py kvm/linux network driver in Nova,
+-# borrows structure and code
+-# @author: Sumit Naiksatam, Cisco Systems, Inc.
+-#
+-
+-
+-"""Extends the linux_net driver when using the Linux Bridge plugin with
+-QuantumManager"""
+-
+-
+-from nova import exception
+-from nova import log as logging
+-from nova import utils
+-
+-from nova.network.linux_net import *
+-
+-
+-LOG = logging.getLogger(__name__)
+-
+-
+-BRDIGE_NAME_PREFIX = "brq"
+-GATEWAY_INTERFACE_PREFIX = "gw-"
+-
+-
+-def _device_exists(device):
+-    """Check if ethernet device exists."""
+-    (_out, err) = utils.execute('ip', 'link', 'show', 'dev', device,
+-                           check_exit_code=False)
+-    return not err
+-
+-
+-# plugs interfaces using Linux Bridge when using QuantumManager
+-class QuantumLinuxBridgeInterfaceDriver(LinuxNetInterfaceDriver):
+-
+-    def plug(self, network, mac_address, gateway=True):
+-        LOG.debug(_("inside plug()"))
+-        dev = self.get_dev(network)
+-        bridge = self.get_bridge(network)
+-        if not gateway:
+-            # If we weren't instructed to act as a gateway then add the
+-            # appropriate flows to block all non-dhcp traffic.
+-            # .. and make sure iptbles won't forward it as well.
+-            iptables_manager.ipv4['filter'].add_rule('FORWARD',
+-                    '--in-interface %s -j DROP' % bridge)
+-            iptables_manager.ipv4['filter'].add_rule('FORWARD',
+-                    '--out-interface %s -j DROP' % bridge)
+-            return bridge
+-        else:
+-            iptables_manager.ipv4['filter'].add_rule('FORWARD',
+-                    '--in-interface %s -j ACCEPT' % bridge)
+-            iptables_manager.ipv4['filter'].add_rule('FORWARD',
+-                    '--out-interface %s -j ACCEPT' % bridge)
+-
+-        if not _device_exists(dev):
+-            try:
+-                # First, try with 'ip'
+-                utils.execute('ip', 'tuntap', 'add', dev, 'mode', 'tap',
+-                          run_as_root=True)
+-            except exception.ProcessExecutionError:
+-                # Second option: tunctl
+-                utils.execute('tunctl', '-b', '-t', dev, run_as_root=True)
+-            utils.execute('ip', 'link', 'set', dev, "address", mac_address,
+-                          run_as_root=True)
+-            utils.execute('ip', 'link', 'set', dev, 'up', run_as_root=True)
+-
+-        if not _device_exists(bridge):
+-            LOG.debug(_("Starting bridge %s "), bridge)
+-            utils.execute('brctl', 'addbr', bridge, run_as_root=True)
+-            utils.execute('brctl', 'setfd', bridge, str(0), run_as_root=True)
+-            utils.execute('brctl', 'stp', bridge, 'off', run_as_root=True)
+-            utils.execute('ip', 'link', 'set', bridge, "address", mac_address,
+-                          run_as_root=True)
+-            utils.execute('ip', 'link', 'set', bridge, 'up', run_as_root=True)
+-            LOG.debug(_("Done starting bridge %s"), bridge)
+-
+-        full_ip = '%s/%s' % (network['dhcp_server'],
+-                             network['cidr'].rpartition('/')[2])
+-        utils.execute('ip', 'address', 'add', full_ip, 'dev', bridge,
+-                run_as_root=True)
+-
+-        return dev
+-
+-    def unplug(self, network):
+-        LOG.debug(_("inside unplug()"))
+-        dev = self.get_dev(network)
+-        try:
+-            utils.execute('ip', 'link', 'delete', dev, run_as_root=True)
+-        except exception.ProcessExecutionError:
+-            LOG.warning(_("Failed while unplugging gateway interface '%s'"),
+-                        dev)
+-            raise
+-        LOG.debug(_("Unplugged gateway interface '%s'"), dev)
+-        return dev
+-
+-    def get_dev(self, network):
+-        dev = GATEWAY_INTERFACE_PREFIX + str(network['uuid'][0:11])
+-        return dev
+-
+-    def get_bridge(self, network):
+-        bridge = BRDIGE_NAME_PREFIX + str(network['uuid'][0:11])
+-        return bridge
+diff --git a/quantum/plugins/linuxbridge/nova/vif_linuxbridge_quantum.py b/quantum/plugins/linuxbridge/nova/vif_linuxbridge_quantum.py
+deleted file mode 100644
+index 729c06a..0000000
+--- a/quantum/plugins/linuxbridge/nova/vif_linuxbridge_quantum.py
++++ /dev/null
+@@ -1,73 +0,0 @@
+-# vim: tabstop=4 shiftwidth=4 softtabstop=4
+-#
+-# Copyright (C) 2012 Midokura KK
+-# Copyright (C) 2012 Nicira, Inc
+-# Copyright (C) 2012 Cisco Systems, Inc
+-# Copyright 2012 OpenStack LLC.
+-# 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.
+-
+-"""
+-VIF driver for libvirt when QuantumManager is configured with Linux Bridge
+-plugin
+-"""
+-
+-from nova import flags
+-from nova import log as logging
+-from nova.network import linux_net
+-from nova.virt import netutils
+-from nova import utils
+-from nova.virt.vif import VIFDriver
+-from nova import exception
+-
+-LOG = logging.getLogger(__name__)
+-
+-FLAGS = flags.FLAGS
+-
+-
+-class QuantumLibvirtLinuxBridgeVIFDriver(VIFDriver):
+-    """VIF driver for Linux Bridge."""
+-
+-    def get_dev_name(_self, iface_id):
+-        return "tap" + iface_id[0:11]
+-
+-    def plug(self, instance, network, mapping):
+-        iface_id = mapping['vif_uuid']
+-        dev = self.get_dev_name(iface_id)
+-        if not linux_net._device_exists(dev):
+-            try:
+-                # First, try with 'ip'
+-                utils.execute('ip', 'tuntap', 'add', dev, 'mode', 'tap',
+-                          run_as_root=True)
+-            except exception.ProcessExecutionError:
+-                # Second option: tunctl
+-                utils.execute('tunctl', '-b', '-t', dev, run_as_root=True)
+-            utils.execute('ip', 'link', 'set', dev, 'up', run_as_root=True)
+-
+-        result = {
+-            'script': '',
+-            'name': dev,
+-            'mac_address': mapping['mac']}
+-        return result
+-
+-    def unplug(self, instance, network, mapping):
+-        """Unplug the VIF from the network by deleting the port from
+-        the bridge."""
+-        dev = self.get_dev_name(mapping['vif_uuid'])
+-        try:
+-            utils.execute('ip', 'link', 'delete', dev, run_as_root=True)
+-        except exception.ProcessExecutionError:
+-            LOG.warning(_("Failed while unplugging vif of instance '%s'"),
+-                        instance['name'])
+-            raise
+-- 
+1.7.4.1
+


More information about the scm-commits mailing list