deltacloud-core 0.1.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. data/DISCLAIMER +8 -0
  2. data/{COPYING → LICENSE} +0 -0
  3. data/NOTICE +13 -0
  4. data/Rakefile +50 -51
  5. data/bin/deltacloudd +8 -1
  6. data/config.ru +0 -2
  7. data/config/drivers.yaml +48 -0
  8. data/deltacloud-core.gemspec +75 -0
  9. data/deltacloud.rb +3 -2
  10. data/lib/deltacloud/backend_capability.rb +15 -3
  11. data/lib/deltacloud/base_driver.rb +0 -2
  12. data/lib/deltacloud/base_driver/base_driver.rb +85 -89
  13. data/lib/deltacloud/base_driver/features.rb +61 -7
  14. data/lib/deltacloud/base_driver/mock_driver.rb +42 -43
  15. data/lib/deltacloud/core_ext.rb +18 -0
  16. data/lib/deltacloud/core_ext/integer.rb +31 -0
  17. data/lib/deltacloud/core_ext/string.rb +50 -0
  18. data/lib/deltacloud/drivers/azure/azure_driver.rb +71 -22
  19. data/lib/deltacloud/drivers/ec2/ec2_driver.rb +641 -584
  20. data/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb +0 -2
  21. data/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb +167 -0
  22. data/lib/deltacloud/drivers/gogrid/gogrid_client.rb +39 -1
  23. data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +41 -25
  24. data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob1.yml +6 -3
  25. data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob2.yml +6 -3
  26. data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob3.yml +4 -2
  27. data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob4.yml +5 -2
  28. data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob5.yml +4 -2
  29. data/lib/deltacloud/drivers/mock/data/instances/inst0.yml +1 -0
  30. data/lib/deltacloud/drivers/mock/data/instances/inst1.yml +1 -0
  31. data/lib/deltacloud/drivers/mock/data/instances/inst2.yml +1 -0
  32. data/lib/deltacloud/drivers/mock/data/storage_volumes/vol1.yml +1 -0
  33. data/lib/deltacloud/drivers/mock/data/storage_volumes/vol2.yml +1 -0
  34. data/lib/deltacloud/drivers/mock/data/storage_volumes/vol3.yml +1 -0
  35. data/lib/deltacloud/drivers/mock/mock_driver.rb +138 -30
  36. data/lib/deltacloud/drivers/opennebula/cloud_client.rb +13 -15
  37. data/lib/deltacloud/drivers/opennebula/occi_client.rb +13 -15
  38. data/lib/deltacloud/drivers/opennebula/opennebula_driver.rb +13 -15
  39. data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +224 -113
  40. data/lib/deltacloud/drivers/rhevm/rhevm_client.rb +332 -0
  41. data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +221 -170
  42. data/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb +0 -1
  43. data/lib/deltacloud/drivers/sbc/sbc_client.rb +247 -0
  44. data/lib/deltacloud/drivers/sbc/sbc_driver.rb +297 -0
  45. data/lib/deltacloud/drivers/terremark/terremark_driver.rb +0 -2
  46. data/lib/deltacloud/hardware_profile.rb +1 -3
  47. data/lib/deltacloud/helpers.rb +0 -2
  48. data/lib/deltacloud/helpers/application_helper.rb +86 -12
  49. data/lib/deltacloud/helpers/blob_stream.rb +19 -2
  50. data/lib/deltacloud/helpers/conversion_helper.rb +0 -2
  51. data/lib/deltacloud/helpers/hardware_profiles_helper.rb +0 -2
  52. data/lib/deltacloud/method_serializer.rb +0 -2
  53. data/lib/deltacloud/models/base_model.rb +0 -2
  54. data/lib/deltacloud/models/blob.rb +1 -2
  55. data/lib/deltacloud/models/bucket.rb +0 -2
  56. data/lib/deltacloud/models/image.rb +0 -2
  57. data/lib/deltacloud/models/instance.rb +19 -2
  58. data/lib/deltacloud/models/instance_profile.rb +4 -2
  59. data/lib/deltacloud/models/key.rb +0 -2
  60. data/lib/deltacloud/models/load_balancer.rb +0 -2
  61. data/lib/deltacloud/models/realm.rb +0 -2
  62. data/lib/deltacloud/models/storage_snapshot.rb +0 -2
  63. data/lib/deltacloud/models/storage_volume.rb +4 -2
  64. data/lib/deltacloud/runner.rb +132 -0
  65. data/lib/deltacloud/state_machine.rb +0 -2
  66. data/lib/deltacloud/validation.rb +9 -7
  67. data/lib/drivers.rb +36 -48
  68. data/lib/sinatra/accept_media_types.rb +26 -0
  69. data/lib/sinatra/lazy_auth.rb +16 -0
  70. data/lib/sinatra/rabbit.rb +112 -54
  71. data/lib/sinatra/rack_driver_select.rb +50 -16
  72. data/lib/sinatra/rack_etag.rb +79 -0
  73. data/lib/sinatra/rack_matrix_params.rb +84 -0
  74. data/lib/sinatra/rack_runtime.rb +47 -0
  75. data/lib/sinatra/static_assets.rb +16 -0
  76. data/lib/sinatra/url_for.rb +31 -4
  77. data/public/favicon.ico +0 -0
  78. data/public/images/bread-bg.png +0 -0
  79. data/public/images/error.png +0 -0
  80. data/public/images/pending.png +0 -0
  81. data/public/images/running.png +0 -0
  82. data/public/images/stopped.png +0 -0
  83. data/public/javascripts/application.js +35 -0
  84. data/public/stylesheets/compiled/application.css +59 -5
  85. data/public/stylesheets/compiled/screen.css +1 -1
  86. data/server.rb +293 -29
  87. data/support/fedora/deltacloud-core +78 -0
  88. data/support/fedora/deltacloud-core.spec +143 -0
  89. data/support/fedora/deltacloudd +78 -18
  90. data/support/fedora/rubygem-deltacloud-core.spec +76 -40
  91. data/tests/common.rb +172 -0
  92. data/tests/drivers/mock/api_test.rb +133 -0
  93. data/tests/drivers/mock/hardware_profiles_test.rb +134 -0
  94. data/tests/drivers/mock/images_test.rb +126 -0
  95. data/tests/drivers/mock/instance_states_test.rb +71 -0
  96. data/tests/drivers/mock/instances_test.rb +236 -0
  97. data/tests/drivers/mock/realms_test.rb +93 -0
  98. data/tests/drivers/mock/setup.rb +3 -0
  99. data/tests/drivers/mock/url_for_test.rb +67 -0
  100. data/tests/drivers/rackspace/api_test.rb +41 -0
  101. data/tests/drivers/rackspace/hardware_profiles_test.rb +53 -0
  102. data/tests/drivers/rackspace/images_test.rb +40 -0
  103. data/tests/drivers/rackspace/instances_test.rb +161 -0
  104. data/tests/drivers/rackspace/realms_test.rb +36 -0
  105. data/tests/drivers/rackspace/setup.rb +14 -0
  106. data/tests/drivers/rhevm/api_test.rb +39 -0
  107. data/tests/drivers/rhevm/hardware_profiles_test.rb +53 -0
  108. data/tests/drivers/rhevm/images_test.rb +42 -0
  109. data/tests/drivers/rhevm/instances_test.rb +179 -0
  110. data/tests/drivers/rhevm/realms_test.rb +35 -0
  111. data/tests/drivers/rhevm/setup.rb +14 -0
  112. data/tests/rabbit_test.rb +52 -0
  113. data/views/api/show.html.haml +2 -5
  114. data/views/blobs/new.html.haml +17 -1
  115. data/views/blobs/show.html.haml +6 -0
  116. data/views/blobs/show.xml.haml +5 -1
  117. data/views/buckets/index.html.haml +1 -12
  118. data/views/buckets/index.xml.haml +3 -5
  119. data/views/docs/operation.html.haml +23 -11
  120. data/views/drivers/index.html.haml +15 -0
  121. data/views/drivers/index.xml.haml +7 -0
  122. data/views/drivers/show.html.haml +20 -0
  123. data/views/drivers/show.xml.haml +7 -0
  124. data/views/error.html.haml +31 -0
  125. data/views/errors/auth_exception.xml.haml +2 -1
  126. data/views/errors/backend_capability_failure.xml.haml +2 -1
  127. data/views/errors/backend_error.html.haml +3 -0
  128. data/views/errors/backend_error.xml.haml +2 -2
  129. data/views/errors/validation_failure.xml.haml +3 -2
  130. data/views/images/index.html.haml +1 -6
  131. data/views/images/index.xml.haml +2 -0
  132. data/views/images/new.html.haml +14 -0
  133. data/views/images/show.xml.haml +2 -0
  134. data/views/instances/index.html.haml +8 -6
  135. data/views/instances/index.xml.haml +4 -0
  136. data/views/instances/new.html.haml +40 -11
  137. data/views/instances/run.html.haml +9 -0
  138. data/views/instances/run.xml.haml +7 -0
  139. data/views/instances/run_command.html.haml +16 -0
  140. data/views/instances/show.html.haml +14 -0
  141. data/views/instances/show.xml.haml +12 -4
  142. data/views/layout.html.haml +7 -2
  143. data/views/load_balancers/index.html.haml +1 -1
  144. data/views/load_balancers/new.html.haml +2 -2
  145. data/views/load_balancers/show.html.haml +1 -1
  146. data/views/storage_snapshots/index.html.haml +3 -0
  147. data/views/storage_snapshots/new.html.haml +9 -0
  148. data/views/storage_volumes/attach.html.haml +20 -0
  149. data/views/storage_volumes/index.html.haml +16 -1
  150. data/views/storage_volumes/index.xml.haml +1 -10
  151. data/views/storage_volumes/new.html.haml +17 -0
  152. data/views/storage_volumes/show.html.haml +8 -0
  153. data/views/storage_volumes/show.xml.haml +25 -3
  154. metadata +197 -127
  155. data/lib/deltacloud/drivers/rackspace/rackspace_client.rb +0 -130
  156. data/parse.rb +0 -7
  157. data/test.rb +0 -3
  158. data/views/api/drivers.xml.haml +0 -6
