stable-only: fix typo in IVS related privsep method

- as part of this change [1], methods requiring root access for
   IVS  were moved to a separate file
 - there was a typo that causes failure to plug VM interface
 - this fixes the typo and includes the original file existence
   check to the utility method

This is a stable-only change for Queens because the code in
question was removed in Rocky [2].

[1] Ic48087fdf283b3ba503294a944be91be0c338132
[2] Icf948f6ee1c0da2327fb5eac61fec6e89ac30531

Change-Id: Ifa4df2bde2d9799727b29c63f2037fcd3eaa4b87
Closes-Bug: #1794126
This commit is contained in:
Aditya Prakash Vaja 2018-09-24 20:19:39 +05:30 committed by Matt Riedemann
parent 8157b16a65
commit 0c9bd9ce6e
1 changed files with 4 additions and 1 deletions

View File

@ -265,7 +265,10 @@ def disable_multicast_snooping(interface):
@nova.privsep.sys_admin_pctxt.entrypoint
def disable_ipv6(interface):
"""Disable ipv6 for a bridge."""
with open('/proc/sys/net/ipv6/conf/%s/disable_ipv' % interface, 'w') as f:
disable_ipv6_path = ('/proc/sys/net/ipv6/conf/%s/disable_ipv6' % interface)
if not os.path.exists(disable_ipv6_path):
return
with open(disable_ipv6_path, 'w') as f:
f.write('1')