On 30/11/12 00:06, David Lutterkort wrote:
> On Wed, 2012-11-28 at 13:24 +0200, [email protected] wrote:
>> From: marios <[email protected]>
>>
>> * attach/detach operations on Machine model
>> * correct generation of MachineVolume collection
>
> I have a question about this patch:
>
>> diff --git a/server/lib/cimi/models/machine_volume.rb
>> b/server/lib/cimi/models/machine_volume.rb
>> index f5fa966..bb6a8a1 100644
>> --- a/server/lib/cimi/models/machine_volume.rb
>> +++ b/server/lib/cimi/models/machine_volume.rb
>> ...
>> + def self.collection_for_instance(instance_id, context)
>> + machine_volumes = self.find(instance_id, context)
>> + volumes_url = context.url("/machines/#{instance_id}/volumes")
>> + unless CIMI::Model.const_defined?('MachineVolumeCollection')
>> + collection_class = CIMI::Model::Collection.generate(self)
>> + else
>> + collection_class = CIMI::Model::MachineVolumeCollection
>> + end
>
> As of commit b02acbd1, embedded collections (those declared through
> 'collection' in another model class) will be generated in the namespace
> of the containing class. IOW, there should always be a
> CIMI::Model::Machine::MachineVolumeCollection - was that not the case
> here ?
Ah - and no - and we do the same for Machine Disk
(server/lib/cimi/models/disk.rb):
unless CIMI::Model.const_defined?('DiskCollection')
collection_class = CIMI::Model::Collection.generate(self)
I'll look into this some more next week,
marios
>
> David
>
>