1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-18 06:03:39 +03:00

B #-: Update AWS elastic driver to new Ruby gem interface

(cherry picked from commit b58d3399e2067f972b456f5202bf18fe1ed0e4e2)
This commit is contained in:
Ruben S. Montero 2024-12-09 12:38:16 +01:00
parent 55ad4891e1
commit a4f81214d3
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87

View File

@ -77,14 +77,15 @@ class AWSProvider
# @return 0 on success, 1 on error
def assign(ip, _external, opts = {})
instcs = @ec2.describe_instances({ :instance_ids => [@deploy_id] })
inst = instcs[0][0].instances[0]
inst = instcs.reservations[0].instances[0]
# find NIC to which the IP belongs (avoid Ceph network)
nic_id = nil
inst.network_interfaces.each do |ec2_nic|
ec2_subnet = @ec2.describe_subnets(
{ :subnet_ids => [ec2_nic.subnet_id] }
)[0][0]
).subnets[0]
ip_range = IPAddr.new(ec2_subnet.cidr_block)
if ip_range.include?(ip)