Hi Dies,
I am not 100% sure I understand what you are suggesting, but I think you
are saying that the instances method in each driver should support an
additional filter param 'system_id' .. is that correct ?
As I understand it, the find method in CIMI::Model::SystemMachine needs
to accept a system_id param to indicate what system we're looking at,
and that param would be passed to driver.instances, i.e.
SystemMachine#find would like something like
def find(system_id, ctx)
ctx.driver.instances(ctx.credentials, :system_id => system_id).map do
|sm|
convert_system_machine(sm)
end
end
If so, I am all for it. Do we need a way to introspect whether instances
accepts a :system_id param ?
David
On Tue, 2013-02-26 at 21:46 +1100, Koper, Dies wrote:
> I'm looking at what the best way would be to design a cimi system's
> subcollections (SystemMachine and SystemVolume in particular), and their
> mapping to the drivers.
>
> Retrieval of a system (or collection of systems), gives a response that
> includes e.g. its machines:
>
> <machines href="http://cimi.example.org/systems/system1/machines" />
>
> Listing the system's machines, should return a collection of SystemMachines,
> with references to the actual machines.
>
> <Collection xmlns="http://schemas.dmtf.org/cimi/1"
> resourceURI="http://schemas.dmtf.org/cimi/1/SystemMachineCollection">
> <id>http://localhost:3001/cimi/systems/system1/machines</id>
> <count>2</count>
> <SystemMachine>
> <id>http://localhost:3001/cimi/systems/system1/machines/inst0</id>
> <name>Mock Instance With Profile Change</name>
> <description>SystemMachine inst0 for System system1</description>
> <machine href="http://localhost:3001/cimi/machines/inst0" />
> <operation rel="delete"
> href="http://localhost:3001/cimi/systems/system1/machines/inst0" />
> </SystemMachine>
> ...
>
> I'm considering several ways to implement this:
> 1. From system_machine#self.find, passing the system_id to the existing
> driver.instances method to list only the instances of that system, then
> convert the instances into a SystemMachineCollection. This would be the most
> efficient way for fgcp.
>
> 2. Introduce a driver.system_machines method and leave it up to the driver
> how to retrieve the instances. A disadvantage is that each supporting driver
> relying on instances() would have to do the instance->machine conversion
> themselves.
>
> 3. Introduce a driver.system_instances method and leave it up to the driver
> how to retrieve the instances belonging to this system. The instance->machine
> conversion would be done in system_machine#self.find as in 1. A disadvantage
> of this is the mixture of cimi and DC concepts.
>
> I prefer 1. Possibly by adding a "system" feature for the drivers that
> support this in their instances (and storage_volumes, keys?) methods, so that
> we can use the DB for drivers that don't.
>
> What do you think?
>
> Regards,
> Dies Koper
>
> --
> Dies KÖPER
> Software & Solutions Architect
>
> Fujitsu Australia Software Technology (FAST) - Cloud Computing
> Tel. +61 2 9452 9061 (Fujitsu internal 7985-29061)
> [email protected]
>
>