deltacloud-core 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (279) hide show
  1. data/deltacloud-core.gemspec +4 -7
  2. data/lib/cimi/collections/address_templates.rb +4 -42
  3. data/lib/cimi/collections/addresses.rb +5 -43
  4. data/lib/cimi/collections/base.rb +11 -3
  5. data/lib/cimi/collections/cloud_entry_point.rb +1 -1
  6. data/lib/cimi/collections/credentials.rb +4 -43
  7. data/lib/cimi/collections/forwarding_group_templates.rb +2 -20
  8. data/lib/cimi/collections/forwarding_groups.rb +2 -21
  9. data/lib/cimi/collections/machine_configurations.rb +2 -20
  10. data/lib/cimi/collections/machine_images.rb +4 -42
  11. data/lib/cimi/collections/machine_templates.rb +4 -42
  12. data/lib/cimi/collections/machines.rb +14 -64
  13. data/lib/cimi/collections/network_configurations.rb +2 -20
  14. data/lib/cimi/collections/network_port_configurations.rb +2 -21
  15. data/lib/cimi/collections/network_port_templates.rb +2 -23
  16. data/lib/cimi/collections/network_ports.rb +6 -46
  17. data/lib/cimi/collections/network_templates.rb +2 -21
  18. data/lib/cimi/collections/networks.rb +4 -40
  19. data/lib/cimi/collections/resource_metadata.rb +2 -21
  20. data/lib/cimi/collections/system_templates.rb +4 -45
  21. data/lib/cimi/collections/systems.rb +65 -82
  22. data/lib/cimi/collections/volume_configurations.rb +4 -45
  23. data/lib/cimi/collections/volume_images.rb +4 -42
  24. data/lib/cimi/collections/volume_templates.rb +5 -44
  25. data/lib/cimi/collections/volumes.rb +4 -48
  26. data/lib/cimi/helpers.rb +1 -0
  27. data/lib/cimi/helpers/cimi_helper.rb +1 -1
  28. data/lib/cimi/helpers/cimi_rabbit_helper.rb +113 -0
  29. data/lib/cimi/helpers/database_helper.rb +1 -2
  30. data/lib/cimi/models.rb +12 -11
  31. data/lib/cimi/models/action.rb +0 -4
  32. data/lib/cimi/models/address.rb +0 -38
  33. data/lib/cimi/models/address_create.rb +0 -31
  34. data/lib/cimi/models/address_template.rb +0 -47
  35. data/lib/cimi/models/address_template_create.rb +0 -16
  36. data/lib/cimi/models/base.rb +2 -74
  37. data/lib/cimi/models/cloud_entry_point.rb +2 -30
  38. data/lib/cimi/models/collection.rb +8 -25
  39. data/lib/cimi/models/credential.rb +0 -34
  40. data/lib/cimi/models/credential_create.rb +0 -26
  41. data/lib/cimi/models/credential_template.rb +0 -2
  42. data/lib/cimi/models/disk.rb +0 -56
  43. data/lib/cimi/models/forwarding_group.rb +0 -8
  44. data/lib/cimi/models/forwarding_group_template.rb +0 -8
  45. data/lib/cimi/models/machine.rb +4 -129
  46. data/lib/cimi/models/machine_configuration.rb +0 -31
  47. data/lib/cimi/models/machine_create.rb +1 -29
  48. data/lib/cimi/models/machine_image.rb +0 -28
  49. data/lib/cimi/models/machine_image_create.rb +0 -19
  50. data/lib/cimi/models/machine_template.rb +5 -39
  51. data/lib/cimi/models/machine_template_create.rb +0 -12
  52. data/lib/cimi/models/machine_volume.rb +0 -65
  53. data/lib/cimi/models/network.rb +0 -32
  54. data/lib/cimi/models/network_configuration.rb +0 -15
  55. data/lib/cimi/models/network_create.rb +0 -23
  56. data/lib/cimi/models/network_port.rb +0 -73
  57. data/lib/cimi/models/network_port_configuration.rb +0 -8
  58. data/lib/cimi/models/network_port_template.rb +0 -8
  59. data/lib/cimi/models/network_template.rb +2 -12
  60. data/lib/cimi/models/resource.rb +0 -6
  61. data/lib/cimi/models/resource_metadata.rb +1 -95
  62. data/lib/cimi/models/schema.rb +28 -32
  63. data/lib/cimi/models/system.rb +15 -39
  64. data/lib/cimi/models/system_address.rb +26 -0
  65. data/lib/cimi/models/system_create.rb +20 -0
  66. data/lib/cimi/models/system_credential.rb +26 -0
  67. data/lib/cimi/models/system_forwarding_group.rb +26 -0
  68. data/lib/cimi/models/system_machine.rb +26 -0
  69. data/lib/cimi/models/system_network.rb +26 -0
  70. data/lib/cimi/models/system_network_port.rb +26 -0
  71. data/lib/cimi/models/system_system.rb +26 -0
  72. data/lib/cimi/models/system_template.rb +15 -31
  73. data/lib/cimi/models/system_volume.rb +26 -0
  74. data/lib/cimi/models/volume.rb +0 -59
  75. data/lib/cimi/models/volume_configuration.rb +1 -64
  76. data/lib/cimi/models/volume_configuration_create.rb +22 -0
  77. data/lib/cimi/models/volume_create.rb +0 -38
  78. data/lib/cimi/models/volume_image.rb +0 -30
  79. data/lib/cimi/models/volume_image_create.rb +0 -25
  80. data/lib/cimi/models/volume_template.rb +2 -43
  81. data/lib/cimi/models/volume_template_create.rb +0 -12
  82. data/lib/cimi/service.rb +82 -0
  83. data/lib/cimi/service/action.rb +21 -0
  84. data/lib/cimi/service/address.rb +56 -0
  85. data/lib/cimi/service/address_create.rb +45 -0
  86. data/lib/cimi/service/address_template.rb +71 -0
  87. data/lib/cimi/service/address_template_create.rb +34 -0
  88. data/lib/cimi/service/base.rb +266 -0
  89. data/lib/cimi/service/cloud_entry_point.rb +53 -0
  90. data/lib/cimi/service/credential.rb +52 -0
  91. data/lib/cimi/service/credential_create.rb +38 -0
  92. data/lib/cimi/service/credential_template.rb +20 -0
  93. data/lib/cimi/service/disk.rb +75 -0
  94. data/lib/cimi/service/forwarding_group.rb +26 -0
  95. data/lib/cimi/service/forwarding_group_template.rb +26 -0
  96. data/lib/cimi/service/machine.rb +154 -0
  97. data/lib/cimi/service/machine_configuration.rb +54 -0
  98. data/lib/cimi/service/machine_create.rb +49 -0
  99. data/lib/cimi/service/machine_image.rb +47 -0
  100. data/lib/cimi/service/machine_image_create.rb +35 -0
  101. data/lib/cimi/service/machine_template.rb +61 -0
  102. data/lib/cimi/service/machine_template_create.rb +29 -0
  103. data/lib/cimi/service/machine_volume.rb +74 -0
  104. data/lib/cimi/service/network.rb +51 -0
  105. data/lib/cimi/service/network_configuration.rb +36 -0
  106. data/lib/cimi/service/network_create.rb +39 -0
  107. data/lib/cimi/service/network_port.rb +97 -0
  108. data/lib/cimi/service/network_port_configuration.rb +26 -0
  109. data/lib/cimi/service/network_port_template.rb +26 -0
  110. data/lib/cimi/service/network_template.rb +28 -0
  111. data/lib/cimi/service/resource_metadata.rb +44 -0
  112. data/lib/cimi/service/system.rb +45 -0
  113. data/lib/cimi/service/system_address.rb +34 -0
  114. data/lib/cimi/service/system_create.rb +39 -0
  115. data/lib/cimi/service/system_credential.rb +34 -0
  116. data/lib/cimi/service/system_forwarding_group.rb +34 -0
  117. data/lib/cimi/service/system_machine.rb +34 -0
  118. data/lib/cimi/service/system_network.rb +34 -0
  119. data/lib/cimi/service/system_network_port.rb +34 -0
  120. data/lib/cimi/service/system_system.rb +34 -0
  121. data/lib/cimi/service/system_template.rb +32 -0
  122. data/lib/cimi/service/system_volume.rb +34 -0
  123. data/lib/cimi/service/volume.rb +81 -0
  124. data/lib/cimi/service/volume_configuration.rb +92 -0
  125. data/lib/cimi/service/volume_configuration_create.rb +29 -0
  126. data/lib/cimi/service/volume_create.rb +47 -0
  127. data/lib/cimi/service/volume_image.rb +44 -0
  128. data/lib/cimi/service/volume_image_create.rb +42 -0
  129. data/lib/cimi/service/volume_template.rb +61 -0
  130. data/lib/cimi/service/volume_template_create.rb +29 -0
  131. data/lib/db/entity.rb +16 -1
  132. data/lib/deltacloud/collections/addresses.rb +2 -2
  133. data/lib/deltacloud/collections/buckets.rb +16 -18
  134. data/lib/deltacloud/collections/drivers.rb +4 -4
  135. data/lib/deltacloud/collections/firewalls.rb +5 -5
  136. data/lib/deltacloud/collections/images.rb +3 -3
  137. data/lib/deltacloud/collections/instance_states.rb +4 -4
  138. data/lib/deltacloud/collections/instances.rb +22 -13
  139. data/lib/deltacloud/collections/keys.rb +2 -2
  140. data/lib/deltacloud/collections/load_balancers.rb +16 -13
  141. data/lib/deltacloud/collections/storage_snapshots.rb +3 -3
  142. data/lib/deltacloud/collections/storage_volumes.rb +5 -5
  143. data/lib/deltacloud/core_ext/ordered_hash.rb +0 -4
  144. data/lib/deltacloud/drivers/fgcp/fgcp_client.rb +8 -0
  145. data/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +4 -3
  146. data/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb +266 -19
  147. data/lib/deltacloud/drivers/google/google_driver.rb +6 -0
  148. data/lib/deltacloud/drivers/mock/mock_driver.rb +2 -2
  149. data/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb +166 -54
  150. data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +2 -0
  151. data/lib/deltacloud/helpers/blob_stream_helper.rb +0 -2
  152. data/lib/deltacloud/helpers/deltacloud_helper.rb +22 -22
  153. data/lib/deltacloud/helpers/driver_helper.rb +4 -7
  154. data/lib/deltacloud/helpers/rabbit_helper.rb +5 -0
  155. data/lib/deltacloud/server.rb +4 -4
  156. data/lib/deltacloud/version.rb +1 -1
  157. data/lib/deltacloud_rack.rb +6 -1
  158. data/lib/ec2/server.rb +6 -1
  159. data/tests/cimi/collections/common.rb +33 -0
  160. data/tests/cimi/collections/machines_test.rb +19 -0
  161. data/tests/cimi/collections/system_templates_test.rb +47 -0
  162. data/tests/cimi/collections/volumes_test.rb +42 -0
  163. data/tests/cimi/db/database_helper_test.rb +7 -4
  164. data/tests/deltacloud/drivers_test.rb +1 -1
  165. data/tests/drivers/ec2/common.rb +4 -1
  166. data/tests/drivers/fgcp/common.rb +1 -2
  167. data/tests/drivers/gogrid/common.rb +1 -2
  168. data/tests/drivers/google/common.rb +1 -1
  169. data/tests/drivers/models/address_test.rb +2 -2
  170. data/tests/drivers/models/base_test.rb +2 -2
  171. data/tests/drivers/models/blob_test.rb +2 -2
  172. data/tests/drivers/models/instance_address_test.rb +8 -8
  173. data/tests/drivers/models/instance_profile_test.rb +2 -2
  174. data/tests/drivers/models/keys_test.rb +4 -4
  175. data/tests/drivers/models/metrics_test.rb +3 -3
  176. data/tests/drivers/openstack/common.rb +1 -2
  177. data/views/addresses/_address.html.haml +3 -3
  178. data/views/addresses/associate.html.haml +3 -3
  179. data/views/addresses/index.html.haml +2 -2
  180. data/views/addresses/index.xml.haml +2 -2
  181. data/views/addresses/show.html.haml +7 -7
  182. data/views/addresses/show.xml.haml +9 -9
  183. data/views/api/show.html.haml +2 -2
  184. data/views/api/show.xml.haml +1 -1
  185. data/views/blobs/new.html.haml +1 -1
  186. data/views/blobs/show.html.haml +8 -8
  187. data/views/blobs/show.xml.haml +7 -7
  188. data/views/buckets/index.html.haml +1 -1
  189. data/views/buckets/index.xml.haml +2 -2
  190. data/views/buckets/show.html.haml +7 -7
  191. data/views/buckets/show.xml.haml +6 -6
  192. data/views/drivers/index.html.haml +1 -1
  193. data/views/drivers/index.xml.haml +1 -1
  194. data/views/drivers/show.html.haml +6 -6
  195. data/views/drivers/show.xml.haml +5 -5
  196. data/views/error.html.haml +2 -2
  197. data/views/errors/backend_capability_failure.xml.haml +3 -3
  198. data/views/errors/common.html.haml +7 -7
  199. data/views/errors/common.xml.haml +5 -5
  200. data/views/firewalls/index.html.haml +1 -1
  201. data/views/firewalls/index.xml.haml +1 -1
  202. data/views/firewalls/new_rule.html.haml +1 -1
  203. data/views/firewalls/show.html.haml +8 -8
  204. data/views/firewalls/show.xml.haml +9 -9
  205. data/views/hardware_profiles/index.html.haml +1 -1
  206. data/views/hardware_profiles/index.xml.haml +2 -2
  207. data/views/hardware_profiles/show.html.haml +3 -3
  208. data/views/hardware_profiles/show.xml.haml +4 -4
  209. data/views/images/index.html.haml +1 -1
  210. data/views/images/index.xml.haml +2 -2
  211. data/views/images/new.html.haml +2 -2
  212. data/views/images/show.html.haml +14 -14
  213. data/views/images/show.xml.haml +14 -14
  214. data/views/instance_states/show.html.haml +1 -1
  215. data/views/instance_states/show.png.erb +2 -2
  216. data/views/instance_states/show.xml.haml +1 -1
  217. data/views/instances/index.html.haml +1 -1
  218. data/views/instances/index.xml.haml +2 -2
  219. data/views/instances/new.html.haml +22 -14
  220. data/views/instances/run.html.haml +2 -2
  221. data/views/instances/run.xml.haml +3 -3
  222. data/views/instances/run_command.html.haml +4 -4
  223. data/views/instances/show.html.haml +27 -27
  224. data/views/instances/show.xml.haml +37 -37
  225. data/views/keys/index.html.haml +1 -1
  226. data/views/keys/index.xml.haml +2 -2
  227. data/views/keys/show.html.haml +10 -10
  228. data/views/keys/show.xml.haml +12 -12
  229. data/views/load_balancers/index.html.haml +1 -1
  230. data/views/load_balancers/index.xml.haml +2 -2
  231. data/views/load_balancers/new.html.haml +1 -8
  232. data/views/load_balancers/show.html.haml +10 -10
  233. data/views/load_balancers/show.xml.haml +9 -9
  234. data/views/metrics/index.html.haml +1 -1
  235. data/views/metrics/index.xml.haml +2 -2
  236. data/views/metrics/show.html.haml +2 -2
  237. data/views/metrics/show.xml.haml +3 -3
  238. data/views/realms/index.html.haml +1 -1
  239. data/views/realms/index.xml.haml +2 -2
  240. data/views/realms/show.html.haml +6 -6
  241. data/views/realms/show.xml.haml +5 -5
  242. data/views/storage_snapshots/index.html.haml +1 -1
  243. data/views/storage_snapshots/index.xml.haml +2 -2
  244. data/views/storage_snapshots/show.html.haml +6 -6
  245. data/views/storage_snapshots/show.xml.haml +4 -4
  246. data/views/storage_volumes/attach.html.haml +2 -2
  247. data/views/storage_volumes/index.html.haml +1 -1
  248. data/views/storage_volumes/index.xml.haml +2 -2
  249. data/views/storage_volumes/show.html.haml +19 -19
  250. data/views/storage_volumes/show.xml.haml +21 -21
  251. metadata +77 -65
  252. data/views/cimi/cloudEntryPoint/index.html.haml +0 -5
  253. data/views/cimi/cloudEntryPoint/index.xml.haml +0 -9
  254. data/views/cimi/collection/index.html.haml +0 -45
  255. data/views/cimi/collection/response.xml.haml +0 -3
  256. data/views/cimi/error.html.haml +0 -31
  257. data/views/cimi/errors/400.xml.haml +0 -3
  258. data/views/cimi/errors/401.xml.haml +0 -2
  259. data/views/cimi/errors/403.xml.haml +0 -2
  260. data/views/cimi/errors/404.xml.haml +0 -2
  261. data/views/cimi/errors/405.xml.haml +0 -5
  262. data/views/cimi/errors/500.xml.haml +0 -6
  263. data/views/cimi/errors/502.xml.haml +0 -7
  264. data/views/cimi/layout.html.haml +0 -32
  265. data/views/cimi/machine_configurations/show.html.haml +0 -159
  266. data/views/cimi/machine_configurations/show.xml.haml +0 -27
  267. data/views/cimi/machine_images/show.html.haml +0 -79
  268. data/views/cimi/machine_images/show.xml.haml +0 -17
  269. data/views/cimi/machines/show.html.haml +0 -177
  270. data/views/cimi/machines/show.xml.haml +0 -28
  271. data/views/cimi/volumes/show.html.haml +0 -68
  272. data/views/cimi/volumes/show.xml.haml +0 -17
  273. data/views/docs/collection.html.haml +0 -26
  274. data/views/docs/collection.xml.haml +0 -14
  275. data/views/docs/index.html.haml +0 -11
  276. data/views/docs/index.xml.haml +0 -5
  277. data/views/docs/operation.html.haml +0 -33
  278. data/views/docs/operation.xml.haml +0 -10
  279. data/views/root/index.html.haml +0 -4
