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.
Files changed (166) hide show
  1. data/Rakefile +63 -7
  2. data/bin/deltacloudd +29 -17
  3. data/config.ru +5 -3
  4. data/config/drivers/ec2.yaml +9 -0
  5. data/config/drivers/google.yaml +3 -0
  6. data/config/drivers/openstack.yaml +3 -0
  7. data/deltacloud-core.gemspec +1 -1
  8. data/lib/cimi/dependencies.rb +62 -0
  9. data/lib/cimi/helpers/cimi_helper.rb +50 -0
  10. data/lib/cimi/model.rb +52 -0
  11. data/lib/cimi/model/action.rb +24 -0
  12. data/lib/cimi/model/base.rb +249 -0
  13. data/lib/cimi/model/cloud_entry_point.rb +48 -0
  14. data/lib/cimi/model/entity_metadata.rb +83 -0
  15. data/lib/cimi/model/entity_metadata_collection.rb +31 -0
  16. data/lib/cimi/model/errors.rb +40 -0
  17. data/lib/cimi/model/machine.rb +227 -0
  18. data/lib/cimi/model/machine_admin.rb +59 -0
  19. data/lib/cimi/model/machine_admin_collection.rb +34 -0
  20. data/lib/cimi/model/machine_collection.rb +34 -0
  21. data/lib/cimi/model/machine_configuration.rb +67 -0
  22. data/lib/cimi/model/machine_configuration_collection.rb +34 -0
  23. data/lib/cimi/model/machine_image.rb +46 -0
  24. data/lib/cimi/model/machine_image_collection.rb +34 -0
  25. data/lib/cimi/model/machine_template.rb +41 -0
  26. data/lib/cimi/model/machine_template_collection.rb +34 -0
  27. data/lib/cimi/model/network.rb +69 -0
  28. data/lib/cimi/model/network_collection.rb +34 -0
  29. data/lib/cimi/model/network_configuration.rb +50 -0
  30. data/lib/cimi/model/network_configuration_collection.rb +34 -0
  31. data/lib/cimi/model/network_template.rb +26 -0
  32. data/lib/cimi/model/schema.rb +277 -0
  33. data/lib/cimi/model/volume.rb +103 -0
  34. data/lib/cimi/model/volume_collection.rb +34 -0
  35. data/lib/cimi/model/volume_configuration.rb +60 -0
  36. data/lib/cimi/model/volume_configuration_collection.rb +34 -0
  37. data/lib/cimi/model/volume_image.rb +49 -0
  38. data/lib/cimi/model/volume_image_collection.rb +34 -0
  39. data/lib/cimi/model/volume_template.rb +23 -0
  40. data/lib/cimi/model/volume_template_collection.rb +34 -0
  41. data/lib/cimi/server.rb +575 -0
  42. data/lib/deltacloud/base_driver/base_driver.rb +11 -1
  43. data/lib/deltacloud/core_ext.rb +2 -0
  44. data/lib/deltacloud/core_ext/array.rb +25 -0
  45. data/lib/deltacloud/core_ext/hash.rb +7 -0
  46. data/lib/deltacloud/core_ext/proc.rb +31 -0
  47. data/lib/deltacloud/core_ext/string.rb +15 -0
  48. data/lib/deltacloud/drivers/condor/condor_driver.rb +2 -1
  49. data/lib/deltacloud/drivers/ec2/ec2_driver.rb +32 -10
  50. data/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb +1 -1
  51. data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +1 -1
  52. data/lib/deltacloud/drivers/google/google_driver.rb +233 -0
  53. data/lib/deltacloud/drivers/mock/data/instances/inst0.yml +7 -2
  54. data/lib/deltacloud/drivers/mock/data/instances/inst1.yml +7 -2
  55. data/lib/deltacloud/drivers/mock/data/instances/inst2.yml +7 -2
  56. data/lib/deltacloud/drivers/mock/mock_client.rb +17 -0
  57. data/lib/deltacloud/drivers/mock/mock_driver.rb +82 -8
  58. data/lib/deltacloud/drivers/opennebula/opennebula_driver.rb +1 -1
  59. data/lib/deltacloud/drivers/openstack/openstack_driver.rb +47 -0
  60. data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +8 -8
  61. data/lib/deltacloud/drivers/rhevm/rhevm_client.rb +122 -49
  62. data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +42 -22
  63. data/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb +1 -1
  64. data/lib/deltacloud/drivers/sbc/sbc_driver.rb +3 -2
  65. data/lib/deltacloud/drivers/terremark/terremark_driver.rb +2 -2
  66. data/lib/deltacloud/drivers/vsphere/vsphere_client.rb +25 -4
  67. data/lib/deltacloud/drivers/vsphere/vsphere_driver.rb +35 -12
  68. data/lib/deltacloud/hardware_profile.rb +34 -10
  69. data/lib/deltacloud/helpers/application_helper.rb +3 -28
  70. data/lib/deltacloud/helpers/blob_stream.rb +2 -1
  71. data/lib/deltacloud/models.rb +2 -0
  72. data/lib/deltacloud/models/bucket.rb +1 -1
  73. data/lib/deltacloud/models/image.rb +1 -1
  74. data/lib/deltacloud/models/instance.rb +2 -1
  75. data/lib/deltacloud/models/instance_address.rb +56 -0
  76. data/lib/deltacloud/models/provider.rb +27 -0
  77. data/{server.rb → lib/deltacloud/server.rb} +72 -14
  78. data/lib/deltacloud/validation.rb +31 -10
  79. data/lib/sinatra/rabbit.rb +34 -26
  80. data/lib/sinatra/rack_accept.rb +5 -5
  81. data/lib/sinatra/rack_matrix_params.rb +6 -2
  82. data/lib/sinatra/rack_syslog.rb +3 -3
  83. data/lib/sinatra/static_assets.rb +1 -1
  84. data/lib/sinatra/url_for.rb +1 -7
  85. data/public/images/bread-bg.png +0 -0
  86. data/public/images/logo-wide.png +0 -0
  87. data/public/images/topbar-bg.png +0 -0
  88. data/public/javascripts/application.js +5 -0
  89. data/public/javascripts/cmwgapp.js +249 -0
  90. data/public/javascripts/jquery-1.4.2.min.js +154 -0
  91. data/public/javascripts/jquery.mobile-1.0rc1.min.js +170 -0
  92. data/public/stylesheets/images/icons-18-black.png +0 -0
  93. data/public/stylesheets/images/icons-18-white.png +0 -0
  94. data/public/stylesheets/images/icons-36-black.png +0 -0
  95. data/public/stylesheets/images/icons-36-white.png +0 -0
  96. data/public/stylesheets/jquery.mobile-1.0rc1.min.css +12 -0
  97. data/public/stylesheets/new.css +4 -0
  98. data/support/fedora/deltacloud-core.init +20 -13
  99. data/tests/cimi/features/step_definitions/common_steps.rb +59 -0
  100. data/tests/cimi/features/step_definitions/machine_images_steps.rb +0 -0
  101. data/tests/cimi/features/step_definitions/machines_steps.rb +99 -0
  102. data/tests/cimi/features/step_definitions/volumes_steps.rb +115 -0
  103. data/tests/cimi/features/support/env.rb +53 -0
  104. data/tests/common.rb +89 -11
  105. data/tests/core_ext/string.rb +31 -0
  106. data/tests/drivers/google/api_test.rb +35 -0
  107. data/tests/drivers/google/buckets_test.rb +116 -0
  108. data/tests/drivers/google/setup.rb +38 -0
  109. data/tests/drivers/mock/instances_test.rb +20 -5
  110. data/tests/drivers/openstack/api_test.rb +41 -0
  111. data/tests/drivers/openstack/hardware_profiles_test.rb +53 -0
  112. data/tests/drivers/openstack/images_test.rb +40 -0
  113. data/tests/drivers/openstack/instances_test.rb +163 -0
  114. data/tests/drivers/openstack/realms_test.rb +36 -0
  115. data/tests/drivers/openstack/setup.rb +20 -0
  116. data/tests/drivers/rackspace/buckets_test.rb +145 -0
  117. data/tests/drivers/rackspace/setup.rb +3 -3
  118. data/tests/drivers/rhevm/api_test.rb +1 -1
  119. data/tests/drivers/rhevm/images_test.rb +2 -2
  120. data/tests/drivers/rhevm/instances_test.rb +10 -12
  121. data/tests/drivers/rhevm/realms_test.rb +4 -4
  122. data/tests/drivers/rhevm/setup.rb +3 -3
  123. data/tests/rabbit_test.rb +1 -1
  124. data/views/api/show.html.haml +13 -0
  125. data/views/cimi/cloudEntryPoint/index.html.haml +5 -0
  126. data/views/cimi/cloudEntryPoint/index.xml.haml +9 -0
  127. data/views/cimi/collection/index.html.haml +45 -0
  128. data/views/cimi/collection/response.xml.haml +3 -0
  129. data/views/cimi/error.html.haml +31 -0
  130. data/views/cimi/errors/400.html.haml +41 -0
  131. data/views/cimi/errors/400.xml.haml +3 -0
  132. data/views/cimi/errors/401.html.haml +41 -0
  133. data/views/cimi/errors/401.xml.haml +2 -0
  134. data/views/cimi/errors/403.html.haml +42 -0
  135. data/views/cimi/errors/403.xml.haml +2 -0
  136. data/views/cimi/errors/404.html.haml +29 -0
  137. data/views/cimi/errors/404.xml.haml +2 -0
  138. data/views/cimi/errors/405.html.haml +29 -0
  139. data/views/cimi/errors/405.xml.haml +5 -0
  140. data/views/cimi/errors/500.html.haml +43 -0
  141. data/views/cimi/errors/500.xml.haml +6 -0
  142. data/views/cimi/errors/502.html.haml +43 -0
  143. data/views/cimi/errors/502.xml.haml +7 -0
  144. data/views/cimi/errors/backend_capability_failure.html.haml +29 -0
  145. data/views/cimi/layout.html.haml +32 -0
  146. data/views/cimi/machine_configurations/show.html.haml +159 -0
  147. data/views/cimi/machine_configurations/show.xml.haml +27 -0
  148. data/views/cimi/machine_images/show.html.haml +79 -0
  149. data/views/cimi/machine_images/show.xml.haml +17 -0
  150. data/views/cimi/machines/show.html.haml +177 -0
  151. data/views/cimi/machines/show.xml.haml +28 -0
  152. data/views/cimi/volumes/show.html.haml +68 -0
  153. data/views/cimi/volumes/show.xml.haml +17 -0
  154. data/views/drivers/show.html.haml +10 -5
  155. data/views/drivers/show.xml.haml +9 -4
  156. data/views/error.html.haml +2 -2
  157. data/views/errors/500.xml.haml +7 -1
  158. data/views/instances/index.html.haml +1 -1
  159. data/views/instances/new.html.haml +19 -16
  160. data/views/instances/show.html.haml +7 -2
  161. data/views/instances/show.xml.haml +8 -7
  162. data/views/layout.html.haml +2 -2
  163. data/views/storage_volumes/show.html.haml +1 -1
  164. metadata +296 -204
  165. data/public/javascripts/jquery.mobile-1.0b1.min.js +0 -146
  166. data/public/stylesheets/jquery.mobile-1.0b1.min.css +0 -8