@@ -1,6 +1,4 @@
1
1
  #
2
- # Copyright (C) 2009,2010 Red Hat, Inc.
3
- #
4
2
  # Licensed to the Apache Software Foundation (ASF) under one or more
5
3
  # contributor license agreements. See the NOTICE file distributed with
6
4
  # this work for additional information regarding copyright ownership. The
@@ -0,0 +1,167 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright ownership. The
4
+ # ASF licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the
6
+ # License. You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations
14
+ # under the License.
15
+ #
16
+
17
+ require 'deltacloud/drivers/ec2/ec2_driver.rb'
18
+
19
+ module Deltacloud
20
+ module Drivers
21
+ module Eucalyptus
22
+ class EucalyptusDriver < EC2::EC2Driver
23
+
24
+ def supported_collections
25
+ DEFAULT_COLLECTIONS + [ :keys, :buckets ]
26
+ end
27
+
28
+ feature :instances, :user_data
29
+ feature :instances, :authentication_key
30
+ feature :instances, :security_group
31
+ feature :instances, :instance_count
32
+ feature :images, :owner_id
33
+
34
+ define_hardware_profile('m1.small') do
35
+ cpu 1
36
+ memory 128
37
+ storage 2
38
+ architecture 'x86_64'
39
+ end
40
+
41
+ define_hardware_profile('c1.medium') do
42
+ cpu 1
43
+ memory 256
44
+ storage 5
45
+ architecture 'x86_64'
46
+ end
47
+
48
+ define_hardware_profile('m1.large') do
49
+ cpu 2
50
+ memory 512
51
+ storage 10
52
+ architecture 'x86_64'
53
+ end
54
+
55
+ define_hardware_profile('m1.xlarge') do
56
+ cpu 2
57
+ memory 1024
58
+ storage 20
59
+ architecture 'x86_64'
60
+ end
61
+
62
+ define_hardware_profile('c1.xlarge') do
63
+ cpu 4
64
+ memory 2048
65
+ storage 20
66
+ architecture 'x86_64'
67
+ end
68
+
69
+ def self.instance_state_machine
70
+ EC2::EC2Driver.instance_state_machine
71
+ end
72
+
73
+ def instance_state_machine
74
+ self.class.instance_state_machine
75
+ end
76
+
77
+ def default_image_owner
78
+ "self"
79
+ end
80
+
81
+ def default_image_type
82
+ nil
83
+ end
84
+
85
+ def tagging?
86
+ false
87
+ end
88
+
89
+ def tag_instance(credentials, instance, name)
90
+ # dummy
91
+ end
92
+
93
+ def untag_instance(credentials, instance_id)
94
+ # dummy
95
+ end
96
+
97
+ # because load balancer is not on the supported_collections,
98
+ # the following methods shouldn't be called.
99
+ def load_balancer(credentials, opts={})
100
+ raise Deltacloud::BackendError.new(500, "Loadbalancer",
101
+ "Loadbalancer not supported in Eucalyptus", "")
102
+ end
103
+
104
+ def load_balancers(credentials, opts=nil)
105
+ raise Deltacloud::BackendError.new(500, "Loadbalancer",
106
+ "Loadbalancer not supported in Eucalyptus", "")
107
+ end
108
+
109
+ def create_load_balancer(credentials, opts={})
110
+ raise Deltacloud::BackendError.new(500, "Loadbalancer",
111
+ "Loadbalancer not supported in Eucalyptus", "")
112
+ end
113
+
114
+ def destroy_load_balancer(credentials, id)
115
+ raise Deltacloud::BackendError.new(500, "Loadbalancer",
116
+ "Loadbalancer not supported in Eucalyptus", "")
117
+ end
118
+
119
+ def lb_register_instance(credentials, opts={})
120
+ raise Deltacloud::BackendError.new(500, "Loadbalancer",
121
+ "Loadbalancer not supported in Eucalyptus", "")
122
+ end
123
+
124
+ def lb_unregister_instance(credentials, opts={})
125
+ raise Deltacloud::BackendError.new(500, "Loadbalancer",
126
+ "Loadbalancer not supported in Eucalyptus", "")
127
+ end
128
+
129
+ def new_client(credentials, type = :ec2)
130
+ klass = case type
131
+ when :ec2 then Aws::Ec2
132
+ when :s3 then Aws::S3
133
+ when :elb then raise Deltacloud::BackendError.new(500,
134
+ "Loadbalancer",
135
+ "Loadbalancer not supported in Eucalyptus", "")
136
+ end
137
+ klass.new(credentials.user, credentials.password,
138
+ endpoint_for_service(type))
139
+ end
140
+
141
+ SERVICE_STUBS = {
142
+ "ec2" => "/services/Eucalyptus",
143
+ "s3" => "/services/Walrus"
144
+ }
145
+
146
+ DEFAULT_PORT = 8773
147
+
148
+ def endpoint_for_service(service)
149
+ service = service.to_s
150
+ endpoint = (Thread.current[:provider] || ENV['API_PROVIDER'])
151
+ if endpoint && endpoint.include?(service)
152
+ # example endpoint: 'ec2=192.168.1.1; s3=192.168.1.2'
153
+ addr = Hash[endpoint.split(";").map { |svc| svc.strip.split("=") }][service]
154
+ host = addr.split(':')[0]
155
+ port = addr.split(':')[1] || DEFAULT_PORT
156
+ stub = SERVICE_STUBS[service]
157
+ { :endpoint_url => "http://#{host}:#{port}#{stub}",
158
+ :connection_mode => :per_thread }
159
+ else
160
+ #EC2_URL/S3_URL env variable will be used by AWS
161
+ { :connection_mode => :per_thread }
162
+ end
163
+ end
164
+ end
165
+ end
166
+ end
167
+ end
@@ -1,7 +1,43 @@
1
+ #
2
+ # Licensed to the Apache Software Foundation (ASF) under one or more
3
+ # contributor license agreements. See the NOTICE file distributed with
4
+ # this work for additional information regarding copyright ownership. The
5
+ # ASF licenses this file to you under the Apache License, Version 2.0 (the
6
+ # "License"); you may not use this file except in compliance with the
7
+ # License. You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14
+ # License for the specific language governing permissions and limitations
15
+ # under the License.
16
+
1
17
  require 'digest/md5'
