Bob McWhirter wrote:
Howdy folks (particularly Bryan)--
I've changed the SPI between framework and driver slightly. We now are
using app/models/**.rb. These are *not* ActiveRecord models.
I like it.. just curious what drove the change
Where a driver previously returned a hash, just wrap it in an
instance
of the appropriate class.
ie
return {
:id=>'ami-42'
}
becomes
return Image.new( {
:id=>'ami-42'
} )
Simple change.
*** Attribute changes...
:public_address and :private_address have been removed and replaced with
:public_addresses and :private_addresses. Both are an array of strings.
:actions should now exist, as an array (possibly empty) of appropriate
actions, based upon the :state. An array of symbols is pretty, such as
:actions=>[ :reboot ]
*** XML changes...
Due to the pluralizing of <public-addresses> and <private-addresses>,
they now look like
<public-addresses>
<address>instance42.public.cloudcorp.com</address>
<address>instance42-nic2.public.cloudcorp.com</address>
</public-addresses>
Actions are exposed through the XML like
<actions>
<link rel="reboot" href="...."/>
</actions>
I have a question about actions. How/where do I define new ones? For my
engine, instances can be stopped and started. How do I expose this? Can
I assume that we move all methods up to the base driver to define "the
api" a driver can expose?
Anywhere a URL exists to another resource, the URL has been moved from
the text content of the tag to an href attribute.
ie,
<image>http://...../ami-42</image>
becomes
<image href="http://...../ami-42"/>
*** Other driver changes...
To help with filtering, there's a filter_on(...) method now available.
If you have a collection of items, along with the opts hash
collection = filter_on( collection, :architecture, opts )
filter_on handles the cases where opts[:architecture] is a single value
and when it's an array value. Or if opts is nil. or if
opts[:architecture] is nil. It's fairly smart, and always safe to apply.
Every plural (instances(), images(), flavors()) should allow filtering
based upon 'id'. The client requires this functionality.
Thus
http://localhost:3000/images?id=ami-42
should return an array with 1 item, matching image with the id of ami-42.
Some methods, such as reboot_instance(creds, opts) has been renamed to
reboot_instance(creds, id). If we need parameters to reboot, let me
suggest reboot_instance(creds, id, opts={}). Keep 'id' parameter distinct.
*** Changes to the code
I've updated the framework, mock and ec2 drivers, along with the
client. All are pushed to their repos.
Bryan, I have not updated the RHEV-M driver. I don't know where it
lives, and I can't test it.
You can see it at
http://github.com/bkearney/deltacloud-driver-rhevm/tree/master, although
it really only runs on Windows.
-- bk