[one-users] Running EC2 Instances in two different regions

Daniel Molina dmolina at opennebula.org
Fri Mar 30 00:13:24 PDT 2012


On 22 March 2012 14:57, Hendrik Wißmann <wissmann at gmx.de> wrote:
> Hello,
>
> my goal is to run two regions as vmhosts in opennebula. My first step was to
> create
> two different monitor and driver sections:
>
> IM_MAD = [
>      name       = "im_ec2_us-east",
>      executable = "one_im_ec2",
>      arguments  = "im_ec2/im_ec2_us-east.conf" ]
>
> IM_MAD = [
>      name       = "im_ec2_eu",
>      executable = "one_im_ec2",
>      arguments  = "im_ec2/im_ec2_eu.conf" ]
>
>
> VM_MAD = [
>    name       = "vmm_ec2-us-east",
>    executable = "one_vmm_ec2",
>    arguments  = "-u https://us-east-1.ec2.amazonaws.com
> vmm_ec2/vmm_ec2_us-east.conf",
>    type       = "xml" ]
>
> VM_MAD = [
>    name       = "vmm_ec2-eu",
>    executable = "one_vmm_ec2",
>    arguments  = "-u https://eu-west-1.ec2.amazonaws.com
> vmm_ec2/vmm_ec2_eu.conf",
>    type       = "xml" ]
>
>
> To differentiate the regions I chose two small instances in us-east and one
> small
> instance in eu and of course two ec2-keys in
> (vmm_ec2_us-east.conf,vmm_ec2_eu.conf)
>
> onehost create ec2-us-east im_ec2_us-east vmm_ec2-us-east tm_dummy dummy
> onehost create ec2-eu im_ec2_eu vmm_ec2-eu tm_dummy dummy
>
>
> The first strange thing is, that there was no resource overview, as
> available with the standard
> configuration:
>
> [oneadmin at centos-1 ~]$ onehost list
>  ID NAME               RVM   TCPU   FCPU   ACPU   TMEM   FMEM   AMEM   STAT
>  28 ec2-us-east          0      0      0    100     0K     0K     0K     on
>  30 ec2-eu               0      0      0    100     0K     0K     0K     on
>

By default the monitoring step is set to 10 minutes, try changing this
value. After the monitoring step these values should be updated

> The instantiation of the template
> EC2=[
>  AMI=ami-a977bec0,
>  AUTHORIZED_PORTS=22,
>  CLOUD=ec2-us-east,
>  INSTANCETYPE=m1.small,
>  NAME=EC2-InstanceStore ]
>
> results in the error:
> Thu Mar 22 14:32:36 2012 [VMM][I]: Command execution fail:
> /var/lib/one/ec2/ec2-api-tools-1.5.2.5/bin/ec2-run-instances ami-a977bec0 -k
> WissmannEU -t m1.small
> Thu Mar 22 14:32:36 2012 [VMM][I]: Client.InvalidAMIID.NotFound: The AMI ID
> 'ami-a977bec0' does not exist

The scheduler will assign a host to the VM, in this case there is no
requirement in the template so the VM can be deployed in both hosts
from the scheduler perspective. In order to avoid this you have two
options:

1. Add a requirement to the VM template specifying the target host.
This way the VM will only be deployed in that host.
REQUIREMENTS = "NAME = \"ec2-us-east\""

2. If you want to be able to deploy the VM in both zones, add another
EC2 section in the template with the parameters for the ec2-eu zone.
 EC2=[
  AMI=ami-a977bec0,
  AUTHORIZED_PORTS=22,
  CLOUD=ec2-us-east,
  INSTANCETYPE=m1.small,
  NAME=EC2-InstanceStore ]

 EC2=[
  AMI=<ec2-eu_ami>,
  AUTHORIZED_PORTS=22,
  CLOUD=ec2-eu,
  INSTANCETYPE=m1.small,
  NAME=EC2-InstanceStore ]

The ec2_vmm will check if there is an EC2 section whose CLOUD
parameter matches the target hostname. If there is no section, it will
use the first one. In your case there is no EC2 section for the ec2-eu
host, so the driver uses the only EC2 section defined

Hope this helps

>
> The first thing is, that the ami is available in us-east and the second
> thing is, that the command
> execution used the wrong default key. I suppose opennebula is using the last
> added vmhost. After
> deleting vmhost 30 everything is fine, except the resource overview.
>
> What I am doing wrong? Can anybody please help me?
>
> Thank you Hendrik
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org

-- 
Daniel Molina
Project Engineer
OpenNebula - The Open Source Solution for Data Center Virtualization
www.OpenNebula.org | dmolina at opennebula.org | @OpenNebula



More information about the Users mailing list