2
18
  require 'cgi'
3
19
  require 'open-uri'
4
20
 
21
+ module Kernel
22
+ def suppress_warnings
23
+ original_verbosity = $VERBOSE
24
+ $VERBOSE = nil
25
+ result = yield
26
+ $VERBOSE = original_verbosity
27
+ return result
28
+ end
29
+ end
30
+
31
+ module OpenURI
32
+ def self.without_ssl_verification
33
+ old = ::OpenSSL::SSL::VERIFY_PEER
34
+ suppress_warnings { ::OpenSSL::SSL.const_set :VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE }
35
+ yield
36
+ ensure
37
+ suppress_warnings { ::OpenSSL::SSL.const_set :VERIFY_PEER, old }
38
+ end
39
+ end
40
+
5
41
  class GoGridClient
6
42
 
7
43
  def initialize(server='https://api.gogrid.com/api',
@@ -26,7 +62,9 @@ class GoGridClient
26
62
  end
27
63
 
28
64
  def sendAPIRequest(method,params={})
29
- open(getRequestURL(method,params)).read
65
+ OpenURI.without_ssl_verification do
66
+ open(getRequestURL(method,params)).read
67
+ end
30
68
  end
31
69
 
32
70
  def request(method, params={}, version=nil)
@@ -1,6 +1,4 @@
1
1
  #
2
- # Copyright (C) 2009, 2010 Red Hat, Inc.
3
- #
4
2
  # Licensed to the Apache Software Foundation (ASF) under one or more
5
3
  # contributor license agreements. See the NOTICE file distributed with
6
4
  # this work for additional information regarding copyright ownership. The
@@ -36,6 +34,7 @@ module Deltacloud
36
34
  class GogridDriver < Deltacloud::BaseDriver
37
35
 
38
36
  feature :instances, :authentication_password
37
+ feature :instances, :sandboxing
39
38
 
40
39
  def hardware_profiles(credentials, opts={})
41
40
  client = new_client(credentials)
@@ -87,7 +86,7 @@ class GogridDriver < Deltacloud::BaseDriver
87
86
  end
88
87
  end
89
88
 
90
- def create_instance(credentials, image_id, opts=nil)
89
+ def create_instance(credentials, image_id, opts={})
91
90
  server_ram = nil
92
91
  if opts[:hwp_memory]
93
92
  mem = opts[:hwp_memory].to_i
@@ -96,14 +95,15 @@ class GogridDriver < Deltacloud::BaseDriver
96
95
  server_ram = "512MB"
97
96
  end
98
97
  client = new_client(credentials)
99
- name = (opts[:name] && opts[:name]!='') ? opts[:name] : get_random_instance_name
98
+ params = {
99
+ 'name' => opts[:name] || get_random_instance_name,
100
+ 'image' => image_id,
101
+ 'server.ram' => server_ram,
102
+ 'ip' => get_free_ip_from_realm(credentials, opts[:realm_id] || '1')
103
+ }
104
+ params.merge!('isSandbox' => 'true') if opts[:sandbox]
100
105
  safely do
101
- instance = client.request('grid/server/add', {
102
- 'name' => name,
103
- 'image' => image_id,
104
- 'server.ram' => server_ram,
105
- 'ip' => get_free_ip_from_realm(credentials, opts[:realm_id] || '1')
106
- })['list'].first
106
+ instance = client.request('grid/server/add', params)['list'].first
107
107
  if instance
108
108
  login_data = get_login_data(client, instance[:id])
109
109
  if login_data['username'] and login_data['password']
@@ -121,6 +121,21 @@ class GogridDriver < Deltacloud::BaseDriver
121
121
  end
122
122
  end
123
123
 
124
+ def run_on_instance(credentials, opts={})
125
+ target = instance(credentials, opts[:id])
126
+ param = {}
127
+ param[:credentials] = {
128
+ :username => target.username,
129
+ :password => target.password,
130
+ }
131
+ param[:credentials].merge!({ :password => opts[:password]}) if opts[:password].length>0
132
+ param[:port] = opts[:port] || '22'
133
+ param[:ip] = target.public_addresses
134
+ Deltacloud::Runner.execute(opts[:cmd], param)
135
+ end
136
+
137
+
138
+
124
139
  def list_instances(credentials, id)
125
140
  instances = []
126
141
  safely do
@@ -270,8 +285,6 @@ class GogridDriver < Deltacloud::BaseDriver
270
285
  'Unregistering instances from load balancer is not supported in GoGrid')
