deltacloud-core 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +63 -7
- data/bin/deltacloudd +29 -17
- data/config.ru +5 -3
- data/config/drivers/ec2.yaml +9 -0
- data/config/drivers/google.yaml +3 -0
- data/config/drivers/openstack.yaml +3 -0
- data/deltacloud-core.gemspec +1 -1
- data/lib/cimi/dependencies.rb +62 -0
- data/lib/cimi/helpers/cimi_helper.rb +50 -0
- data/lib/cimi/model.rb +52 -0
- data/lib/cimi/model/action.rb +24 -0
- data/lib/cimi/model/base.rb +249 -0
- data/lib/cimi/model/cloud_entry_point.rb +48 -0
- data/lib/cimi/model/entity_metadata.rb +83 -0
- data/lib/cimi/model/entity_metadata_collection.rb +31 -0
- data/lib/cimi/model/errors.rb +40 -0
- data/lib/cimi/model/machine.rb +227 -0
- data/lib/cimi/model/machine_admin.rb +59 -0
- data/lib/cimi/model/machine_admin_collection.rb +34 -0
- data/lib/cimi/model/machine_collection.rb +34 -0
- data/lib/cimi/model/machine_configuration.rb +67 -0
- data/lib/cimi/model/machine_configuration_collection.rb +34 -0
- data/lib/cimi/model/machine_image.rb +46 -0
- data/lib/cimi/model/machine_image_collection.rb +34 -0
- data/lib/cimi/model/machine_template.rb +41 -0
- data/lib/cimi/model/machine_template_collection.rb +34 -0
- data/lib/cimi/model/network.rb +69 -0
- data/lib/cimi/model/network_collection.rb +34 -0
- data/lib/cimi/model/network_configuration.rb +50 -0
- data/lib/cimi/model/network_configuration_collection.rb +34 -0
- data/lib/cimi/model/network_template.rb +26 -0
- data/lib/cimi/model/schema.rb +277 -0
- data/lib/cimi/model/volume.rb +103 -0
- data/lib/cimi/model/volume_collection.rb +34 -0
- data/lib/cimi/model/volume_configuration.rb +60 -0
- data/lib/cimi/model/volume_configuration_collection.rb +34 -0
- data/lib/cimi/model/volume_image.rb +49 -0
- data/lib/cimi/model/volume_image_collection.rb +34 -0
- data/lib/cimi/model/volume_template.rb +23 -0
- data/lib/cimi/model/volume_template_collection.rb +34 -0
- data/lib/cimi/server.rb +575 -0
- data/lib/deltacloud/base_driver/base_driver.rb +11 -1
- data/lib/deltacloud/core_ext.rb +2 -0
- data/lib/deltacloud/core_ext/array.rb +25 -0
- data/lib/deltacloud/core_ext/hash.rb +7 -0
- data/lib/deltacloud/core_ext/proc.rb +31 -0
- data/lib/deltacloud/core_ext/string.rb +15 -0
- data/lib/deltacloud/drivers/condor/condor_driver.rb +2 -1
- data/lib/deltacloud/drivers/ec2/ec2_driver.rb +32 -10
- data/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb +1 -1
- data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +1 -1
- data/lib/deltacloud/drivers/google/google_driver.rb +233 -0
- data/lib/deltacloud/drivers/mock/data/instances/inst0.yml +7 -2
- data/lib/deltacloud/drivers/mock/data/instances/inst1.yml +7 -2
- data/lib/deltacloud/drivers/mock/data/instances/inst2.yml +7 -2
- data/lib/deltacloud/drivers/mock/mock_client.rb +17 -0
- data/lib/deltacloud/drivers/mock/mock_driver.rb +82 -8
- data/lib/deltacloud/drivers/opennebula/opennebula_driver.rb +1 -1
- data/lib/deltacloud/drivers/openstack/openstack_driver.rb +47 -0
- data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +8 -8
- data/lib/deltacloud/drivers/rhevm/rhevm_client.rb +122 -49
- data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +42 -22
- data/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb +1 -1
- data/lib/deltacloud/drivers/sbc/sbc_driver.rb +3 -2
- data/lib/deltacloud/drivers/terremark/terremark_driver.rb +2 -2
- data/lib/deltacloud/drivers/vsphere/vsphere_client.rb +25 -4
- data/lib/deltacloud/drivers/vsphere/vsphere_driver.rb +35 -12
- data/lib/deltacloud/hardware_profile.rb +34 -10
- data/lib/deltacloud/helpers/application_helper.rb +3 -28
- data/lib/deltacloud/helpers/blob_stream.rb +2 -1
- data/lib/deltacloud/models.rb +2 -0
- data/lib/deltacloud/models/bucket.rb +1 -1
- data/lib/deltacloud/models/image.rb +1 -1
- data/lib/deltacloud/models/instance.rb +2 -1
- data/lib/deltacloud/models/instance_address.rb +56 -0
- data/lib/deltacloud/models/provider.rb +27 -0
- data/{server.rb → lib/deltacloud/server.rb} +72 -14
- data/lib/deltacloud/validation.rb +31 -10
- data/lib/sinatra/rabbit.rb +34 -26
- data/lib/sinatra/rack_accept.rb +5 -5
- data/lib/sinatra/rack_matrix_params.rb +6 -2
- data/lib/sinatra/rack_syslog.rb +3 -3
- data/lib/sinatra/static_assets.rb +1 -1
- data/lib/sinatra/url_for.rb +1 -7
- data/public/images/bread-bg.png +0 -0
- data/public/images/logo-wide.png +0 -0
- data/public/images/topbar-bg.png +0 -0
- data/public/javascripts/application.js +5 -0
- data/public/javascripts/cmwgapp.js +249 -0
- data/public/javascripts/jquery-1.4.2.min.js +154 -0
- data/public/javascripts/jquery.mobile-1.0rc1.min.js +170 -0
- data/public/stylesheets/images/icons-18-black.png +0 -0
- data/public/stylesheets/images/icons-18-white.png +0 -0
- data/public/stylesheets/images/icons-36-black.png +0 -0
- data/public/stylesheets/images/icons-36-white.png +0 -0
- data/public/stylesheets/jquery.mobile-1.0rc1.min.css +12 -0
- data/public/stylesheets/new.css +4 -0
- data/support/fedora/deltacloud-core.init +20 -13
- data/tests/cimi/features/step_definitions/common_steps.rb +59 -0
- data/tests/cimi/features/step_definitions/machine_images_steps.rb +0 -0
- data/tests/cimi/features/step_definitions/machines_steps.rb +99 -0
- data/tests/cimi/features/step_definitions/volumes_steps.rb +115 -0
- data/tests/cimi/features/support/env.rb +53 -0
- data/tests/common.rb +89 -11
- data/tests/core_ext/string.rb +31 -0
- data/tests/drivers/google/api_test.rb +35 -0
- data/tests/drivers/google/buckets_test.rb +116 -0
- data/tests/drivers/google/setup.rb +38 -0
- data/tests/drivers/mock/instances_test.rb +20 -5
- data/tests/drivers/openstack/api_test.rb +41 -0
- data/tests/drivers/openstack/hardware_profiles_test.rb +53 -0
- data/tests/drivers/openstack/images_test.rb +40 -0
- data/tests/drivers/openstack/instances_test.rb +163 -0
- data/tests/drivers/openstack/realms_test.rb +36 -0
- data/tests/drivers/openstack/setup.rb +20 -0
- data/tests/drivers/rackspace/buckets_test.rb +145 -0
- data/tests/drivers/rackspace/setup.rb +3 -3
- data/tests/drivers/rhevm/api_test.rb +1 -1
- data/tests/drivers/rhevm/images_test.rb +2 -2
- data/tests/drivers/rhevm/instances_test.rb +10 -12
- data/tests/drivers/rhevm/realms_test.rb +4 -4
- data/tests/drivers/rhevm/setup.rb +3 -3
- data/tests/rabbit_test.rb +1 -1
- data/views/api/show.html.haml +13 -0
- data/views/cimi/cloudEntryPoint/index.html.haml +5 -0
- data/views/cimi/cloudEntryPoint/index.xml.haml +9 -0
- data/views/cimi/collection/index.html.haml +45 -0
- data/views/cimi/collection/response.xml.haml +3 -0
- data/views/cimi/error.html.haml +31 -0
- data/views/cimi/errors/400.html.haml +41 -0
- data/views/cimi/errors/400.xml.haml +3 -0
- data/views/cimi/errors/401.html.haml +41 -0
- data/views/cimi/errors/401.xml.haml +2 -0
- data/views/cimi/errors/403.html.haml +42 -0
- data/views/cimi/errors/403.xml.haml +2 -0
- data/views/cimi/errors/404.html.haml +29 -0
- data/views/cimi/errors/404.xml.haml +2 -0
- data/views/cimi/errors/405.html.haml +29 -0
- data/views/cimi/errors/405.xml.haml +5 -0
- data/views/cimi/errors/500.html.haml +43 -0
- data/views/cimi/errors/500.xml.haml +6 -0
- data/views/cimi/errors/502.html.haml +43 -0
- data/views/cimi/errors/502.xml.haml +7 -0
- data/views/cimi/errors/backend_capability_failure.html.haml +29 -0
- data/views/cimi/layout.html.haml +32 -0
- data/views/cimi/machine_configurations/show.html.haml +159 -0
- data/views/cimi/machine_configurations/show.xml.haml +27 -0
- data/views/cimi/machine_images/show.html.haml +79 -0
- data/views/cimi/machine_images/show.xml.haml +17 -0
- data/views/cimi/machines/show.html.haml +177 -0
- data/views/cimi/machines/show.xml.haml +28 -0
- data/views/cimi/volumes/show.html.haml +68 -0
- data/views/cimi/volumes/show.xml.haml +17 -0
- data/views/drivers/show.html.haml +10 -5
- data/views/drivers/show.xml.haml +9 -4
- data/views/error.html.haml +2 -2
- data/views/errors/500.xml.haml +7 -1
- data/views/instances/index.html.haml +1 -1
- data/views/instances/new.html.haml +19 -16
- data/views/instances/show.html.haml +7 -2
- data/views/instances/show.xml.haml +8 -7
- data/views/layout.html.haml +2 -2
- data/views/storage_volumes/show.html.haml +1 -1
- metadata +296 -204
- data/public/javascripts/jquery.mobile-1.0b1.min.js +0 -146
- data/public/stylesheets/jquery.mobile-1.0b1.min.css +0 -8
@@ -0,0 +1,43 @@
|
|
1
|
+
%div{ :'data-role' => :content, :'data-theme' => 'b'}
|
2
|
+
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
|
3
|
+
%li{ :'data-role' => 'list-divider'} Server message
|
4
|
+
%li
|
5
|
+
%h3=[@error.class.name, @error.message].join(' - ')
|
6
|
+
%li{ :'data-role' => 'list-divider'} Original request URI
|
7
|
+
%li
|
8
|
+
%a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
|
9
|
+
%span=request.env['REQUEST_URI']
|
10
|
+
%span{ :class => 'ui-li-count'} Retry
|
11
|
+
%li{ :'data-role' => 'list-divider'} Error details
|
12
|
+
%li
|
13
|
+
- if @error.class.method_defined? :details
|
14
|
+
%p= @error.details
|
15
|
+
- else
|
16
|
+
%em No details
|
17
|
+
|
18
|
+
%div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
|
19
|
+
%h3 Backtrace
|
20
|
+
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
|
21
|
+
%li
|
22
|
+
%pre=@error.backtrace.join("\n")
|
23
|
+
|
24
|
+
%div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
|
25
|
+
%h3 Parameters
|
26
|
+
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
|
27
|
+
- if params.keys.empty?
|
28
|
+
%li{ :'data-role' => 'list-divider'} No parameters
|
29
|
+
- params.each do |key, value|
|
30
|
+
- next if value.inspect.to_s == '#'
|
31
|
+
%li{ :'data-role' => 'list-divider'}=key
|
32
|
+
%li
|
33
|
+
%span{:style => 'font-weight:normal;'}=value.inspect
|
34
|
+
|
35
|
+
|
36
|
+
%div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
|
37
|
+
%h3 Request details
|
38
|
+
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
|
39
|
+
- request.env.each do |key, value|
|
40
|
+
- next if value.inspect.to_s == '#'
|
41
|
+
%li{ :'data-role' => 'list-divider'}=key
|
42
|
+
%li
|
43
|
+
%span{:style => 'font-weight:normal;'}=value.inspect
|
@@ -0,0 +1,43 @@
|
|
1
|
+
%div{ :'data-role' => :content, :'data-theme' => 'b'}
|
2
|
+
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
|
3
|
+
%li{ :'data-role' => 'list-divider'} Server message
|
4
|
+
%li
|
5
|
+
%h3=[@error.class.name, @error.message].join(' - ')
|
6
|
+
%li{ :'data-role' => 'list-divider'} Original request URI
|
7
|
+
%li
|
8
|
+
%a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
|
9
|
+
%span=request.env['REQUEST_URI']
|
10
|
+
%span{ :class => 'ui-li-count'} Retry
|
11
|
+
%li{ :'data-role' => 'list-divider'} Error details
|
12
|
+
%li
|
13
|
+
- if @error.class.method_defined? :details
|
14
|
+
%p= @error.details
|
15
|
+
- else
|
16
|
+
%em No details
|
17
|
+
|
18
|
+
%div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
|
19
|
+
%h3 Backtrace
|
20
|
+
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
|
21
|
+
%li
|
22
|
+
%pre=@error.backtrace.join("\n")
|
23
|
+
|
24
|
+
%div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
|
25
|
+
%h3 Parameters
|
26
|
+
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
|
27
|
+
- if params.keys.empty?
|
28
|
+
%li{ :'data-role' => 'list-divider'} No parameters
|
29
|
+
- params.each do |key, value|
|
30
|
+
- next if value.inspect.to_s == '#'
|
31
|
+
%li{ :'data-role' => 'list-divider'}=key
|
32
|
+
%li
|
33
|
+
%span{:style => 'font-weight:normal;'}=value.inspect
|
34
|
+
|
35
|
+
|
36
|
+
%div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
|
37
|
+
%h3 Request details
|
38
|
+
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
|
39
|
+
- request.env.each do |key, value|
|
40
|
+
- next if value.inspect.to_s == '#'
|
41
|
+
%li{ :'data-role' => 'list-divider'}=key
|
42
|
+
%li
|
43
|
+
%span{:style => 'font-weight:normal;'}=value.inspect
|
@@ -0,0 +1,7 @@
|
|
1
|
+
%error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
|
2
|
+
%kind backend_error
|
3
|
+
%backend{ :driver => driver_symbol }
|
4
|
+
%code= @error.code
|
5
|
+
- if @error.respond_to?(:details) && @error.details
|
6
|
+
%details< #{cdata @error.details.join("\n")}
|
7
|
+
%message< #{cdata @error.message}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
%div{ :'data-role' => :content, :'data-theme' => 'b'}
|
2
|
+
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
|
3
|
+
%li{ :'data-role' => 'list-divider'} Server message
|
4
|
+
%li
|
5
|
+
%h3 Backend capability failure
|
6
|
+
%li{ :'data-role' => 'list-divider'} Original request URI
|
7
|
+
%li
|
8
|
+
%a{ :href => request.env['REQUEST_URI'], :'data-ajax' => 'false'}
|
9
|
+
%span=request.env['REQUEST_URI']
|
10
|
+
%span{ :class => 'ui-li-count'} Retry
|
11
|
+
|
12
|
+
%div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
|
13
|
+
%h3 Parameters
|
14
|
+
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
|
15
|
+
- if params.keys.empty?
|
16
|
+
%li{ :'data-role' => 'list-divider'} No parameters
|
17
|
+
- params.each do |key, value|
|
18
|
+
%li{ :'data-role' => 'list-divider'}=key
|
19
|
+
%li
|
20
|
+
%span{:style => 'font-weight:normal;'}=value.inspect
|
21
|
+
|
22
|
+
|
23
|
+
%div{ 'data-role' => :collapsible, 'data-collapsed' => "true"}
|
24
|
+
%h3 Request details
|
25
|
+
%ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'e'}
|
26
|
+
- request.env.each do |key, value|
|
27
|
+
%li{ :'data-role' => 'list-divider'}=key
|
28
|
+
%li
|
29
|
+
%span{:style => 'font-weight:normal;'}=value.inspect
|
@@ -0,0 +1,32 @@
|
|
1
|
+
!!!
|
2
|
+
!!! XML
|
3
|
+
|
4
|
+
%html
|
5
|
+
%head
|
6
|
+
= stylesheet_link_tag '/stylesheets/compiled/screen.css', :media => 'screen, projection'
|
7
|
+
= stylesheet_link_tag '/stylesheets/compiled/print.css', :media => 'print'
|
8
|
+
/[if lt IE 8]
|
9
|
+
= stylesheet_link_tag '/stylesheets/compiled/ie.css', :media => 'screen, projection'
|
10
|
+
= stylesheet_link_tag '/stylesheets/compiled/application.css', :media => 'screen, projection'
|
11
|
+
%script{:type => "text/javascript", :src => "/javascripts/jquery-1.4.2.min.js" }
|
12
|
+
%script{:type => "text/javascript", :src => "/javascripts/application.js" }
|
13
|
+
%script{:type => "text/javascript", :src => "/javascripts/cmwgapp.js" }
|
14
|
+
%body
|
15
|
+
#wrapper
|
16
|
+
#header
|
17
|
+
= link_to image_tag( "/images/logo-wide.png" ), settings.root_url
|
18
|
+
= bread_crumb_ext
|
19
|
+
#content
|
20
|
+
= yield
|
21
|
+
#footer
|
22
|
+
#formats
|
23
|
+
Format:
|
24
|
+
=link_to_format(:xml)
|
25
|
+
|
|
26
|
+
=link_to_format(:json)
|
27
|
+
#driver_info
|
28
|
+
Driver: #{driver_symbol} | API version: #{settings.version}
|
29
|
+
#copyright
|
30
|
+
Copyright 2009-2011
|
31
|
+
%a{:href => 'http://incubator.apache.org/deltacloud/'} The Apache Software Foundation
|
32
|
+
and individual contributors.
|
@@ -0,0 +1,159 @@
|
|
1
|
+
%h1 View/Edit machine configuration
|
2
|
+
|
3
|
+
%form{ :action => machine_configurations_url }
|
4
|
+
%input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
|
5
|
+
%input{ :name => :xmlRootNode, :type => :hidden, :value => @xml_root_node }/
|
6
|
+
%input{ :name => :refreshURI, :type => :hidden, :value => machine_configurations_url }/
|
7
|
+
%p
|
8
|
+
%label
|
9
|
+
Name:
|
10
|
+
%p
|
11
|
+
%input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
|
12
|
+
%input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
|
13
|
+
%p
|
14
|
+
%br
|
15
|
+
%label
|
16
|
+
Description:
|
17
|
+
%p
|
18
|
+
%textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
|
19
|
+
%p
|
20
|
+
%br
|
21
|
+
%label
|
22
|
+
Properties:
|
23
|
+
%p
|
24
|
+
%table{ :style => "width:50%;", :id => "propertyTable"}
|
25
|
+
- if @dmtfitem["property"]
|
26
|
+
- if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
|
27
|
+
- property_object = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
|
28
|
+
- else
|
29
|
+
- property_object = @dmtfitem["property"]
|
30
|
+
|
31
|
+
- iter = -1
|
32
|
+
- property_object.each_pair do |key, value|
|
33
|
+
- iter += 1
|
34
|
+
%tr
|
35
|
+
%td
|
36
|
+
%input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
|
37
|
+
%td
|
38
|
+
%input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
|
39
|
+
%td
|
40
|
+
%input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
|
41
|
+
%input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
|
42
|
+
%p
|
43
|
+
%br
|
44
|
+
%label
|
45
|
+
Cpu:
|
46
|
+
%p
|
47
|
+
%input{ :name => :cpu, :size => 50, :value => @dmtfitem["cpu"], :style => "width:50%;" }
|
48
|
+
%br
|
49
|
+
%label
|
50
|
+
Memory:
|
51
|
+
%p
|
52
|
+
%input{ :name => :memory_quantity, :size => 20, :value => @dmtfitem["memory"]["quantity"], :style => "width:10%;" }
|
53
|
+
%input{ :name => :memory_units, :size => 20, :value => @dmtfitem["memory"]["units"], :style => "width:10%;" }
|
54
|
+
%br
|
55
|
+
%label
|
56
|
+
Disk:
|
57
|
+
%p
|
58
|
+
%table{ :style => "width:50%;", :id => "diskTable"}
|
59
|
+
- if @dmtfitem["disk"]
|
60
|
+
- if @dmtfitem["disk"].kind_of?(Array)
|
61
|
+
- property_object = @dmtfitem["disk"]
|
62
|
+
- else
|
63
|
+
- property_object = [@dmtfitem["disk"]]
|
64
|
+
|
65
|
+
- iter = -1
|
66
|
+
%tr
|
67
|
+
%td
|
68
|
+
%label
|
69
|
+
Quantity
|
70
|
+
%td
|
71
|
+
%label
|
72
|
+
Units
|
73
|
+
%td
|
74
|
+
%label
|
75
|
+
GuestInterface
|
76
|
+
%td
|
77
|
+
- property_object.each do |disk|
|
78
|
+
- iter += 1
|
79
|
+
%tr
|
80
|
+
%td
|
81
|
+
%input{ :name => "disk_quantity_" + iter.to_s, :size => 10, :value => disk["capacity"]["quantity"] }
|
82
|
+
%td
|
83
|
+
%input{ :name => "disk_units_" + iter.to_s, :size => 10, :value => disk["capacity"]["units"] }
|
84
|
+
%td
|
85
|
+
%input{ :name => "disk_guestInterface_" + iter.to_s, :size => 30, :value => disk["guestInterface"] }
|
86
|
+
%td
|
87
|
+
%input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
|
88
|
+
%input{ :type => :button, :name => "commit", :value => "Add new disk", :onClick => "return addDiskRow('diskTable')" }
|
89
|
+
|
90
|
+
%br
|
91
|
+
%label
|
92
|
+
EntityMetadata:
|
93
|
+
%br
|
94
|
+
|
95
|
+
:javascript
|
96
|
+
function fixupXml(theNode) {
|
97
|
+
var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
|
98
|
+
xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
|
99
|
+
xmlData += getStandardData(theNode);
|
100
|
+
xmlData += "<cpu>" + $(theNode.form).attr("cpu").value + "</cpu>";
|
101
|
+
xmlData += "<memory quantity='" + $(theNode.form).attr("memory_quantity").value + "' units='";
|
102
|
+
xmlData += $(theNode.form).attr("memory_units").value + "' />"
|
103
|
+
|
104
|
+
var index=0;
|
105
|
+
subDisk = ""
|
106
|
+
while ($(theNode.form).attr("disk_quantity_" + index)) {
|
107
|
+
if ($(theNode.form).attr("disk_quantity_" + index).value != null &&
|
108
|
+
$(theNode.form).attr("disk_quantity_" + index).value.length > 0) {
|
109
|
+
subDisk += "<capacity quantity='" + $(theNode.form).attr("disk_quantity_" + index).value + "' units='" +
|
110
|
+
$(theNode.form).attr("disk_units_" + index).value + "' />";
|
111
|
+
subDisk += "<guestInterface>" + $(theNode.form).attr("disk_guestInterface_" + index).value + "</guestInterface>";
|
112
|
+
}
|
113
|
+
index++;
|
114
|
+
}
|
115
|
+
if (subDisk.length > 0) {
|
116
|
+
xmlData += "<disk>" + subDisk + "</disk>";
|
117
|
+
}
|
118
|
+
|
119
|
+
xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
|
120
|
+
|
121
|
+
return xmlData;
|
122
|
+
}
|
123
|
+
|
124
|
+
function addDiskRow(tableId) {
|
125
|
+
var tbl = document.getElementById(tableId);
|
126
|
+
var lastRow = tbl.rows.length;
|
127
|
+
// if there's no header row in the table, then iteration = lastRow + 1
|
128
|
+
var iteration = lastRow - 1;
|
129
|
+
var row = tbl.insertRow(lastRow);
|
130
|
+
|
131
|
+
elNames = ['disk_quantity_', 'disk_units_', 'disk_guestInterface_'];
|
132
|
+
elSizes = [10, 10, 30]
|
133
|
+
elValues = ["200", "megabyte", ""]
|
134
|
+
|
135
|
+
for (var index=0; index<elNames.length; index++) {
|
136
|
+
var aCellTD = row.insertCell(index);
|
137
|
+
var aCell = document.createElement('input');
|
138
|
+
aCell.type = 'text';
|
139
|
+
aCell.name = elNames[index] + iteration;
|
140
|
+
aCell.id = aCell.name;
|
141
|
+
aCell.size = elSizes[index];
|
142
|
+
aCell.value = elValues[index];
|
143
|
+
aCellTD.appendChild(aCell);
|
144
|
+
}
|
145
|
+
|
146
|
+
// select cell
|
147
|
+
var cellRightBut = row.insertCell(elNames.length);
|
148
|
+
var er = document.createElement('input');
|
149
|
+
er.type = 'button';
|
150
|
+
er.name = 'param_remove' + iteration;
|
151
|
+
er.id = 'param_remove' + iteration;
|
152
|
+
er.value = "Remove";
|
153
|
+
er.tableRow = row
|
154
|
+
$(er).click(function() {
|
155
|
+
removeProperty(this);
|
156
|
+
})
|
157
|
+
|
158
|
+
cellRightBut.appendChild(er);
|
159
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
- unless defined?(partial)
|
2
|
+
!!! XML
|
3
|
+
%MachineConfiguration{ :xmlns => CMWG_NAMESPACE }
|
4
|
+
%uri=machine_configurations_url + "/" + @dmtfitem["uri"]
|
5
|
+
%name=@dmtfitem["name"]
|
6
|
+
%description=@dmtfitem["description"]
|
7
|
+
%created=@dmtfitem["created"]
|
8
|
+
- if @dmtfitem["property"]
|
9
|
+
- if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
|
10
|
+
- property_object = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
|
11
|
+
- else
|
12
|
+
- property_object = @dmtfitem["property"]
|
13
|
+
- property_object.each_pair do |key, value|
|
14
|
+
%property{ :name => key}=value["content"]
|
15
|
+
%cpu=@dmtfitem["cpu"]
|
16
|
+
%memory{ :quantity => @dmtfitem["memory"]["quantity"], :units => @dmtfitem["memory"]["units"] }
|
17
|
+
- if @dmtfitem["disk"]
|
18
|
+
- if @dmtfitem["disk"].kind_of?(Array)
|
19
|
+
- property_object = @dmtfitem["disk"]
|
20
|
+
- else
|
21
|
+
- property_object = [@dmtfitem["disk"]]
|
22
|
+
- property_object.each do |disk|
|
23
|
+
%disk
|
24
|
+
%capacity{ :quantity => disk["capacity"]["quantity"], :units => disk["capacity"]["units"] }
|
25
|
+
%guestInterface= disk["guestInterface"]
|
26
|
+
%operation{ :rel => "edit", :href => machine_configurations_url + "/" + @dmtfitem["uri"] }
|
27
|
+
%operation{ :rel => "delete", :href => machine_configurations_url + "/" + @dmtfitem["uri"] }
|
@@ -0,0 +1,79 @@
|
|
1
|
+
%h1 View/Edit machine image
|
2
|
+
|
3
|
+
%form{ :action => machine_images_url }
|
4
|
+
%input{ :name => :id, :type => :hidden, :value => @dmtfitem["uri"] }/
|
5
|
+
%input{ :name => :xmlRootNode, :type => :hidden, :value => @xml_root_node }/
|
6
|
+
%input{ :name => :refreshURI, :type => :hidden, :value => machine_images_url }/
|
7
|
+
%p
|
8
|
+
%label
|
9
|
+
Name:
|
10
|
+
%p
|
11
|
+
%input{ :name => :name, :size => 50, :value => @dmtfitem["name"], :style => "width:50%;" }
|
12
|
+
%input{ :name => :created, :type => :hidden, :size => 50, :value => @dmtfitem["created"] }
|
13
|
+
%p
|
14
|
+
%br
|
15
|
+
%label
|
16
|
+
Description:
|
17
|
+
%p
|
18
|
+
%textarea{ :name => :description, :cols => 50, :rows => 4, :style => "width:50%;" } #{@dmtfitem['description']}
|
19
|
+
%p
|
20
|
+
%br
|
21
|
+
%label
|
22
|
+
Properties:
|
23
|
+
%p
|
24
|
+
%table{ :style => "width:50%;", :id => "propertyTable"}
|
25
|
+
- if @dmtfitem["property"]
|
26
|
+
- if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
|
27
|
+
- property_object = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
|
28
|
+
- else
|
29
|
+
- property_object = @dmtfitem["property"]
|
30
|
+
|
31
|
+
- iter = -1
|
32
|
+
- property_object.each_pair do |key, value|
|
33
|
+
- iter += 1
|
34
|
+
%tr
|
35
|
+
%td
|
36
|
+
%input{ :name => "param_name_" + iter.to_s, :size => 30, :value => key }
|
37
|
+
%td
|
38
|
+
%input{ :name => "param_value_" + iter.to_s, :size => 30, :value => value["content"] }
|
39
|
+
%td
|
40
|
+
%input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
|
41
|
+
%input{ :type => :button, :name => "commit", :value => "Add new property", :onClick => "return AddNewPproperty('propertyTable')" }
|
42
|
+
%p
|
43
|
+
%br
|
44
|
+
%label
|
45
|
+
Image Location:
|
46
|
+
%p
|
47
|
+
%input{ :name => :imageLocation, :size => 50, :value => @dmtfitem["imageLocation"], :style => "width:50%;" }
|
48
|
+
%br
|
49
|
+
%label
|
50
|
+
Image Data:
|
51
|
+
%p
|
52
|
+
%textarea{:style=> "width:50%;height:100px;", :name => "imageData"}
|
53
|
+
%br
|
54
|
+
%label
|
55
|
+
EntityMetadata:
|
56
|
+
%br
|
57
|
+
%div{:style => "width:90%;"}
|
58
|
+
%pre
|
59
|
+
- if @metadata
|
60
|
+
= convert_xml_to_html @metadata
|
61
|
+
%br
|
62
|
+
|
63
|
+
:javascript
|
64
|
+
function fixupXml(theNode) {
|
65
|
+
var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
|
66
|
+
xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
|
67
|
+
xmlData += getStandardData(theNode);
|
68
|
+
xmlData += "<imageLocation href='" + $(theNode.form).attr("imageLocation").value + "' />";
|
69
|
+
xmlData += "<imageData>" + $(theNode.form).attr("imageData").value + "</imageData>";
|
70
|
+
|
71
|
+
//we handle entityMetadata here
|
72
|
+
if ($(theNode.form).attr("entityMetadata") != null && $(theNode.form).attr("entityMetadata").value) {
|
73
|
+
xmlData += $(theNode.form).attr("entityMetadata").value
|
74
|
+
}
|
75
|
+
|
76
|
+
xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
|
77
|
+
|
78
|
+
return xmlData;
|
79
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
- unless defined?(partial)
|
2
|
+
!!! XML
|
3
|
+
%MachineImage{ :xmlns => CMWG_NAMESPACE }
|
4
|
+
%uri=machine_images_url + "/" + @dmtfitem["uri"]
|
5
|
+
%name=@dmtfitem["name"]
|
6
|
+
%description=@dmtfitem["description"]
|
7
|
+
%created=@dmtfitem["created"]
|
8
|
+
- if @dmtfitem["property"]
|
9
|
+
- if @dmtfitem["property"]["name"] && @dmtfitem["property"]["content"]
|
10
|
+
- property_object = {"#{@dmtfitem['property']['name']}" => {"content" => @dmtfitem["property"]["content"]}}
|
11
|
+
- else
|
12
|
+
- property_object = @dmtfitem["property"]
|
13
|
+
- property_object.each_pair do |key, value|
|
14
|
+
%property{ :name => key}=value["content"]
|
15
|
+
%imageLocation{ :href => @dmtfitem["imageLocation"]}
|
16
|
+
%operation{ :rel => "edit", :href => machine_images_url + "/" + @dmtfitem["uri"] }
|
17
|
+
%operation{ :rel => "delete", :href => machine_images_url + "/" + @dmtfitem["uri"] }
|