Display AWS Ec2 IP Address in Opennebula

I have opennebula deploying instances on EC2. This works fine, but how do I get IP or DNS information to display in opennebula?

From Sunstone, you can access this information from the Network tab after clicking an element in the VMs table.

From the CLI, all the information monitored by OpenNebula is included in the resource, onevm show VMID

Unfortunately I am unable to see the information in either locations. I also have the ec2-context.deb installed. Any idea what else I can check?

onevm show 30
VIRTUAL MACHINE 30 INFORMATION
ID : 30
NAME : Copy of MyWebServer -awstesting-30
USER : userme
GROUP : oneadmin
STATE : ACTIVE
LCM_STATE : RUNNING
RESCHED : No
HOST : us-east-1
CLUSTER ID : -1
CLUSTER : default
START TIME : 02/11 18:32:41
END TIME : -
DEPLOY ID : i-469ee5c6

VIRTUAL MACHINE MONITORING

PERMISSIONS
OWNER : um-
GROUP : —
OTHER : —

VM DISKS
ID DATASTORE TARGET IMAGE SIZE TYPE SAVE
0 - hda CONTEXT -/- - -

VIRTUAL MACHINE HISTORY
SEQ HOST ACTION DS START TIME PROLOG
0 us-east-1 none -1 02/11 18:33:09 0d 00h01m 0h00m00s

USER TEMPLATE
EC2=[
AMI=“ami-d25065b8”,
INSTANCETYPE=“m1.small”,
KEYPAIR=“opea” ]
SCHED_REQUIREMENTS="ID=“2"”

VIRTUAL MACHINE TEMPLATE
AUTOMATIC_REQUIREMENTS="!(PUBLIC_CLOUD = YES) | (PUBLIC_CLOUD = YES & (HYPERVISOR = ec2))"
CONTEXT=[
DISK_ID=“0”,
NETWORK=“YES”,
SET_HOSTNAME=“Copy of MyWebServer -awstesting-30”,
SSH_PUBLIC_KEY=“ssh-rsa e343242Lp user@vdad.net”,
TARGET=“hda” ]
CPU="0.5"
GRAPHICS=[
LISTEN=“0.0.0.0”,
PORT=“5930”,
TYPE=“VNC” ]
MEMORY="128"
TEMPLATE_ID="5"
VMID=“30”

Could you check if there is any error in oned.log? btw, after instantiating the VM you have to wait for a while (depending on monitoring step in oned.conf) until this information is available in the VM.

The logs do not show any errors?

Sat Feb 13 03:29:09 2016 [Z0][ReM][D]: Req:4224 UID:0 VirtualMachineDeploy invoked , 31, 2, false, -1
Sat Feb 13 03:29:09 2016 [Z0][DiM][D]: Deploying VM 31
Sat Feb 13 03:29:09 2016 [Z0][ReM][D]: Req:4224 UID:0 VirtualMachineDeploy result SUCCESS, 31
Sat Feb 13 03:29:09 2016 [Z0][VMM][D]: Message received: LOG I 31 Successfully execute network driver operation: pre.

Sat Feb 13 03:29:09 2016 [Z0][ReM][D]: Req:6032 UID:0 VirtualMachineInfo invoked , 31
Sat Feb 13 03:29:09 2016 [Z0][ReM][D]: Req:6032 UID:0 VirtualMachineInfo result SUCCESS, "31…"
Sat Feb 13 03:29:09 2016 [Z0][ReM][D]: Req:8480 UID:2 VirtualMachinePoolInfo invoked , -2, 0, -2000, -1
Sat Feb 13 03:29:09 2016 [Z0][ReM][D]: Req:8480 UID:2 VirtualMachinePoolInfo result SUCCESS, "<VM_POOL>0</…"
Sat Feb 13 03:29:10 2016 [Z0][ReM][D]: Req:3600 UID:2 VirtualMachinePoolInfo invoked , -2, 0, -2000, -1
Sat Feb 13 03:29:10 2016 [Z0][ReM][D]: Req:3600 UID:2 VirtualMachinePoolInfo result SUCCESS, "<VM_POOL>0</…"
Sat Feb 13 03:29:11 2016 [Z0][VMM][D]: Message received: LOG I 31 Successfully execute virtualization driver operation: deploy.