271
286
  end
272
287
 
273
-
274
-
275
288
  def key(credentials, opts=nil)
276
289
  keys(credentials, opts).first
277
290
  end
@@ -305,6 +318,14 @@ class GogridDriver < Deltacloud::BaseDriver
305
318
  stopped.to( :finish ) .on( :destroy )
306
319
  end
307
320
 
321
+ def catched_exceptions_list
322
+ {
323
+ :auth => [ /Forbidden/ ],
324
+ :error => [ /Error/ ],
325
+ :glob => [ /(.*)/ ]
326
+ }
327
+ end
328
+
308
329
  private
309
330
 
310
331
  def new_client(credentials)
@@ -371,9 +392,9 @@ class GogridDriver < Deltacloud::BaseDriver
371
392
  def convert_image(gg_image, owner_id=nil)
372
393
  Image.new( {
373
394
  :id=>gg_image['id'],
374
- :name => gg_image['friendlyName'],
375
- :description=> convert_description(gg_image),
376
- :owner_id=>gg_image['owner']['name'],
395
+ :name => "#{gg_image['friendlyName']}",
396
+ :description=> convert_description(gg_image).to_s,
397
+ :owner_id=>gg_image['owner']['name'].to_s,
377
398
  :architecture=>convert_arch(gg_image['description']),
378
399
  :state => gg_image['state']['name'].upcase
379
400
  } )
