summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@yahoo.com>2010-10-01 05:57:17 -0700
committerVishvananda Ishaya <vishvananda@yahoo.com>2010-10-01 05:57:17 -0700
commit5e3da5864825a12da5a1ea1102a6efb6cebe204b (patch)
tree3bf2321dd436f6abb0c03e6aeee932f08ae8b018 /bin
parent4d13a8554459638387d772a23fffe6aaaab3348d (diff)
Fix the deprecation warnings for passing no context.
Moved RequestContext out of nova.api, because it is used by everything Context is passed through the queue. Added some helper methods for converting to admin context. Added a few more fields to request context.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nova-dhcpbridge20
1 files changed, 14 insertions, 6 deletions
diff --git a/bin/nova-dhcpbridge b/bin/nova-dhcpbridge
index a127ed03c..4574f0e20 100755
--- a/bin/nova-dhcpbridge
+++ b/bin/nova-dhcpbridge
@@ -33,6 +33,7 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')):
sys.path.insert(0, possible_topdir)
+from nova import context
from nova import db
from nova import flags
from nova import rpc
@@ -52,9 +53,12 @@ def add_lease(mac, ip_address, _hostname, _interface):
if FLAGS.fake_rabbit:
logging.debug("leasing ip")
network_manager = utils.import_object(FLAGS.network_manager)
- network_manager.lease_fixed_ip(None, mac, ip_address)
+ network_manager.lease_fixed_ip(context.get_admin_context(),
+ mac,
+ ip_address)
else:
- rpc.cast("%s.%s" % (FLAGS.network_topic, FLAGS.host),
+ rpc.cast(context.get_admin_context(),
+ "%s.%s" % (FLAGS.network_topic, FLAGS.host),
{"method": "lease_fixed_ip",
"args": {"context": None,
"mac": mac,
@@ -71,9 +75,12 @@ def del_lease(mac, ip_address, _hostname, _interface):
if FLAGS.fake_rabbit:
logging.debug("releasing ip")
network_manager = utils.import_object(FLAGS.network_manager)
- network_manager.release_fixed_ip(None, mac, ip_address)
+ network_manager.release_fixed_ip(context.get_admin_context(),
+ mac,
+ ip_address)
else:
- rpc.cast("%s.%s" % (FLAGS.network_topic, FLAGS.host),
+ rpc.cast(context.get_admin_context(),
+ "%s.%s" % (FLAGS.network_topic, FLAGS.host),
{"method": "release_fixed_ip",
"args": {"context": None,
"mac": mac,
@@ -82,8 +89,9 @@ def del_lease(mac, ip_address, _hostname, _interface):
def init_leases(interface):
"""Get the list of hosts for an interface."""
- network_ref = db.network_get_by_bridge(None, interface)
- return linux_net.get_dhcp_hosts(None, network_ref['id'])
+ ctxt = context.get_admin_context()
+ network_ref = db.network_get_by_bridge(ctxt, interface)
+ return linux_net.get_dhcp_hosts(ctxt, network_ref['id'])
def main():