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:
parent
4b685dc22a
commit
db0655b77c
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user