CIMI Resources and Collections

We are continually improving CIMI support in Deltacloud. If you come across any inconsistencies or errors in the Deltacloud CIMI implementation we'll be very glad to hear about them.

In the following sections, the textual definitions following the title of each resource (e.g. "Machine") that are rendered in bold and italic type are taken from the CIMI 1.0.1 specification, available from the DMTF Cloud Management Initiative (DSP0263).




Machine

An instantiated compute resource that encapsulates both CPU and Memory. A Machine Collection resource represents the collection of Machine resources within a Provider


Retrieve the Machine Collection

Note the 'add' URI of the Machine Collection resource in the example response below. This is the URI that is used for creating a new Machine (adding to the Machine Collection).

Example request:

GET /cimi/machines HTTP/1.1
Authorization: Basic bW9ja3VzZXI6bW9ja3Bhc3N3b3Jk
User-Agent: curl/7.24.0 (i686-redhat-linux-gnu)
Host: localhost:3001
Accept: application/xml

Server response:

HTTP/1.1 200 OK
Content-Type: application/xml
CIMI-Specification-Version: 1.0.1
Content-Length: 2293
ETag: 5c6dc8cfbceeb1f3c610765a4aa600dd
Cache-Control: max-age=0, private, must-revalidate
Date: Fri, 28 Dec 2012 11:08:27 GMT
Connection: keep-alive
Server: thin 1.5.0 codename Knife

<Collection xmlns="http://schemas.dmtf.org/cimi/1"
        resourceURI="http://schemas.dmtf.org/cimi/1/MachineCollection">
  <id>http://localhost:3001/cimi/machines</id>
  <count>2</count>
  <Machine>
    <id>http://localhost:3001/cimi/machines/inst0</id>
    <name>Mock Instance With Profile Change</name>
    <description>No description set for Machine Mock Instance With Profile Change</description>
    <created>2012-12-28T13:08:27+02:00</created>
    <property key="machine_image">http://localhost:3001/cimi/machine_images/img1</property>
    <property key="credential">http://localhost:3001/cimi/credentials</property>
    <state>STARTED</state>
    <cpu>1</cpu>
    <memory>12582912</memory>
    <disks href="http://localhost:3001/cimi/machines/inst0/disks" />
    <volumes href="http://localhost:3001/cimi/machines/inst0/volumes" />
    <operation rel="http://schemas.dmtf.org/cimi/1/action/restart"
        href="http://localhost:3001/cimi/machines/inst0/restart" />
    <operation rel="http://schemas.dmtf.org/cimi/1/action/stop"
        href="http://localhost:3001/cimi/machines/inst0/stop" />
    <operation rel="http://schemas.dmtf.org/cimi/1/action/capture"
        href="http://localhost:3001/cimi/machine_images" />
  </Machine>
  <Machine>
    <id>http://localhost:3001/cimi/machines/inst1</id>
    <name>MockUserInstance</name>
    <description>No description set for Machine MockUserInstance</description>
    <created>2012-12-28T13:08:27+02:00</created>
    <property key="machine_image">http://localhost:3001/cimi/machine_images/img3</property>
    <property key="credential">http://localhost:3001/cimi/credentials</property>
    <state>STARTED</state>
    <cpu>1</cpu>
    <memory>1782579</memory>
    <disks href="http://localhost:3001/cimi/machines/inst1/disks" />
    <volumes href="http://localhost:3001/cimi/machines/inst1/volumes" />
    <operation rel="http://schemas.dmtf.org/cimi/1/action/restart"
        href="http://localhost:3001/cimi/machines/inst1/restart" />
    <operation rel="http://schemas.dmtf.org/cimi/1/action/stop"
        href="http://localhost:3001/cimi/machines/inst1/stop" />
    <operation rel="http://schemas.dmtf.org/cimi/1/action/capture"
        href="http://localhost:3001/cimi/machine_images" />
  </Machine>
  <operation rel="add" href="http://localhost:3001/cimi/machines" />
</Collection>


Retrieve a single Machine

Example request:

GET /cimi/machines/inst0 HTTP/1.1
Authorization: Basic bW9ja3VzZXI6bW9ja3Bhc3N3b3Jk
User-Agent: curl/7.24.0 (i686-redhat-linux-gnu)
Host: localhost:3001
Accept: application/xml

Server response:

HTTP/1.1 200 OK
Content-Type: application/xml
CIMI-Specification-Version: 1.0.1
Content-Length: 1092
ETag: 2d57aa01f1a50b2d13c04f0c51f08ab9
Cache-Control: max-age=0, private, must-revalidate
Date: Fri, 28 Dec 2012 11:20:28 GMT
Connection: keep-alive
Server: thin 1.5.0 codename Knife

