Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 717182 Details for
Bug 927349
dnsmasq seems to run the dhcp-script only on startup.
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
nova-dhcpbridge
nova-dhcpbridge (text/plain), 4.25 KB, created by
David Hill
on 2013-03-27 17:41:40 UTC
(
hide
)
Description:
nova-dhcpbridge
Filename:
MIME Type:
Creator:
David Hill
Created:
2013-03-27 17:41:40 UTC
Size:
4.25 KB
patch
obsolete
>#!/usr/bin/python ># vim: tabstop=4 shiftwidth=4 softtabstop=4 > ># Copyright 2010 United States Government as represented by the ># Administrator of the National Aeronautics and Space Administration. ># 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. > >""" >Handle lease database updates from DHCP servers. >""" > >import gettext >import os >import sys > ># If ../nova/__init__.py exists, add ../ to Python search path, so that ># it will override what happens to be installed in /usr/(local/)lib/python... >possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), > os.pardir, > os.pardir)) >if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): > sys.path.insert(0, possible_topdir) > >gettext.install('nova', unicode=1) > >from nova import context >from nova import db >from nova import flags >from nova.network import linux_net >from nova.openstack.common import importutils >from nova.openstack.common import log as logging >from nova.openstack.common import rpc >from nova import utils > >FLAGS = flags.FLAGS > >LOG = logging.getLogger('nova.dhcpbridge') > > >def add_lease(mac, ip_address): > """Set the IP that was assigned by the DHCP server.""" > if FLAGS.fake_rabbit: > LOG.debug(_("leasing ip")) > network_manager = importutils.import_object(FLAGS.network_manager) > network_manager.lease_fixed_ip(context.get_admin_context(), > ip_address) > else: > rpc.cast(context.get_admin_context(), > "%s.%s" % (FLAGS.network_topic, FLAGS.host), > {"method": "lease_fixed_ip", > "args": {"address": ip_address}}) > > >def old_lease(mac, ip_address): > """Called when an old lease is recognized.""" > # NOTE(vish): We assume we heard about this lease the first time. > # If not, we will get it the next time the lease is > # renewed. > pass > > >def del_lease(mac, ip_address): > """Called when a lease expires.""" > if FLAGS.fake_rabbit: > LOG.debug(_("releasing ip")) > network_manager = importutils.import_object(FLAGS.network_manager) > network_manager.release_fixed_ip(context.get_admin_context(), > ip_address) > else: > rpc.cast(context.get_admin_context(), > "%s.%s" % (FLAGS.network_topic, FLAGS.host), > {"method": "release_fixed_ip", > "args": {"address": ip_address}}) > > >def init_leases(network_id): > """Get the list of hosts for a network.""" > ctxt = context.get_admin_context() > network_ref = db.network_get(ctxt, network_id) > network_manager = importutils.import_object(FLAGS.network_manager) > return network_manager.get_dhcp_leases(ctxt, network_ref) > > >def main(): > """Parse environment and arguments and call the approproate action.""" > flagfile = os.environ.get('FLAGFILE', FLAGS.dhcpbridge_flagfile) > argv = flags.parse_args(sys.argv, default_config_files=[flagfile]) > logging.setup("nova") > > if int(os.environ.get('TESTING', '0')): > from nova.tests import fake_flags > > action = argv[1] > if action in ['add', 'del', 'old']: > mac = argv[2] > ip = argv[3] > msg = (_("Called '%(action)s' for mac '%(mac)s' with ip '%(ip)s'") % > {"action": action, > "mac": mac, > "ip": ip}) > LOG.debug(msg) > globals()[action + '_lease'](mac, ip) > else: > try: > network_id = int(os.environ.get('NETWORK_ID')) > except TypeError: > LOG.error(_("Environment variable 'NETWORK_ID' must be set.")) > sys.exit(1) > > print init_leases(network_id) > > rpc.cleanup() > > >if __name__ == "__main__": > main()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 927349
: 717182 |
731497