deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "marios@redhat.com" <mandr...@redhat.com>
Subject Re: Rev1 CIMI ResourceMetadata capabilities
Date Wed, 19 Dec 2012 09:53:01 GMT
On 18/12/12 23:09, Ronelle Landy wrote:
>> From: marios@redhat.com
>> To: dev@deltacloud.apache.org
>> Sent: Tuesday, December 18, 2012 12:26:20 PM
>> Subject: Rev1 CIMI ResourceMetadata capabilities
>>
>>
>> Initial implementation/rework of CIMI ResourceMetadata:
>>
>> curl --user "mockuser:mockpassword" -H "Accept: application/xml"
>> http://localhost:3001/cimi/resource_metadata
>>
>>
>> *** Usage:
>>
>> CIMI features go in
>> deltacloud/server/lib/deltacloud/drivers/cimi_features.rb - defined
>> in same way as deltacloud features.
>>
>> Example usage in mock driver:
>>
>>  87     #cimi features$
>>  88     feature :machines, :default_initial_state do$
>>  89       { :values => ["STARTED"] }$
>>  90     end$
>>  91     feature :machines, :initial_states do$
>>  92       { :values => ["STARTED", "STOPPED"]}$
>>  93     end$
>>
>> NOTE: these may note make sense for mock (e.g. initial_states) but
>> are here just for testing/example
>>
>> *** Issues
>>
>> imo CIMI spec not entirely clear/I don't understand how 'values' are
>> to be defined for capability (I tried following what is says for
>> 'constraints' of attributes - i need to bring this up in next
>> meeting)... and I can't work out how to serialize them correctly
>> using our dsl - so the XML for example looks like (note how 'value'
>> is specified...):
>>
>> <ResourceMetadata xmlns="http://schemas.dmtf.org/cimi/1"
>> resourceURI="http://schemas.dmtf.org/cimi/1/ResourceMetadata">
>>   <id>http://localhost:3001/cimi/resource_metadata/machine</id>
>>   <name>Machine</name>
>>   <typeUri>http://localhost:3001/cimi/machines</typeUri>
>>   <capability name="DefaultInitialState"
>>   uri="http://schemas.dmtf.org/cimi/1/capability/Machine/DefaultInitialState"
>>   description="Indicates what the default initial state of a new
>>   Machine">
>>     <value>
>>       <value>STARTED</value>
>>     </value>
>>   </capability>
>>   <capability name="DefaultInitialState"
>>   uri="http://schemas.dmtf.org/cimi/1/capability/Machine/DefaultInitialState"
>>   description="Indicates the list of allowable initial states">
>>     <value>
>>       <value>STARTED</value>
>>     </value>
>>     <value>
>>       <value>STOPPED</value>
>>     </value>
>>   </capability>
>> </ResourceMetadata>
>>
>>
>> marios
>>
> 
> Apologies for the string of emails ... logging stuff as I hit it: 
> 

np - thanks for the feedback:


>  - The XML example above shows name, uri and description for each capability added. After
applying the patches, I see the name and uri but no description ... json output is copied
below - see empty decsription:
> 
> {"id":"http://qeblade39.rhq.lab.eng.bos.redhat.com:3001/cimi/resource_metadata","count":1,"resourceMetadata":[{"id":"http://qeblade39.rhq.lab.eng.bos.redhat.com:3001/cimi/resource_metadata/machine","name":"Machine","typeUri":"http://qeblade39.rhq.lab.eng.bos.redhat.com:3001/cimi/machines","capabilities":[{"name":"DefaultInitialState","uri":"http://schemas.dmtf.org/cimi/1/capability/Machine/DefaultInitialState","description":[],"values":[{"value":"STARTED"}]},{"name":"DefaultInitialState","uri":"http://schemas.dmtf.org/cimi/1/capability/Machine/DefaultInitialState","description":[],"values":[{"value":"STARTED"},{"value":"STOPPED"}]}]}],"resourceURI":"http://schemas.dmtf.org/cimi/1/ResourceMetadataCollection"}
> 


couldn't re-create this one... wonder if it's a sinatra-rabbit version
issue... what does gem list sinatra-rabbit say (I am running 1.1.3)



>  -  When creating a new machine, where in the POST command would I specify the desired
initial state?
> 

There's an 'initialState' attribute for machineTemplate... at a guess it
would look like (NOTE: our machine create code is not yet setup to parse
and act on this initial state yet):

curl -v --user "user:password" -X POST -H "Content-Type:
application/xml" -H "Accept: application/xml" -d '
<MachineCreate xmlns="http://schemas.dmtf.org/cimi/1">
  <name> myMachine1 </name>
  <description> my machine </description>
  <machineTemplate>
    <initialState> STARTED </initialState>
    <machineConfig
href="http://localhost:3001/cimi/machine_configurations/m1.small">
</machineConfig>
    <machineImage
href="http://localhost:3001/cimi/machine_images/ami-48aa4921">
</machineImage>
  </machineTemplate>
</MachineCreate>' http://localhost:3001/cimi/machines


curl -v --user "user:password" -X POST -H "Content-Type:
application/json" -H "Accept: application/xml" -d
'{ "resourceURI": "http://schemas.dmtf.org/cimi/1/MachineCreate", 	
   "name": "myMachine3", "description": "My very first json machine",
   "machineTemplate":
    { "initialState": "STARTED",
      "machineConfig":
       { "href":
"http://localhost:3001/cimi/machine_configurations/m1.small" },
      "machineImage":
       { "href": "http://localhost:3001/cimi/machine_images/ami-48aa4921"
       }
    }
 }' http://localhost:3001/cimi/machines


marios

> 
> 
>  
> 


Mime
View raw message