@@ -0,0 +1,177 @@
1
+ %h1 View/Edit machine
2
+
3
+ %form{ :action => machines_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 => machines_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 => 25, :value => key }
37
+ %td
38
+ %input{ :name => "param_value_" + iter.to_s, :size => 25, :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
+ Status:
46
+ %p
47
+ %input{ :name => :status, :size => 50, :value => @dmtfitem["status"], :style => "width:50%;" }
48
+ %p
49
+ %br
50
+ %label
51
+ CPU:
52
+ %p
53
+ %input{ :name => :cpu, :size => 50, :value => @dmtfitem["cpu"], :style => "width:50%;" }
54
+ %br
55
+ %label
56
+ Memory:
57
+ %p
58
+ %input{ :name => :memory_quantity, :size => 20, :value => @dmtfitem["memory"]["quantity"], :style => "width:10%;" }      
59
+ %input{ :name => :memory_units, :size => 20, :value => @dmtfitem["memory"]["units"], :style => "width:10%;" }
60
+ %br
61
+ %label
62
+ Disk:
63
+ %p
64
+ %table{ :style => "width:50%;", :id => "diskTable"}
65
+ - if @dmtfitem["disk"]
66
+ - if @dmtfitem["disk"].kind_of?(Array)
67
+ - property_object = @dmtfitem["disk"]
68
+ - else
69
+ - property_object = [@dmtfitem["disk"]]
70
+
71
+ - iter = -1
72
+ %tr
73
+ %td
74
+ %label
75
+ Quantity
76
+ %td
77
+ %label
78
+ Units
79
+ %td
80
+ %label
81
+ GuestInterface
82
+ %td  
83
+ - property_object.each do |disk|
84
+ - iter += 1
85
+ %tr
86
+ %td
87
+ %input{ :name => "disk_quantity_" + iter.to_s, :size => 10, :value => disk["capacity"]["quantity"] }
88
+ %td
89
+ %input{ :name => "disk_units_" + iter.to_s, :size => 10, :value => disk["capacity"]["units"] }
90
+ %td
91
+ %input{ :name => "disk_guestInterface_" + iter.to_s, :size => 20, :value => disk["guestInterface"] }
92
+ %td
93
+ %input{ :type => :button, :value => "Remove", :onClick => "return removeProperty(this)" }
94
+ %input{ :type => :button, :name => "commit", :value => "Add new disk", :onClick => "return addDiskRow('diskTable')" }
95
+
96
+ %br
97
+ %label
98
+ EntityMetadata:
99
+ %br
100
+ %label
101
+ TODO Need to handle volumes:
102
+ %p
103
+ %br
104
+ %label
105
+ TODO Need to handle network interfaces:
106
+
107
+ :javascript
108
+ function fixupXml(theNode) {
109
+ var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
110
+ xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
111
+ xmlData += getStandardData(theNode);
112
+ xmlData += "<cpu>" + $(theNode.form).attr("cpu").value + "</cpu>";
113
+ xmlData += "<memory quantity='" + $(theNode.form).attr("memory_quantity").value + "' units='";
114
+ xmlData += $(theNode.form).attr("memory_units").value + "' />"
115
+
116
+ var index=0;
117
+ subDisk = ""
118
+ while ($(theNode.form).attr("disk_quantity_" + index)) {
119
+ if ($(theNode.form).attr("disk_quantity_" + index).value != null &&
120
+ $(theNode.form).attr("disk_quantity_" + index).value.length > 0) {
121
+ subDisk += "<capacity quantity='" + $(theNode.form).attr("disk_quantity_" + index).value + "' units='" +
122
+ $(theNode.form).attr("disk_units_" + index).value + "' />";
123
+ subDisk += "<guestInterface>" + $(theNode.form).attr("disk_guestInterface_" + index).value + "</guestInterface>";
124
+ }
125
+ index++;
126
+ }
127
+ if (subDisk.length > 0) {
128
+ xmlData += "<disk>" + subDisk + "</disk>";
129
+ }
130
+
131
+ //we handle entityMetadata here
132
+ if ($(theNode.form).attr("entityMetadata").value) {
133
+ xmlData += $(theNode.form).attr("entityMetadata").value
134
+ }
135
+
136
+ xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
137
+
138
+ return xmlData;
139
+ }
140
+
141
+ function addDiskRow(tableId) {
142
+ var tbl = document.getElementById(tableId);
143
+ var lastRow = tbl.rows.length;
144
+ // if there's no header row in the table, then iteration = lastRow + 1
145
+ var iteration = lastRow - 1;
146
+ var row = tbl.insertRow(lastRow);
147
+
148
+ elNames = ['disk_quantity_', 'disk_units_', 'disk_guestInterface_'];
149
+ elSizes = [10, 10, 20]
150
+ elValues = ["200", "megabyte", ""]
151
+
152
+ for (var index=0; index<elNames.length; index++) {
153
+ var aCellTD = row.insertCell(index);
154
+ var aCell = document.createElement('input');
155
+ aCell.type = 'text';
156
+ aCell.name = elNames[index] + iteration;
157
+ aCell.id = aCell.name;
158
+ aCell.size = elSizes[index];
159
+ aCell.value = elValues[index];
160
+ aCellTD.appendChild(aCell);
161
+ }
162
+
163
+ // select cell
164
+ var cellRightBut = row.insertCell(elNames.length);
165
+ var er = document.createElement('input');
166
+ er.type = 'button';
167
+ er.name = 'param_remove' + iteration;
168
+ er.id = 'param_remove' + iteration;
169
+ er.value = "Remove";
170
+ er.tableRow = row
171
+ $(er).click(function() {
172
+ removeProperty(this);
173
+ })
174
+
175
+ cellRightBut.appendChild(er);
176
+
177
+ }
@@ -0,0 +1,28 @@
1
+ - unless defined?(partial)
2
+ !!! XML
3
+ %Machine{ :xmlns => CMWG_NAMESPACE }
4
+ %uri=machines_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
+ %status=@dmtfitem["status"]
16
+ %cpu=@dmtfitem["cpu"]
17
+ %memory{ :quantity => @dmtfitem["memory"]["quantity"], :units => @dmtfitem["memory"]["units"] }
18
+ - if @dmtfitem["disk"]
19
+ - if @dmtfitem["disk"].kind_of?(Array)
20
+ - property_object = @dmtfitem["disk"]
21
+ - else
22
+ - property_object = [@dmtfitem["disk"]]
23
+ - property_object.each do |disk|
24
+ %disk
25
+ %capacity{ :quantity => disk["capacity"]["quantity"], :units => disk["capacity"]["units"] }
26
+ %guestInterface= disk["guestInterface"]
27
+ %operation{ :rel => "edit", :href => machines_url + "/" + @dmtfitem["uri"] }
28
+ %operation{ :rel => "delete", :href => machines_url + "/" + @dmtfitem["uri"] }
@@ -0,0 +1,68 @@
1
+ %h1 View/Edit volume
2
+
3
+ %form{ :action => volumes_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 => volumes_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
+ Capacity:
46
+ %p
47
+ %input{ :name => :capacity_quantity, :size => 20, :value => @dmtfitem["capacity"]["quantity"], :style => "width:10%;" } &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
48
+ %input{ :name => :capacity_units, :size => 20, :value => @dmtfitem["capacity"]["units"], :style => "width:10%;" }
49
+ %br
50
+ %label
51
+ EntityMetadata:
52
+ %br
53
+
54
+ :javascript
55
+ function fixupXml(theNode) {
56
+ var xmlData = "<?xml version='1.0' encoding='utf-8' ?>";
57
+ xmlData += "<" + $(theNode.form).attr("xmlRootNode").value + " xmlns='http://www.dmtf.org/cimi'>";
58
+ xmlData += getStandardData(theNode);
59
+ xmlData += "<cpu>" + $(theNode.form).attr("cpu").value + "</cpu>";
60
+ xmlData += "<memory quantity='" + $(theNode.form).attr("memory_quantity").value + "' units='";
61
+ xmlData += $(theNode.form).attr("memory_units").value + "' />"
62
+
63
+ var index=0;
64
+
65
+ xmlData += "</" + $(theNode.form).attr("xmlRootNode").value + ">";
66
+
67
+ return xmlData;
68
+ }
@@ -0,0 +1,17 @@
1
+ - unless defined?(partial)
2
+ !!! XML
3
+ %Volume{ :xmlns => CMWG_NAMESPACE }
4
+ %uri=volumes_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
+ %capacity{ :quantity => @dmtfitem["capacity"]["quantity"], :units => @dmtfitem["capacity"]["units"]}
16
+ %operation{ :rel => "edit", :href => volumes_url + "/" + @dmtfitem["uri"] }
17
+ %operation{ :rel => "delete", :href => volumes_url + "/" + @dmtfitem["uri"] }
@@ -12,9 +12,14 @@
12
12
  %li{ :'data-role' => 'list-divider'} Provider
13
13
  %li
14
14
  %p{ :'data-role' => 'fieldcontain'}
15
- - providers = driver_provider(@driver).keys.collect { |k| k.to_s }.sort
16
- - if providers.empty?
17
- None
15
+ - if @providers
16
+ - @providers.each do |p|
17
+ %h3= p.id
18
+ %p= p.url
18
19
  - else
19
- - providers.each do |k|
20
- %p= k
20
+ - providers = driver_provider(@driver).keys.collect { |k| k.to_s }.sort
21
+ - if providers.empty?
22
+ None
23
+ - else
24
+ - providers.each do |k|
25
+ %p= k
@@ -1,7 +1,12 @@
1
1
  %driver{ :href => driver_url(@name), :id => @name }
2
2
  %name<
3
3
  = @driver[:name]
4
- - driver_provider(@driver).each do |prov, details|
5
- %provider{ :id => prov }
6
- - details.each do |kind, url|
7
- %entrypoint{ :kind => kind }<=cdata(url)
4
+ - if @providers.nil?
5
+ - driver_provider(@driver).each do |prov, details|
6
+ %provider{ :id => prov }
7
+ - details.each do |kind, url|
8
+ %entrypoint{ :kind => kind }<=cdata(url)
9
+ - else
10
+ - @providers.each do |p|
11
+ %provider{ :id => p.id }
12
+ %entrypoint{ :kind => p.name }<=p.url
@@ -2,11 +2,11 @@
2
2
  %html
3
3
  %head
4
4
  %title Deltacloud API #{settings.version}
5
- = stylesheet_link_tag '/stylesheets/jquery.mobile-1.0b1.min.css'
5
+ = stylesheet_link_tag '/stylesheets/jquery.mobile-1.0rc1.min.css'
6
6
  = stylesheet_link_tag '/stylesheets/new.css'
7
7
  %script{:type => "text/javascript", :src => "/javascripts/jquery.min.js" }
8
8
  %script{:type => "text/javascript", :src => "/javascripts/application.js" }
9
- %script{:type => "text/javascript", :src => "/javascripts/jquery.mobile-1.0b1.min.js" }
9
+ %script{:type => "text/javascript", :src => "/javascripts/jquery.mobile-1.0rc1.min.js" }
10
10
  :javascript
11
11
  $(document).ready(function() {
12
12
  $(document).bind("mobileinit", function(){
@@ -1,5 +1,11 @@
1
1
  %error{:url => "#{request.env['REQUEST_URI']}", :status => "#{response.status}"}
2
2
  %kind backend_error
3
- %backend{ :driver => driver_symbol }
3
+ %backend{ :driver => driver_symbol, :provider => "#{Thread::current[:provider] || ENV['API_PROVIDER'] || 'default'}" }
4
4
  %code=response.status
5
5
  %message< #{cdata @error.message}
6
+ - if @error.respond_to? :backtrace
7
+ %backtrace=cdata @error.backtrace.join("\n")
8
+ - if params
9
+ %request
10
+ - params.each do |k, v|
11
+ %param{ :name => k}=v
@@ -4,7 +4,7 @@
4
4
  %div{ :'data-role' => :content, :'data-theme' => 'c'}
5
5
  %ul{ :'data-role' => :listview , :'data-inset' => :true, :'data-divider-theme' => 'a'}
6
6
  %li{ :'data-role' => 'list-divider'}=driver_symbol
7
- - @instances.each do |instance|
7
+ - @elements.each do |instance|
8
8
  %li
9
9
  %a{ :href => instance_url(instance.id), :'data-ajax' => 'false'}
10
10
  %img{ :class => 'ui-link-thumb', :src => '/images/machine.png'}
@@ -1,5 +1,21 @@
1
1
  =header "Launch new instance"
2
- =subheader @image.description
2
+ =subheader "#{@image.id}"
3
+
4
+ .hidden_content
5
+ - @hardware_profiles.each do |profile|
6
+ %div{ :'data-role' => :fieldcontain, :id => "hwp_properties_#{profile.name}", :class => 'property_block'}
7
+ - profile.properties.reject { |prop| prop.fixed? }.each do |prop|
8
+ %label{ :for => "#{prop.param}_#{profile.name}", :class => 'ui-input-text' }=prop.name
9
+ %span.radio-group-details
10
+ - if prop.kind == :enum
11
+ %select{ :size => 1, :name => prop.param }
12
+ - for v in prop.values
13
+ %option= v
14
+ = prop.unit
15
+ - elsif prop.kind == :range
16
+ %input{ :type => :range, :value => prop.first, :min => prop.first, :max => prop.last, :name => prop.param}
17
+ - else
18
+ %input{ :name => prop.param, :size => 10, :value => "#{prop.default}" }= prop.unit
3
19
 
4
20
  %div{ :'data-role' => :content, :'data-theme' => 'c', :class => 'middle-dialog'}
5
21
  %form{ :action => instances_url, :method => :post, :class => :new_instance, :'data-ajax' => 'false'}
@@ -59,21 +75,8 @@
59
75
  %fieldset{ :'data-role' => :fieldcontain}
60
76
  - @hardware_profiles.each do |profile|
61
77
  %input{ :type => :radio, :name => 'hwp_id', :value => profile.name, :id => profile.name, :'data-theme' => 'b'}/
62
- %label{ :for => profile.name}=profile.name
63
- - profile.properties.reject { |prop| prop.fixed? }.each do |prop|
64
- %div{ :'data-role' => :fieldcontain}
65
- %label{ :for => "#{prop.param}_#{profile.name}" }=prop.name
66
- %span.radio-group-details
67
- - if prop.kind == :enum
68
- %select{ :size => 1, :name => prop.param }
69
- - for v in prop.values
70
- %option= v
71
- = prop.unit
72
- - elsif prop.kind == :range
73
- %input{ :type => :range, :value => prop.first, :min => prop.first, :max => prop.last, :name => prop.param}
74
- - else
75
- %input{ :name => prop.param, :size => 10, :value => "#{prop.default}" }
76
- = prop.unit
78
+ %label{ :for => profile.name, :onclick => "expandHWP('#{profile.name}');"}=profile.name
79
+ %div{ :'data-role' => :fieldcontain, :id => "property_container_#{profile.name}", :class => 'hwp_properties'}
77
80
 
78
81
  - if !@realms.empty?
79
82
  %div{ 'data-role' => :fieldcontain }
@@ -28,10 +28,10 @@
28
28
  default
29
29
  %li{ :'data-role' => 'list-divider'} Public addresses
30
30
  %li
31
- %p{ :'data-role' => 'fieldcontain'}=@instance.public_addresses.map.join(',')
31
+ %p{ :'data-role' => 'fieldcontain'}=@instance.public_addresses.join(',')
32
32
  %li{ :'data-role' => 'list-divider'} Private addresses
33
33
  %li
34
- %p{ :'data-role' => 'fieldcontain'}=@instance.private_addresses.map.join(',')
34
+ %p{ :'data-role' => 'fieldcontain'}=@instance.private_addresses.join(',')
35
35
  - if @instance.password or @instance.keyname
36
36
  %li{ :'data-role' => 'list-divider'} Authentication
37
37
  - if @instance.password
@@ -46,6 +46,11 @@
46
46
  - if @instance.firewalls
47
47
  %li{ :'data-role' => 'list-divider'} Firewalls
48
48
  %li=@instance.firewalls.join(", ")
49
+ - if @instance.storage_volumes
50
+ %li{ :'data-role' => 'list-divider'} Attached Storage Volumes
51
+ -@instance.storage_volumes.each do |vol|
52
+ %li
53
+ %p{ :'data-role' => 'fieldcontain'}="#{vol.keys.first} <---> #{vol.values.first}"
49
54
  %li{ :'data-role' => 'list-divider'} Actions
50
55
  %li
51
56
  %div{ :'data-role' => 'controlgroup', :'data-type' => "horizontal" }
@@ -31,19 +31,20 @@
31
31
  =@instance.launch_time
32
32
  - if @instance.public_addresses
33
33
  %public_addresses<
34
- - @instance.public_addresses.each do |address|
35
- - if address.class.eql?(Hash) and address[:address]!=""
36
- =format_address(address[:address], :port => address[:port], :type => address[:type], :mac => address[:mac])
37
- - elsif address.class.eql?(String)
38
- =format_address(address)
34
+ - @instance.public_addresses.each do |a|
35
+ %address{ :type => a.address_type, :port => a.port }=a.address
39
36
  - if @instance.private_addresses
40
37
  %private_addresses<
41
- - @instance.private_addresses.each do |address|
42
- =format_address(address)
38
+ - @instance.private_addresses.each do |a|
39
+ %address{ :type => a.address_type, :port => a.port }=a.address
43
40
  - if @instance.firewalls
44
41
  %firewalls<
45
42
  - @instance.firewalls.each do |firewall|
46
43
  %firewall{:href => firewall_url(firewall), :id => firewall }
44
+ - if @instance.storage_volumes
45
+ %storage_volumes<
46
+ - @instance.storage_volumes.each do |volume|
47
+ %storage_volume{:href=> storage_volume_url(volume.keys.first), :id => volume.keys.first, :device => volume.values.first}
47
48
  - if driver_has_auth_features?
48
49
  %authentication{ :type => driver_auth_feature_name }
49
50
  - if @instance.authn_feature_failed?