1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-11 05:17:41 +03:00

F #3189: Improve looks (#3902)

This commit is contained in:
Daniel Clavijo Coca 2019-11-05 09:11:54 -06:00 committed by Ruben S. Montero
parent ed3e55ea1c
commit 85d8d745ad

View File

@ -5,6 +5,25 @@ $LOAD_PATH << "#{__dir__}/../.."
require 'vnmmad'
require 'open3'
def clean_host_nic(veth)
cmd = "ip link show #{veth}"
_o, _e, s = Open3.capture3(cmd)
return unless s == 0
cmd = "sudo ip link delete #{veth}"
OpenNebula.log "Found lingering nic #{veth}\n Running #{cmd}"
o, e, _s = Open3.capture3(cmd)
OpenNebula.log "#{o}\n#{e}"
end
###############
# Start patch #
###############
template64 = STDIN.read
vnm = VNMMAD::NoVLANDriver.from_base64(template64, nil, nil)
@ -29,21 +48,6 @@ nics.each do |nic|
detach = nic[:nic][:target]
end
def clean_host_nic(veth)
cmd = "ip link show #{veth}"
_o, _e, s = Open3.capture3(cmd)
return unless s == 0
cmd = "sudo ip link delete #{veth}"
OpenNebula.log "Found lingering nic #{veth}\n Running #{cmd}"
o, e, _s = Open3.capture3(cmd)
OpenNebula.log "#{o}\n#{e}"
end
if detach # only clean detached nic
clean_host_nic(detach)
else # clean all nics