@@ -397,6 +418,7 @@ class GogridDriver < Deltacloud::BaseDriver
397
418
  end
398
419
 
399
420
  def convert_arch(description)
421
+ return 'i386' unless description
400
422
  description.include?('64-bit') ? 'x86_64' : 'i386'
401
423
  end
402
424
 
@@ -410,8 +432,8 @@ class GogridDriver < Deltacloud::BaseDriver
410
432
  opts[:hwp_memory] = (mem.to_i * 1024).to_s
411
433
  end
412
434
  end
413
- prof = InstanceProfile.new("server", opts)
414
435
 
436
+ prof = InstanceProfile.new("server", opts)
415
437
  hwp_name = instance['image']['name']
416
438
  state = convert_server_state(instance['state']['name'], instance['id'])
417
439
 
@@ -422,7 +444,7 @@ class GogridDriver < Deltacloud::BaseDriver
422
444
  # to uniquely identify this instance.
423
445
  :id => instance['name'],
424
446
  :owner_id => owner_id,
425
- :image_id => instance['image']['id'],
447
+ :image_id => "#{instance['image']['id']}",
426
448
  :instance_profile => prof,
427
449
  :name => instance['name'],
428
450
  :realm_id => instance['ip']['datacenter']['id'],
@@ -431,7 +453,8 @@ class GogridDriver < Deltacloud::BaseDriver
431
453
  :public_addresses => [ instance['ip']['ip'] ],
