deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik <>
Subject Re: [PATCH] added Template subcollections to SystemTemplate
Date Tue, 02 Apr 2013 08:41:43 GMT
On 04/02/2013 02:26 AM, David Lutterkort wrote:
> On Thu, 2013-03-28 at 12:19 +1100, Koper, Dies wrote:
>> A bit of background on this patch:
>> It contains my latest work on implementing cimi systems and system
>> templates for mock and fgcp.
>> It is not complete and contains some debugging statements. Its main
>> purpose is to show you what I have and what issues I'm seeing.
>> It applies to master (fcffad13e66175152cf8a43d615b79727902b5ee) and
>> requires "[PATCH] CIMI schema: tolerate nil hash_map attributes" to
>> solve a nil error for system templates with fgcp.
>> Issues I'm having:
>> (1)
>> With mock, even unsupported subcollections are shown when retrieving
>> systems. With fgcp they are also shown, and their href urls are broken:
> This is a shortcoming of how we populate models right now - there's no
> way to suppress collections that the driver doesn't support. In fact,
> the code goes through great length to make sure we generate the href for
> empty collections (since that href is needed to add the first element to
> an empty collection)
> The easiest way to 'fix' this for now is to comment those unsupported
> collections out in system.rb.
> A better fix is to add a mechanism similar to what we do for $select to
> models; call that the 'exclude' mechanism. The various generate_xxx
> methods should set the that exclude parameter based on collections that
> are declared in Rabbit, but not available (Rabbit knows that, Michal:
> how do we get that info out of Rabbit ?)

How about this?

module CIMI::Helper

   def supported_collections


All 'Base' classes are in fact 'Sinatra::Base' and you can use all 
defined Sinatra helpers in the Rabbit operation control block.

Having this, you can do then following in all Service models:

context.supported_collections.include? Collection

> Similar to how CIMI::Model::Resource has @select_attrs it should also
> have @exclude_attrs that are consulted in prepare and cause the
> corresponding collection to be set to nil (which will remove it from the
> XML/JSON output)
>> (2)
>> With mock (not with fgcp), when I list a system's volumes, its id is not
>> generated correctly:
>> d:\projects>curl --user mockuser:mockpassword
>> http://localhost:3001/cimi/systems/system2/volumes?format=xml
>> <Collection xmlns=""
>> resourceURI="">
>>    <id>http://localhost:3001/cimi/system/system2/volumes</id>
>>    <count>1</count>
>>    <SystemVolume>
>>      <id>http://localhost:3001/cimi/volumes?id=sysvol1</id>
>> ...
>> That should be http://localhost:3001/cimi/volumes/sysvol1.
>> Note my comment in mock_driver_cimi_methods.rb#system_volumes about the
>> 1st arg I pass to convert_cimi_mock_urls:
>>        #FIXME: with ":volumes", delete url becomes
>> 'http://localhost:3001/cimi/volumes?id=sysvol1'
>>        #with ":system_volume" or ":system_volumes", undefined method
>> `system_volume_url' for #<CIMI::Collections::Systems:0x44fe338> in
>> mock_driver_cimi_methods.rb:261
>>{|vol|convert_cimi_mock_urls(:volumes, vol,
>> opts[:env])}.flatten
> This seems to be a Rabbit problem with the names of the subcollections;
> somehow URL helpers for the subcollections do not get generated
> correctly. Michal ?
> BTW, attached is a patch that addresses a few URL conversion problems I
> found in the mock driver; feel free to commit if it doesn't make things
> worse ;)
> David


Michal Fojtik <>
Deltacloud API, CloudForms

View raw message