mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Ticket #3983: fix elastic ip association
(cherry picked from commit 6a260e1081f44cf00b9e26af5444d5b72ef5d2b6)
This commit is contained in:
parent
f43309ac93
commit
945b2393f9
@ -35,6 +35,7 @@ require 'yaml'
|
||||
require 'rubygems'
|
||||
require 'aws-sdk'
|
||||
require 'uri'
|
||||
require 'resolv'
|
||||
|
||||
$: << RUBY_LIB_LOCATION
|
||||
|
||||
@ -338,11 +339,26 @@ class EC2Driver
|
||||
|
||||
instance.create_tags(:tags => tag_array)
|
||||
|
||||
elastic_ip = ec2_value(ec2_info, 'ELASTICIP')
|
||||
|
||||
if elastic_ip
|
||||
wait_state('pending', instance.id)
|
||||
|
||||
if elastic_ip.match(Resolv::IPv4::Regex)
|
||||
address_key = :public_ip
|
||||
else
|
||||
address_key = :allocation_id
|
||||
end
|
||||
|
||||
address = {
|
||||
:instance_id => instance.id,
|
||||
address_key => elastic_ip
|
||||
}
|
||||
|
||||
@ec2.client.associate_address(address)
|
||||
end
|
||||
|
||||
wait_state('running', instance.id)
|
||||
if ec2_value(ec2_info, 'ELASTICIP')
|
||||
instance.associate_elastic_ip(ec2_value(ec2_info, 'ELASTICIP'))
|
||||
end
|
||||
|
||||
puts(instance.id)
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user