432
454
  :private_addresses => [],
433
455
  :username => instance['username'],
434
- :password => instance['password']
456
+ :password => instance['password'],
457
+ :create_image => 'true'.eql?(instance['isSandbox'])
435
458
  )
436
459
  end
437
460
 
@@ -456,13 +479,6 @@ class GogridDriver < Deltacloud::BaseDriver
456
479
  return ip
457
480
  end
458
481
 
459
- def safely(&block)
460
- begin
461
- block.call
462
- rescue Exception => e
463
- raise Deltacloud::BackendError.new(500, e.class.to_s, e.message, e.backtrace)
464
- end
465
- end
466
482
 
467
483
  end
468
484
 
@@ -1,5 +1,8 @@
1
- :bucket: bucket1
2
- :content_length: 12627
1
+ ---
3
2
  :content_type: text/plain
3
+ :content_length: 17
4
+ :bucket: bucket1
5
+ :user_metadata:
6
+ SOMENEWKEY: NEWVALUE
4
7
  :last_modified: 2010-09-23 16:44:54 +0100
5
- :content: "content of blob 1"
8
+ :content: content of blob 1
@@ -1,5 +1,8 @@
1
- :bucket: bucket1
2
- :content_length: 4420
1
+ ---
2
+ :user_metadata:
3
+ VERSION: "1.2"
3
4
  :content_type: text/html
