You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by dk...@apache.org on 2013/07/15 09:00:11 UTC
[1/8] git commit: CIMI: fix typo (Credential->Machine) in client UI
machine creation button
Updated Branches:
refs/heads/master 7fabd2bdf -> 16ba86d8f
CIMI: fix typo (Credential->Machine) in client UI machine
creation button
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/5c2c9dce
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/5c2c9dce
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/5c2c9dce
Branch: refs/heads/master
Commit: 5c2c9dcedd631edb81896edcc1fa64ef916f96e5
Parents: 7fabd2b
Author: Dies Koper <di...@fast.au.fujitsu.com>
Authored: Mon Jul 15 10:29:47 2013 +1000
Committer: Dies Koper <di...@fast.au.fujitsu.com>
Committed: Mon Jul 15 10:53:00 2013 +1000
----------------------------------------------------------------------
clients/cimi/views/machines/index.haml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/5c2c9dce/clients/cimi/views/machines/index.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/machines/index.haml b/clients/cimi/views/machines/index.haml
index aa195ab..894ea85 100644
--- a/clients/cimi/views/machines/index.haml
+++ b/clients/cimi/views/machines/index.haml
@@ -40,7 +40,7 @@
- @creds.credentials.each do |cred|
%option{ :value => cred.id }=href_to_id(cred.id)
.modal-footer
- %a{ :href => '#', :class => 'btn btn-primary', :'data-loading-text' => 'Creating Credential...', :onclick => "postModalForm(this, 'machineModal')"} Continue
+ %a{ :href => '#', :class => 'btn btn-primary', :'data-loading-text' => 'Creating Machine...', :onclick => "postModalForm(this, 'machineModal')"} Continue
%a{ :href => '#', :class => 'btn', :'data-dismiss' => 'modal'} Cancel
%p{:style => 'text-align:right;'}
%a{ :href => "#{@machines.id}?format=xml", :class => 'label warning' } XML
[3/8] git commit: CIMI: use id instead of name in urls in client UI
Posted by dk...@apache.org.
CIMI: use id instead of name in urls in client UI
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/1d8b3912
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/1d8b3912
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/1d8b3912
Branch: refs/heads/master
Commit: 1d8b3912cef23c8e1409ffb2f1742a4a58fbbfed
Parents: 7bab588
Author: Dies Koper <di...@fast.au.fujitsu.com>
Authored: Mon Jul 15 10:28:15 2013 +1000
Committer: Dies Koper <di...@fast.au.fujitsu.com>
Committed: Mon Jul 15 10:53:21 2013 +1000
----------------------------------------------------------------------
clients/cimi/lib/entities/address.rb | 2 +-
clients/cimi/lib/entities/credential.rb | 2 +-
clients/cimi/lib/entities/machine.rb | 2 +-
clients/cimi/lib/entities/machine_template.rb | 2 +-
clients/cimi/lib/entities/network.rb | 2 +-
clients/cimi/views/credentials/show.haml | 4 ++--
server/lib/cimi/service/machine_image.rb | 2 +-
7 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1d8b3912/clients/cimi/lib/entities/address.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/address.rb b/clients/cimi/lib/entities/address.rb
index 95c76d8..665561e 100644
--- a/clients/cimi/lib/entities/address.rb
+++ b/clients/cimi/lib/entities/address.rb
@@ -43,7 +43,7 @@ class CIMI::Frontend::Address < CIMI::Frontend::Entity
result = create_entity('addresses', address_xml, credentials)
address = collection_class_for(:address).from_xml(result)
flash[:success] = "Address was successfully created."
- redirect "/cimi/addresses/#{address.name}", 302
+ redirect "/cimi/addresses/#{href_to_id(address.id)}", 302
rescue => e
flash[:error] = "Address cannot be created: #{e.message}"
end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1d8b3912/clients/cimi/lib/entities/credential.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/credential.rb b/clients/cimi/lib/entities/credential.rb
index 3916704..5b123e6 100644
--- a/clients/cimi/lib/entities/credential.rb
+++ b/clients/cimi/lib/entities/credential.rb
@@ -55,7 +55,7 @@ class CIMI::Frontend::Credential < CIMI::Frontend::Entity
result = create_entity('credentials', credential_xml, credentials)
cred = collection_class_for(:credential).from_xml(result)
flash[:success] = "Credential was successfully created."
- redirect "/cimi/credentials/#{cred.name}", 302
+ redirect "/cimi/credentials/#{href_to_id(cred.id)}", 302
rescue => e
flash[:error] = "Credential could not be created: #{e.message}"
redirect(back)
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1d8b3912/clients/cimi/lib/entities/machine.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/machine.rb b/clients/cimi/lib/entities/machine.rb
index 05f1e14..f193ebd 100644
--- a/clients/cimi/lib/entities/machine.rb
+++ b/clients/cimi/lib/entities/machine.rb
@@ -112,7 +112,7 @@ class CIMI::Frontend::Machine < CIMI::Frontend::Entity
result = create_entity('machines', machine_xml, credentials)
machine = collection_class_for(:machine).from_xml(result)
flash[:success] = "Machine was successfully created."
- redirect "/cimi/machines/#{machine.name}", 302
+ redirect "/cimi/machines/#{href_to_id machine.id}", 302
rescue => e
flash[:error] = "Machine cannot be created: #{e.message}"
end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1d8b3912/clients/cimi/lib/entities/machine_template.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/machine_template.rb b/clients/cimi/lib/entities/machine_template.rb
index c7a0717..334b731 100644
--- a/clients/cimi/lib/entities/machine_template.rb
+++ b/clients/cimi/lib/entities/machine_template.rb
@@ -44,7 +44,7 @@ class CIMI::Frontend::MachineTemplate < CIMI::Frontend::Entity
result = create_entity('machine_templates', machine_template_xml, credentials)
machine_template = collection_class_for(:machine_template).from_xml(result)
flash[:success] = "Machine Template was successfully created."
- redirect "/cimi/machine_templates/#{machine_template.name}", 302
+ redirect "/cimi/machine_templates/#{href_to_id(machine_template.id)}", 302
rescue => e
flash[:error] = "Machine Template cannot be created: #{e.message}"
end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1d8b3912/clients/cimi/lib/entities/network.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/network.rb b/clients/cimi/lib/entities/network.rb
index 361d4d9..d0c0013 100644
--- a/clients/cimi/lib/entities/network.rb
+++ b/clients/cimi/lib/entities/network.rb
@@ -56,7 +56,7 @@ class CIMI::Frontend::Network < CIMI::Frontend::Entity
result = create_entity('networks', network_xml, credentials)
network = collection_class_for(:network).from_xml(result)
flash[:success] = "Network was successfully created."
- redirect "/cimi/networks/#{network.name}", 302
+ redirect "/cimi/networks/#{href_to_id(network.id)}", 302
rescue => e
flash[:error] = "Network cannot be created: #{e.message}"
end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1d8b3912/clients/cimi/views/credentials/show.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/credentials/show.haml b/clients/cimi/views/credentials/show.haml
index 6a9ac76..5908ff5 100644
--- a/clients/cimi/views/credentials/show.haml
+++ b/clients/cimi/views/credentials/show.haml
@@ -15,8 +15,8 @@
%p
%a{ :href => "#{@cred.id}?format=xml", :class => 'label warning' } XML
%a{ :href => "#{@cred.id}?format=json", :class => 'label warning' } JSON
- %p
- %form{ :action => "/cimi/credentials/#{@cred.name}/delete", :method => :post, :style => 'display:inline'}
+ %p}
+ %form{ :action => "/cimi/credentials/#{href_to_id @cred.id}/delete", :method => :post, :style => 'display:inline'}
%input{ :type => :hidden, :name => '_method', :value => 'delete'}
%button{ :class => 'btn btn-danger'} Destroy
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/1d8b3912/server/lib/cimi/service/machine_image.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/service/machine_image.rb b/server/lib/cimi/service/machine_image.rb
index 17d9220..ede8559 100644
--- a/server/lib/cimi/service/machine_image.rb
+++ b/server/lib/cimi/service/machine_image.rb
@@ -29,7 +29,7 @@ class CIMI::Service::MachineImage < CIMI::Service::Base
def self.from_image(image, context)
self.new(context, :values => {
:id => context.machine_image_url(image.id),
- :name => image.id,
+ :name => image.name,
:description => image.description,
:state => image.state || 'UNKNOWN',
:type => "IMAGE",
[4/8] git commit: CIMI: made id optional in client UI helper method
so it can be used for collection operations such as import
Posted by dk...@apache.org.
CIMI: made id optional in client UI helper method
so it can be used for collection operations such as import
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/452093b7
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/452093b7
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/452093b7
Branch: refs/heads/master
Commit: 452093b757b350a88dc8678b63b3c4ea7064d7c3
Parents: a8ed21e
Author: Dies Koper <di...@fast.au.fujitsu.com>
Authored: Mon Jul 15 10:25:50 2013 +1000
Committer: Dies Koper <di...@fast.au.fujitsu.com>
Committed: Mon Jul 15 11:07:21 2013 +1000
----------------------------------------------------------------------
clients/cimi/lib/client.rb | 7 +++++--
clients/cimi/lib/entities/machine.rb | 6 +++---
2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/452093b7/clients/cimi/lib/client.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/client.rb b/clients/cimi/lib/client.rb
index e0ba51b..7a9ba60 100644
--- a/clients/cimi/lib/client.rb
+++ b/clients/cimi/lib/client.rb
@@ -57,8 +57,11 @@ module CIMI
client["%s/%s" % [entity_type, id]].delete(auth_header(credentials))
end
- def entity_action(entity_type, action, id, body, credentials)
- client["%s/%s/%s" % [entity_type, id, action.to_s]].post(body, auth_header(credentials).merge(:content_type => 'application/xml'))
+ def entity_action(entity_type, action, body, credentials, id=nil)
+ entity_href = get_entity_collection_href(entity_type, credentials)
+ raise RestClient::ResourceNotFound if not entity_href
+ url = id ? '%s/%s/%s' % [entity_href, id, action.to_s] : '%s/%s' % [entity_href, action.to_s]
+ RestClient::Resource.new(url).post(body, auth_header(credentials).merge(:content_type => 'application/xml'))
end
def provider_header(credentials)
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/452093b7/clients/cimi/lib/entities/machine.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/machine.rb b/clients/cimi/lib/entities/machine.rb
index f193ebd..d124f5f 100644
--- a/clients/cimi/lib/entities/machine.rb
+++ b/clients/cimi/lib/entities/machine.rb
@@ -69,7 +69,7 @@ class CIMI::Frontend::Machine < CIMI::Frontend::Entity
xml.action "http://schemas.dmtf.org/cimi/1/action/stop"
}
end.to_xml
- entity_action 'machines', 'stop', params[:id], action_xml, credentials
+ entity_action 'machines', 'stop', action_xml, credentials, params[:id]
flash[:success] = "Machine successfully stopped."
redirect '/cimi/machines/%s' % params[:id]
end
@@ -80,7 +80,7 @@ class CIMI::Frontend::Machine < CIMI::Frontend::Entity
xml.action "http://schemas.dmtf.org/cimi/1/action/start"
}
end.to_xml
- entity_action 'machines', 'start', params[:id], action_xml, credentials
+ entity_action 'machines', 'start', action_xml, credentials, params[:id]
flash[:success] = "Machine successfully started."
redirect '/cimi/machines/%s' % params[:id]
end
@@ -91,7 +91,7 @@ class CIMI::Frontend::Machine < CIMI::Frontend::Entity
xml.action "http://schemas.dmtf.org/cimi/1/action/restart"
}
end.to_xml
- entity_action 'machines', 'restart', params[:id], action_xml, credentials
+ entity_action 'machines', 'restart', action_xml, credentials, action_xml
flash[:success] = "Machine successfully restarted."
redirect '/cimi/machines/%s' % params[:id]
end
[7/8] git commit: CIMI: added memory unit (KiB) and use consistent
naming between machine and machine_configuration
Posted by dk...@apache.org.
CIMI: added memory unit (KiB) and use consistent naming
between machine and machine_configuration
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/36186098
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/36186098
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/36186098
Branch: refs/heads/master
Commit: 3618609856e73fa933784dcc421e4eaeae974836
Parents: cbeeef3
Author: Dies Koper <di...@fast.au.fujitsu.com>
Authored: Mon Jul 15 12:02:09 2013 +1000
Committer: Dies Koper <di...@fast.au.fujitsu.com>
Committed: Mon Jul 15 12:02:24 2013 +1000
----------------------------------------------------------------------
clients/cimi/views/machine_configurations/show.haml | 4 ++--
clients/cimi/views/machines/show.haml | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/36186098/clients/cimi/views/machine_configurations/show.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/machine_configurations/show.haml b/clients/cimi/views/machine_configurations/show.haml
index d5ac78a..94b696e 100644
--- a/clients/cimi/views/machine_configurations/show.haml
+++ b/clients/cimi/views/machine_configurations/show.haml
@@ -21,7 +21,7 @@
- row 'Name', @machine_configuration.name
- row 'Description', @machine_configuration.description
- row 'Created', @machine_configuration.created
- - row 'Num of CPUs', @machine_configuration.cpu
- - row 'Memory (RAM)', @machine_configuration.memory
+ - row 'CPU', @machine_configuration.cpu
+ - row 'Memory (RAM)', "#{@machine_configuration.memory} KiB"
- row 'Storage (disks)', @machine_configuration.disks.map { |d| [d.capacity, d.format].join(' ') }.join(',')
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/36186098/clients/cimi/views/machines/show.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/machines/show.haml b/clients/cimi/views/machines/show.haml
index 7d36da0..a7ef075 100644
--- a/clients/cimi/views/machines/show.haml
+++ b/clients/cimi/views/machines/show.haml
@@ -38,7 +38,7 @@
-row 'Description',@machine.description
-row 'State',state_span_for(@machine.state)
-row 'CPU', boolean_span_for(@machine.cpu)
- -row 'RAM', @machine.memory
+ -row 'Memory (RAM)', "#{@machine.memory} KiB"
-row 'Meters', (@machine.meters.empty? ? "No meters" : ( @machine.meters.each{|meter| meters.id}))
-row 'Created', @machine.created
-row 'Disks', url("/cimi/machines/#{href_to_id @machine.id}/disks")
[5/8] git commit: CIMI: add system and templates to client UI
Posted by dk...@apache.org.
CIMI: add system and templates to client UI
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/a8ed21e5
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/a8ed21e5
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/a8ed21e5
Branch: refs/heads/master
Commit: a8ed21e575548ff558108b9e85a3efe5c71d1a4f
Parents: 1d8b391
Author: Dies Koper <di...@fast.au.fujitsu.com>
Authored: Tue Jul 9 16:33:13 2013 +1000
Committer: Dies Koper <di...@fast.au.fujitsu.com>
Committed: Mon Jul 15 11:07:21 2013 +1000
----------------------------------------------------------------------
clients/cimi/app.rb | 2 +
clients/cimi/lib/client.rb | 10 +-
clients/cimi/lib/entities.rb | 2 +
clients/cimi/lib/entities/system.rb | 208 +++++++++++++++++++
clients/cimi/lib/entities/system_template.rb | 55 +++++
clients/cimi/views/system_templates/index.haml | 49 +++++
clients/cimi/views/system_templates/show.haml | 74 +++++++
clients/cimi/views/systems/index.haml | 70 +++++++
clients/cimi/views/systems/resources/index.haml | 34 +++
clients/cimi/views/systems/resources/show.haml | 31 +++
clients/cimi/views/systems/show.haml | 81 ++++++++
server/lib/cimi/models/system.rb | 10 +-
.../drivers/mock/mock_driver_cimi_methods.rb | 2 +
13 files changed, 619 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a8ed21e5/clients/cimi/app.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/app.rb b/clients/cimi/app.rb
index 104afde..350ed2d 100644
--- a/clients/cimi/app.rb
+++ b/clients/cimi/app.rb
@@ -39,6 +39,8 @@ module CIMI::Frontend
use CIMI::Frontend::NetworkTemplate
use CIMI::Frontend::NetworkPort
use CIMI::Frontend::ResourceMetadata
+ use CIMI::Frontend::System
+ use CIMI::Frontend::SystemTemplate
use Rack::Session::Cookie
helpers CIMI::Frontend::Helper
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a8ed21e5/clients/cimi/lib/client.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/client.rb b/clients/cimi/lib/client.rb
index 0418682..e0ba51b 100644
--- a/clients/cimi/lib/client.rb
+++ b/clients/cimi/lib/client.rb
@@ -23,7 +23,9 @@ module CIMI
end
def get_entity(entity_type, id, credentials)
- client['%s/%s' % [entity_type, id]].get(auth_header(credentials))
+ entity_href = get_entity_collection_href(entity_type, credentials)
+ raise RestClient::ResourceNotFound if not entity_href
+ RestClient::Resource.new('%s/%s' % [entity_href, id]).get(auth_header(credentials))
end
def get_entity_collection(entity_type, credentials)
@@ -33,6 +35,10 @@ module CIMI
RestClient::Resource.new(entity_href).get(auth_header(credentials))
end
+ def get_sub_entity_collection(parent_href, credentials)
+ RestClient::Resource.new(parent_href).get(auth_header(credentials))
+ end
+
# look up entity collection url from cloud entry point
# returns nil if entity not in cloud entry point (i.e. not supported)
def get_entity_collection_href(entity_type, credentials)
@@ -52,7 +58,7 @@ module CIMI
end
def entity_action(entity_type, action, id, body, credentials)
- client["%s/%s/%s" % [entity_type, id, action.to_s]].post(body, auth_header(credentials))
+ client["%s/%s/%s" % [entity_type, id, action.to_s]].post(body, auth_header(credentials).merge(:content_type => 'application/xml'))
end
def provider_header(credentials)
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a8ed21e5/clients/cimi/lib/entities.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities.rb b/clients/cimi/lib/entities.rb
index 680d52d..1d01db7 100644
--- a/clients/cimi/lib/entities.rb
+++ b/clients/cimi/lib/entities.rb
@@ -39,3 +39,5 @@ require 'entities/network_port_configuration'
require 'entities/network_port_template'
require 'entities/network_template'
require 'entities/resource_metadata'
+require 'entities/system'
+require 'entities/system_template'
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a8ed21e5/clients/cimi/lib/entities/system.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/system.rb b/clients/cimi/lib/entities/system.rb
new file mode 100644
index 0000000..996cb57
--- /dev/null
+++ b/clients/cimi/lib/entities/system.rb
@@ -0,0 +1,208 @@
+# 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::System < CIMI::Frontend::Entity
+
+ get '/cimi/systems' do
+ system_xml = get_entity_collection('systems', credentials)
+ @systems = collection_class_for(:system).from_xml(system_xml)
+ # We need to include this stuff for new System form
+ begin
+ system_templates_xml = get_entity_collection('system_templates', credentials)
+ @system_templates = collection_class_for(:system_template).from_xml(system_templates_xml)
+ rescue RestClient::ResourceNotFound # In case backend does not support System Template collection
+ @system_templates = nil
+ end
+ haml :'systems/index'
+ end
+
+ get '/cimi/systems/:id' do
+ system_xml = get_entity('systems', params[:id], credentials)
+ @system = CIMI::Model::System.from_xml(system_xml)
+ haml :'systems/show'
+ end
+
+ get '/cimi/systems/:id/systems' do
+ systems_resources_index('systems')
+ end
+
+ get '/cimi/systems/:id/machines' do
+ systems_resources_index('machines')
+ end
+
+ get '/cimi/systems/:id/credentials' do
+ systems_resources_index('credentials')
+ end
+
+ get '/cimi/systems/:id/volumes' do
+ systems_resources_index('volumes')
+ end
+
+ get '/cimi/systems/:id/networks' do
+ systems_resources_index('networks')
+ end
+
+ get '/cimi/systems/:id/network_ports' do
+ systems_resources_index('network_ports')
+ end
+
+ get '/cimi/systems/:id/addresses' do
+ systems_resources_index('addresses')
+ end
+
+ get '/cimi/systems/:id/forwarding_groups' do
+ systems_resources_index('forwarding_groups')
+ end
+
+ get '/cimi/systems/:id/systems/:res_id' do
+ systems_resources_show('systems')
+ end
+
+ get '/cimi/systems/:id/machines/:res_id' do
+ systems_resources_show('machines')
+ end
+
+ get '/cimi/systems/:id/credentials/:res_id' do
+ systems_resources_show('credentials')
+ end
+
+ get '/cimi/systems/:id/volumes/:res_id' do
+ systems_resources_show('volumes')
+ end
+
+ get '/cimi/systems/:id/networks/:res_id' do
+ systems_resources_show('networks')
+ end
+
+ get '/cimi/systems/:id/network_ports/:res_id' do
+ systems_resources_show('network_ports')
+ end
+
+ get '/cimi/systems/:id/addresses/:res_id' do
+ systems_resources_show('addresses')
+ end
+
+ get '/cimi/systems/:id/forwarding_groups/:res_id' do
+ systems_resources_show('forwarding_groups')
+ end
+
+ def systems_resources_show(res)
+ system_xml = get_entity('systems', params[:id], credentials)
+ @system = CIMI::Model::System.from_xml(system_xml)
+ @resource_collection = @system.send(res)
+ system_resources_xml = get_sub_entity_collection(@resource_collection.href, credentials)
+ @resource = XmlSimple.xml_in(system_resources_xml)[collection_name(@resource_collection).sub(/(.+)Collection/,'\1')].find do |r|
+ href_to_id r['id'][0] == params[:res_id]
+ end
+ raise RestClient::ResourceNotFound if not @resource
+ @resource_type = id_to_href(collection_name(@resource_collection).sub(/System(.+)Collection/,'\1'))[1..-1]
+ haml :'systems/resources/show'
+ end
+
+ def systems_resources_index(res)
+ system_xml = get_entity('systems', params[:id], credentials)
+ @system = CIMI::Model::System.from_xml(system_xml)
+ @resource_collection = @system.send(res)
+ system_resources_xml = get_sub_entity_collection(@resource_collection.href, credentials)
+ @resources = XmlSimple.xml_in(system_resources_xml)
+ haml :'systems/resources/index'
+ end
+
+ delete '/cimi/systems/:id/delete' do
+ result = destroy_entity('systems', params[:id], credentials)
+ if result.code == 200
+ flash[:success] = "System '#{params[:id]}' was successfully destroyed."
+ redirect '/cimi/systems'
+ else
+ flash[:error] = "Unable to destroy system #{params[:id]}"
+ end
+ end
+
+ post '/cimi/systems/:id/stop' do
+ action_xml = Nokogiri::XML::Builder.new do |xml|
+ xml.Action(:xmlns => CIMI::Frontend::CMWG_NAMESPACE) {
+ xml.action "http://schemas.dmtf.org/cimi/1/action/stop"
+ }
+ end.to_xml
+ entity_action 'systems', 'stop', action_xml, credentials, params[:id]
+ flash[:success] = "System stop successfully initiated."
+ redirect '/cimi/systems/%s' % params[:id]
+ end
+
+ post '/cimi/systems/:id/start' do
+ action_xml = Nokogiri::XML::Builder.new do |xml|
+ xml.Action(:xmlns => CIMI::Frontend::CMWG_NAMESPACE) {
+ xml.action "http://schemas.dmtf.org/cimi/1/action/start"
+ }
+ end.to_xml
+ entity_action 'systems', 'start', action_xml, credentials, params[:id]
+ flash[:success] = "System start successfully initiated."
+ redirect '/cimi/systems/%s' % params[:id]
+ end
+
+ post '/cimi/systems/:id/restart' do
+ action_xml = Nokogiri::XML::Builder.new do |xml|
+ xml.Action(:xmlns => CIMI::Frontend::CMWG_NAMESPACE) {
+ xml.action "http://schemas.dmtf.org/cimi/1/action/restart"
+ }
+ end.to_xml
+ entity_action 'systems', 'restart', action_xml, credentials, params[:id]
+ flash[:success] = "System restart successfully initiated."
+ redirect '/cimi/systems/%s' % params[:id]
+ end
+
+ post '/cimi/systems' do
+ system_xml = Nokogiri::XML::Builder.new do |xml|
+ xml.System(:xmlns => CIMI::Frontend::CMWG_NAMESPACE) {
+ xml.name params[:system][:name]
+ xml.systemTemplate( :href => params[:system][:system_template])
+ }
+ end.to_xml
+ begin
+ result = create_entity('systems', system_xml, credentials)
+ system = collection_class_for(:system).from_xml(result)
+ flash[:success] = "System create was successfully initiated."
+ redirect "/cimi/systems/#{href_to_id(system.id)}"
+ rescue => e
+ flash[:error] = "System cannot be created: #{e.message}"
+ end
+ end
+
+ post '/cimi/systems/import' do
+ action_xml = Nokogiri::XML::Builder.new do |xml|
+ xml.Action(:xmlns => CIMI::Frontend::CMWG_NAMESPACE) {
+ xml.action "http://schemas.dmtf.org/cimi/1/action/import"
+ xml.source params[:system][:source]
+ }
+ end.to_xml
+ entity_action 'systems', 'import', action_xml, credentials
+ flash[:success] = "System import successfully initiated."
+ redirect '/cimi/systems'
+ end
+
+ post '/cimi/systems/:id/export' do
+ action_xml = Nokogiri::XML::Builder.new do |xml|
+ xml.Action(:xmlns => CIMI::Frontend::CMWG_NAMESPACE) {
+ xml.action "http://schemas.dmtf.org/cimi/1/action/export"
+ xml.format params[:system][:format]
+ xml.destination params[:system][:destination]
+ }
+ end.to_xml
+ result = entity_action 'systems', 'export', action_xml, credentials, params[:id]
+ flash[:success] = "System export successfully initiated."
+ redirect '/cimi/systems/%s' % params[:id]
+ end
+
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a8ed21e5/clients/cimi/lib/entities/system_template.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/system_template.rb b/clients/cimi/lib/entities/system_template.rb
new file mode 100644
index 0000000..fdb30ec
--- /dev/null
+++ b/clients/cimi/lib/entities/system_template.rb
@@ -0,0 +1,55 @@
+# 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::SystemTemplate < CIMI::Frontend::Entity
+
+ get '/cimi/system_templates/:id' do
+ system_templates_xml = get_entity('system_templates', params[:id], credentials)
+ @system_template = CIMI::Model::SystemTemplate.from_xml(system_templates_xml)
+ haml :'system_templates/show'
+ end
+
+ get '/cimi/system_templates' do
+ system_template_xml = get_entity_collection('system_templates', credentials)
+ @system_templates = collection_class_for(:system_template).from_xml(system_template_xml)
+ haml :'system_templates/index'
+ end
+
+ post '/cimi/system_templates/import' do
+ action_xml = Nokogiri::XML::Builder.new do |xml|
+ xml.Action(:xmlns => CIMI::Frontend::CMWG_NAMESPACE) {
+ xml.action "http://schemas.dmtf.org/cimi/1/action/import"
+ xml.source params[:system_template][:source]
+ }
+ end.to_xml
+ entity_action 'system_templates', 'import', action_xml, credentials
+ flash[:success] = "System Template import successfully initiated."
+ redirect '/cimi/system_templates'
+ end
+
+ post '/cimi/system_templates/:id/export' do
+ action_xml = Nokogiri::XML::Builder.new do |xml|
+ xml.Action(:xmlns => CIMI::Frontend::CMWG_NAMESPACE) {
+ xml.action "http://schemas.dmtf.org/cimi/1/action/export"
+ xml.format params[:system_template][:format]
+ xml.destination params[:system_template][:destination]
+ }
+ end.to_xml
+ result = entity_action 'system_templates', 'export', action_xml, credentials, params[:id]
+ flash[:success] = "System Template export successfully initiated."
+ redirect '/cimi/system_templates/%s' % params[:id]
+ end
+
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a8ed21e5/clients/cimi/views/system_templates/index.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/system_templates/index.haml b/clients/cimi/views/system_templates/index.haml
new file mode 100644
index 0000000..17dc36c
--- /dev/null
+++ b/clients/cimi/views/system_templates/index.haml
@@ -0,0 +1,49 @@
+- @title=collection_name @system_templates
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li.active
+ SystemTemplateCollection
+
+- content_for :actions do
+
+ - if @system_templates.operations.find {|o| o.rel == 'http://schemas.dmtf.org/cimi/1/action/import'}
+ %p
+ %a{ :href => '#systemTemplateModal', :class => 'btn btn-primary', :'data-toggle' => :modal} Import System Template
+
+ %div{ :id => :systemTemplateModal, :class => 'modal hide fade' }
+ .modal-header
+ %h3 Import a System Template
+ .modal-body
+ %form{ :action => "/cimi/system_templates/import", :method => :post }
+ %fieldset
+ .control-group
+ %label.control-label{ :for => 'system_template[source]' } Source URI
+ .controls
+ %input{ :type => :text, :name => 'system_template[source]' }
+ .modal-footer
+ %a{ :href => '#', :class => 'btn btn-primary', :'data-loading-text' => 'Creating System Template...', :onclick => "postModalForm(this, 'systemTemplateModal')"} Continue
+ %a{ :href => '#', :class => 'btn', :'data-dismiss' => 'modal'} Cancel
+
+ %p{:style => 'text-align:right;'}
+ %a{ :href => "#{@system_templates.id}?format=xml", :class => 'label warning' } XML
+ %a{ :href => "#{@system_templates.id}?format=json", :class => 'label warning' } JSON
+
+%blockquote
+ %p
+ A System Template Collection entity represents the collection of
+ System Template entities within a Provider. This entity can be used to
+ create systems.
+
+%h3 SystemTemplateCollection
+%ul
+ - @system_templates.system_templates.each do |temp|
+ %li
+ %a{ :href => "/cimi/system_templates/#{href_to_id(temp.id)}"}=href_to_id(temp.id)
+
+- details do
+ -row 'id',@system_templates.id
+ -row 'Count',@system_templates.count
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a8ed21e5/clients/cimi/views/system_templates/show.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/system_templates/show.haml b/clients/cimi/views/system_templates/show.haml
new file mode 100644
index 0000000..c12ecbb
--- /dev/null
+++ b/clients/cimi/views/system_templates/show.haml
@@ -0,0 +1,74 @@
+- @title="#{@system_template.name}"
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li
+ %a{ :href => "/cimi/system_templates"} SystemTemplateCollection
+ %span.divider="/"
+ %li.active
+ = @system_template.name
+
+- content_for :actions do
+
+ %div{:class => 'btn-group btn-group-vertical'}
+ %form{ :action => "/cimi/system_templates/#{href_to_id @system_template.id}/delete", :method => :post, :style => 'display:inline', :id => 'frm_delete'}
+ %input{ :type => :hidden, :name => '_method', :value => 'delete'}
+ - if @system_template.operations.find {|o| o.rel == 'http://schemas.dmtf.org/cimi/1/action/export'}
+ %a{ :class => 'btn btn-primary', :href => '#systemModal', :'data-toggle' => :modal} Export
+ - if @system_template.operations.find {|o| o.rel == 'delete'}
+ %button{ :class => 'btn btn-danger', :type => :button, :onclick => '$("#frm_delete").submit()'} Destroy
+
+ %div{ :id => :systemModal, :class => 'modal hide fade' }
+ .modal-header
+ %h3 Export System Template entity
+ .modal-body
+ %form{ :action => "/cimi/system_templates/#{href_to_id @system_template.id}/export", :method => :post }
+ %fieldset
+ .control-group
+ %label.control-label{ :for => 'system_template[format]' } Media Type
+ .controls
+ %input{ :type => :text, :name => 'system_template[format]' }
+ %label.control-label{ :for => 'system_template[destination]' } Location to Put Exported Data
+ .controls
+ %input{ :type => :text, :name => 'system_template[destination]' }
+ .modal-footer
+ %a{ :href => '#', :class => 'btn btn-primary', :'data-loading-text' => 'System Template Export Initiated...', :onclick => "postModalForm(this, 'systemModal')"} Continue
+ %a{ :href => '#', :class => 'btn', :'data-dismiss' => 'modal'} Cancel
+
+ %p{:style => 'margin-top:1em;'}
+ %a{ :href => "#{@system_template.id}?format=xml", :class => 'label warning' } XML
+ %a{ :href => "#{@system_template.id}?format=json", :class => 'label warning' } JSON
+
+-details 'SystemTemplate details' do
+ -row 'ID',@system_template.id
+ -row 'Name',@system_template.name
+ -row 'Description',@system_template.description
+ -row 'Created',@system_template.created
+
+%h5 Component Descriptors
+%table{ :class => 'table table-bordered table-striped' }
+ %thead
+ %tr
+ %th Name
+ %th Description
+ %th Type
+ %th Component Template
+ %th Quantity
+ %tbody
+ - @system_template.component_descriptors.each do |compo|
+ %tr
+ %td=compo.name
+ %td=compo.description
+ %td=compo.type
+ -descriptors = [:machine_template,:system_template,:credential_template,:volume_template,:network_template,:network_port_template,:forwarding_group_template,:address_template]
+ -value = nil
+ -unless descriptors.find {|d| value = compo.send(d)[:href]}
+ -descriptors.find do |d|
+ - values = compo.send(d).attribute_values.collect do |k, v|
+ - "#{k} => #{v.attribute_values[:href]}" if v and v.respond_to? 'attribute_values' and v.attribute_values[:href]
+ - value = values.compact.join(' <br> ')
+ %td=value ? convert_urls(value) : 'N/A'
+ %td=compo.quantity ? compo.quantity : 1
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a8ed21e5/clients/cimi/views/systems/index.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/systems/index.haml b/clients/cimi/views/systems/index.haml
new file mode 100644
index 0000000..243e7d9
--- /dev/null
+++ b/clients/cimi/views/systems/index.haml
@@ -0,0 +1,70 @@
+- @title=collection_name @systems
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li.active
+ SystemCollection
+
+- content_for :actions do
+
+ - if @systems.operations.find {|o| o.rel == 'add'} and @system_templates
+ %p
+ %a{ :href => '#systemModal', :class => 'btn btn-primary', :'data-toggle' => :modal} New System
+
+ %div{ :id => :systemModal, :class => 'modal hide fade' }
+ .modal-header
+ %h3 Create new System entity
+ .modal-body
+ %form{ :action => "/cimi/systems", :method => :post }
+ %fieldset
+ .control-group
+ %label.control-label{ :for => 'system[name]' } System Name
+ .controls
+ %input{ :type => :text, :name => 'system[name]' }
+ %label.control-label{ :for => 'system[system_template]' } System Template
+ .controls
+ %select{ :name => 'system[system_template]' }
+ - @system_templates.system_templates.each do |template|
+ %option{ :value => template.id }=href_to_id(template.id)
+ .modal-footer
+ %a{ :href => '#', :class => 'btn btn-primary', :'data-loading-text' => 'Creating System...', :onclick => "postModalForm(this, 'systemModal')"} Continue
+ %a{ :href => '#', :class => 'btn', :'data-dismiss' => 'modal'} Cancel
+
+ - if @systems.operations.find {|o| o.rel == 'http://schemas.dmtf.org/cimi/1/action/import'}
+ %p
+ %a{ :href => '#systemImportModal', :class => 'btn btn-primary', :'data-toggle' => :modal} Import System
+
+ %div{ :id => :systemImportModal, :class => 'modal hide fade' }
+ .modal-header
+ %h3 Import system
+ .modal-body
+ %form{ :action => "/cimi/systems/import", :method => :post }
+ %fieldset
+ .control-group
+ %label.control-label{ :for => 'system[source]' } Source URI
+ .controls
+ %input{ :type => :text, :name => 'system[source]' }
+ .modal-footer
+ %a{ :href => '#', :class => 'btn btn-primary', :'data-loading-text' => 'Import...', :onclick => "postModalForm(this, 'systemImportModal')"} Continue
+ %a{ :href => '#', :class => 'btn', :'data-dismiss' => 'modal'} Cancel
+
+ %p{:style => 'text-align:right;'}
+ %a{ :href => "#{@systems.id}?format=xml", :class => 'label warning' } XML
+ %a{ :href => "#{@systems.id}?format=json", :class => 'label warning' } JSON
+
+%ul
+ - if @systems.systems and not @systems.systems.empty?
+ - @systems.systems.each do |system|
+ %li
+ %a{ :href => "/cimi/systems/#{href_to_id(system.id)}"}=href_to_id(system.id)
+ - else
+ .alert-message.block-message.warning
+ %p
+ There are no System entities defined for this collection.
+
+- details do
+ - row 'ID', @systems.id
+ - row 'Count', @systems.count
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a8ed21e5/clients/cimi/views/systems/resources/index.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/systems/resources/index.haml b/clients/cimi/views/systems/resources/index.haml
new file mode 100644
index 0000000..940c992
--- /dev/null
+++ b/clients/cimi/views/systems/resources/index.haml
@@ -0,0 +1,34 @@
+- @title=collection_name @resource_collection
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li
+ %a{ :href => "/cimi/systems"} SystemCollection
+ %span.divider="/"
+ %li
+ %a{ :href => "/cimi/systems/#{href_to_id(@system.id)}"}= href_to_id(@system.id)
+ %span.divider="/"
+ %li.active=collection_name @resource_collection
+
+- content_for :actions do
+ %p
+ %a{ :href => "#{@resource_collection.id}?format=xml", :class => 'label warning' } XML
+ %a{ :href => "#{@resource_collection.id}?format=json", :class => 'label warning' } JSON
+
+%ul
+ - resources = @resources[collection_name(@resource_collection).sub(/Collection/,'')]
+ - if resources and not resources.empty?
+ - @resources[collection_name(@resource_collection).sub(/Collection/,'')].each do |c|
+ %li
+ %a{ :href => "#{id_to_href(collection_name(@resource_collection).sub(/System(.+)Collection/,'\1'))[1..-1].pluralize}/#{href_to_id(c['id'][0])}"}=href_to_id(c['id'][0])
+ - else
+ .alert-message.block-message.warning
+ %p
+ There are no #{collection_name(@resource_collection).sub(/Collection/,'').pluralize} defined for this system.
+
+-details do
+ -row 'ID', @resources['id'][0]
+ -row 'Count', @resources['count'][0]
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a8ed21e5/clients/cimi/views/systems/resources/show.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/systems/resources/show.haml b/clients/cimi/views/systems/resources/show.haml
new file mode 100644
index 0000000..2e5851f
--- /dev/null
+++ b/clients/cimi/views/systems/resources/show.haml
@@ -0,0 +1,31 @@
+- @title="#{@resource['name'][0]}"
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li
+ %a{ :href => "/cimi/systems"} SystemCollection
+ %span.divider="/"
+ %li
+ %a{ :href => "/cimi/systems/#{href_to_id(@system.id)}"}= href_to_id(@system.id)
+ %span.divider="/"
+ %li
+ %a{ :href => "/cimi/systems/#{href_to_id(@system.id)}/#{@resource_type.pluralize}"}= collection_name @resource_collection
+ %span.divider="/"
+ %li.active
+ = @resource['name'][0]
+
+- content_for :actions do
+
+ %p{:style => 'margin-top:1em;'}
+ %a{ :href => "#{@resource['id'][0]}?format=xml", :class => 'label warning' } XML
+ %a{ :href => "#{@resource['id'][0]}?format=json", :class => 'label warning' } JSON
+
+- details do
+ -row 'ID', @resource['id'][0]
+ -row 'Name', @resource['name'][0]
+ -row 'Description', @resource['description'] ? @resource['description'][0] : 'N/A'
+ -row 'Created', @resource['created'] ? @resource['created'][0] : 'N/A'
+ -row collection_name(@resource_collection).sub(/System(.+)Collection/,'\1'), url("/cimi/#{@resource_type.pluralize}/#{href_to_id @resource[@resource_type][0]['href']}")
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a8ed21e5/clients/cimi/views/systems/show.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/systems/show.haml b/clients/cimi/views/systems/show.haml
new file mode 100644
index 0000000..6aab865
--- /dev/null
+++ b/clients/cimi/views/systems/show.haml
@@ -0,0 +1,81 @@
+- @title="#{@system.name}"
+
+- content_for :breadcrumb do
+ %ul.breadcrumb
+ %li
+ %a{ :href => "/cimi/cloudEntryPoint"} CloudEntryPoint
+ %span.divider="/"
+ %li
+ %a{ :href => "/cimi/systems"} SystemCollection
+ %span.divider="/"
+ %li.active
+ = @system.name
+
+- content_for :actions do
+
+ %div{:class => 'btn-group btn-group-vertical'}
+ %form{ :action => "/cimi/systems/#{href_to_id @system.id}/stop", :method => :post, :style => 'display:inline', :id => 'frm_stop'}
+ %form{ :action => "/cimi/systems/#{href_to_id @system.id}/start", :method => :post, :style => 'display:inline', :id => 'frm_start'}
+ %form{ :action => "/cimi/systems/#{href_to_id @system.id}/restart", :method => :post, :style => 'display:inline', :id => 'frm_restart'}
+ %form{ :action => "/cimi/systems/#{href_to_id @system.id}/delete", :method => :post, :style => 'display:inline', :id => 'frm_delete'}
+ %input{ :type => :hidden, :name => '_method', :value => 'delete'}
+ - if @system.operations.find {|o| o.rel == 'http://schemas.dmtf.org/cimi/1/action/stop'}
+ %button{ :class => 'btn btn-warning', :type => :button, :onclick => '$("#frm_stop").submit()'} Stop
+ - if @system.operations.find {|o| o.rel == 'http://schemas.dmtf.org/cimi/1/action/start'}
+ %button{ :class => 'btn btn-success', :type => :button, :onclick => '$("#frm_start").submit()'} Start
+ - if @system.operations.find {|o| o.rel == 'http://schemas.dmtf.org/cimi/1/action/restart'}
+ %button{ :class => 'btn btn-info', :type => :button, :onclick => '$("#frm_restart").submit()'} Reboot
+ - if @system.operations.find {|o| o.rel == 'http://schemas.dmtf.org/cimi/1/action/export'}
+ %a{ :class => 'btn btn-primary', :href => '#systemModal', :'data-toggle' => :modal} Export
+ - if @system.operations.find {|o| o.rel == 'delete'}
+ %button{ :class => 'btn btn-danger', :type => :button, :onclick => '$("#frm_delete").submit()'} Destroy
+
+ %div{ :id => :systemModal, :class => 'modal hide fade' }
+ .modal-header
+ %h3 Export System entity
+ .modal-body
+ %form{ :action => "/cimi/systems/#{href_to_id @system.id}/export", :method => :post }
+ %fieldset
+ .control-group
+ %label.control-label{ :for => 'system[format]' } Media Type
+ .controls
+ %input{ :type => :text, :name => 'system[format]' }
+ %label.control-label{ :for => 'system[destination]' } Location to Put Exported Data
+ .controls
+ %input{ :type => :text, :name => 'system[destination]' }
+ .modal-footer
+ %a{ :href => '#', :class => 'btn btn-primary', :'data-loading-text' => 'System Export Initiated...', :onclick => "postModalForm(this, 'systemModal')"} Continue
+ %a{ :href => '#', :class => 'btn', :'data-dismiss' => 'modal'} Cancel
+
+ %p{:style => 'margin-top:1em;'}
+ %a{ :href => "#{@system.id}?format=xml", :class => 'label warning' } XML
+ %a{ :href => "#{@system.id}?format=json", :class => 'label warning' } JSON
+
+- details do
+ -row 'ID', @system.id
+ -row 'Name',@system.name
+ -row 'Description',@system.description
+ -row 'Created', @system.created
+ -row 'State',state_span_for(@system.state)
+ -row 'Systems', @system.systems.href
+ -row 'Machines', @system.machines.href
+ -row 'Credentials', @system.credentials.href
+ -row 'Volumes', @system.volumes.href
+ -row 'Networks', @system.networks.href
+ -row 'NetworkPorts', @system.network_ports.href
+ -row 'Addresses', @system.addresses.href
+ -row 'ForwardingGroups', @system.forwarding_groups.href
+ -row 'Meters', (@system.meters.empty? ? "No meters" : ( @system.meters.each{|meter| meters.id}))
+
+%h5 Properties
+%table{ :class => 'table table-bordered table-striped' }
+ %thead
+ %tr
+ %th Name
+ %th Value
+ %tbody
+ - @system.property.each do |name, value|
+ %tr
+ %td
+ %code=name
+ %td=convert_urls value
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a8ed21e5/server/lib/cimi/models/system.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/system.rb b/server/lib/cimi/models/system.rb
index 4a176ae..c9caa7e 100644
--- a/server/lib/cimi/models/system.rb
+++ b/server/lib/cimi/models/system.rb
@@ -26,13 +26,9 @@ class CIMI::Model::System < CIMI::Model::Base
collection :addresses, :class => CIMI::Model::SystemAddress
collection :forwarding_groups, :class => CIMI::Model::SystemForwardingGroup
- #TODO: implement the attributes commented out
-
- # array :meters do
- # scalar :href
- # end
-
- # href :event_log
+ array :meters do
+ scalar :href
+ end
array :operations do
scalar :rel, :href
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a8ed21e5/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
index 10c6133..717582c 100644
--- a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
@@ -142,6 +142,7 @@ module Deltacloud::Drivers::Mock
def export_system(credentials, opts={})
puts "export_system(#{opts})"
+ "http://cimi.example.org/ovf-packages/#{opts[:id]}" unless opts[:destination]
end
def system_machines(credentials, opts={})
@@ -237,6 +238,7 @@ module Deltacloud::Drivers::Mock
def export_system_template(credentials, opts={})
puts "export_system(#{opts})"
+ "http://cimi.example.org/ovf-packages/#{opts[:id]}" unless opts[:destination]
end
def networks(credentials, opts={})
[6/8] git commit: FGCP: add descriptions to machine templates in
system template
Posted by dk...@apache.org.
FGCP: add descriptions to machine templates in system template
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/cbeeef39
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/cbeeef39
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/cbeeef39
Branch: refs/heads/master
Commit: cbeeef3956439b7f1c4d94936d9f5422e790579f
Parents: 452093b
Author: Dies Koper <di...@fast.au.fujitsu.com>
Authored: Mon Jul 15 11:40:31 2013 +1000
Committer: Dies Koper <di...@fast.au.fujitsu.com>
Committed: Mon Jul 15 11:40:31 2013 +1000
----------------------------------------------------------------------
.../lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/cbeeef39/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb b/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
index 20c9223..ffae858 100644
--- a/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
+++ b/server/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb
@@ -244,6 +244,7 @@ module Deltacloud::Drivers::Fgcp
safely do
client = new_client(credentials)
context = opts[:env]
+ images = nil #lazy load
templates = client.list_vsys_descriptor['vsysdescriptors'][0]['vsysdescriptor'].collect do |desc|
conf = client.get_vsys_descriptor_configuration(desc['vsysdescriptorId'][0])['vsysdescriptor'][0]
components = conf['vservers'][0]['vserver'].collect do |vserver|
@@ -253,13 +254,15 @@ module Deltacloud::Drivers::Fgcp
:volume_config => CIMI::Model::VolumeConfiguration.new(:capacity => vdisk['size'][0].to_i * 1024 * 1024)
)
end if vserver['vdisks']
+ images = images(credentials) if not images
+ this_image = images.find {|img| img.id == vserver['diskimageId'][0] }
{
:name => vserver['vserverName'][0],
- :description => '',
+ :description => this_image ? this_image.description : '',
:type => "http://schemas.dmtf.org/cimi/1/Machine",
:machine_template => CIMI::Model::MachineTemplate.new(
:name => vserver['vserverName'][0],
- :description => '',
+ :description => this_image ? this_image.description : '',
:machine_config => CIMI::Service::MachineConfiguration.find(vserver['vserverType'][0], context),
:machine_image => { :href => context.machine_image_url(vserver['diskimageId'][0]) },
:volume_templates => volume_templates
[2/8] git commit: CIMI: added/changed conditionals to only show
machine operations for which the action url was returned in client UI
Posted by dk...@apache.org.
CIMI: added/changed conditionals to only show machine operations
for which the action url was returned in client UI
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/7bab5887
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/7bab5887
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/7bab5887
Branch: refs/heads/master
Commit: 7bab5887904435d6c66116a9163b8887318bd035
Parents: 5c2c9dc
Author: Dies Koper <di...@fast.au.fujitsu.com>
Authored: Mon Jul 15 10:31:28 2013 +1000
Committer: Dies Koper <di...@fast.au.fujitsu.com>
Committed: Mon Jul 15 10:53:01 2013 +1000
----------------------------------------------------------------------
clients/cimi/views/machines/show.haml | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7bab5887/clients/cimi/views/machines/show.haml
----------------------------------------------------------------------
diff --git a/clients/cimi/views/machines/show.haml b/clients/cimi/views/machines/show.haml
index cc31f0c..7d36da0 100644
--- a/clients/cimi/views/machines/show.haml
+++ b/clients/cimi/views/machines/show.haml
@@ -19,12 +19,14 @@
%form{ :action => "/cimi/machines/#{href_to_id @machine.id}/restart", :method => :post, :style => 'display:inline', :id => 'frm_restart'}
%form{ :action => "/cimi/machines/#{href_to_id @machine.id}/delete", :method => :post, :style => 'display:inline', :id => 'frm_delete'}
%input{ :type => :hidden, :name => '_method', :value => 'delete'}
- - if @machine.state == 'STARTED'
+ - if @machine.operations.find {|o| o.rel == 'http://schemas.dmtf.org/cimi/1/action/stop'}
%button{ :class => 'btn btn-warning', :type => :button, :onclick => '$("#frm_stop").submit()'} Stop
- - if @machine.state == 'STOPPED'
+ - if @machine.operations.find {|o| o.rel == 'http://schemas.dmtf.org/cimi/1/action/start'}
%button{ :class => 'btn btn-success', :type => :button, :onclick => '$("#frm_start").submit()'} Start
- %button{ :class => 'btn btn-info', :type => :button, :onclick => '$("#frm_restart").submit()'} Reboot
- %button{ :class => 'btn btn-danger', :type => :button, :onclick => '$("#frm_delete").submit()'} Destroy
+ - if @machine.operations.find {|o| o.rel == 'http://schemas.dmtf.org/cimi/1/action/restart'}
+ %button{ :class => 'btn btn-info', :type => :button, :onclick => '$("#frm_restart").submit()'} Reboot
+ - if @machine.operations.find {|o| o.rel == 'delete'}
+ %button{ :class => 'btn btn-danger', :type => :button, :onclick => '$("#frm_delete").submit()'} Destroy
%p{:style => 'margin-top:1em;'}
%a{ :href => "#{@machine.id}?format=xml", :class => 'label warning' } XML
[8/8] git commit: CIMI: add dealing with 202 return code from system
delete Used by FGCP. See 4.2.1.7 Asynchronous operations of CIMI 1.0.1 spec.
Posted by dk...@apache.org.
CIMI: add dealing with 202 return code from system delete
Used by FGCP. See 4.2.1.7 Asynchronous operations of CIMI 1.0.1 spec.
Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/16ba86d8
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/16ba86d8
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/16ba86d8
Branch: refs/heads/master
Commit: 16ba86d8f5e9d021463ef79cfba2894178c99854
Parents: 3618609
Author: Dies Koper <di...@fast.au.fujitsu.com>
Authored: Mon Jul 15 12:58:36 2013 +1000
Committer: Dies Koper <di...@fast.au.fujitsu.com>
Committed: Mon Jul 15 12:58:47 2013 +1000
----------------------------------------------------------------------
clients/cimi/lib/entities/system.rb | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/16ba86d8/clients/cimi/lib/entities/system.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/system.rb b/clients/cimi/lib/entities/system.rb
index 996cb57..4661fec 100644
--- a/clients/cimi/lib/entities/system.rb
+++ b/clients/cimi/lib/entities/system.rb
@@ -125,6 +125,9 @@ class CIMI::Frontend::System < CIMI::Frontend::Entity
if result.code == 200
flash[:success] = "System '#{params[:id]}' was successfully destroyed."
redirect '/cimi/systems'
+ elsif result.code == 202
+ flash[:success] = "Deletion of System '#{params[:id]}' was successfully initiated."
+ redirect '/cimi/systems'
else
flash[:error] = "Unable to destroy system #{params[:id]}"
end