@@ -39,8 +39,8 @@ module Deltacloud::Collections
39
39
  status 201 # Created
40
40
  response['Location'] = address_url(@address.id)
41
41
  respond_to do |format|
42
- format.xml { haml :"addresses/show", :ugly => true }
43
- format.html { haml :"addresses/_address", :layout => false }
42
+ format.xml { haml :"addresses/show", :ugly => true, :locals => { :address => @address } }
43
+ format.html { haml :"addresses/_address", :layout => false, :locals => { :address => @address } }
44
44
  format.json { JSON::dump(:address => @address.to_hash(self)) }
45
45
  end
46
46
  end
@@ -27,7 +27,7 @@ module Deltacloud::Collections
27
27
  get '/buckets/:bucket/%s' % NEW_BLOB_FORM_ID do
28
28
  @bucket_id = params[:bucket]
29
29
  respond_to do |format|
30
- format.html {haml :"blobs/new"}
30
+ format.html {haml :"blobs/new", :locals=>{:bucket_id => @bucket_id} }
31
31
  end
32
32
  end
33
33
 
@@ -65,14 +65,12 @@ module Deltacloud::Collections
65
65
  report_error(400) # likely blob size < 112 KB (didn't hit streaming patch)
66
66
  end
67
67
  when "finalize" then
68
- bucket_id = params[:bucket]
69
- blob_id = params[:blob]
70
68
  segmented_blob_manifest = BlobHelper.extract_segmented_blob_manifest(request)
71
69
  segmented_blob_id = BlobHelper.segmented_blob_id(request)
72
70
  @blob = driver.create_blob(credentials, params[:bucket], params[:blob], nil, {:segment_manifest=>segmented_blob_manifest, :segmented_blob_id=>segmented_blob_id})
73
71
  respond_to do |format|
74
- format.xml { haml :"blobs/show" }
75
- format.html { haml :"blobs/show" }
72
+ format.xml { haml :"blobs/show", :locals => { :blob => @blob } }
73
+ format.html { haml :"blobs/show", :locals => { :blob => @blob } }
76
74
  format.json { xml_to_json 'blobs/show' }
77
75
  end
78
76
  else
@@ -89,8 +87,8 @@ module Deltacloud::Collections
89
87
  @blob = driver.blob(credentials, {:id => params[:blob],
90
88
  'bucket' => params[:bucket]})
91
89
  respond_to do |format|
92
- format.xml { haml :"blobs/show" }
93
- format.html { haml :"blobs/show" }
90
+ format.xml { haml :"blobs/show", :locals => { :blob => @blob } }
91
+ format.html { haml :"blobs/show", :locals => { :blob => @blob } }
94
92
  format.json { JSON::dump(:blob => @blob.to_hash(self) ) }
95
93
  end
96
94
  elsif(env["BLOB_FAIL"])
@@ -108,8 +106,8 @@ module Deltacloud::Collections
108
106
  @blob = driver.create_blob(credentials, bucket_id, blob_id, blob_data, user_meta)
109
107
  temp_file.delete
110
108
  respond_to do |format|
111
- format.xml { haml :"blobs/show" }
112
- format.html { haml :"blobs/show" }
109
+ format.xml { haml :"blobs/show", :locals => { :blob => @blob } }
110
+ format.html { haml :"blobs/show", :locals => { :blob => @blob } }
113
111
  format.json { JSON::dump(:blob => @blob.to_hash(self)) }
114
112
  end
115
113
  end
@@ -128,7 +126,7 @@ module Deltacloud::Collections
128
126
  status 201
129
127
  response['Location'] = bucket_url(@bucket.id)
130
128
  respond_to do |format|
131
- format.xml { haml :"buckets/show" }
129
+ format.xml { haml :"buckets/show", :locals=> { :bucket => @bucket } }
132
130
  format.json { JSON::dump(:bucket => @bucket.to_hash(self)) }
133
131
  format.html do
134
132
  redirect bucket_url(@bucket.id) if @bucket and @bucket.id
@@ -158,8 +156,8 @@ module Deltacloud::Collections
158
156
  @blob = driver.blob(credentials, { :id => params[:blob_id], 'bucket' => params[:id]} )
