Merge "Remove unused method update_fixed_ip_lease_expiration"

This commit is contained in:
Jenkins 2014-03-05 20:17:11 +00:00 committed by Gerrit Code Review
commit 92b5fe2e09
2 changed files with 0 additions and 37 deletions

View File

@ -15,7 +15,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import datetime
import random import random
import netaddr import netaddr
@ -32,7 +31,6 @@ from neutron.db import sqlalchemyutils
from neutron import neutron_plugin_base_v2 from neutron import neutron_plugin_base_v2
from neutron.openstack.common import excutils from neutron.openstack.common import excutils
from neutron.openstack.common import log as logging from neutron.openstack.common import log as logging
from neutron.openstack.common import timeutils
from neutron.openstack.common import uuidutils from neutron.openstack.common import uuidutils
@ -315,25 +313,6 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
return True return True
return False 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 @staticmethod
def _delete_ip_allocation(context, network_id, subnet_id, ip_address): def _delete_ip_allocation(context, network_id, subnet_id, ip_address):

View 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) res = port_req.get_response(self.api)
self.assertEqual(res.status_int, webob.exc.HTTPClientError.code) 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): def test_max_fixed_ips_exceeded(self):
with self.subnet(gateway_ip='10.0.0.3', with self.subnet(gateway_ip='10.0.0.3',
cidr='10.0.0.0/24') as subnet: cidr='10.0.0.0/24') as subnet:
@ -2681,7 +2667,6 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase):
allocation_pools=allocation_pools) allocation_pools=allocation_pools)
def test_subnet_with_allocation_range(self): def test_subnet_with_allocation_range(self):
cfg.CONF.set_override('dhcp_lease_duration', 0)
with self.network() as network: with self.network() as network:
net_id = network['network']['id'] net_id = network['network']['id']
data = {'subnet': {'network_id': net_id, data = {'subnet': {'network_id': net_id,
@ -2711,7 +2696,6 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase):
port = self.deserialize(self.fmt, res) port = self.deserialize(self.fmt, res)
# delete the port # delete the port
self._delete('ports', port['port']['id']) self._delete('ports', port['port']['id'])
cfg.CONF.set_override('dhcp_lease_duration', 120)
def test_create_subnet_with_none_gateway_allocation_pool(self): def test_create_subnet_with_none_gateway_allocation_pool(self):
cidr = '10.0.0.0/24' cidr = '10.0.0.0/24'