[
https://issues.apache.org/jira/browse/DTACLOUD-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13587028#comment-13587028
]
Michal Fojtik commented on DTACLOUD-499:
----------------------------------------
FYI, you can apply Dies patch '[PATCH] added MachineTemplate subcollection of
SystemTemplate', then:
You need to do this modification in MachineTemplate model:
array :volume_templates do
ref :volume_template
#scalar :href, :initial_location
end
Then:
1. add "require 'pry'" to
"lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb"
2. add "binding.pry" on line 76
3. start server
4. GET /cimi/system_templates
5. go to console and type: 'system_template' (scroll down and you will see the
VolumeTemplateRef)
you can inspect the CIMI object now (that is how I found this issue). Another
good breakpoint for pry
is in schema.rb, line 248 :-) (from_json in Array class, before
@struct.convert_from_json(elt))
> The 'ref' attributes are not (de)serialized properly when used in array
> -----------------------------------------------------------------------
>
> Key: DTACLOUD-499
> URL: https://issues.apache.org/jira/browse/DTACLOUD-499
> Project: DeltaCloud
> Issue Type: Bug
> Components: CIMI/Frontend
> Reporter: Michal Fojtik
> Assignee: David Lutterkort
>
> If you have this definition in CIMI model (MachineTemplate in this case):
> array :volume_templates do
> ref :volume_template
> end
> and you use this JSON in .from_json method to create an instance of the
> MachineTemplate:
> <snip>
> 'volume_templates' : [
> { 'volumeConfig' : { 'capacity' : '12345' } }
> ]
> </snip>
> The resulting
> 'machine_template.volume_templates.first.volume_config.capacity' will be
> 'nil'.
> I tried to play a bit with the input JSON and I found that if you use this:
> <snip>
> 'volume_templates' : [
> 'volume_template' : {
> { 'volumeConfig' : { 'capacity' : '12345' } }
> }
> ]
> </snip>
> The resulting
> 'machine_template.volume_templates.first.volume_template.capacity' is set
> properly to '12345' :-)
> The XML output then looks like:
> <snip>
> <volumeTemplate>
> <volumeTemplate>
> <volumeConfig>
> <capacity>10240</capacity>
> </volumeConfig>
> </volumeTemplate>
> </volumeTemplate>
> </snip>
> I think we need to do something smart in the 'array' to remove the upper
> 'volumeTemplate' or introduce something like 'ref_arr :volume_templates'.
> Anyway, I'm leaving this one to you David, as you might have better schema
> knowledge than me ;-)
> CC'ing Dies, as he reported this issue original in his email.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira