deltacloud-core 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (242) hide show
  1. data/LICENSE +145 -0
  2. data/NOTICE +10 -1
  3. data/Rakefile +50 -2
  4. data/bin/deltacloudd +111 -14
  5. data/config/addresses.xml +14 -0
  6. data/config/condor.yaml +30 -0
  7. data/config/drivers/azure.yaml +3 -0
  8. data/config/drivers/condor.yaml +3 -0
  9. data/config/{drivers.yaml → drivers/ec2.yaml} +5 -34
  10. data/config/drivers/eucalyptus.yaml +8 -0
  11. data/config/drivers/gogrid.yaml +3 -0
  12. data/config/drivers/mock.yaml +3 -0
  13. data/config/drivers/opennebula.yaml +4 -0
  14. data/config/drivers/rackspace.yaml +3 -0
  15. data/config/drivers/rhevm.yaml +3 -0
  16. data/config/drivers/rimuhosting.yaml +3 -0
  17. data/config/drivers/sbc.yaml +2 -0
  18. data/config/drivers/terremark.yaml +3 -0
  19. data/config/drivers/vsphere.yaml +8 -0
  20. data/deltacloud-core.gemspec +13 -5
  21. data/deltacloud.rb +4 -2
  22. data/lib/deltacloud/backend_capability.rb +2 -2
  23. data/lib/deltacloud/base_driver/base_driver.rb +23 -52
  24. data/lib/deltacloud/base_driver/exceptions.rb +168 -0
  25. data/lib/deltacloud/base_driver/features.rb +31 -12
  26. data/lib/deltacloud/base_driver/mock_driver.rb +2 -1
  27. data/lib/deltacloud/core_ext/string.rb +2 -0
  28. data/lib/deltacloud/drivers/azure/azure_driver.rb +5 -5
  29. data/lib/deltacloud/drivers/condor/condor_client.rb +273 -0
  30. data/lib/deltacloud/drivers/condor/condor_driver.rb +236 -0
  31. data/lib/deltacloud/drivers/condor/ip_agents/confserver.rb +75 -0
  32. data/lib/deltacloud/drivers/condor/ip_agents/default.rb +84 -0
  33. data/lib/deltacloud/drivers/ec2/ec2_driver.rb +326 -95
  34. data/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb +3 -3
  35. data/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb +40 -8
  36. data/lib/deltacloud/drivers/gogrid/gogrid_client.rb +7 -7
  37. data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +42 -25
  38. data/lib/deltacloud/drivers/mock/data/{buckets/blobs → blobs}/blob1.yml +6 -4
  39. data/lib/deltacloud/drivers/mock/data/{buckets/blobs → blobs}/blob2.yml +7 -5
  40. data/lib/deltacloud/drivers/mock/data/{buckets/blobs → blobs}/blob3.yml +6 -4
  41. data/lib/deltacloud/drivers/mock/data/{buckets/blobs → blobs}/blob4.yml +6 -4
  42. data/lib/deltacloud/drivers/mock/data/{buckets/blobs → blobs}/blob5.yml +6 -4
  43. data/lib/deltacloud/drivers/mock/data/buckets/bucket1.yml +7 -1
  44. data/lib/deltacloud/drivers/mock/data/buckets/bucket2.yml +6 -1
  45. data/lib/deltacloud/drivers/mock/data/images/img1.yml +6 -2
  46. data/lib/deltacloud/drivers/mock/data/images/img2.yml +6 -2
  47. data/lib/deltacloud/drivers/mock/data/images/img3.yml +6 -2
  48. data/lib/deltacloud/drivers/mock/data/instances/inst0.yml +11 -10
  49. data/lib/deltacloud/drivers/mock/data/instances/inst1.yml +14 -7
  50. data/lib/deltacloud/drivers/mock/data/instances/inst2.yml +14 -7
  51. data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap1.yml +3 -2
  52. data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap2.yml +3 -2
  53. data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap3.yml +3 -2
  54. data/lib/deltacloud/drivers/mock/data/storage_volumes/vol1.yml +4 -3
  55. data/lib/deltacloud/drivers/mock/data/storage_volumes/vol2.yml +4 -3
  56. data/lib/deltacloud/drivers/mock/data/storage_volumes/vol3.yml +4 -3
  57. data/lib/deltacloud/drivers/mock/mock_client.rb +101 -0
  58. data/lib/deltacloud/drivers/mock/mock_driver.rb +367 -429
  59. data/lib/deltacloud/drivers/opennebula/opennebula_driver.rb +6 -0
  60. data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +59 -9
  61. data/lib/deltacloud/drivers/rhevm/rhevm_client.rb +62 -8
  62. data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +100 -45
  63. data/lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb +3 -2
  64. data/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb +8 -11
  65. data/lib/deltacloud/drivers/sbc/sbc_client.rb +6 -6
  66. data/lib/deltacloud/drivers/sbc/sbc_driver.rb +16 -0
  67. data/lib/deltacloud/drivers/terremark/terremark_driver.rb +17 -12
  68. data/lib/deltacloud/drivers/vsphere/vsphere_client.rb +140 -0
  69. data/lib/deltacloud/drivers/vsphere/vsphere_driver.rb +405 -0
  70. data/lib/deltacloud/drivers/vsphere/vsphere_filemanager.rb +182 -0
  71. data/lib/deltacloud/hardware_profile.rb +1 -1
  72. data/lib/deltacloud/helpers.rb +2 -1
  73. data/lib/deltacloud/helpers/application_helper.rb +92 -20
  74. data/lib/deltacloud/helpers/blob_stream.rb +160 -12
  75. data/lib/deltacloud/helpers/conversion_helper.rb +6 -2
  76. data/lib/deltacloud/helpers/json_helper.rb +31 -0
  77. data/lib/deltacloud/models/address.rb +28 -0
  78. data/lib/deltacloud/models/base_model.rb +5 -1
  79. data/lib/deltacloud/models/blob.rb +1 -1
  80. data/lib/deltacloud/models/bucket.rb +10 -0
  81. data/lib/deltacloud/models/firewall.rb +22 -0
  82. data/lib/deltacloud/models/firewall_rule.rb +23 -0
  83. data/lib/deltacloud/models/image.rb +12 -0
  84. data/lib/deltacloud/models/instance.rb +20 -2
  85. data/lib/deltacloud/models/key.rb +1 -1
  86. data/lib/deltacloud/runner.rb +3 -3
  87. data/lib/deltacloud/validation.rb +3 -7
  88. data/lib/drivers.rb +7 -1
  89. data/lib/sinatra/body_proxy.rb +34 -0
  90. data/lib/sinatra/lazy_auth.rb +5 -0
  91. data/lib/sinatra/rabbit.rb +54 -31
  92. data/lib/sinatra/rack_accept.rb +157 -0
  93. data/lib/sinatra/rack_date.rb +38 -0
  94. data/lib/sinatra/rack_etag.rb +2 -3
  95. data/lib/sinatra/rack_matrix_params.rb +51 -29
  96. data/lib/sinatra/rack_runtime.rb +1 -1
  97. data/lib/sinatra/rack_syslog.rb +86 -0
  98. data/lib/sinatra/url_for.rb +14 -1
  99. data/public/images/address.png +0 -0
  100. data/public/images/balancer.png +0 -0
  101. data/public/images/blob.png +0 -0
  102. data/public/images/bucket.png +0 -0
  103. data/public/images/cloud.png +0 -0
  104. data/public/images/firewall.png +0 -0
  105. data/public/images/image.png +0 -0
  106. data/public/images/key.png +0 -0
  107. data/public/images/machine.png +0 -0
  108. data/public/images/profile.png +0 -0
  109. data/public/images/realm.png +0 -0
  110. data/public/images/snapshot.png +0 -0
  111. data/public/images/volume.png +0 -0
  112. data/public/javascripts/application.js +119 -16
  113. data/public/javascripts/jquery.min.js +18 -0
  114. data/public/javascripts/jquery.mobile-1.0b1.min.js +146 -0
  115. data/public/stylesheets/compiled/application.css +8 -0
  116. data/public/stylesheets/images/ajax-loader.png +0 -0
  117. data/public/{images → stylesheets/images}/bread-bg.png +0 -0
  118. data/public/{images → stylesheets/images}/error.png +0 -0
  119. data/public/{images → stylesheets/images}/grid.png +0 -0
  120. data/public/stylesheets/images/icon-search-black.png +0 -0
  121. data/public/stylesheets/images/icons-18-black.png +0 -0
  122. data/public/stylesheets/images/icons-18-white.png +0 -0
  123. data/public/stylesheets/images/icons-36-black.png +0 -0
  124. data/public/stylesheets/images/icons-36-white.png +0 -0
  125. data/public/{images → stylesheets/images}/logo-wide.png +0 -0
  126. data/public/{images → stylesheets/images}/pending.png +0 -0
  127. data/public/{images → stylesheets/images}/rails.png +0 -0
  128. data/public/{images → stylesheets/images}/running.png +0 -0
  129. data/public/{images → stylesheets/images}/stopped.png +0 -0
  130. data/public/{images → stylesheets/images}/topbar-bg.png +0 -0
  131. data/public/stylesheets/jquery.mobile-1.0b1.min.css +8 -0
  132. data/public/stylesheets/new.css +53 -0
  133. data/server.rb +487 -175
  134. data/support/condor/bash/cached_images.sh +8 -0
  135. data/support/condor/bash/cloud_exit_hook.sh +17 -0
  136. data/support/condor/bash/cloud_functions +175 -0
  137. data/support/condor/bash/cloud_prepare_hook.sh +20 -0
  138. data/support/condor/bash/libvirt_cloud_script.sh +13 -0
  139. data/support/condor/config/50condor_cloud.config +37 -0
  140. data/support/condor/config/50condor_cloud_node.config +37 -0
  141. data/support/condor/config/condor-cloud +2 -0
  142. data/support/condor/config/condor_config.local +44 -0
  143. data/support/fedora/deltacloud-core +48 -26
  144. data/support/fedora/deltacloud-core-config +26 -0
  145. data/support/fedora/deltacloud-core.spec +314 -68
  146. data/support/fedora/deltacloudd-fedora +5 -0
  147. data/tests/common.rb +34 -4
  148. data/tests/drivers/mock/api_test.rb +3 -3
  149. data/tests/drivers/mock/images_test.rb +12 -0
  150. data/tests/drivers/mock/instances_test.rb +2 -0
  151. data/tests/rabbit_test.rb +2 -2
  152. data/views/addresses/_address.html.haml +6 -0
  153. data/views/addresses/associate.html.haml +12 -0
  154. data/views/addresses/index.html.haml +9 -0
  155. data/views/addresses/index.xml.haml +4 -0
  156. data/views/addresses/show.html.haml +21 -0
  157. data/views/addresses/show.xml.haml +14 -0
  158. data/views/api/show.html.haml +6 -11
  159. data/views/api/show.xml.haml +2 -0
  160. data/views/blobs/new.html.haml +24 -23
  161. data/views/blobs/show.html.haml +30 -31
  162. data/views/buckets/index.html.haml +9 -21
  163. data/views/buckets/index.xml.haml +3 -7
  164. data/views/buckets/new.html.haml +13 -12
  165. data/views/buckets/show.html.haml +22 -22
  166. data/views/buckets/show.xml.haml +5 -3
  167. data/views/docs/collection.html.haml +23 -34
  168. data/views/docs/collection.xml.haml +2 -2
  169. data/views/docs/index.html.haml +9 -13
  170. data/views/docs/index.xml.haml +1 -1
  171. data/views/docs/operation.html.haml +28 -38
  172. data/views/docs/operation.xml.haml +1 -1
  173. data/views/drivers/index.html.haml +8 -13
  174. data/views/drivers/show.html.haml +18 -18
  175. data/views/error.html.haml +32 -27
  176. data/views/errors/400.html.haml +41 -0
  177. data/views/errors/{validation_failure.xml.haml → 400.xml.haml} +0 -4
  178. data/views/errors/401.html.haml +41 -0
  179. data/views/errors/{auth_exception.xml.haml → 401.xml.haml} +0 -0
  180. data/views/errors/403.html.haml +42 -0
  181. data/views/errors/{not_allowed.xml.haml → 403.xml.haml} +0 -0
  182. data/views/errors/404.html.haml +29 -0
  183. data/views/errors/{not_found.xml.haml → 404.xml.haml} +1 -1
  184. data/views/errors/405.html.haml +29 -0
  185. data/views/errors/405.xml.haml +5 -0
  186. data/views/errors/500.html.haml +43 -0
  187. data/views/errors/500.xml.haml +5 -0
  188. data/views/errors/502.html.haml +43 -0
  189. data/views/errors/{backend_error.xml.haml → 502.xml.haml} +1 -2
  190. data/views/errors/backend_capability_failure.html.haml +27 -9
  191. data/views/firewalls/index.html.haml +15 -0
  192. data/views/firewalls/index.xml.haml +28 -0
  193. data/views/firewalls/new.html.haml +11 -0
  194. data/views/firewalls/new_rule.html.haml +20 -0
  195. data/views/firewalls/show.html.haml +42 -0
  196. data/views/firewalls/show.xml.haml +26 -0
  197. data/views/hardware_profiles/index.html.haml +15 -23
  198. data/views/hardware_profiles/show.html.haml +22 -18
  199. data/views/images/index.html.haml +11 -23
  200. data/views/images/index.xml.haml +4 -13
  201. data/views/images/new.html.haml +12 -13
  202. data/views/images/show.html.haml +26 -20
  203. data/views/images/show.xml.haml +2 -1
  204. data/views/instance_states/show.html.haml +21 -25
  205. data/views/instances/index.html.haml +13 -30
  206. data/views/instances/index.xml.haml +2 -23
  207. data/views/instances/new.html.haml +83 -88
  208. data/views/instances/show.html.haml +53 -55
  209. data/views/instances/show.xml.haml +12 -10
  210. data/views/keys/index.html.haml +13 -24
  211. data/views/keys/new.html.haml +7 -7
  212. data/views/keys/show.html.haml +26 -21
  213. data/views/layout.html.haml +28 -27
  214. data/views/load_balancers/index.html.haml +11 -31
  215. data/views/load_balancers/index.xml.haml +0 -1
  216. data/views/load_balancers/new.html.haml +1 -1
  217. data/views/load_balancers/show.html.haml +33 -34
  218. data/views/load_balancers/show.xml.haml +2 -2
  219. data/views/realms/index.html.haml +11 -24
  220. data/views/realms/index.xml.haml +2 -8
  221. data/views/realms/show.html.haml +17 -15
  222. data/views/realms/show.xml.haml +2 -1
  223. data/views/storage_snapshots/index.html.haml +11 -21
  224. data/views/storage_snapshots/index.xml.haml +2 -5
  225. data/views/storage_snapshots/new.html.haml +1 -1
  226. data/views/storage_snapshots/show.html.haml +21 -13
  227. data/views/storage_snapshots/show.xml.haml +2 -1
  228. data/views/storage_volumes/index.html.haml +11 -34
  229. data/views/storage_volumes/new.html.haml +1 -1
  230. data/views/storage_volumes/show.html.haml +33 -27
  231. data/views/storage_volumes/show.xml.haml +2 -1
  232. metadata +266 -178
  233. data/lib/sinatra/respond_to.rb +0 -248
  234. data/support/fedora/deltacloudd +0 -128
  235. data/support/fedora/rubygem-deltacloud-core.spec +0 -127
  236. data/views/accounts/index.html.haml +0 -11
  237. data/views/accounts/show.html.haml +0 -30
  238. data/views/errors/auth_exception.html.haml +0 -8
  239. data/views/errors/backend_error.html.haml +0 -22
  240. data/views/errors/not_allowed.html.haml +0 -6
  241. data/views/errors/not_found.html.haml +0 -6
  242. data/views/errors/validation_failure.html.haml +0 -11
data/LICENSE CHANGED
@@ -174,3 +174,148 @@
174
174
  of your accepting any such warranty or additional liability.
175
175
 
176
176
  END OF TERMS AND CONDITIONS
177
+
178
+ DELTACLOUD SERVER SUBCOMPONENTS
179
+
180
+ The Deltacloud Server includes a number of subcomponents with separate
181
+ copyrights and license terms. Your use of the source code for the these
182
+ subcomponents is subject to the terms and conditions of the following
183
+ licenses.
184
+
185
+ For the jQuery and jQuery mobile components in
186
+ public/javascripts/jquery.*.js:
187
+
188
+ /*!
189
+ * jQuery JavaScript Library v1.6.2
190
+ * http://jquery.com/
191
+ *
192
+ * Copyright 2011, John Resig
193
+ * Dual licensed under the MIT or GPL Version 2 licenses.
194
+ * http://jquery.org/license
195
+ *
196
+ * Includes Sizzle.js
197
+ * http://sizzlejs.com/
198
+ * Copyright 2011, The Dojo Foundation
199
+ * Released under the MIT, BSD, and GPL Licenses.
200
+ *
201
+ * Date: Thu Jun 30 14:16:56 2011 -0400
202
+ */
203
+
204
+ Deltacloud uses jQuery and jQuery mobile under the MIT license.
205
+
206
+ For the lib/sinatra/accept_media_types.rb component:
207
+
208
+ # Copyright (C) 2009 Martin Aumont (mynyml)
209
+ #
210
+ # Permission is hereby granted, free of charge, to any person obtaining a
211
+ # copy of this software and associated documentation files (the
212
+ # "Software"), to deal in the Software without restriction, including
213
+ # without limitation the rights to use, copy, modify, merge, publish,
214
+ # distribute, sublicense, and/or sell copies of the Software, and to permit
215
+ # persons to whom the Software is furnished to do so, subject to the
216
+ # following conditions:
217
+ #
218
+ # The above copyright notice and this permission notice shall be included
219
+ # in all copies or substantial portions of the Software.
220
+ #
221
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
222
+ # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
223
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
224
+ # NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
225
+ # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
226
+ # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
227
+ # USE OR OTHER DEALINGS IN THE SOFTWARE.
228
+
229
+ For the lib/sinatra/body_proxy.rb and lib/sinatra/rack_syslog.rb components:
230
+
231
+ Copyright (c) 2007, 2008, 2009, 2010 Christian Neukirchen
232
+ <purl.org/net/chneukirchen>
233
+
234
+ Permission is hereby granted, free of charge, to any person obtaining a copy
235
+ of this software and associated documentation files (the "Software"), to
236
+ deal in the Software without restriction, including without limitation the
237
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
238
+ sell copies of the Software, and to permit persons to whom the Software is
239
+ furnished to do so, subject to the following conditions:
240
+
241
+ The above copyright notice and this permission notice shall be included in
242
+ all copies or substantial portions of the Software.
243
+
244
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
245
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
246
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
247
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
248
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
249
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
250
+
251
+ For the lib/sinatra/rack_accept.rb component:
252
+
253
+ (The MIT License)
254
+
255
+ Copyright (c) 2009-2010 Chris Hoffman
256
+
257
+ Permission is hereby granted, free of charge, to any person obtaining a
258
+ copy of this software and associated documentation files (the
259
+ 'Software'), to deal in the Software without restriction, including
260
+ without limitation the rights to use, copy, modify, merge, publish,
261
+ distribute, sublicense, and/or sell copies of the Software, and to permit
262
+ persons to whom the Software is furnished to do so, subject to the
263
+ following conditions:
264
+
265
+ The above copyright notice and this permission notice shall be included
266
+ in all copies or substantial portions of the Software.
267
+
268
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS
269
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
270
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
271
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
272
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
273
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
274
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
275
+
276
+ For the lib/sinatra/rack_date.rb, lib/sinatra/rack_etag.rb, and
277
+ lib/sinatra/rack_runtime.rb components:
278
+
279
+ Copyright (c) 2008 The Committers
280
+
281
+ Permission is hereby granted, free of charge, to any person obtaining a
282
+ copy of this software and associated documentation files (the
283
+ "Software"), to deal in the Software without restriction, including
284
+ without limitation the rights to use, copy, modify, merge, publish,
285
+ distribute, sublicense, and/or sell copies of the Software, and to
286
+ permit persons to whom the Software is furnished to do so, subject to
287
+ the following conditions:
288
+
289
+ The above copyright notice and this permission notice shall be included
290
+ in all copies or substantial portions of the Software.
291
+
292
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
293
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
294
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
295
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM,
296
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
297
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
298
+ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
299
+
300
+ For the lib/sinatra/url_for.rb component:
301
+
302
+ Copyright (C) 2009 Eric Kidd
303
+
304
+ Permission is hereby granted, free of charge, to any person obtaining a
305
+ copy of this software and associated documentation files (the
306
+ "Software"), to deal in the Software without restriction, including
307
+ without limitation the rights to use, copy, modify, merge, publish,
308
+ distribute, sublicense, and/or sell copies of the Software, and to permit
309
+ persons to whom the Software is furnished to do so, subject to the
310
+ following conditions:
311
+
312
+ The above copyright notice and this permission notice shall be included
313
+ in all copies or substantial portions of the Software.
314
+
315
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
316
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
317
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
318
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
319
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
320
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
321
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
data/NOTICE CHANGED
@@ -1,5 +1,5 @@
1
1
  Apache Deltacloud
2
- Copyright 2010 The Apache Software Foundation
2
+ Copyright 2010, 2011 The Apache Software Foundation
3
3
 
4
4
  This product includes software developed at The Apache Software Foundation
5
5
  (http://www.apache.org/).
@@ -11,3 +11,12 @@ This product includes software developed by IBM Corporation
11
11
 
12
12
  This product includes software developed by the OpenNebula Project
13
13
  (http://opennebula.org/)
14
+
15
+ This product includes software developed by the jQuery Project
16
+ (http://jquerymobile.com/)
17
+
18
+ This product includes icons created by David Vignon licensed under LGPL
19
+ (http://www.icon-king.com/)
20
+
21
+ This product includes software developed by Christian Neukirchen
22
+ (https://github.com/rack/rack)
data/Rakefile CHANGED
@@ -19,7 +19,7 @@
19
19
 
20
20
  require 'rake'
21
21
  require 'rake/testtask'
22
- require 'rake/gempackagetask'
22
+ require 'rubygems/package_task'
23
23
 
24
24
  begin
25
25
  require 'ci/reporter/rake/test_unit'
@@ -86,6 +86,54 @@ rescue LoadError
86
86
  end
87
87
 
88
88
  spec = Gem::Specification.load('deltacloud-core.gemspec')
89
- Rake::GemPackageTask.new(spec) do |pkg|
89
+
90
+ Gem::PackageTask.new(spec) do |pkg|
90
91
  pkg.need_tar = true
91
92
  end
93
+
94
+ desc "List all REST routes defined through Rabbit"
95
+ task :routes do
96
+ require 'server.rb'
97
+ Sinatra::Rabbit::routes.each do |m, path|
98
+ puts sprintf("\033[1;30m%-8s\033[0m %s", m.to_s.upcase, path)
99
+ end
100
+ end
101
+
102
+ namespace :mock do
103
+ namespace :fixtures do
104
+ desc "Setup Mock driver fixtures"
105
+ task 'setup' do
106
+ if ENV["DELTACLOUD_MOCK_STORAGE"]
107
+ storage_root = ENV["DELTACLOUD_MOCK_STORAGE"]
108
+ elsif ENV["USER"]
109
+ storage_root = File::join("/var/tmp", "deltacloud-mock-#{ENV["USER"]}")
110
+ else
111
+ raise "Please set either the DELTACLOUD_MOCK_STORAGE or USER environment variable"
112
+ end
113
+ data = Dir::glob(File::join(File::dirname(__FILE__), "lib", "deltacloud", "drivers", "mock", "data", "*"))
114
+ FileUtils::mkdir_p(storage_root, :verbose => true)
115
+ FileUtils::cp_r(data, storage_root, :verbose => true)
116
+ end
117
+
118
+ desc "Remove Mock driver fixtures"
119
+ task 'clean' do
120
+ if ENV["DELTACLOUD_MOCK_STORAGE"]
121
+ storage_root = ENV["DELTACLOUD_MOCK_STORAGE"]
122
+ elsif ENV["USER"]
123
+ storage_root = File::join("/var/tmp", "deltacloud-mock-#{ENV["USER"]}")
124
+ else
125
+ raise "Please set either the DELTACLOUD_MOCK_STORAGE or USER environment variable"
126
+ end
127
+ FileUtils::rm_rf(storage_root, :verbose => true)
128
+ end
129
+
130
+ desc "Reset Mock driver fixtures"
131
+ task 'reset' do
132
+ Rake::Task["mock:fixtures:clean"].reenable
133
+ Rake::Task["mock:fixtures:clean"].invoke
134
+ Rake::Task["mock:fixtures:setup"].reenable
135
+ Rake::Task["mock:fixtures:setup"].invoke
136
+ end
137
+
138
+ end
139
+ end
@@ -1,7 +1,24 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ # Licensed to the Apache Software Foundation (ASF) under one or more
4
+ # contributor license agreements. See the NOTICE file distributed with
5
+ # this work for additional information regarding copyright ownership. The
6
+ # ASF licenses this file to you under the Apache License, Version 2.0 (the
7
+ # "License"); you may not use this file except in compliance with the
8
+ # License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15
+ # License for the specific language governing permissions and limitations
16
+ # under the License.
17
+ #
18
+
3
19
  require 'rubygems'
4
20
  require 'optparse'
21
+ require 'yaml'
5
22
 
6
23
  # See if we can require +name+ and return +true+ if the library is there,
7
24
  # +false+ otherwise. Note that, as a side effect, the library will be
@@ -15,6 +32,7 @@ def library_present?(name)
15
32
  end
16
33
  end
17
34
 
35
+ DEFAULT_CONFIG = "~/.deltacloud/config"
18
36
  options = {
19
37
  :env => 'development'
20
38
  }
@@ -39,8 +57,42 @@ BANNER
39
57
  opts.on( '-P', '--provider PROVIDER', 'Use PROVIDER (default is set in the driver)') do |provider|
40
58
  ENV['API_PROVIDER'] = provider
41
59
  end
60
+ opts.on( '-c', '--config [FILE]', 'Read provider and other config from FILE (default: ~/.deltacloud/config)') do |config|
61
+ options[:config] = File::expand_path(config || DEFAULT_CONFIG)
62
+ end
42
63
  opts.on( '-e', '--env ENV', 'Environment (default: "development")') { |env| options[:env] = env }
64
+ opts.on( '-d', '--daemon', 'Run daemonized in the background, logging to SYSLOG (default: "disabled")') do
65
+ options[:daemon] = true
66
+ end
67
+ opts.on( '-u', '--user USER', 'User to run daemon as. Use with -d (default: "nobody")') { |user| options[:user] = user }
68
+ opts.on( '', '--pid PID', 'File to store PID (default: tmp/pids/thin.pid)') { |pid| options[:pid] = pid }
69
+ opts.on( '-l', '--drivers', 'List available drivers') { |env| options[:drivers] = true }
70
+ opts.on( '-s', '--ssl', 'Enable SSL (default: disabled)') { |ssl| options[:ssl] = true }
71
+ opts.on( '-k', '--ssl-key KEY', 'SSL key file to use') { |key| options[:ssl_key] = key }
72
+ opts.on( '-C', '--ssl-cert CERT', 'SSL certificate file to use') { |cert| options[:ssl_cert] = cert }
73
+ opts.on( '-t', '--timeout TIMEOUT', 'Timeout for single request (default: 60)') do |timeout|
74
+ ENV["API_TIMEOUT"] = timeout
75
+ end
43
76
  opts.on( '-h', '--help', '') { options[:help] = true }
77
+
78
+ opts.separator <<EOS
79
+
80
+ Config file:
81
+
82
+ Server configuration can be specified in a YAML file; the file must
83
+ contain a hash, where the keys are driver names; each driver entry is
84
+ also a hash. Possible keys are
85
+ :provider - the provider to use for this driver
86
+ :user - the user name for this driver
87
+ :password - the password for this driver
88
+
89
+ Note that specifying :user and :password turns off authentication on the
90
+ server, and any request is forwarded to the backend cloud with the
91
+ specified credentials.
92
+
93
+ Note, for SSL you need to have API_SSL_KEY and API_SSL_CERT environment
94
+ variables set.
95
+ EOS
44
96
  end
45
97
 
46
98
  optparse.parse!
@@ -50,19 +102,61 @@ if options[:help]
50
102
  exit(0)
51
103
  end
52
104
 
53
- unless ENV["API_DRIVER"]
105
+ unless options[:drivers] or ENV["API_DRIVER"]
54
106
  puts "You need to specify a driver to use (-i <driver>)"
107
+ puts "To list all available drivers try: deltacloudd --drivers"
55
108
  exit(1)
56
109
  end
57
110
 
111
+ if options[:drivers]
112
+ require 'server.rb'
113
+ puts "Available drivers:\n\n"
114
+ puts "* " + driver_config.keys.map{ |d| d.to_s }.join("\n* ")
115
+ puts
116
+ exit(0)
117
+ end
118
+
119
+
120
+ if options[:ssl]
121
+ unless options[:ssl_key]
122
+ puts "You need to set SSL key using '-k /path/to/keyfile.key'"
123
+ exit(1)
124
+ end
125
+ unless options[:ssl_cert]
126
+ puts "You need to set SSL certificate using '-C /path/to/certificate.crt'"
127
+ exit(1)
128
+ end
129
+ end
130
+
131
+ if options[:config]
132
+ cfg = YAML::load(File.read(options[:config]))
133
+ if c = cfg[ENV["API_DRIVER"].to_sym]
134
+ ENV["API_PROVIDER"] ||= c[:provider]
135
+ ENV["API_USER"] ||= c[:user]
136
+ ENV["API_PASSWORD"] ||= c[:password]
137
+ end
138
+ end
139
+
58
140
  ENV["API_HOST"] = "localhost" unless ENV["API_HOST"]
59
141
  ENV["API_PORT"] = "3001" unless ENV["API_PORT"]
60
142
 
61
- msg = "Starting Deltacloud API :: #{ENV["API_DRIVER"]} "
62
- msg << ":: #{ENV['API_PROVIDER']} " if ENV['API_PROVIDER']
63
- msg << ":: http://#{ENV["API_HOST"]}:#{ENV["API_PORT"]}/api"
64
- puts msg
65
- puts
143
+ unless options[:daemon]
144
+ msg = "Starting Deltacloud API :: #{ENV["API_DRIVER"]} "
145
+ msg << ":: #{ENV['API_PROVIDER']} " if ENV['API_PROVIDER']
146
+ if options[:ssl]
147
+ msg << ":: https://#{ENV["API_HOST"]}:#{ENV["API_PORT"]}/api"
148
+ else
149
+ msg << ":: http://#{ENV["API_HOST"]}:#{ENV["API_PORT"]}/api"
150
+ end
151
+ puts msg
152
+ puts
153
+ end
154
+
155
+ if ENV['API_USER'] && ENV['API_PASSWORD']
156
+ puts "Warning: API_USER and API_PASSWORD set in environment"
157
+ puts " anybody can access this server with your credentials"
158
+ puts
159
+ end
66
160
 
67
161
  dirname="#{File.dirname(__FILE__)}/.."
68
162
 
@@ -105,9 +199,17 @@ else
105
199
  argv_opts << ['--rackup', 'config.ru' ]
106
200
  argv_opts << ['--chdir', dirname ]
107
201
  argv_opts << ['-e', options[:env] ]
108
- argv_opts << ['--timeout', '60']
109
- argv_opts << ['--threaded', '-D', '--stats', '/stats']
202
+ argv_opts << ['--timeout', ENV["API_TIMEOUT"] || '60']
203
+ argv_opts << ['--threaded', '-D' ]
204
+ if options[:ssl]
205
+ argv_opts << [ '--ssl', '--ssl-key-file', options[:ssl_key], '--ssl-cert-file', options[:ssl_cert]]
206
+ end
110
207
 
208
+ if options[:daemon]
209
+ options[:env] = "production"
210
+ argv_opts << [ "--daemonize", "--user", options[:user] || 'nobody', "--tag", "deltacloud-#{ENV['API_DRIVER']}"]
211
+ argv << [ "--pid", options[:pid]] if options[:pid]
212
+ end
111
213
  argv_opts.flatten!
112
214
 
113
215
  if have_rerun && options[:env] == "development"
@@ -119,11 +221,6 @@ else
119
221
  rerun.join
120
222
  else
121
223
  thin = Thin::Runner.new(argv_opts)
122
-
123
- begin
124
- thin.run!
125
- rescue Exception => e
126
- puts "ERROR: #{e.message}"
127
- end
224
+ thin.run!
128
225
  end
129
226
  end
@@ -0,0 +1,14 @@
1
+ <addresses>
2
+ <address mac="00:1A:4A:22:20:01">172.31.0.101</address>
3
+ <address mac="00:1A:4A:22:20:02">172.31.0.102</address>
4
+ <address mac="00:1A:4A:22:20:03">172.31.0.103</address>
5
+ <address mac="00:1A:4A:22:20:04">172.31.0.104</address>
6
+ <address mac="00:1A:4A:22:20:05">172.31.0.105</address>
7
+ <address mac="00:1A:4A:22:20:06">172.31.0.106</address>
8
+ <address mac="00:1A:4A:22:20:07">172.31.0.107</address>
9
+ <address mac="00:1A:4A:22:20:08">172.31.0.108</address>
10
+ <address mac="00:1A:4A:22:20:09">172.31.0.109</address>
11
+ <address mac="00:1A:4A:22:20:10">172.31.0.110</address>
12
+ <address mac="00:1A:4A:22:20:11">172.31.0.111</address>
13
+ <address mac="00:1A:4A:22:20:12">172.31.0.112</address>
14
+ </addresses>
@@ -0,0 +1,30 @@
1
+ ---
2
+
3
+ # The network bridge used for VMs.
4
+ :default_bridge: br0
5
+ :username: condor
6
+ :password: deltacloud
7
+
8
+ # The location of your images. These would be regular KVM formatted images.
9
+ # Note that this variable also exists in the condor cloud configuration in
10
+ # /usr/libexec/condor/cloud_functions. This directory must also be shared
11
+ # accross all nodes so that they all have access to the images.
12
+ #
13
+ # *** If you change this check /usr/libexec/condor/cloud_functions ***
14
+ :image_storage: /var/lib/condor-cloud/shared_images
15
+
16
+ # There are currently 2 ways to configure the IP addresses of instances,
17
+ # one is to use the ip server agent in each image, the other is a simple
18
+ # mapping between MAC and IP. The latter is the default.
19
+ #
20
+ # For the simple mac/ip mapping, see config/addresses.xml for the mapping list.
21
+ # You must then configure your DHCPD server to hand out those addresses
22
+ # for the given macs.
23
+ :default_ip_agent: DefaultIPAgent
24
+
25
+ #:default_ip_agent: ConfServerIPAgent
26
+ #:ip_agent_address: '10.34.32.181:4444'
27
+ #:ip_agent_version: '0.0.1'
28
+
29
+ :vnc_listen_port: '5900'
30
+ :vnc_listen_ip: '0.0.0.0'