summaryrefslogtreecommitdiff
path: root/nova/privsep
diff options
context:
space:
mode:
authorMichael Still <mikal@stillhq.com>2018-12-10 18:45:19 +1100
committerMichael Still <mikal@stillhq.com>2019-03-05 22:18:08 +0000
commit144205fe1b0cb87daa98562cba3bfb22b63739df (patch)
tree79c1042f408fd18136cab555d1d212e88869fdfe /nova/privsep
parent41ada6be3590293ccf14c707fd15e759cdfc5964 (diff)
downloadnova-144205fe1b0cb87daa98562cba3bfb22b63739df.tar.gz
Move route management to privsep.
Some of this code is pretty terrible, but its pre-existing terrible and should be cleaned up outside of the privsep transition. Change-Id: I3ace688d26a340dc44e34c7c5369463b9f98a230
Diffstat (limited to 'nova/privsep')
-rw-r--r--nova/privsep/linux_net.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/nova/privsep/linux_net.py b/nova/privsep/linux_net.py
index 69a2ac0144..cb302bb16e 100644
--- a/nova/privsep/linux_net.py
+++ b/nova/privsep/linux_net.py
@@ -146,6 +146,35 @@ def dhcp_release(dev, address, mac_address):
processutils.execute('dhcp_release', dev, address, mac_address)
+def routes_show(dev):
+ # Format of output is:
+ # 192.168.1.0/24 proto kernel scope link src 192.168.1.6
+ return processutils.execute('ip', 'route', 'show', 'dev', dev)
+
+
+# TODO(mikal): this is horrid. The calling code takes arguments from a route
+# list and just regurgitates them into new routes. This isn't good enough,
+# but is outside the scope of the privsep transition. Mark it as bonkers and
+# hope we clean it up later.
+@nova.privsep.sys_admin_pctxt.entrypoint
+def route_add_horrid(routes):
+ processutils.execute('ip', 'route', 'add', *routes)
+
+
+@nova.privsep.sys_admin_pctxt.entrypoint
+def route_delete(dev, route):
+ processutils.execute('ip', 'route', 'del', route, 'dev', dev)
+
+
+# TODO(mikal): this is horrid. The calling code takes arguments from a route
+# list and just regurgitates them into new routes. This isn't good enough,
+# but is outside the scope of the privsep transition. Mark it as bonkers and
+# hope we clean it up later.
+@nova.privsep.sys_admin_pctxt.entrypoint
+def route_delete_horrid(dev, routes):
+ processutils.execute('ip', 'route', 'del', *routes)
+
+
@nova.privsep.sys_admin_pctxt.entrypoint
def create_tap_dev(dev, mac_address=None, multiqueue=False):
_create_tap_dev_inner(dev, mac_address=mac_address,