1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

B OpenNebula/one#3058: Apply fix for LXC (#1471)

This commit is contained in:
Daniel Clavijo Coca 2021-09-21 10:41:39 -05:00 committed by GitHub
parent 4b685dc22a
commit db0655b77c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,6 +115,11 @@ class Container
def reboot
rc = @client.stop(@one.vm_name)
# Remove nic from ovs-switch if needed
@one.get_nics.each do |nic|
del_bridge_port(nic) # network driver matching implemented here
end
return false unless rc
@client.start(@one.vm_name)
@ -161,4 +166,18 @@ class Container
@client.info(@one.vm_name)['State'] == STATES[:running]
end
def del_bridge_port(nic)
return true unless /ovswitch/ =~ nic['VN_MAD']
cmd = 'sudo -n ovs-vsctl --if-exists del-port '\
"#{nic['BRIDGE']} #{nic['TARGET']}"
rc, _o, e = Command.execute(cmd, false)
return true if rc.zero?
OpenNebula.log_error "#{__method__}: #{e}"
false
end
end