159
157
  if @blob
160
158
  respond_to do |format|
161
- format.xml { haml :"blobs/show" }
162
- format.html { haml :"blobs/show" }
159
+ format.xml { haml :"blobs/show", :locals => { :blob => @blob } }
160
+ format.html { haml :"blobs/show", :locals => { :blob => @blob } }
163
161
  format.json { JSON::dump(:blob => @blob.to_hash(self)) }
164
162
  end
165
163
  else
@@ -192,8 +190,8 @@ module Deltacloud::Collections
192
190
  @blob = driver.create_blob(credentials, bucket_id, blob_id, blob_data, user_meta)
193
191
  status 201
194
192
  respond_to do |format|
195
- format.xml { haml :"blobs/show" }
196
- format.html { haml :"blobs/show"}
193
+ format.xml { haml :"blobs/show", :locals => { :blob => @blob } }
194
+ format.html { haml :"blobs/show", :locals => { :blob => @blob }}
197
195
  format.json { JSON::dump(:blob => @blob.to_hash(self)) }
198
196
  end
199
197
  end
@@ -225,8 +223,8 @@ module Deltacloud::Collections
225
223
  @blob = driver.blob(credentials, {:id => params[:blob],
226
224
  'bucket' => params[:bucket]})
227
225
  respond_to do |format|
228
- format.xml { haml :"blobs/show" }
229
- format.html { haml :"blobs/show" }
226
+ format.xml { haml :"blobs/show", :locals => { :blob => @blob } }
227
+ format.html { haml :"blobs/show", :locals => { :blob => @blob } }
230
228
  format.json { JSON::dump(@blob.to_hash(self)) }
231
229
  end
232
230
  elsif(env["BLOB_FAIL"])
@@ -244,8 +242,8 @@ module Deltacloud::Collections
244
242
  @blob = driver.create_blob(credentials, bucket_id, blob_id, blob_data, user_meta)
245
243
  temp_file.delete
246
244
  respond_to do |format|
247
- format.xml { haml :"blobs/show" }
248
- format.html { haml :"blobs/show" }
245
+ format.xml { haml :"blobs/show", :locals => { :blob => @blob } }
246
+ format.html { haml :"blobs/show", :locals => { :blob => @blob } }
249
247
  format.json { JSON::dump(@blob.to_hash(self)) }
250
248
  end
251
249
  end
@@ -22,9 +22,9 @@ module Deltacloud::Collections
22
22
  control do
23
23
  @drivers = Deltacloud::Drivers.driver_config
24
24
  respond_to do |format|
25
- format.xml { haml :"drivers/index" }
25
+ format.xml { haml :"drivers/index", :locals => { :drivers => @drivers } }
26
26
  format.json { @drivers.to_json }
27
- format.html { haml :"drivers/index" }
27
+ format.html { haml :"drivers/index", :locals => { :drivers => @drivers } }
28
28
  end
29
29
  end
30
30
  end
@@ -38,9 +38,9 @@ module Deltacloud::Collections
38
38
  @driver = Deltacloud::Drivers.driver_config[@name]
39
39
  halt 404 unless @driver
40
40
  respond_to do |format|
41
- format.xml { haml :"drivers/show" }
41
+ format.xml { haml :"drivers/show", :locals => { :driver => @driver, :name => @name, :providers => @providers } }
42
42
  format.json { { :driver => @driver.merge(:id => params[:id]) }.to_json }
43
- format.html { haml :"drivers/show" }
43
+ format.html { haml :"drivers/show", :locals => { :driver => @driver, :name => @name, :providers => @providers }}
44
44
  end
45
45
  end
46
46
  end
@@ -25,7 +25,7 @@ module Deltacloud::Collections
25
25
  get '/firewalls/:id/new_rule' do
26
26
  @firewall_name = params[:id]
27
27
  respond_to do |format|
28
- format.html {haml :"firewalls/new_rule" }
28
+ format.html { haml :"firewalls/new_rule", :locals => { :firewall_name => @firewall_name } }
29
29
  end
30
30
  end
31
31
 
@@ -64,8 +64,8 @@ module Deltacloud::Collections
64
64
  status 201 # Created
65
65
  response['Location'] = firewall_url(@firewall.id)
66
66
  respond_to do |format|
67
- format.xml { haml :"firewalls/show" }
68
- format.html { haml :"firewalls/show" }
67
+ format.xml { haml :"firewalls/show", :locals => { :firewall => @firewall } }
68
+ format.html { haml :"firewalls/show", :locals => { :firewall => @firewall } }
69
69
  format.json { JSON::dump(:firewall => @firewall.to_hash(self)) }
70
70
  end
71
71
  end
@@ -107,8 +107,8 @@ module Deltacloud::Collections
107
107
  @firewall = driver.firewall(credentials, {:id => params[:id]})
108
108
  status 201
109
109
  respond_to do |format|
110
- format.xml { haml :"firewalls/show" }
111
- format.html { haml :"firewalls/show" }
110
+ format.xml { haml :"firewalls/show", :locals => { :firewall => @firewall} }
111
+ format.html { haml :"firewalls/show", :locals => { :firewall => @firewall} }
112
112
  format.json { JSON::dump(:firewall => @firewall.to_hash(self) ) }
