You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by em...@gmail.com on 2011/12/02 19:32:41 UTC
[PATCH 3/5] CIMI: Added volume configuration support for new cimi client
From: Tong Li <li...@us.ibm.com>
---
clients/cimi/app.rb | 1 +
clients/cimi/lib/entities.rb | 3 +-
clients/cimi/lib/entities/volume_configuration.rb | 30 ++++++++++++++++++++
.../cimi/views/volume_configurations/index.haml | 21 ++++++++++++++
clients/cimi/views/volume_configurations/show.haml | 30 ++++++++++++++++++++
5 files changed, 84 insertions(+), 1 deletions(-)
create mode 100644 clients/cimi/lib/entities/volume_configuration.rb
create mode 100644 clients/cimi/views/volume_configurations/index.haml
create mode 100644 clients/cimi/views/volume_configurations/show.haml
diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb
index 0c15495..01927cb 100644
--- a/clients/cimi/app.rb
+++ b/clients/cimi/app.rb
@@ -21,6 +21,7 @@ module CIMI::Frontend
use CIMI::Frontend::MachineImage
use CIMI::Frontend::Machine
use CIMI::Frontend::MachineTemplate
+ use CIMI::Frontend::VolumeConfiguration
configure do
enable :logging
diff --git a/clients/cimi/lib/entities.rb b/clients/cimi/lib/entities.rb
index 88e13a9..2605f26 100644
--- a/clients/cimi/lib/entities.rb
+++ b/clients/cimi/lib/entities.rb
@@ -23,4 +23,5 @@ require 'entities/cloud_entry_point'
require 'entities/machine_configuration'
require 'entities/machine_image'
require 'entities/machine'
-require 'entities/machine_template'
\ No newline at end of file
+require 'entities/machine_template'
+require 'entities/volume_configuration'
\ No newline at end of file
diff --git a/clients/cimi/lib/entities/volume_configuration.rb b/clients/cimi/lib/entities/volume_configuration.rb
new file mode 100644
index 0000000..5c5185f
--- /dev/null
+++ b/clients/cimi/lib/entities/volume_configuration.rb
@@ -0,0 +1,30 @@
+# 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.
+
+class CIMI::Frontend::VolumeConfiguration < CIMI::Frontend::Entity
+
+ get '/cimi/volume_configurations/:id' do
+ volume_confs_xml = CIMI::Frontend.get_entity('volume_configurations', params[:id], credentials)
+ @volume_configuration = CIMI::Model::VolumeConfiguration.from_xml(volume_confs_xml)
+ haml :'volume_configurations/show'
+ end
+
+ get '/cimi/volume_configurations' do
+ volume_conf_xml = CIMI::Frontend.get_entity_collection('volume_configurations', credentials)
+ @volume_configurations = CIMI::Model::VolumeConfigurationCollection.from_xml(volume_conf_xml)
+ haml :'volume_configurations/index'
+ end
+
+end
diff --git a/clients/cimi/views/volume_configurations/index.haml b/clients/cimi/views/volume_configurations/index.haml
new file mode 100644
index 0000000..602d230
--- /dev/null
+++ b/clients/cimi/views/volume_configurations/index.haml
@@ -0,0 +1,21 @@
+- @title=@volume_configurations.description
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li.active
+ VolumeConfigurationCollection
+
+
+%blockquote
+ %p
+ A Volume Configuration Collection entity represents the collection of
+ Volume Configuration entities within a Provider. This entity can be used to
+ locate and create Volume Configurations.
+
+%ul
+ - @volume_configurations.volume_configurations.each do |conf|
+ %li
+ %a{ :href => "/cimi/volume_configurations/#{conf.href.split('/').last}"}=conf.href.split('/').last
diff --git a/clients/cimi/views/volume_configurations/show.haml b/clients/cimi/views/volume_configurations/show.haml
new file mode 100644
index 0000000..373486c
--- /dev/null
+++ b/clients/cimi/views/volume_configurations/show.haml
@@ -0,0 +1,30 @@
+- @title="#{@volume_configuration.name}"
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li
+ %a{ :href => "/cimi/volume_configurations"} VolumeConfigurationCollection
+ %span.divider="/"
+ %li.active
+ = @volume_configuration.name
+
+%blockquote
+ %p
+ The Volume Configuration entity represents the set of configuration values
+ that define the (virtual) hardware resources of a to-be-realized Volume
+ Instance. Volume Configurations are created by Providers and MAY, at the
+ Providers discretion, be created by Consumers.
+
+%dl
+ %dt URI
+ %dd
+ %a{ :href => @volume_configuration.uri }=@volume_configuration.uri
+ %dt Description
+ %dd=@volume_configuration.description
+ %dt Created
+ %dd #{@volume_configuration.created}
+ %dt Details
+ %dd=@volume_configuration.inspect
\ No newline at end of file
--
1.7.4.1