mirror of
https://github.com/OpenNebula/one.git
synced 2026-12-02 13:16:48 +09:00
Allow to be already assigned on host, e.g:
when VM poweroff itself and then resumes
(cherry picked from commit 85d66f3938)
This commit is contained in:
1 parent
d73ce652c3
commit
04581b1c07
2 files changed
+8
-1
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user