113
113
  end
114
114
  end
@@ -23,7 +23,7 @@ module Deltacloud::Collections
23
23
 
24
24
  new_route_for :images do
25
25
  halt 404 unless params[:instance_id]
26
- @instance = Deltacloud::Instance.new( :id => params[:instance_id] )
26
+ @opts[:instance] = Deltacloud::Instance.new( :id => params[:instance_id] )
27
27
  end
28
28
 
29
29
  collection :images do
@@ -49,9 +49,9 @@ module Deltacloud::Collections
49
49
  status 201 # Created
50
50
  response['Location'] = image_url(@image.id)
51
51
  respond_to do |format|
52
- format.xml { haml :"images/show" }
52
+ format.xml { haml :"images/show", :locals => { :image => @image } }
53
53
  format.json { JSON::dump(:image => @image.to_hash(self)) }
54
- format.html { haml :"images/show" }
54
+ format.html { haml :"images/show", :locals => { :image => @image } }
55
55
  end
56
56
  end
57
57
  end
@@ -26,7 +26,7 @@ module Deltacloud::Collections
26
26
  control do
27
27
  @machine = driver.instance_state_machine
28
28
  respond_to do |format|
29
- format.xml { haml :'instance_states/show', :layout => false }
29
+ format.xml { haml :'instance_states/show', :layout => false, :locals => { :machine => @machine } }
30
30
  format.json do
31
31
  out = []
32
32
  @machine.states.each do |state|
@@ -37,12 +37,12 @@ module Deltacloud::Collections
37
37
  end
38
38
  out.to_json
39
39
  end
40
- format.html { haml :'instance_states/show'}
41
- format.gv { erb :"instance_states/show" }
40
+ format.html { haml :'instance_states/show', :locals => { :machine => @machine }}
41
+ format.gv { erb :"instance_states/show", :locals => { :machine => @machine } }
42
42
  format.png do
43
43
  # Trick respond_to into looking up the right template for the
44
44
  # graphviz file
45
- gv = erb(:"instance_states/show")
45
+ gv = erb(:"instance_states/show", :locals => { :machine => @machine })
46
46
  png = ''
47
47
  cmd = 'dot -Kdot -Gpad="0.2,0.2" -Gsize="5.0,8.0" -Gdpi="180" -Tpng'
48
48
  ::Open3.popen3( cmd ) do |stdin, stdout, stderr|
@@ -22,19 +22,28 @@ module Deltacloud::Collections
22
22
  check_features :for => lambda { |c, f| driver.class.has_feature?(c, f) }
23
23
 
24
24
  new_route_for(:instances) do
25
- @instance = Deltacloud::Instance.new( { :id=>params[:id], :image_id=>params[:image_id] } )
26
- @image = driver.image(credentials, :id => params[:image_id])
27
- @hardware_profiles = driver.hardware_profiles(credentials, :architecture => @image.architecture )
28
- @realms = [Deltacloud::Realm.new(:id => params[:realm_id])] if params[:realm_id]
29
- @realms ||= driver.realms(credentials)
30
- @firewalls = driver.firewalls(credentials) if driver.class.has_feature? :instances, :firewalls
31
- @keys = driver.keys(credentials) if driver.class.has_feature? :instances, :authentication_key
25
+ @opts = {
26
+ :instance => Deltacloud::Instance.new(:id=>params[:id], :image_id=>params[:image_id]),
27
+ }
28
+ @opts[:image] = driver.image(credentials, :id => params[:image_id])
29
+ @opts[:hardware_profiles] = @opts[:image].hardware_profiles
30
+ if params[:realm_id]
31
+ @opts[:realms] = [ Deltacloud::Realm.new(:id => params[:realm_id]) ] if params[:realm_id]
32
+ else
33
+ @opts[:realms] = driver.realms(credentials)
34
+ end
35
+ if driver.class.has_feature?(:instances, :firewalls)
36
+ @opts[:firewalls] = driver.firewalls(credentials)
37
+ end
38
+ if driver.class.has_feature?(:instances, :authentication_key)
39
+ @opts[:keys] = driver.keys(credentials)
40
+ end
32
41
  end
33
42
 
34
43
  get '/instances/:id/run' do
35
44
  respond_to do |format|
36
45
  @instance = driver.instances(credentials, :id => params[:id]).first
37
- format.html {haml :"instances/run_command" }
46
+ format.html {haml :"instances/run_command", :locals => @instance }
38
47
  end
39
48
  end
40
49
 
@@ -59,7 +68,7 @@ module Deltacloud::Collections
59
68
  end
60
69
  status 201 # Created
61
70
  respond_to do |format|
62
- format.xml { haml :"instances/#{action_handler}" }
71
+ format.xml { haml :"instances/#{action_handler}", :locals => {:instance=>@instance} }
63
72
  format.json do
64
73
  if @elements
65
74
  JSON::dump(:instances => @elements.map { |i| i.to_hash(self) })
@@ -69,10 +78,10 @@ module Deltacloud::Collections
69
78
  end
70
79
  format.html do
71
80
  if @elements
72
- haml :"instances/index"
81
+ haml :"instances/index", :locals => { :elements => @elements }
73
82
  elsif @instance and @instance.id
74
83
  response['Location'] = instance_url(@instance.id)
75
- haml :"instances/show"
84
+ haml :"instances/show", :locals => { :instance => @instance }
76
85
  else
