~nova-coresec/nova/bexar-translations

« back to all changes in this revision

Viewing changes to nova/network/manager.py

  • Committer: Todd Willey
  • Date: 2011-01-04 05:23:35 UTC
  • mto: (515.6.1 newlog2)
  • mto: This revision was merged to the branch mainline in revision 528.
  • Revision ID: todd@ansolabs.com-20110104052335-rfq4igtasqjv3ux5
Apply logging changes as a giant patch to work around the cloudpipe delete + add issue in the original patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
"""
46
46
 
47
47
import datetime
48
 
import logging
49
48
import math
50
49
import socket
51
50
 
55
54
from nova import db
56
55
from nova import exception
57
56
from nova import flags
 
57
from nova import log as logging
58
58
from nova import manager
59
59
from nova import utils
60
60
from nova import rpc
61
61
 
62
62
 
 
63
LOG = logging.getLogger("nova.networkmanager")
63
64
FLAGS = flags.FLAGS
64
65
flags.DEFINE_string('flat_network_bridge', 'br100',
65
66
                    'Bridge for simple network instances')
131
132
 
132
133
    def set_network_host(self, context, network_id):
133
134
        """Safely sets the host of the network."""
134
 
        logging.debug(_("setting network host"))
 
135
        LOG.debug(_("setting network host"))
135
136
        host = self.db.network_set_host(context,
136
137
                                        network_id,
137
138
                                        self.host)
186
187
 
187
188
    def lease_fixed_ip(self, context, mac, address):
188
189
        """Called by dhcp-bridge when ip is leased."""
189
 
        logging.debug("Leasing IP %s", address)
 
190
        LOG.debug(_("Leasing IP %s"), address)
190
191
        fixed_ip_ref = self.db.fixed_ip_get_by_address(context, address)
191
192
        instance_ref = fixed_ip_ref['instance']
192
193
        if not instance_ref:
201
202
                                {'leased': True,
202
203
                                 'updated_at': now})
203
204
        if not fixed_ip_ref['allocated']:
204
 
            logging.warn(_("IP %s leased that was already deallocated"),
205
 
                         address)
 
205
            LOG.warn(_("IP %s leased that was already deallocated"), address)
206
206
 
207
207
    def release_fixed_ip(self, context, mac, address):
208
208
        """Called by dhcp-bridge when ip is released."""
209
 
        logging.debug("Releasing IP %s", address)
 
209
        LOG.debug("Releasing IP %s", address)
210
210
        fixed_ip_ref = self.db.fixed_ip_get_by_address(context, address)
211
211
        instance_ref = fixed_ip_ref['instance']
212
212
        if not instance_ref:
216
216
            raise exception.Error(_("IP %s released from bad mac %s vs %s") %
217
217
                                  (address, instance_ref['mac_address'], mac))
218
218
        if not fixed_ip_ref['leased']:
219
 
            logging.warn(_("IP %s released that was not leased"), address)
 
219
            LOG.warn(_("IP %s released that was not leased"), address)
220
220
        self.db.fixed_ip_update(context,
221
221
                                fixed_ip_ref['address'],
222
222
                                {'leased': False})
437
437
                                                           self.host,
438
438
                                                           time)
439
439
        if num:
440
 
            logging.debug(_("Dissassociated %s stale fixed ip(s)"), num)
 
440
            LOG.debug(_("Dissassociated %s stale fixed ip(s)"), num)
441
441
 
442
442
    def init_host(self):
443
443
        """Do any initialization that needs to be run if this is a