<Machine xmlns="http://schemas.dmtf.org/cimi/1"
          resourceURI="http://schemas.dmtf.org/cimi/1/Machine">
  <id>http://localhost:3001/cimi/machines/inst0</id>
  <name>Mock Instance With Profile Change</name>
  <description>No description set for Machine Mock Instance With Profile Change</description>
  <created>2012-12-28T13:20:28+02:00</created>
  <property key="machine_image">http://localhost:3001/cimi/machine_images/img1</property>
  <property key="credential">http://localhost:3001/cimi/credentials</property>
  <state>STARTED</state>
  <cpu>1</cpu>
  <memory>12582912</memory>
  <disks href="http://localhost:3001/cimi/machines/inst0/disks" />
  <volumes href="http://localhost:3001/cimi/machines/inst0/volumes" />
  <operation rel="http://schemas.dmtf.org/cimi/1/action/restart"
          href="http://localhost:3001/cimi/machines/inst0/restart" />
  <operation rel="http://schemas.dmtf.org/cimi/1/action/stop"
          href="http://localhost:3001/cimi/machines/inst0/stop" />
  <operation rel="http://schemas.dmtf.org/cimi/1/action/capture"
          href="http://localhost:3001/cimi/machine_images" />
</Machine>


Create a new Machine

The 'add' URI of the Machine Collection is used to create a new Machine. This is returned when retrieving the Machine Collection resource.

Example request:

POST /cimi/machines HTTP/1.1
Authorization: Basic bW9ja3VzZXI6bW9ja3Bhc3N3b3Jk
User-Agent: curl/7.24.0 (i686-redhat-linux-gnu)
Host: localhost:3001
Content-Type: application/xml
Accept: application/xml
Content-Length: 370

<MachineCreate xmlns="http://schemas.dmtf.org/cimi/1">
  <name> myMachine1 </name>
  <description> my machine description </description>
  <machineTemplate>
    <machineConfig href="http://localhost:3001/cimi/machine_configurations/m1-small">
    </machineConfig>
    <machineImage href="http://localhost:3001/cimi/machine_images/img1">
    </machineImage>
  </machineTemplate>
</MachineCreate>

Server response:

HTTP/1.1 201 Created
Content-Type: application/xml
Location: http://localhost:3001/cimi/machines/inst3
CIMI-Specification-Version: 1.0.1
Content-Length: 1030
ETag: 360992481f1450f9d475f439e5105f9d
Cache-Control: max-age=0, private, must-revalidate
Date: Fri, 28 Dec 2012 11:47:58 GMT
Connection: keep-alive
Server: thin 1.5.0 codename Knife

<Machine xmlns="http://schemas.dmtf.org/cimi/1" resourceURI="http://schemas.dmtf.org/cimi/1/Machine">
  <id>http://localhost:3001/cimi/machines/inst3</id>
  <name> myMachine1 </name>
  <description> my machine description </description>
  <created>2012-12-28T13:47:58+02:00</created>
  <property key="machine_image">http://localhost:3001/cimi/machine_images/img1</property>
  <property key="credential">http://localhost:3001/cimi/credentials</property>
  <state>STARTED</state>
  <cpu>1</cpu>
  <memory>1782579</memory>
  <disks href="http://localhost:3001/cimi/machines/inst3/disks" />
  <volumes href="http://localhost:3001/cimi/machines/inst3/volumes" />
  <operation rel="http://schemas.dmtf.org/cimi/1/action/restart"
          href="http://localhost:3001/cimi/machines/inst3/restart" />
  <operation rel="http://schemas.dmtf.org/cimi/1/action/stop"
          href="http://localhost:3001/cimi/machines/inst3/stop" />
  <operation rel="http://schemas.dmtf.org/cimi/1/action/capture"
          href="http://localhost:3001/cimi/machine_images" />
</Machine>


Perform a Machine Operation

The list of Machine operations is returned when the URI of a specific Machine resource is dereferenced. Examples of operations are 'stop', 'restart' and 'capture'. An 'Action' resource is used in the POST message body corresponding to the operation to be executed. The example below shows the 'stop' action.

Example request:

POST /cimi/machines/inst3/stop HTTP/1.1
Authorization: Basic bW9ja3VzZXI6bW9ja3Bhc3N3b3Jk
User-Agent: curl/7.24.0 (i686-redhat-linux-gnu)
Host: localhost:3001
Content-Type: application/xml
Accept: application/xml
Content-Length: 125

<Action xmlns="http://schemas.dmtf.org/cimi/1">
  <action> http://http://schemas.dmtf.org/cimi/1/action/stop </action>
</Action>

Server response:

HTTP/1.1 202 Accepted
CIMI-Specification-Version: 1.0.1
Content-Length: 0
Date: Fri, 28 Dec 2012 14:01:43 GMT
Connection: keep-alive
Server: thin 1.5.0 codename Knife