77
86
  redirect instances_url
78
87
  end
@@ -113,8 +122,8 @@ module Deltacloud::Collections
113
122
  control do
114
123
  @output = driver.run_on_instance(credentials, params)
115
124
  respond_to do |format|
116
- format.xml { haml :"instances/run" }
117
- format.html { haml :"instances/run" }
125
+ format.xml { haml :"instances/run", :locals => { :output => @output } }
126
+ format.html { haml :"instances/run", :locals => { :output => @output } }
118
127
  format.json { JSON::dump({:instance => { :id => params[:id], :public_address => @output.ssh.network.ip, :command => @output.ssh.command, :output => @output.body}})}
119
128
  end
120
129
  end
@@ -40,8 +40,8 @@ module Deltacloud::Collections
40
40
  status 201
41
41
  response['Location'] = key_url(@key.id)
42
42
  respond_to do |format|
43
- format.xml { haml :"keys/show", :ugly => true }
44
- format.html { haml :"keys/show" }
43
+ format.xml { haml :"keys/show", :ugly => true, :locals => { :key => @key } }
44
+ format.html { haml :"keys/show", :locals => { :key => @key } }
45
45
  format.json { JSON::dump(:key => @key.to_hash(self)) }
46
46
  end
47
47
  end
@@ -19,7 +19,7 @@ module Deltacloud::Collections
19
19
  set :capability, lambda { |m| driver.respond_to? m }
20
20
 
21
21
  new_route_for :load_balancers do
22
- @realms = driver.realms(credentials)
22
+ @opts[:realms] = driver.realms(credentials)
23
23
  end
24
24
 
25
25
  collection :load_balancers do
@@ -30,19 +30,22 @@ module Deltacloud::Collections
30
30
  operation :show, :with_capability => :load_balancer do
31
31
  param :id, :string, :required
32
32
  control do
33
- @load_balancer = driver.load_balancer(credentials, params)
34
- @registered_instances = @load_balancer.instances.collect{|i| {:id => i.id, :name=> i.name}}
35
- # if provider supports realm_filter and load balancer has only one realm (which is mostly the case), use optimization:
36
- if @load_balancer.realms.size == 1 and driver.class.has_feature?(:instances, :realm_filter)
37
- all_instances = driver.instances(credentials, :realm_id => @load_balancer.realms.first.id).collect{|i| {:id => i.id, :name => i.name}}
38
- elsif
33
+ vars = {}
34
+ vars[:load_balancer] = driver.load_balancer(credentials, params)
35
+ vars[:registered_instances] = vars[:load_balancer].instances.map{ |i| {:id => i.id, :name=> i.name} }
36
+ # If provider supports realm_filter and load balancer has only one realm (which is mostly the case), use optimization:
37
+ if vars[:load_balancer].realms.size == 1 and driver.class.has_feature?(:instances, :realm_filter)
38
+ all_instances = driver.instances(credentials, :realm_id => vars[:load_balancer].realms.first.id).collect{ |i|
39
+ { :id => i.id, :name => i.name }
40
+ }
41
+ else
39
42
  all_instances = driver.instances(credentials).collect{|i| {:id => i.id, :name => i.name} }
40
43
  end
41
- @unregistered_instances = all_instances - @registered_instances
44
+ vars[:unregistered_instances] = all_instances - vars[:registered_instances]
42
45
  respond_to do |format|
43
- format.xml { haml :'load_balancers/show' }
46
+ format.xml { haml :'load_balancers/show', :locals => vars }
44
47
  format.json { JSON::dump(:load_balancer => @load_balancer.to_hash(self)) }
45
- format.html { haml :'load_balancers/show' }
48
+ format.html { haml :'load_balancers/show', :locals => vars }
46
49
  end
47
50
  end
48
51
  end
@@ -58,7 +61,7 @@ module Deltacloud::Collections
58
61
  status 201 # Created
59
62
  response['Location'] = load_balancer_url(@load_balancer.id)
60
63
  respond_to do |format|
61
- format.xml { haml :"load_balancers/show" }
64
+ format.xml { haml :"load_balancers/show", :locals => { :load_balancer => @load_balancer } }
62
65
  format.json { JSON::dump(:load_balancer => @load_balancer.to_hash(self)) }
63
66
  format.html { redirect load_balancer_url(@load_balancer.id)}
64
67
  end
@@ -72,7 +75,7 @@ module Deltacloud::Collections
72
75
  driver.lb_register_instance(credentials, params)
73
76
  @load_balancer = driver.load_balancer(credentials, :id => params[:id])
74
77
  respond_to do |format|
75
- format.xml { haml :'load_balancers/show' }
78
+ format.xml { haml :'load_balancers/show', :locals => { :load_balancer => @load_balancer } }
76
79
  format.json { JSON::dump(:load_balancer => @load_balancer.to_hash(self) ) }
77
80
  format.html { redirect load_balancer_url(@load_balancer.id)}
78
81
  end
@@ -86,7 +89,7 @@ module Deltacloud::Collections
86
89
  driver.lb_unregister_instance(credentials, params)
87
90
  @load_balancer = driver.load_balancer(credentials, :id => params[:id])
88
91
  respond_to do |format|
89
- format.xml { haml :'load_balancers/show' }
92
+ format.xml { haml :'load_balancers/show', :locals => { :load_balancer => @load_balancer } }
90
93
  format.json { JSON::dump(:load_balancer => @load_balancer.to_hash(self)) }
91
94
  format.html { redirect load_balancer_url(@load_balancer.id) }
92
95
  end
