As promised, I've been working on a node driver writers guide. It is
really rough, but I wanted to kick it out ASAP. Here is my first cut:
http://wiki.github.com/cloudkick/libcloud/nodedriverwritersguide
For the guide, I showed how to implement basic Linode support. Jed,
would love to have you take a look and offer some feedback. The only
weird thing I had to do was an additional API call to get ipaddresses,
as they are not returned in linode.list, as far as I can tell.
Let me know what you think! I'm probably going to stick this in a
sphinx doc, as soon as I can figure out how to use sphinx on the code
base.
-Alex
--
co-founder, cloudkick.com
twitter.com/cloudkick
541 231 0624
Looks good! The documentation will be a big help for future
implementers :-)
On the IP address subject, it is possible for a Linode instance to have
multiple public IP addresses. In such cases, the JSON return for
linode.ip.list is something like:
[{"LINODEID":61,
"ISPUBLIC":1,
"IPADDRESS":"72.14.191.56",
"RDNS_NAME":"li-56.members.linode.com",
"IPADDRESSID":113},
{"LINODEID":61,
"ISPUBLIC":1,
"IPADDRESS":"72.14.191.181",
"RDNS_NAME":"li-181.members.linode.com",
"IPADDRESSID":238},
{"LINODEID":61,
"ISPUBLIC":1,
"IPADDRESS":"72.14.191.187",
"RDNS_NAME":"li-187.members.linode.com",
"IPADDRESSID":244}]
Note that the IP addresses are not returned in chronological order; .181
came with the instance, then .187 and .56 were added in that order.
Right now, the linode.py driver is returning the last public IP address
returned:
>>> instance.list_nodes()[0].public_ip
u'72.14.191.187'
The Linode web interface uses a different algorithm to choose the "main"
IP address on the summary page; in this case, it displays the first
one, .56. I am not 100% sure what the web interface uses for the
algorithm, but I believe it displays the minimum of the IP address list.
To reduce confusion, returning the first IP address instead of the last
would probably be the way to go.
Alternatively, I propose defining public_ips as a list of all public IPs
returned by the provider (and defining private_ips in the same fashion).
For this particular Linode:
>>> instance.list_nodes()[0].public_ips
[u'72.14.191.56',u'72.14.191.181',u'72.14.191.187']
>>> instance.list_nodes()[0].private_ips
[]
Thoughts? -rt
--
Ryan Tucker <rtu...@gmail.com>