]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove unused method update_fixed_ip_lease_expiration
authorAaron Rosen <aaronorosen@gmail.com>
Mon, 3 Mar 2014 22:47:02 +0000 (14:47 -0800)
committerAaron Rosen <aaronorosen@gmail.com>
Mon, 3 Mar 2014 22:48:10 +0000 (14:48 -0800)
This should have been log removed here:
Ifcb4f093c92904ceb896438987d53e692eb7fb26

Change-Id: I9395fea531365b82a0cd16f29d6392199e2d9c22
Closes-bug: #1287407

neutron/db/db_base_plugin_v2.py
neutron/tests/unit/test_db_plugin.py

index 852c9c526dac934ba7686402865e69a5361fc086..2a8ef167a3f029bcf932fdd49a8f0111456515bf 100644 (file)
@@ -15,7 +15,6 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import datetime
 import random
 
 import netaddr
@@ -32,7 +31,6 @@ from neutron.db import sqlalchemyutils
 from neutron import neutron_plugin_base_v2
 from neutron.openstack.common import excutils
 from neutron.openstack.common import log as logging
-from neutron.openstack.common import timeutils
 from neutron.openstack.common import uuidutils
 
 
@@ -315,25 +313,6 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
             return True
         return False
 
-    def update_fixed_ip_lease_expiration(self, context, network_id,
-                                         ip_address, lease_remaining):
-
-        expiration = (timeutils.utcnow() +
-                      datetime.timedelta(seconds=lease_remaining))
-
-        query = context.session.query(models_v2.IPAllocation)
-        query = query.filter_by(network_id=network_id, ip_address=ip_address)
-
-        try:
-            with context.session.begin(subtransactions=True):
-                fixed_ip = query.one()
-                fixed_ip.expiration = expiration
-        except exc.NoResultFound:
-            LOG.debug(_("No fixed IP found that matches the network "
-                        "%(network_id)s and ip address %(ip_address)s."),
-                      {'network_id': network_id,
-                       'ip_address': ip_address})
-
     @staticmethod
     def _delete_ip_allocation(context, network_id, subnet_id, ip_address):
 
index eb0ec34e6cef9c0074e353d13a82e60eb5453678..8c801d5a13bc88a4afc5a3abd4c5c04cc89f4bcd 100644 (file)
@@ -1618,20 +1618,6 @@ fixed_ips=ip_address%%3D%s&fixed_ips=ip_address%%3D%s&fixed_ips=subnet_id%%3D%s
             res = port_req.get_response(self.api)
             self.assertEqual(res.status_int, webob.exc.HTTPClientError.code)
 
-    def test_update_fixed_ip_lease_expiration_invalid_address(self):
-        cfg.CONF.set_override('dhcp_lease_duration', 10)
-        plugin = NeutronManager.get_plugin()
-        with self.subnet() as subnet:
-            with self.port(subnet=subnet) as port:
-                update_context = context.Context('', port['port']['tenant_id'])
-                with mock.patch.object(db_base_plugin_v2, 'LOG') as log:
-                    plugin.update_fixed_ip_lease_expiration(
-                        update_context,
-                        subnet['subnet']['network_id'],
-                        '255.255.255.0',
-                        120)
-                    self.assertTrue(log.mock_calls)
-
     def test_max_fixed_ips_exceeded(self):
         with self.subnet(gateway_ip='10.0.0.3',
                          cidr='10.0.0.0/24') as subnet:
@@ -2681,7 +2667,6 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase):
                                  allocation_pools=allocation_pools)
 
     def test_subnet_with_allocation_range(self):
-        cfg.CONF.set_override('dhcp_lease_duration', 0)
         with self.network() as network:
             net_id = network['network']['id']
             data = {'subnet': {'network_id': net_id,
@@ -2711,7 +2696,6 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase):
             port = self.deserialize(self.fmt, res)
             # delete the port
             self._delete('ports', port['port']['id'])
-        cfg.CONF.set_override('dhcp_lease_duration', 120)
 
     def test_create_subnet_with_none_gateway_allocation_pool(self):
         cidr = '10.0.0.0/24'