mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
Allow to be already assigned on host, e.g: when VM poweroff itself and then resumes (cherry picked from commit 85d66f39388a17db58b0c90b3a4c5ca175bcbafb)
This commit is contained in:
parent
6ef9d016f9
commit
c21e519c57
@ -73,7 +73,7 @@ class ElasticDriver < VNMMAD::VNMDriver
|
||||
process_all do |nic|
|
||||
next if attach_nic_id && attach_nic_id != nic[:nic_id]
|
||||
|
||||
cmds.add :ip, "route add #{nic[:ip]}/32 dev #{nic[:bridge]}"
|
||||
cmds.add :ip, "route add #{nic[:ip]}/32 dev #{nic[:bridge]} ||:"
|
||||
cmds.add :ip, "neighbour add proxy #{nic[:gateway]} dev #{nic[:bridge]}"
|
||||
|
||||
provider.activate(cmds, nic) if provider.respond_to? :activate
|
||||
|
@ -55,6 +55,12 @@ class PacketProvider
|
||||
def assign(_ip, external, _opts = {})
|
||||
@client.assign_cidr_device("#{external}/32", @deploy_id)
|
||||
0
|
||||
rescue Packet::Error => e
|
||||
# potential VM poweroff(itself) + resume
|
||||
return 0 if e.message == '{"errors"=>["Address has already been taken"]}'
|
||||
|
||||
OpenNebula.log_error("Error assiging #{external}:#{e.message}")
|
||||
1
|
||||
rescue StandardError => e
|
||||
OpenNebula.log_error("Error assiging #{external}:#{e.message}")
|
||||
1
|
||||
@ -87,4 +93,5 @@ class PacketProvider
|
||||
cmds.add :iptables, "-t nat -D PREROUTING -d #{nic[:external_ip]} -j DNAT"\
|
||||
" --to-destination #{nic[:ip]}"
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user