Work with Machine Volumes

Retrieve the MachineVolume Collection

Example request:

GET /cimi/machines/inst1/volumes HTTP/1.1
Authorization: Basic bW9ja3VzZXI6bW9ja3Bhc3N3b3Jk
User-Agent: curl/7.24.0 (i686-redhat-linux-gnu)
Host: localhost:3001
Accept: application/xml
  

Server response:

HTTP/1.1 200 OK
Content-Type: application/xml
CIMI-Specification-Version: 1.0.1
Content-Length: 747
ETag: 8e2d333a3747634c04942b7d219a8d59
Cache-Control: max-age=0, private, must-revalidate
Date: Fri, 18 Jan 2013 14:50:26 GMT
Connection: keep-alive
Server: thin 1.5.0 codename Knife

<Collection xmlns="http://schemas.dmtf.org/cimi/1"
          resourceURI="http://schemas.dmtf.org/cimi/1/MachineVolumeCollection">
  <id>http://localhost:3001/cimi/machines/inst1/volumes</id>
  <count>1</count>
  <MachineVolume>
    <id>http://localhost:3001/cimi/machines/inst1/volumes/vol3</id>
    <name>vol3</name>
    <description>MachineVolume vol3 for Machine inst1</description>
    <created>2009-07-30T14:35:11Z</created>
    <initialLocation>/dev/sda1</initialLocation>
    <volume href="http://localhost:3001/cimi/volumes/vol3" />
    <operation rel="delete" href="http://localhost:3001/cimi/machines/inst1/volumes/vol3" />
  </MachineVolume>
  <operation rel="add" href="http://localhost:3001/cimi/machines/inst1/volume_attach" />
</Collection>
  


Attach a Volume to a Machine - aka add a new MachineVolume to the MachineVolumeCollection of a specific Machine resource

Example request:


POST /cimi/machines/inst1/volume_attach HTTP/1.1
Authorization: Basic bW9ja3VzZXI6bW9ja3Bhc3N3b3Jk
User-Agent: curl/7.24.0 (i686-redhat-linux-gnu)
Host: localhost:3001
Content-Type: application/xml
Accept: application/xml
Content-Length: 186

<MachineVolume xmlns="http://schemas.dmtf.org/cimi/1/MachineVolume">
  <initialLocation> /dev/sdf </initialLocation>
  <volume href="http://localhost:3001/cimi/volumes/vol3"/>
</MachineVolume>
  

Server response:


HTTP/1.1 201 Created
Content-Type: application/xml
Location: http://localhost:3001/cimi/machines/inst1/volumes/vol3
CIMI-Specification-Version: 1.0.1
Content-Length: 522
ETag: cba6ca3186fa1ca3b7caf6b19e857139
Cache-Control: max-age=0, private, must-revalidate
Date: Fri, 18 Jan 2013 14:56:52 GMT
Connection: keep-alive
Server: thin 1.5.0 codename Knife

<MachineVolume xmlns="http://schemas.dmtf.org/cimi/1" resourceURI="http://schemas.dmtf.org/cimi/1/MachineVolume">
  <id>http://localhost:3001/cimi/machines/inst1/volumes/vol3</id>
  <name>vol3</name>
  <description>MachineVolume vol3 for Machine inst1</description>
  <created>2009-07-30T14:35:11Z</created>
  <initialLocation>/dev/sdf</initialLocation>
  <volume href="http://localhost:3001/cimi/volumes/vol3" />
  <operation rel="delete" href="http://localhost:3001/cimi/machines/inst1/volumes/vol3" />
</MachineVolume>

  


Detach a Volume from a Machine - aka remove a MachineVolume from the MachineVolumeCollection of a specific Machine resource

Example request:

DELETE /cimi/machines/inst1/volumes/vol3 HTTP/1.1
Authorization: Basic bW9ja3VzZXI6bW9ja3Bhc3N3b3Jk
User-Agent: curl/7.24.0 (i686-redhat-linux-gnu)
Host: localhost:3001
Accept: application/xml

  

Server response:

HTTP/1.1 200 OK
Content-Type: application/xml
CIMI-Specification-Version: 1.0.1
Content-Length: 304
ETag: 011fb5daa52162644aeb170c86dc08ce
Cache-Control: max-age=0, private, must-revalidate
Date: Fri, 18 Jan 2013 17:11:02 GMT
Connection: keep-alive
Server: thin 1.5.0 codename Knife

<Collection xmlns="http://schemas.dmtf.org/cimi/1" resourceURI="http://schemas.dmtf.org/cimi/1/MachineVolumeCollection">
  <id>http://localhost:3001/cimi/machines/inst1/volumes</id>
  <count>0</count>
  <operation rel="add" href="http://localhost:3001/cimi/machines/inst1/volume_attach" />
</Collection>