@@ -34,9 +34,9 @@ module Deltacloud::Collections
34
34
  status 201 # Created
35
35
  response['Location'] = storage_snapshot_url(@storage_snapshot.id)
36
36
  respond_to do |format|
37
- format.xml { haml :"storage_snapshots/show" }
38
- format.html { haml :"storage_snapshots/show" }
39
- format.json { xml_to_json "storage_snapshots/show" }
37
+ format.xml { haml :"storage_snapshots/show", :locals => { :storage_snapshot => @storage_snapshot } }
38
+ format.html { haml :"storage_snapshots/show", :locals => { :storage_snapshot => @storage_snapshot } }
39
+ format.json { JSON::dump(:storage_snapshot => @storage_snapshot.to_hash(self)) }
40
40
  end
41
41
  end
42
42
  end
@@ -24,7 +24,7 @@ module Deltacloud::Collections
24
24
  new_route_for(:storage_volumes)
25
25
 
26
26
  get "/storage_volumes/:id/attach_instance" do
27
- @instances = driver.instances(credentials)
27
+ @opts[:instances] = driver.instances(credentials)
28
28
  respond_to do |format|
29
29
  format.html{ haml :"storage_volumes/attach"}
30
30
  end
@@ -46,8 +46,8 @@ module Deltacloud::Collections
46
46
  status 201
47
47
  response['Location'] = storage_volume_url(@storage_volume.id)
48
48
  respond_to do |format|
49
- format.xml { haml :"storage_volumes/show" }
50
- format.html { haml :"storage_volumes/show" }
49
+ format.xml { haml :"storage_volumes/show", :locals => { :storage_volume => @storage_volume } }
50
+ format.html { haml :"storage_volumes/show", :locals => { :storage_volume => @storage_volume } }
51
51
  format.json { JSON::dump(:storage_volume => @storage_volume.to_hash(self)) }
52
52
  end
53
53
  end
@@ -62,7 +62,7 @@ module Deltacloud::Collections
62
62
  status 202
63
63
  respond_to do |format|
64
64
  format.html { redirect(storage_volume_url(params[:id]))}
65
- format.xml { haml :"storage_volumes/show" }
65
+ format.xml { haml :"storage_volumes/show", :locals => { :storage_volume => @storage_volume } }
66
66
  format.json { JSON::dump(:storage_volume => @storage_volume.to_hash(self)) }
67
67
  end
68
68
  end
@@ -78,7 +78,7 @@ module Deltacloud::Collections
78
78
  status 202
79
79
  respond_to do |format|
80
80
  format.html { redirect(storage_volume_url(params[:id]))}
81
- format.xml { haml :"storage_volumes/show" }
81
+ format.xml { haml :"storage_volumes/show", :locals => { :storage_volume => @storage_volume } }
82
82
  format.json { JSON::dump(:storage_volume => @storage_volume.to_hash(self)) }
83
83
  end
84
84
  end
@@ -1,9 +1,5 @@
1
1
  # Code from ActiveSupport, https://github.com/rails/rails/tree/3-2-stable/activesupport
2
2
  # MIT licensed
3
- begin
4
- require 'psych'
5
- rescue LoadError
6
- end
7
3
 
8
4
  require 'yaml'
9
5
 
@@ -82,6 +82,10 @@ class FgcpClient
82
82
  request('ListVSYS')
83
83
  end
84
84
 
85
+ def get_vsys_status(vsys_id)
86
+ request('GetVSYSStatus', {'vsysId' => vsys_id})
87
+ end
88
+
85
89
  def get_vsys_attributes(vsys_id)
86
90
  request('GetVSYSAttributes', {'vsysId' => vsys_id})
87
91
  end
@@ -94,6 +98,10 @@ class FgcpClient
94
98
  request('ListVSYSDescriptor')
95
99
  end
96
100
 
101
+ def get_vsys_descriptor_configuration(vsys_descriptor_id)
102
+ request('GetVSYSDescriptorConfiguration', {'vsysDescriptorId' => vsys_descriptor_id})
103
+ end
104
+
97
105
  def list_vservers(vsys_id)
98
106
  request('ListVServer', {'vsysId' => vsys_id})
99
107
  end
@@ -516,7 +516,8 @@ class FgcpDriver < Deltacloud::BaseDriver
516
516
  vdisks['vdisk'].each do |vdisk|
517
517
 
518
518
  #state requires an additional call per volume. Only set if attached.
519
- #exclude system disks as they are not detachable?
519
+ #exclude system disks as they are instance disks, not volumes
520
+ kind = determine_storage_type(vdisk['vdiskId'][0])
520
521
  volumes << StorageVolume.new(
521
522
  :id => vdisk['vdiskId'][0],
522
523
  :name => vdisk['vdiskName'][0],
@@ -524,9 +525,9 @@ class FgcpDriver < Deltacloud::BaseDriver
524
525
  :instance_id => vdisk['attachedTo'].nil? ? nil : vdisk['attachedTo'][0],
525
526
  :realm_id => client.extract_vsys_id(vdisk['vdiskId'][0]),
526
527
  # aligning with rhevm, which returns 'system' or 'data'
527
- :kind => determine_storage_type(vdisk['vdiskId'][0]),
528
+ :kind => kind,
528
529
  :state => vdisk['attachedTo'].nil? ? 'AVAILABLE' : 'IN-USE'
529
- )
530
+ ) unless kind == 'system'
530
531
  end
531
532
  end
532
533
  rescue Exception => ex # cater for case where vsys was just destroyed since list_vsys call