My answers are in-line.

On Tue, Mar 26, 2013 at 12:25 AM, Rudolf Streif <rstr...@linuxfoundation.org
> wrote:

> I would appreciate if someone could explain to me why for
> BaseEC2NodeDriver.list_locations() the name parameter is set to
> availability_zone rather than availability_zone.name?
>
>     def list_locations(self):
>         locations = []
>         for index, availability_zone in \
>                 enumerate(self.ex_list_availability_zones()):
>                     locations.append(EC2NodeLocation(
>                         index, availability_zone, self.country, self,
>                         availability_zone)
>                     )
>         return locations
>

I'm not sure about this one, it looks like a bug to me. I've pushed a
commit with a fix to 0.12.x branch -
http://svn.apache.org/viewvc?view=revision&revision=r1461400

Thanks for spotting and reporting this.


> And the to make the confusion complete, at least for me, in __repr__ the
> code outputs self.availability_zone.name for the availability_zone where I
> would expect self.availability_zone.
>
> class EC2NodeLocation(NodeLocation):
>     def __init__(self, id, name, country, driver, availability_zone):
>         super(EC2NodeLocation, self).__init__(id, name, country, driver)
>         self.availability_zone = availability_zone
>
>     def __repr__(self):
>         return (('<EC2NodeLocation: id=%s, name=%s, country=%s, '
>                  'availability_zone=%s driver=%s>')
>                 % (self.id, self.name, self.country,
>                    self.availability_zone.name, self.driver.name))
>

Also a bug which should now be fixed in 0.12.x branch.


> It does not seem to make much sense to me how it is and it is actually
> rather cumbersome to use. In my application I am creating a node using
> default location since I cannot specify the location for create_node
> (unless I am missing something).
>
> After that I want to create a volume for which I must specify the location
> otherwise AWS EC2 will reject it (the code of BaseEC2NodeDriver in
> incorrect in allowing location=None).


I will look into this asap. I thought EC2 uses default availability zone if
you don't explicitly specify one, but it looks like this might not be the
case.


> For that purpose I need to query my
> node for its location with mynode.extra['availability']. However, I cannot
> use that value for create_volume() because it expects a Location object.
>
> Now I have either manually create a Location object with a nested
> availability_zone object for which I have to set the name attribute.
> Alternatively, I have to use list_locations() and then iterate through the
> list to find the one with the name I am looking for but not using the name
> attribute but using availability_zone.name.
>

On a side note - we are slowly moving away from this (cumbersome) multiple
classes per region + list_locations model in trunk.

This should hopefully make the whole interface feel more natural and user
friendly.


> Thanks,
> Rudi
>

Reply via email to