You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2011/10/19 15:44:10 UTC
[PATCH core 4/4] CIMI: Removed XmlSimple parsing of static XML files (moved to HAML) and a lot of small fixes and improvements.
From: Michal Fojtik <mf...@redhat.com>
Signed-off-by: Michal fojtik <mf...@redhat.com>
---
server/lib/cimi/data/collections/machine.col.xml | 8 -
.../data/collections/machine_configuration.col.xml | 8 -
.../cimi/data/collections/machine_image.col.xml | 8 -
server/lib/cimi/data/collections/volume.col.xml | 8 -
server/lib/cimi/data/default_res/machine.col.xml | 35 ----
.../data/default_res/machine_configuration.col.xml | 17 --
.../cimi/data/default_res/machine_image.col.xml | 11 --
server/lib/cimi/data/default_res/volume.col.xml | 14 --
server/lib/cimi/helpers/cmwg_helper.rb | 79 ++++++++
server/lib/cimi/helpers/cmwgapp_helper.rb | 146 ---------------
server/lib/cimi/server.rb | 191 ++++++--------------
server/views/cimi/cloudEntryPoint/index.html.haml | 5 -
server/views/cimi/cloudEntryPoint/index.xml.haml | 9 -
.../views/cimi/cloud_entry_point/index.html.haml | 7 +
server/views/cimi/cloud_entry_point/index.xml.haml | 8 +
server/views/cimi/error.html.haml | 59 ++++---
server/views/cimi/layout.html.haml | 56 +++---
.../cimi/machine_configurations/index.xml.haml | 8 +
.../cimi/machine_configurations/show.xml.haml | 14 ++
server/views/cimi/machine_images/index.xml.haml | 8 +
server/views/cimi/machine_images/show.xml.haml | 9 +
server/views/cimi/machines/index.xml.haml | 8 +
server/views/cimi/machines/show.xml.haml | 30 +++
server/views/cimi/volume/show.html.haml | 68 -------
server/views/cimi/volumes/index.xml.haml | 8 +
server/views/cimi/volumes/show.html.haml | 68 +++++++
server/views/cimi/volumes/show.xml.haml | 12 ++
27 files changed, 377 insertions(+), 525 deletions(-)
delete mode 100644 server/lib/cimi/data/collections/machine.col.xml
delete mode 100644 server/lib/cimi/data/collections/machine_configuration.col.xml
delete mode 100644 server/lib/cimi/data/collections/machine_image.col.xml
delete mode 100644 server/lib/cimi/data/collections/volume.col.xml
delete mode 100644 server/lib/cimi/data/default_res/machine.col.xml
delete mode 100644 server/lib/cimi/data/default_res/machine_configuration.col.xml
delete mode 100644 server/lib/cimi/data/default_res/machine_image.col.xml
delete mode 100644 server/lib/cimi/data/default_res/volume.col.xml
create mode 100644 server/lib/cimi/helpers/cmwg_helper.rb
delete mode 100644 server/lib/cimi/helpers/cmwgapp_helper.rb
delete mode 100644 server/views/cimi/cloudEntryPoint/index.html.haml
delete mode 100644 server/views/cimi/cloudEntryPoint/index.xml.haml
create mode 100644 server/views/cimi/cloud_entry_point/index.html.haml
create mode 100644 server/views/cimi/cloud_entry_point/index.xml.haml
create mode 100644 server/views/cimi/machine_configurations/index.xml.haml
create mode 100644 server/views/cimi/machine_configurations/show.xml.haml
create mode 100644 server/views/cimi/machine_images/index.xml.haml
create mode 100644 server/views/cimi/machine_images/show.xml.haml
create mode 100644 server/views/cimi/machines/index.xml.haml
create mode 100644 server/views/cimi/machines/show.xml.haml
delete mode 100644 server/views/cimi/volume/show.html.haml
create mode 100644 server/views/cimi/volumes/index.xml.haml
create mode 100644 server/views/cimi/volumes/show.html.haml
create mode 100644 server/views/cimi/volumes/show.xml.haml
diff --git a/server/lib/cimi/data/collections/machine.col.xml b/server/lib/cimi/data/collections/machine.col.xml
deleted file mode 100644
index 622a6fe..0000000
--- a/server/lib/cimi/data/collections/machine.col.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<MachineCollection xmlns="http://www.dmtf.org/cimi">
- <uri>machine</uri>
- <name>Machine collection </name>
- <description>The machine collection</description>
- <created>2011-09-12 11:37:28 UTC</created>
- <operation rel="add" href="/machines" />
-</MachineCollection>
diff --git a/server/lib/cimi/data/collections/machine_configuration.col.xml b/server/lib/cimi/data/collections/machine_configuration.col.xml
deleted file mode 100644
index 99af7fb..0000000
--- a/server/lib/cimi/data/collections/machine_configuration.col.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<MachineConfigurationCollection xmlns="http://www.dmtf.org/cimi">
- <uri>machineConfiguration</uri>
- <name>Machine Configuration collection </name>
- <description>That is jsut a test</description>
- <created>2011-09-12 11:37:28 UTC</created>
- <operation rel="add" href="/machine_configurations" />
-</MachineConfigurationCollection>
diff --git a/server/lib/cimi/data/collections/machine_image.col.xml b/server/lib/cimi/data/collections/machine_image.col.xml
deleted file mode 100644
index 2c27075..0000000
--- a/server/lib/cimi/data/collections/machine_image.col.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<MachineImageCollection xmlns="http://www.dmtf.org/cimi">
- <uri>machineImage</uri>
- <name>Machine Config collection </name>
- <description>The machine config collection</description>
- <created>2011-09-12 11:37:28 UTC</created>
- <operation rel="add" href="/machine_images" />
-</MachineImageCollection>
diff --git a/server/lib/cimi/data/collections/volume.col.xml b/server/lib/cimi/data/collections/volume.col.xml
deleted file mode 100644
index e2d2b4a..0000000
--- a/server/lib/cimi/data/collections/volume.col.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<VolumeCollection xmlns="http://www.dmtf.org/cimi">
- <uri>volume</uri>
- <name>Volume collection </name>
- <description>The volume collection</description>
- <created>2011-09-12 11:37:28 UTC</created>
- <operation rel="add" href="/volumes" />
-</VolumeCollection>
diff --git a/server/lib/cimi/data/default_res/machine.col.xml b/server/lib/cimi/data/default_res/machine.col.xml
deleted file mode 100644
index 7c2bab1..0000000
--- a/server/lib/cimi/data/default_res/machine.col.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<Machine xmlns="http://www.dmtf.org/cimi">
- <uri>machine</uri>
- <name>Default machine name </name>
- <description>Default machine description</description>
- <created>2011-01-01 00:00:01 UTC</created>
- <property name="prop1" content="prop1 value" />
- <status>Started</status>
- <cpu>Intel</cpu>
- <memory quantity="4" units="gigabyte" />
- <disk>
- <capacity quantity="200" units="gigabyte" />
- <format>ntgs</format>
- <attachmentPoint>/dev/sdb0</attachmentPoint>
- <guestInterface>SATA</guestInterface>
- </disk>
- <volume href="http://host:port/volume/vol01" attachmentPoint="/dev/sdc01" protocol="NFS" />
- <networkInterface>
- <vsp href="http://host:port/vsp/vsp01" />
- <hostname>example host name</hostname>
- <macAddress>00:00:00:00:00:00</macAddress>
- <state>Active</state>
- <protocol>IPv6</protocol>
- <allocation>Dynamic</allocation>
- <address>10.10.10.1</address>
- <defaultGateway>10.10.0.1</defaultGateway>
- <dns>10.10.0.1</dns>
- <maxTransmissionUnit>512</maxTransmissionUnit>
- </networkInterface>
- <meter href="/meter" />
- <eventLog href="eventLog" />
- <operation rel="edit" href="/machine"/>
- <operation rel="delete" href="/machine"/>
- <operation rel="http://www.dmtf.org/cimi/stop" href="/machine/stop"/>
-</Machine>
\ No newline at end of file
diff --git a/server/lib/cimi/data/default_res/machine_configuration.col.xml b/server/lib/cimi/data/default_res/machine_configuration.col.xml
deleted file mode 100644
index 564b378..0000000
--- a/server/lib/cimi/data/default_res/machine_configuration.col.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<MachineConfiguration xmlns="http://www.dmtf.org/cimi">
- <uri>machineConfiguration</uri>
- <name>Default machine configuration name </name>
- <description>Default description</description>
- <created>2011-01-01 00:00:01 UTC</created>
- <cpu>i386</cpu>
- <memory quantity="4" units="gigabyte" />
- <disk>
- <capacity quantity="200" units="gigabyte"/>
- <guestInterface>SATA</guestInterface>
- </disk>
- <supportsSnapshots>false</supportsSnapshots>
- <guestInterface>http://www.ibm.com</guestInterface>
- <operation rel="edit" href="/machine_configuration"/>
- <operation rel="delete" href="/machinie_configuration"/>
-</MachineConfiguration>
\ No newline at end of file
diff --git a/server/lib/cimi/data/default_res/machine_image.col.xml b/server/lib/cimi/data/default_res/machine_image.col.xml
deleted file mode 100644
index e7de5e7..0000000
--- a/server/lib/cimi/data/default_res/machine_image.col.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<MachineImage xmlns="http://www.dmtf.org/cimi">
- <uri>machineImage</uri>
- <name>Default machine image name </name>
- <description>Default machine image description</description>
- <created>2011-01-01 00:00:01 UTC</created>
- <imageLocation>http://</imageLocation>
- <imageData></imageData>
- <operation rel="edit" href="/machine_image"/>
- <operation rel="delete" href="/machinie_image"/>
-</MachineImage>
\ No newline at end of file
diff --git a/server/lib/cimi/data/default_res/volume.col.xml b/server/lib/cimi/data/default_res/volume.col.xml
deleted file mode 100644
index 21b9d65..0000000
--- a/server/lib/cimi/data/default_res/volume.col.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<Volume xmlns="http://www.dmtf.org/cimi">
- <uri>volume</uri>
- <name>Default volume name </name>
- <description>Default volume description</description>
- <created>2011-01-01 00:00:01 UTC</created>
- <capacity quantity="200" units="gigabyte"/>
- <bootable>true</bootable>
- <format>ext4</format>
- <supportsSnapshots>true</supportsSnapshots>
- <guestInterface>SATA</guestInterface>
- <operation rel="edit" href="/volume"/>
- <operation rel="delete" href="/volume"/>
-</Volume>
\ No newline at end of file
diff --git a/server/lib/cimi/helpers/cmwg_helper.rb b/server/lib/cimi/helpers/cmwg_helper.rb
new file mode 100644
index 0000000..0a9b1e9
--- /dev/null
+++ b/server/lib/cimi/helpers/cmwg_helper.rb
@@ -0,0 +1,79 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+module CMWG
+ module Helper
+
+ include Deltacloud
+
+ def render_resource(object_name, data)
+ respond_to do |format|
+ format.xml do
+ report_error 404 unless data
+ @object = data
+ content_type cimi_content_type_for(object_name.to_s.camelize, :xml)
+ haml :"#{object_name.to_s.pluralize}/show", :layout => false
+ end
+ format.json do
+ report_error 404 unless data
+ content_type cimi_content_type_for(object_name.to_s.camelize, :json)
+ resource_to_json(object_name, data)
+ end
+ end
+ end
+
+ def render_collection(collection_name)
+ name = (collection_name == :cloud_entry_point) ? collection_name : collection_name.to_s.pluralize
+ respond_to do |format|
+ format.html do
+ haml :"#{name}/index"
+ end
+ format.xml do
+ content_type cimi_content_type_for([collection_name.to_s.camelize, 'Collection'].join, :xml)
+ haml :"#{name}/index", :layout => false
+ end
+ format.json do
+ content_type cimi_content_type_for([collection_name.to_s.camelize, 'Collection'].join, :json)
+ collection_to_json collection_name, @resources
+ end
+ end
+ end
+
+ def cimi_content_type_for(coll_type, format="html")
+ case format
+ when :xml
+ "application/CIMI-%s+xml" % coll_type
+ when :json
+ "application/CIMI-%s+json" % coll_type
+ end
+ end
+
+ def collection_to_json(collection_name, resources=[])
+ name = collection_name == :cloud_entry_point ? collection_name.to_s : collection_name.to_s.pluralize
+ engine = Tilt::HamlTemplate.new(File.join(settings.views, name, 'index.xml.haml'))
+ hash_response = XmlSimple.xml_in(engine.render(self, :'@resources' => resources))
+ hash_response.delete('xmlns')
+ hash_response.to_json
+ end
+
+ def resource_to_json(resource_name, object)
+ engine = Tilt::HamlTemplate.new(File.join(settings.views, resource_name.to_s.pluralize, 'show.xml.haml'))
+ hash_response = XmlSimple.xml_in(engine.render(self, :'@object' => object))
+ hash_response.delete('xmlns')
+ hash_response.to_json
+ end
+
+ end
+end
diff --git a/server/lib/cimi/helpers/cmwgapp_helper.rb b/server/lib/cimi/helpers/cmwgapp_helper.rb
deleted file mode 100644
index a3f91b4..0000000
--- a/server/lib/cimi/helpers/cmwgapp_helper.rb
+++ /dev/null
@@ -1,146 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership. The
-# ASF licenses this file to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance with the
-# License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-# Methods added to this helper will be available to all templates in the application.
-
-# this section defines constants used in the implementation.
-
-#this method is to fixup the hash object to make sure it can be serialized into json
-#as DMTF spec requires. as the spec keeps changing, this method may need to be revisited
-#and modified again.
-def fixup_content(hash_obj, key_name="content", attr_name="name")
- #this check is to make sure we are not handling nil values.
- if hash_obj
- hash_obj.each_pair do |key, value|
- if value.kind_of? Hash
- #We can only handle the element without any other attribute,
- #if the element also has other attribute, then we can not do fixups since it will lose information.
- if value[key_name] && value.size == 1
- hash_obj[key] = value[key_name]
- elsif value[key_name] && value[attr_name] && value.size == 2
- hash_obj[key] = { "#{value[attr_name]}" => value[key_name] }
- else
- fixup_content value, key_name, attr_name
- end
- end
- end
- end
-end
-
-module ApplicationHelper
-
- include Deltacloud
-
- def bread_crumb_ext
- s = "<ul class='breadcrumb'><li class='first'><a href='#{settings.root_url}'>δ home</a></li>"
- s+="<li class='docs'>#{link_to_documentation}</li>"
- s+="</ul>"
- end
-
- def respond_to_collection(collType)
- respond_to do |format|
- format.html do
- root_hash = XmlSimple.xml_in(File.join(STOREROOT, 'collections/' + collType),
- { 'ForceArray' => false, 'KeepRoot'=>true, 'KeyAttr' => ['name']})
-
- @xml_root_node = root_hash.first[0]
- @dmtfitem = root_hash.first[1]
- haml :"collection/index"
- end
- format.xml do
- root_hash = XmlSimple.xml_in(File.join(STOREROOT, 'collections/' + collType),
- { 'ForceArray' => true, 'KeepRoot'=>true, 'KeyAttr' => ['name']})
- col_item_name = root_hash.first[0]
- content_type get_response_content_type(col_item_name, 'xml'), :charset => 'utf-8'
- col_item_name = col_item_name.sub(/Collection/,'') #Remove the Collection at the end.
- col_item_name = col_item_name[0].downcase + col_item_name[1, col_item_name.length]
-
- urls = []
- @dmtf_col_items.map do |item|
- urls << {"href" => item["href"]}
- end
-
- root_hash.first[1][0]["#{col_item_name}"] = urls
-
- XmlSimple.xml_out(root_hash, { 'KeyAttr' => 'name', 'KeepRoot' => true, 'ContentKey' => 'content'})
- end
- format.json do
- root_hash = XmlSimple.xml_in(File.join(STOREROOT, 'collections/' + collType),
- { 'ForceArray' => false, 'KeepRoot'=>true, 'KeyAttr' => ['name']})
- col_item_name = root_hash.first[0]
- content_type get_response_content_type(col_item_name, 'json'), :charset => 'utf-8'
- #Remove the Collection at the end.
- col_item_name = col_item_name.sub(/Collection/,'')
- col_item_name = col_item_name[0].downcase + col_item_name[1, col_item_name.length]
-
- urls = []
- @dmtf_col_items.map do |item|
- urls << {"href" => item["href"]}
- end
-
- root_hash.first[1]["#{col_item_name}"] = urls
-
- json_hash = root_hash.first[1]
- if json_hash.has_key?("xmlns")
- json_hash.delete "xmlns"
- end
- fixup_content json_hash
- res = json_hash.to_json
- end
- end
- end
-
- def get_response_content_type(coll_type, format="html")
- case format
- when "text/html"
- ""
- when "xml"
- "application/CIMI-" + coll_type + "+xml"
- when "json"
- "application/CIMI-" + coll_type + "+json"
- end
- end
-
- def get_resource_default(coll_type)
- file_path = File.join STOREROOT, "default_res/" + coll_type + ".col.xml"
- if File.exist?(file_path)
- root_hash = XmlSimple.xml_in(file_path, {'ForceArray'=>false, 'KeepRoot'=>true, 'KeyAttr'=>['name']})
- { "xml_root_node" => root_hash.first[0], "dmtfitem" => root_hash.first[1]}
- end
- end
-
- def show_resource(resource_path, content_type)
- respond_to do |format|
- format.xml do
- content_type "application/CIMI-#{content_type}+xml", :charset => 'utf-8'
- haml :"#{resource_path}", :layout => false
- end
- format.html do
- haml :"#{resource_path}"
- end
- format.json do
- content_type "application/CIMI-#{content_type}+json", :charset => 'utf-8'
- engine = Haml::Engine.new(File.read(settings.views + "/#{resource_path}.xml.haml"))
- responseXML = engine.render self
- hash_response = XmlSimple.xml_in responseXML, {'ForceArray' => false, 'KeepRoot'=>true, 'KeyAttr' => ['name']}
- hash_response = hash_response.first[1]
- if hash_response.has_key?("xmlns")
- hash_response.delete "xmlns"
- end
- hash_response.to_json
- end
- end
- end
-end
diff --git a/server/lib/cimi/server.rb b/server/lib/cimi/server.rb
index 63a414c..03625b9 100644
--- a/server/lib/cimi/server.rb
+++ b/server/lib/cimi/server.rb
@@ -15,7 +15,7 @@
require 'cimi/helpers/dmtfdep'
-require 'cimi/helpers/cmwgapp_helper'
+require 'cimi/helpers/cmwg_helper'
set :version, '0.1.0'
@@ -23,8 +23,6 @@ include Deltacloud::Drivers
set :drivers, Proc.new { driver_config }
STOREROOT = File.join($top_srcdir, 'lib', 'cimi', 'data')
-#We would like to know the storage root.
-puts "store root is " + STOREROOT
Sinatra::Application.register Rack::RespondTo
@@ -34,11 +32,12 @@ use Rack::MatrixParams
use Rack::DriverSelect
use Rack::MediaType
use Rack::Date
+helpers CMWG::Helper
configure do
set :root_url, "/cimi"
set :views, File::join($top_srcdir, 'views', 'cimi')
- set :public, File::join($top_srcdir, 'public')
+ set :public_folder, File::join($top_srcdir, 'public')
# Try to load the driver on startup to fail early if there are issues
driver
set :store, STOREROOT
@@ -68,52 +67,42 @@ error do
report_error
end
-get "#{settings.root_url}\/?" do
- if params[:force_auth]
- return [401, 'Authentication failed'] unless driver.valid_credentials?(credentials)
- end
+get "/" do
+ redirect settings.root_url
+end
+get "#{settings.root_url}\/?" do
+ halt 401 if params[:force_auth] and not driver.valid_credentials?(credentials)
redirect "#{settings.root_url}/cloudEntryPoint", 301
end
-collection :cloudEntryPoint do
- # Make sure this collection can be accessed, regardless of whether the
- # driver supports it or not
- global!
-
- description <<EOS
- cloud entry point
-EOS
-
+global_collection :cloudEntryPoint do
+ description "Cloud entry point"
operation :index do
- description "list all resources of the cloud"
+ description "List all resources of the cloud"
control do
- @collections = entry_points.reject { |p| p[0] == :cloudEntryPoint }
- show_resource "cloudEntryPoint/index", "CloudEntryPoint"
+ @resources = entry_points.reject { |p| p[0] == :cloudEntryPoint }
+ render_collection :cloud_entry_point
end
end
end
-collection :machine_configurations do
- global!
+global_collection :machine_configurations do
- description <<EOS
-List all machine configurations
-EOS
+ description "List all machine configurations"
operation :index do
description "List all machine configurations"
control do
- profiles = driver.hardware_profiles(credentials, nil)
- @dmtf_col_items = []
- if profiles
- profiles.map do |profile|
- new_item = { "name" => profile.name,
- "href" => machine_configuration_url(profile.name) }
- @dmtf_col_items.insert 0, new_item
- end
+ profiles = driver.hardware_profiles(credentials)
+ @resources = []
+ profiles.each do |profile|
+ @resources << {
+ :name => profile.name,
+ :href => machine_configuration_url(profile.name)
+ }
end
- respond_to_collection "machine_configuration.col.xml"
+ render_collection :machine_configuration
end
end
@@ -122,43 +111,26 @@ EOS
with_capability :hardware_profile
param :id, :string, :required
control do
- @profile = driver.hardware_profile(credentials, params[:id])
- if @profile
- #setup the default values for a machine configuration
- resource_default = get_resource_default "machine_configuration"
- #get the actual values from profile
- resource_value = { "name" => @profile.name,"uri" => @profile.name,
- "href" => machine_configuration_url(@profile.name) }
- #mixin actual values get from profile
- @dmtfitem = resource_default["dmtfitem"].merge resource_value
- show_resource "machine_configurations/show", "MachineConfiguration"
- else
- report_error(404)
- end
+ render_resource :machine_configuration, driver.hardware_profile(credentials, params[:id])
end
end
end
-collection :machine_images do
- global!
-
- description <<EOS
-List all machine images
-EOS
+global_collection :machine_images do
+ description "List all machine images"
operation :index do
description "List all machine configurations"
control do
images = driver.send(:images, credentials, {})
- @dmtf_col_items = []
- if images
- images.map do |image|
- new_item = { "name" => image.name,
- "href" => machine_image_url(image.id) }
- @dmtf_col_items.insert 0, new_item
- end
+ @resources = []
+ images.each do |image|
+ @resources << {
+ :name => image.name,
+ :href => machine_image_url(image.id)
+ }
end
- respond_to_collection "machine_image.col.xml"
+ render_collection :machine_image
end
end
@@ -167,45 +139,30 @@ EOS
with_capability :image
param :id, :string, :required
control do
- @image = driver.send(:image, credentials, { :id => params[:id]} )
- if @image
- #setup the default values for a machine imageion
- resource_default = get_resource_default "machine_image"
- #get the actual values from image
- resource_value = { "name" => @image.name,
- "description" => @image.description,
- "uri" => @image.id,"href" => machine_image_url(@image.id) }
- #mixin actual values get from the specific image
- @dmtfitem = resource_default["dmtfitem"].merge resource_value
- show_resource "machine_images/show", "MachineImage"
- else
- report_error(404)
- end
+ # FIXME: We need to unify the way how we query for single object.
+ # Currently there is ":id => params[:id]" together with just 'params[:id]'
+ # (look at machine_configuration collection)
+ render_resource :machine_image, driver.image(credentials, { :id => params[:id]} )
end
end
end
-collection :machines do
- global!
-
- description <<EOS
-List all machine
-EOS
+global_collection :machines do
+ description "List all machine"
operation :index do
description "List all machines"
control do
instances = driver.send(:instances, credentials, {})
- @dmtf_col_items = []
- if instances
- instances.map do |instance|
- new_item = { "name" => instance.name,
- "href" => machine_url(instance.id) }
- @dmtf_col_items.insert 0, new_item
- end
+ @resources = []
+ instances.each do |instance|
+ @resources << {
+ :name => instance.name,
+ :href => machine_url(instance.id)
+ }
end
- respond_to_collection "machine.col.xml"
+ render_collection :machine
end
end
@@ -214,45 +171,27 @@ EOS
with_capability :instance
param :id, :string, :required
control do
- @machine = driver.send(:instance, credentials, { :id => params[:id]} )
- if @machine
- #setup the default values for a machine imageion
- resource_default = get_resource_default "machine"
- #get the actual values from image
- resource_value = { "name" => @machine.name,
- "status" => @machine.state, "uri" => @machine.id,
- "href" => machine_url(@machine.id) }
- #mixin actual values get from the specific image
- @dmtfitem = resource_default["dmtfitem"].merge resource_value
- show_resource "machines/show", "Machine"
- else
- report_error(404)
- end
+ render_resource :machine, driver.send(:instance, credentials, { :id => params[:id]} )
end
end
end
-collection :volumes do
- global!
-
- description <<EOS
-List all volumes
-EOS
+global_collection :volumes do
+ description "List all volumes"
operation :index do
description "List all volumes"
control do
- instances = driver.send(:storage_volumes, credentials, {})
- @dmtf_col_items = []
- if instances
- instances.map do |instance|
- new_item = { "name" => instance.id,
- "href" => volume_url(instance.id) }
- @dmtf_col_items.insert 0, new_item
- end
+ volumes = driver.send(:storage_volumes, credentials, {})
+ @resources = []
+ volumes.each do |volume|
+ @resources << {
+ :name => volume.name,
+ :href => machine_url(volume.id)
+ }
end
- respond_to_collection "volume.col.xml"
+ render_collection :volume
end
end
@@ -261,21 +200,7 @@ EOS
with_capability :storage_volume
param :id, :string, :required
control do
- @volume = driver.send(:storage_volume, credentials, { :id => params[:id]} )
- if @volume
- #setup the default values for a machine imageion
- resource_default = get_resource_default "volume"
- #get the actual values from image
- resource_value = { "name" => @volume.id,
- "status" => @volume.state, "uri" => @volume.id,
- "href" => volume_url(@volume.id),
- "capacity" => { "quantity" => @volume.capacity, "units" => "gigabyte"} }
- #mixin actual values get from the specific image
- @dmtfitem = resource_default["dmtfitem"].merge resource_value
- show_resource "volumes/show", "Volume"
- else
- report_error(404)
- end
+ render_resource :volume, driver.send(:storage_volume, credentials, { :id => params[:id]} )
end
end
diff --git a/server/views/cimi/cloudEntryPoint/index.html.haml b/server/views/cimi/cloudEntryPoint/index.html.haml
deleted file mode 100644
index 76f147b..0000000
--- a/server/views/cimi/cloudEntryPoint/index.html.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-- @collections.each do |p|
- - name, path = p
- = link_to name.to_s.capitalize, path
- %br/
diff --git a/server/views/cimi/cloudEntryPoint/index.xml.haml b/server/views/cimi/cloudEntryPoint/index.xml.haml
deleted file mode 100644
index c39a34d..0000000
--- a/server/views/cimi/cloudEntryPoint/index.xml.haml
+++ /dev/null
@@ -1,9 +0,0 @@
-!!!XML
-%CloudEntryPoint{ :xmlns => CMWG_NAMESPACE }
- %uri= api_url_for("/cloudEntryPoint")
- %name cloud entry point
- %description cloud entry point
- %created= Time.new.getutc.to_s
- - @collections.each do |api|
- - res_name = api[0].to_s.camelize
- = "<#{res_name} href=\"#{api[1]}\"/>"
diff --git a/server/views/cimi/cloud_entry_point/index.html.haml b/server/views/cimi/cloud_entry_point/index.html.haml
new file mode 100644
index 0000000..c9f7b83
--- /dev/null
+++ b/server/views/cimi/cloud_entry_point/index.html.haml
@@ -0,0 +1,7 @@
+=header "Deltacloud API #{settings.version} CIMI", :back => 'false'
+=subheader "#{driver_symbol}@#{Thread::current[:provider] || ENV['API_PROVIDER'] || 'default'}"
+
+%div{ :'data-role' => :content, :'data-theme' => 'c'}
+ %ul{ :'data-role' => :listview, :'data-inset' => 'true'}
+ - @resources.each do |name, url|
+ %li= link_to name.to_s.gsub('_', ' ').capitalize, url, :'data-icon' => "arrow-r", :'data-ajax' => false
diff --git a/server/views/cimi/cloud_entry_point/index.xml.haml b/server/views/cimi/cloud_entry_point/index.xml.haml
new file mode 100644
index 0000000..5c35215
--- /dev/null
+++ b/server/views/cimi/cloud_entry_point/index.xml.haml
@@ -0,0 +1,8 @@
+!!!XML
+%CloudEntryPoint{ :xmlns => CMWG_NAMESPACE }
+ %uri= api_url_for("/cloudEntryPoint")
+ %name cloud entry point
+ %description cloud entry point
+ %created= Time.new.getutc.to_s
+ - @resources.each do |resource, url|
+ = "<#{resource.to_s.camelize}Collection href='#{url}'/>"
diff --git a/server/views/cimi/error.html.haml b/server/views/cimi/error.html.haml
index 5a9bb59..a74cd62 100644
--- a/server/views/cimi/error.html.haml
+++ b/server/views/cimi/error.html.haml
@@ -1,31 +1,36 @@
-!!!
-!!! XML
-
+!!!5
%html
%head
- = stylesheet_link_tag '/stylesheets/compiled/screen.css', :media => 'screen, projection'
- = stylesheet_link_tag '/stylesheets/compiled/print.css', :media => 'print'
- /[if lt IE 8]
- = stylesheet_link_tag '/stylesheets/compiled/ie.css', :media => 'screen, projection'
- = stylesheet_link_tag '/stylesheets/compiled/application.css', :media => 'screen, projection'
- %script{:type => "text/javascript", :src => "/javascripts/jquery-1.4.2.min.js" }
+ %title Deltacloud API #{settings.version}
+ = stylesheet_link_tag '/stylesheets/jquery.mobile-1.0rc1.min.css'
+ = stylesheet_link_tag '/stylesheets/new.css'
+ %script{:type => "text/javascript", :src => "/javascripts/jquery.min.js" }
%script{:type => "text/javascript", :src => "/javascripts/application.js" }
+ %script{:type => "text/javascript", :src => "/javascripts/jquery.mobile-1.0rc1.min.js" }
+ :javascript
+ $(document).ready(function() {
+ $(document).bind("mobileinit", function(){
+ $.mobile.ajaxEnabled = false;
+ $.mobile.hashListeningEnabled = false;
+ });
+ })
%body
- #wrapper
- #header
- = link_to image_tag( "/images/logo-wide.png" ), settings.root_url
- = bread_crumb
- #content{:class => :error}
- = yield
- #footer
- #formats
- Format:
- =link_to_format(:xml)
- |
- =link_to_format(:json)
- #driver_info
- Driver: #{driver_symbol} | API version: #{settings.version}
- #copyright
- Copyright 2009-2011
- %a{:href => 'http://incubator.apache.org/deltacloud/'} The Apache Software Foundation
- and individual contributors.
\ No newline at end of file
+ %div{ 'data-role' => :page, :'data-theme' => 'e', :class => :error }
+ =header "#{response.status} - #{translate_error_code(response.status)[:message]}"
+ - if @error
+ =subheader @error.message
+ - elsif response.status.to_s =~ /4(\d{2})/
+ =subheader request.env['REQUEST_URI']
+ = yield
+ %div{ 'data-role' => :footer, :'data-theme' => 'a'}
+ %div{ 'data-role' => :navbar}
+ %ul
+ %li
+ %a{ :'data-icon' => 'home', :href => api_url_for(''), :'data-ajax' => 'false'} Home
+ %li=link_to_format(:xml)
+ %li=link_to_format(:json)
+ %div{ 'data-role' => :header, 'data-theme' => 'a' }
+ #copyright
+ Copyright 2009-2011
+ %a{:href => 'http://incubator.apache.org/deltacloud/'} The Apache Software Foundation
+ and individual contributors.
diff --git a/server/views/cimi/layout.html.haml b/server/views/cimi/layout.html.haml
index 2673453..97d2e56 100644
--- a/server/views/cimi/layout.html.haml
+++ b/server/views/cimi/layout.html.haml
@@ -1,32 +1,32 @@
-!!!
-!!! XML
-
+!!!5
%html
%head
- = stylesheet_link_tag '/stylesheets/compiled/screen.css', :media => 'screen, projection'
- = stylesheet_link_tag '/stylesheets/compiled/print.css', :media => 'print'
- /[if lt IE 8]
- = stylesheet_link_tag '/stylesheets/compiled/ie.css', :media => 'screen, projection'
- = stylesheet_link_tag '/stylesheets/compiled/application.css', :media => 'screen, projection'
- %script{:type => "text/javascript", :src => "/javascripts/jquery-1.4.2.min.js" }
+ %title Deltacloud API #{settings.version}
+ = stylesheet_link_tag '/stylesheets/jquery.mobile-1.0rc1.min.css'
+ = stylesheet_link_tag '/stylesheets/new.css'
+ %script{:type => "text/javascript", :src => "/javascripts/jquery.min.js" }
%script{:type => "text/javascript", :src => "/javascripts/application.js" }
- %script{:type => "text/javascript", :src => "/javascripts/cmwgapp.js" }
+ %script{:type => "text/javascript", :src => "/javascripts/jquery.mobile-1.0rc1.min.js" }
+ :javascript
+ $(document).ready(function() {
+ $(document).bind("mobileinit", function(){
+ $.mobile.ajaxEnabled = false;
+ $.mobile.hashListeningEnabled = false;
+ });
+ })
+
%body
- #wrapper
- #header
- = link_to image_tag( "/images/logo-wide.png" ), settings.root_url
- = bread_crumb_ext
- #content
- = yield
- #footer
- #formats
- Format:
- =link_to_format(:xml)
- |
- =link_to_format(:json)
- #driver_info
- Driver: #{driver_symbol} | API version: #{settings.version}
- #copyright
- Copyright 2009-2011
- %a{:href => 'http://incubator.apache.org/deltacloud/'} The Apache Software Foundation
- and individual contributors.
\ No newline at end of file
+ %div{ 'data-role' => :page }
+ = yield
+ %div{ 'data-role' => :footer, :'data-theme' => 'a'}
+ %div{ 'data-role' => :navbar}
+ %ul
+ %li
+ %a{ :'data-icon' => 'home', :href => api_url_for(''), :'data-ajax' => 'false'} Home
+ %li=link_to_format(:xml)
+ %li=link_to_format(:json)
+ %div{ 'data-role' => :header, 'data-theme' => 'a' }
+ #copyright
+ Copyright 2009-2011
+ %a{:href => 'http://incubator.apache.org/deltacloud/'} The Apache Software Foundation
+ and individual contributors.
diff --git a/server/views/cimi/machine_configurations/index.xml.haml b/server/views/cimi/machine_configurations/index.xml.haml
new file mode 100644
index 0000000..ca1c312
--- /dev/null
+++ b/server/views/cimi/machine_configurations/index.xml.haml
@@ -0,0 +1,8 @@
+%MachineConfigurationCollection{ :xmlns => "http://www.dmtf.org/cimi" }
+ %uri machineConfiguration
+ - @resources.each do |resource|
+ %machineConfiguration{ :href => resource[:href] }
+ %name Machine Configuration collection
+ %description That is just a test
+ %created 2011-09-12 11:37:28 UTC
+ %operation{ :rel => :add, :href => "/machine_configurations"}
diff --git a/server/views/cimi/machine_configurations/show.xml.haml b/server/views/cimi/machine_configurations/show.xml.haml
new file mode 100644
index 0000000..dc00caa
--- /dev/null
+++ b/server/views/cimi/machine_configurations/show.xml.haml
@@ -0,0 +1,14 @@
+%MachineConfiguration{ :xmlns => 'http://www.dmtf.org/cimi' }
+ %uri machineConfiguration
+ %name=@object.name
+ %description FIXME: Machine description
+ %created FIXME: Created
+ %cpu=@object.architecture.value
+ %memory{ :quantity => @object.memory.value, :units => :gigabyte }
+ %disk
+ %capacity{ :quantity => 200, :units => :gigabyte}
+ %guestInterface SATA
+ %supportsSnapshots false
+ %guestInterface http://www.ibm.com
+ %operation{ :rel => :edit, :href => '/machine_configuration' }
+ %operation{ :rel => :delete, :href => '/machine_configuration' }
diff --git a/server/views/cimi/machine_images/index.xml.haml b/server/views/cimi/machine_images/index.xml.haml
new file mode 100644
index 0000000..04ed206
--- /dev/null
+++ b/server/views/cimi/machine_images/index.xml.haml
@@ -0,0 +1,8 @@
+%MachineImageCollection{ :xmlns => "http://www.dmtf.org/cimi" }
+ %uri machineImage
+ - @resources.each do |resource|
+ %machineImage{ :href => resource[:href] }
+ %name Machine Config collection
+ %description The machine config collection
+ %created 2011-09-12 11:37:28 UTC
+ %operation{ :rel => :add, :href => "/machine_images"}
diff --git a/server/views/cimi/machine_images/show.xml.haml b/server/views/cimi/machine_images/show.xml.haml
new file mode 100644
index 0000000..c92b838
--- /dev/null
+++ b/server/views/cimi/machine_images/show.xml.haml
@@ -0,0 +1,9 @@
+%MachineImage{ :xmlns => 'http://www.dmtf.org/cimi' }
+ %uri machineImage
+ %name=@object.id
+ %description=@object.name
+ %created FIXME: Created
+ %imageLocation FIXME: Location
+ %imageData
+ %operation{ :rel => :edit, :href => '/machine_image' }
+ %operation{ :rel => :delete, :href => '/machine_image' }
diff --git a/server/views/cimi/machines/index.xml.haml b/server/views/cimi/machines/index.xml.haml
new file mode 100644
index 0000000..3b941f0
--- /dev/null
+++ b/server/views/cimi/machines/index.xml.haml
@@ -0,0 +1,8 @@
+%MachineCollection{ :xmlns => "http://www.dmtf.org/cimi" }
+ %uri machine
+ - @resources.each do |resource|
+ %machine{ :href => resource[:href] }
+ %name Machine collection
+ %description The machine collection
+ %created 2011-09-12 11:37:28 UTC
+ %operation{ :rel => :add, :href => "/machine_images"}
diff --git a/server/views/cimi/machines/show.xml.haml b/server/views/cimi/machines/show.xml.haml
new file mode 100644
index 0000000..fa91066
--- /dev/null
+++ b/server/views/cimi/machines/show.xml.haml
@@ -0,0 +1,30 @@
+%Machine{ :xmlns => "http://www.dmtf.org/cimi" }
+ %uri machine
+ %name=@object.id
+ %description=@object.name
+ %created FIXME: Created
+ %property{ :name => :prop1, :content => "prop1 value"}
+ %status=@object.state
+ %cpu=@object.instance_profile.overrides.select { |p, v| p == :cpu }.first
+ %memory=@object.instance_profile.overrides.select { |p, v| p == :memory }.first
+ %disk
+ %capacity{ :quantity => 200, :units => :gigabyte}
+ %format ntgs
+ %attachmentPoint /dev/sdb0
+ %guestInterface SATA
+ %volume{ :href => "/cimi/volumes/vol01", :attachmentPoint => "/dev/sdc01", :protocol => 'NFS' }
+ %networkInterface
+ %vps{ :href => '/cimi/vsp/vsp01' }
+ %macAddress 00:00:00:00:00:00
+ %state Active
+ %protocol IPv4
+ %allocation Dynamic
+ %address 10.10.10.1
+ %defaultGateway 10.10.0.1
+ %dns 10.10.0.1
+ %maxTransmissionUnit 512
+ %meter{ :href => '/meter' }
+ %eventLog{ :href => '/eventLog' }
+ %operation{ :rel => :edit, :href => '/machine' }
+ %operation{ :rel => :delete, :href => '/machine' }
+ %operation{ :rel => :stop, :href => '/machine/stop' }
diff --git a/server/views/cimi/volume/show.html.haml b/server/views/cimi/volume/show.html.haml
deleted file mode 100644
index 0e7b20b..0000000
--- a/server/views/cimi/volume/show.html.haml
+++ /dev/null
@@ -1,68 +0,0 @@
-%h1 View/Edit volume
-
-%form{ :action => volumes_url }
- %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
- %input{ :name => :xmlRootNode, :type => :hidden, :value => @xml_root_node }/
- %input{ :name => :refreshURI, :type => :hidden, :value => volumes_url }/
- %p
- %label
- Name:
- %p
- %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
- %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
- %p
- %br
- %label
- Description:
- %p
- %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
- %p
- %br
- %label
- Properties:
- %p
- %table{ :style => "width:50%;", :id => "propertyTable"}
- - if @dmtfitem["property"]
- - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
- - property_object = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
- - else
- - property_object = @dmtfitem["property"]
-
- - iter = -1
- - property_object.each_pair do |key, value|
- - iter += 1
- %tr
- %td
- %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
- %td
- %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
- %td
- %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
- %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
- %p
- %br
- %label
- Capacity:
- %p
- %input{ :name => :capacity_quantity, :size => 20, :value => @dmtfitem["capacity"]["quantity"], :style => "width:10%;" }
- %input{ :name => :capacity_units, :size => 20, :value => @dmtfitem["capacity"]["units"], :style => "width:10%;" }
- %br
- %label
- EntityMetadata:
- %br
-
-:javascript
- function fixupXml(theNode) {
- var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
- xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
- xmlData += getStandardData(theNode);
- xmlData += "<cpu>" + $(theNode.form).attr("cpu").value + "</cpu>";
- xmlData += "<memory quantity='" + $(theNode.form).attr("memory_quantity").value + "' units='";
- xmlData += $(theNode.form).attr("memory_units").value + "' />"
-
- var index=0;
-
- xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
-
- return xmlData;
- }
\ No newline at end of file
diff --git a/server/views/cimi/volumes/index.xml.haml b/server/views/cimi/volumes/index.xml.haml
new file mode 100644
index 0000000..9b91bf5
--- /dev/null
+++ b/server/views/cimi/volumes/index.xml.haml
@@ -0,0 +1,8 @@
+%VolumeCollection{ :xmlns => "http://www.dmtf.org/cimi" }
+ %uri volume
+ - @resources.each do |resource|
+ %volume{ :href => resource[:href] }
+ %name Volume collection
+ %description The volume collection
+ %created 2011-09-12 11:37:28 UTC
+ %operation{ :rel => :add, :href => "/volumes"}
diff --git a/server/views/cimi/volumes/show.html.haml b/server/views/cimi/volumes/show.html.haml
new file mode 100644
index 0000000..0e7b20b
--- /dev/null
+++ b/server/views/cimi/volumes/show.html.haml
@@ -0,0 +1,68 @@
+%h1 View/Edit volume
+
+%form{ :action => volumes_url }
+ %input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
+ %input{ :name => :xmlRootNode, :type => :hidden, :value => @xml_root_node }/
+ %input{ :name => :refreshURI, :type => :hidden, :value => volumes_url }/
+ %p
+ %label
+ Name:
+ %p
+ %input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
+ %input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
+ %p
+ %br
+ %label
+ Description:
+ %p
+ %textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
+ %p
+ %br
+ %label
+ Properties:
+ %p
+ %table{ :style => "width:50%;", :id => "propertyTable"}
+ - if @dmtfitem["property"]
+ - if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
+ - property_object = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
+ - else
+ - property_object = @dmtfitem["property"]
+
+ - iter = -1
+ - property_object.each_pair do |key, value|
+ - iter += 1
+ %tr
+ %td
+ %input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
+ %td
+ %input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
+ %td
+ %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
+ %input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
+ %p
+ %br
+ %label
+ Capacity:
+ %p
+ %input{ :name => :capacity_quantity, :size => 20, :value => @dmtfitem["capacity"]["quantity"], :style => "width:10%;" }
+ %input{ :name => :capacity_units, :size => 20, :value => @dmtfitem["capacity"]["units"], :style => "width:10%;" }
+ %br
+ %label
+ EntityMetadata:
+ %br
+
+:javascript
+ function fixupXml(theNode) {
+ var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
+ xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
+ xmlData += getStandardData(theNode);
+ xmlData += "<cpu>" + $(theNode.form).attr("cpu").value + "</cpu>";
+ xmlData += "<memory quantity='" + $(theNode.form).attr("memory_quantity").value + "' units='";
+ xmlData += $(theNode.form).attr("memory_units").value + "' />"
+
+ var index=0;
+
+ xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
+
+ return xmlData;
+ }
\ No newline at end of file
diff --git a/server/views/cimi/volumes/show.xml.haml b/server/views/cimi/volumes/show.xml.haml
new file mode 100644
index 0000000..c68f4c0
--- /dev/null
+++ b/server/views/cimi/volumes/show.xml.haml
@@ -0,0 +1,12 @@
+%Volume{ :xmlns => "http://www.dmtf.org/cimi" }
+ %uri volume
+ %name=@object.id
+ %description FIXME: Description
+ %created FIXME: Created
+ %capacity{ :quantity => @object.capacity, :units => :gigabytes }
+ %bootable true
+ %format ext4
+ %supportsSnapshots true
+ %guestInterface SATA
+ %operation{ :rel => :edit, :href => "/volume"}
+ %operation{ :rel => :delete, :href => "/volume"}
--
1.7.4.4