Sat Feb 13 03:29:11 2016 [Z0][VMM][D]: Message received: LOG I 31 Successfully execute network driver operation: post.

Sat Feb 13 03:29:11 2016 [Z0][VMM][D]: Message received: DEPLOY SUCCESS 31 i-93226e13

Sat Feb 13 03:29:27 2016 [Z0][ImM][D]: Datastore system (0) successfully monitored.

EC2 oned.conf settings:

IM_MAD = [
name = “ec2”,
executable = “one_im_sh”,
arguments = “-c -t 1 -r 0 ec2” ]

#-------------------------------------------------------------------------------
VM_MAD = [
name = “ec2”,
executable = “one_vmm_sh”,
arguments = “-t 15 -r 0 ec2”,
type = “xml” ]

AWS VM STATE:
Sat Feb 13 03:52:41 2016 [Z0][InM][D]: Host us-east-1 (2) successfully monitored.
Sat Feb 13 03:52:41 2016 [Z0][VMM][D]: VM 29 successfully monitored: STATE=-
Sat Feb 13 03:52:41 2016 [Z0][VMM][D]: VM 30 successfully monitored: STATE=-
Sat Feb 13 03:52:41 2016 [Z0][VMM][D]: VM 31 successfully monitored: STATE=-
Sat Feb 13 03:52:41 2016 [Z0][VMM][D]: VM 32 successfully monitored: STATE=-

Any other suggestions?

Could you check if the VM has an IP in the AWS console?
Could you also try removing the NETWORK=YES from the CONTEXT section in the template and reinstantiate the template

I got the same issue with EC2 driver in our setup (OpenNebula 4.14.2); but it seems an issue related to users different from oneadmin. I found out that if the VM owner is oneadmin the AWS info are displayed otherwise no info are displayed.

Ok so changing the vm owner to oneadmin fixes this. How can my regular user see this info because the VM will not be launched by oneadmin but by users?

We will take a look into this and let you know what could be the problem
http://dev.opennebula.org/issues/4334

Thank you, looking forward to the results and fix.

Hi,

I have just tested it and it’s working for me. From the log you pasted:

Sat Feb 13 03:52:41 2016 [Z0][VMM][D]: VM 29 successfully monitored: STATE=- 

It looks like there is a problem with the monitoring and the error is not logged by the driver. It should look like this:

Mon Feb 15 17:52:10 2016 [Z0][VMM][D]: VM 1 successfully monitored: MEMORY=0 CPU=0 NETTX=0 NETRX=0 STATE=a AWS_DNS_NAME=ec2-....compute-1.amazonaws.com AWS_PRIVATE_DNS_NAME=ip-.....ec2.internal AWS_AVAILABILITY_ZONE=us-east-1e AWS_PRIVATE_IP_ADDRESS=...AWS_IP_ADDRESS=....AWS_SECURITY_GROUPS=sg-AWS_INSTANCE_TYPE=t1.micro AWS_IMAGE_ID=ami-

Could you try changing the following line in /usr/lib/one/ruby/ec2_driver.rb:558 to:

        rescue => e
            STDERR.puts(e.message)
            exit(-1)
        end

Restart oned and check /var/log/one/oned.log for the error. Probably there is a problem with the aws-sdk version, I have tested with aws-sdk (1.33.0)

Can you place the surrounded code around that statement you want me add? For some reason line 558 is different for me, or place the entire file with changes on paste.debian.net

By the way, I am also using the same version: /var/lib/gems/2.1.0/gems/aws-sdk-1.33.0/bin/aws-rb

If i substitute the actual ec2_driver.rb (OpenNebula version 4.14.2) with the file ec2_driver.rb from github it works; the AWS info are displayed also for regular users.

Ok, I found out the problem and as Marco said it is already fixed in the repo. This is the commit that fixes the problem, you can modify your file to include the INFO_ALL_VM flag or just replace the ec2_driver.rb file with the one in the the repo.

https://github.com/OpenNebula/one/commit/248f1879656dd75b34ea4cc716f7a24e7b0050d0

Thank you, the problem is resolved! I will check github first in the future.