5
+ :content_length: 56
6
+ :bucket: bucket1
4
7
  :last_modified: 2010-09-23 16:55:05 +0100
5
- :content: "content of blob 2"
8
+ :content: <html><head></head><body>content of blob 2</body></html>
@@ -1,5 +1,7 @@
1
1
  :bucket: bucket1
2
- :content_length: 98732
2
+ :content_length: 17
3
3
  :content_type: text/plain
4
4
  :last_modified: 2010-08-14 02:14:31 +0100
5
- :content: "content of blob 3"
5
+ :content:
6
+ content of blob 3
7
+ :user_metadata: ''
@@ -1,5 +1,8 @@
1
1
  :bucket: bucket2
2
- :content_length: 983232
2
+ :content_length: 17
3
3
  :content_type: application/octet-stream
4
4
  :last_modified: 2010-09-21 06:17:24 +0100
5
- :content: "content of blob 4"
5
+ :content:
6
+ content of blob 4
7
+ :user_metadata:
8
+ some: "value"
@@ -1,5 +1,7 @@
1
1
  :bucket: bucket2
2
- :content_length: 651922
2
+ :content_length: 17
3
3
  :content_type: application/pdf
4
4
  :last_modified: 2009-07-21 11:12:13 +0100
5
- :content: "content of blob 5"
5
+ :content:
6
+ content of blob 5
7
+ :user_metadata: ''
@@ -14,3 +14,4 @@
14
14
  :actions:
15
15
  - :reboot
16
16
  - :stop
17
+ :create_image: true
@@ -7,3 +7,4 @@
7
7
  :realm_id: us
8
8
  :instance_profile: !ruby/object:InstanceProfile
9
9
  id: m1-small
10
+ :create_image: true