summaryrefslogtreecommitdiff
path: root/nova/privsep
diff options
context:
space:
mode:
authorMichael Still <mikal@stillhq.com>2018-12-11 10:50:54 +1100
committerMichael Still <mikal@stillhq.com>2019-03-17 23:19:08 +0000
commit4b46c3ba88d7a439c7899c4e73d70218916d6960 (patch)
treeb56062d4d1603ee38594716cd2be519f0e527357 /nova/privsep
parentbe8af28a4ff111f99da9b34ee36a90a8a25d5bef (diff)
downloadnova-4b46c3ba88d7a439c7899c4e73d70218916d6960.tar.gz
Move slight bonkers IP management to privsep.
Change-Id: Ifdbee5c9f84211314d57e31ab84419987fec4737
Diffstat (limited to 'nova/privsep')
-rw-r--r--nova/privsep/linux_net.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/nova/privsep/linux_net.py b/nova/privsep/linux_net.py
index 82f3da79c0..74bae4dade 100644
--- a/nova/privsep/linux_net.py
+++ b/nova/privsep/linux_net.py
@@ -152,6 +152,18 @@ def change_ip(device, ip):
'dev', device)
+# TODO(mikal): this is horrid. The calling code takes arguments from an
+# interface list and just regurgitates them here. 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 address_command_deprecated(device, action, params):
+ cmd = ['ip', 'addr', action]
+ cmd.extend(params)
+ cmd.extend(['dev', device])
+ processutils.execute(*cmd, check_exit_code=[0, 2, 254])
+
+
@nova.privsep.sys_admin_pctxt.entrypoint
def dhcp_release(dev, address, mac_address):
processutils.execute('dhcp_release', dev, address, mac_address)
@@ -168,7 +180,7 @@ def routes_show(dev):
# 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):
+def route_add_deprecated(routes):
processutils.execute('ip', 'route', 'add', *routes)
@@ -182,7 +194,7 @@ def route_delete(dev, route):
# 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):
+def route_delete_deprecated(dev, routes):
processutils.execute('ip', 'route', 'del', *routes)