deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Koper, Dies" <>
Subject RE: [PATCH] CIMI: adding system support
Date Sat, 09 Feb 2013 11:51:29 GMT

> > +++ b/server/lib/cimi/collections/system_templates.rb
> Nothing wrong with what you did here, but I am wondering if there is
> anything we can do to reduce this sort of boilerplate. Most of our
> collections look exactly the same ...

I was planning to suggest the same, after I confirmed the copying and pasting I did is actually
I suppose we have two types of models/collections, the ones that are implemented directly
in the drivers (like system, I suppose also meter and eventlog) and the ones that are mapped
to Deltacloud's models first (machines/instances, images, etc.). Especially in the former
case but maybe also in the latter case most of the code is the same.
I based this and system.rb on I believe machine.rb and all I did was rename machine to system.

> The puts just before the else is where things go wrong: without the
> puts, the value of the if branch is whatever is assigned to systems,
> which in turn is what gets returned from self.find - by inserting the
> puts, you are now returning nil. Put a line 'systems' just after the
> puts, and things look much better (at least, you're getting a valid
> response back instead of a 500, though it had no systems for me)

Thanks, that worked for me. Now both systems and system_templates are returning an entry for

<Collection xmlns="" resourceURI="">
    <description>the first system</description>
    <created>Fri Feb 08 15:25:41 EET 2013</created>
    <systems href="http://localhost:3001/cimi/systems/system1/systems" />
    <machines href="" />
    <volumes href="http://localhost:3001/cimi/systems/system1/volumes" />
    <networks href="" />
    <addresses href="http://localhost:3001/cimi/systems/system1/addresses" />
    <forwardingGroups href="http://localhost:3001/cimi/systems/system1/forwarding_groups"
    <operation rel="edit" href="http://localhost:3001/cimi/systems/system1" />
    <operation rel="delete" href="http://localhost:3001/cimi/systems/system1" />


<Collection xmlns="" resourceURI="">
    <id>http://localhost:3001/cimi/system_templates/system template 1</id>
    <name>system template 1</name>
    <description>A mock system template</description>
    <created>Fri Feb 08 12:15:15 EET 2013</created>
      <name>my machine</name>
      <description>an inline mock machine template</description>
      <name>my network</name>
      <description>a reference to an existing mock network template</description>
    <operation rel="edit" href="http://localhost:3001/cimi/system_templates/system template
1" />
    <operation rel="delete" href="http://localhost:3001/cimi/system_templates/system template
1" />

The first time I ran it it didn't work for me because I needed to copy the json files from
mock/data to my local /var/tmp/... folder. Maybe that's why it didn't work for you?

I don't believe this response XML is correct so I'll look at that first.

> As a general comment, try adding as little of the System* objects in one
> patch as possible, again, to make reviewing easier. I haven't looked in
> detail if that makes sense here or not, but it would be nice if it did,
> and there's nothing wrong with a CIMI provider that only has System, but
> none of the other System* collections.

It is my understanding that a System references its components (machines, etc.) through System*
collections, so without the System* collections all we'd have is a System class with a name,
description and state, but no containing machines, etc.
So I assume leaving them out here doesn't make sense?

Dies Koper
View raw message