peterknife / boto

Automatically exported from code.google.com/p/boto
0 stars 0 forks source link

The return value of boto.ec2.connection.get_all_instances() doesn't contain any placement group info #574

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Boto version: 2.1.1

Suppose I have an HPC instance running on my Amazon EC2 account, and I am in an 
interactive Python session. I have an object named 'ec2' constructed by 
'boto.ec2.connection.EC2Connection(...)'. When I call 
'ec2.get_all_instances()', this will return a list of reservations where each 
reservation contains a list of instances. However, none of the instance objects 
contains information about the placement group.

According to Amazons API a RunningInstanceItemType [1] has a 'placement' 
element which is of type PlacementResponseType [2] which contains 'groupName': 
the placement group name. Therefore the information is available. Yet, this 
information is not stored in an Instance object. 

Digging into the source of boto, I found that boto.ec2.instance.Instance is 
responsible for parsing the 'RunningInstancesItemType' response. In the 
Instance.endElement function there is an if-statement with condition name == 
'groupName', but the assignment to 'group_name' depends on the 
'_in_monitoring_element' member. I don't know what the original intention was 
of the 'group_name' member in Instance, but removing the line with the 
if-statement on '_in_monitoring_element', let's the placement group name be 
saved in member 'group_name'. It almost seems that that if-statement was 
accidentally inserted.

[1] 
http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemTy
pe-RunningInstancesItemType.html

[2] 
http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-ItemTy
pe-PlacementResponseType.html

Original issue reported on code.google.com by wijnands...@gmail.com on 4 Jan 2012 at 3:51

GoogleCodeExporter commented 9 years ago
I am in a similar situation where I need to retrieve the Placement Group for a 
given instance. Did you find a workaround without requiring modification of the 
library?

Original comment by homncr...@gmail.com on 22 Jun 2012 at 11:45

GoogleCodeExporter commented 9 years ago
It is a long time ago, that this issue bothered me. IIRC I changed my
copy of boto's source as I suggested in the report.

Original comment by wijnands...@gmail.com on 24 Jun 2012 at 8:32

GoogleCodeExporter commented 9 years ago
Forward propagated this issue into the Github project: 
https://github.com/boto/boto/issues/838

The fix suggested by the OP (remove the if statement) resolves the issue.

Original comment by homncr...@gmail.com on 25 Jun 2012 at 6:51

GoogleCodeExporter commented 9 years ago
FYI, garnaat closed the bug: 
https://github.com/boto/boto/issues/838#issuecomment-7288266

Original comment by homncr...@gmail.com on 26 Jul 2012 at 8:26