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.
- data/DISCLAIMER +8 -0
- data/{COPYING → LICENSE} +0 -0
- data/NOTICE +13 -0
- data/Rakefile +50 -51
- data/bin/deltacloudd +8 -1
- data/config.ru +0 -2
- data/config/drivers.yaml +48 -0
- data/deltacloud-core.gemspec +75 -0
- data/deltacloud.rb +3 -2
- data/lib/deltacloud/backend_capability.rb +15 -3
- data/lib/deltacloud/base_driver.rb +0 -2
- data/lib/deltacloud/base_driver/base_driver.rb +85 -89
- data/lib/deltacloud/base_driver/features.rb +61 -7
- data/lib/deltacloud/base_driver/mock_driver.rb +42 -43
- data/lib/deltacloud/core_ext.rb +18 -0
- data/lib/deltacloud/core_ext/integer.rb +31 -0
- data/lib/deltacloud/core_ext/string.rb +50 -0
- data/lib/deltacloud/drivers/azure/azure_driver.rb +71 -22
- data/lib/deltacloud/drivers/ec2/ec2_driver.rb +641 -584
- data/lib/deltacloud/drivers/ec2/ec2_mock_driver.rb +0 -2
- data/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb +167 -0
- data/lib/deltacloud/drivers/gogrid/gogrid_client.rb +39 -1
- data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +41 -25
- data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob1.yml +6 -3
- data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob2.yml +6 -3
- data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob3.yml +4 -2
- data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob4.yml +5 -2
- data/lib/deltacloud/drivers/mock/data/buckets/blobs/blob5.yml +4 -2
- data/lib/deltacloud/drivers/mock/data/instances/inst0.yml +1 -0
- data/lib/deltacloud/drivers/mock/data/instances/inst1.yml +1 -0
- data/lib/deltacloud/drivers/mock/data/instances/inst2.yml +1 -0
- data/lib/deltacloud/drivers/mock/data/storage_volumes/vol1.yml +1 -0
- data/lib/deltacloud/drivers/mock/data/storage_volumes/vol2.yml +1 -0
- data/lib/deltacloud/drivers/mock/data/storage_volumes/vol3.yml +1 -0
- data/lib/deltacloud/drivers/mock/mock_driver.rb +138 -30
- data/lib/deltacloud/drivers/opennebula/cloud_client.rb +13 -15
- data/lib/deltacloud/drivers/opennebula/occi_client.rb +13 -15
- data/lib/deltacloud/drivers/opennebula/opennebula_driver.rb +13 -15
- data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +224 -113
- data/lib/deltacloud/drivers/rhevm/rhevm_client.rb +332 -0
- data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +221 -170
- data/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb +0 -1
- data/lib/deltacloud/drivers/sbc/sbc_client.rb +247 -0
- data/lib/deltacloud/drivers/sbc/sbc_driver.rb +297 -0
- data/lib/deltacloud/drivers/terremark/terremark_driver.rb +0 -2
- data/lib/deltacloud/hardware_profile.rb +1 -3
- data/lib/deltacloud/helpers.rb +0 -2
- data/lib/deltacloud/helpers/application_helper.rb +86 -12
- data/lib/deltacloud/helpers/blob_stream.rb +19 -2
- data/lib/deltacloud/helpers/conversion_helper.rb +0 -2
- data/lib/deltacloud/helpers/hardware_profiles_helper.rb +0 -2
- data/lib/deltacloud/method_serializer.rb +0 -2
- data/lib/deltacloud/models/base_model.rb +0 -2
- data/lib/deltacloud/models/blob.rb +1 -2
- data/lib/deltacloud/models/bucket.rb +0 -2
- data/lib/deltacloud/models/image.rb +0 -2
- data/lib/deltacloud/models/instance.rb +19 -2
- data/lib/deltacloud/models/instance_profile.rb +4 -2
- data/lib/deltacloud/models/key.rb +0 -2
- data/lib/deltacloud/models/load_balancer.rb +0 -2
- data/lib/deltacloud/models/realm.rb +0 -2
- data/lib/deltacloud/models/storage_snapshot.rb +0 -2
- data/lib/deltacloud/models/storage_volume.rb +4 -2
- data/lib/deltacloud/runner.rb +132 -0
- data/lib/deltacloud/state_machine.rb +0 -2
- data/lib/deltacloud/validation.rb +9 -7
- data/lib/drivers.rb +36 -48
- data/lib/sinatra/accept_media_types.rb +26 -0
- data/lib/sinatra/lazy_auth.rb +16 -0
- data/lib/sinatra/rabbit.rb +112 -54
- data/lib/sinatra/rack_driver_select.rb +50 -16
- data/lib/sinatra/rack_etag.rb +79 -0
- data/lib/sinatra/rack_matrix_params.rb +84 -0
- data/lib/sinatra/rack_runtime.rb +47 -0
- data/lib/sinatra/static_assets.rb +16 -0
- data/lib/sinatra/url_for.rb +31 -4
- data/public/favicon.ico +0 -0
- data/public/images/bread-bg.png +0 -0
- data/public/images/error.png +0 -0
- data/public/images/pending.png +0 -0
- data/public/images/running.png +0 -0
- data/public/images/stopped.png +0 -0
- data/public/javascripts/application.js +35 -0
- data/public/stylesheets/compiled/application.css +59 -5
- data/public/stylesheets/compiled/screen.css +1 -1
- data/server.rb +293 -29
- data/support/fedora/deltacloud-core +78 -0
- data/support/fedora/deltacloud-core.spec +143 -0
- data/support/fedora/deltacloudd +78 -18
- data/support/fedora/rubygem-deltacloud-core.spec +76 -40
- data/tests/common.rb +172 -0
- data/tests/drivers/mock/api_test.rb +133 -0
- data/tests/drivers/mock/hardware_profiles_test.rb +134 -0
- data/tests/drivers/mock/images_test.rb +126 -0
- data/tests/drivers/mock/instance_states_test.rb +71 -0
- data/tests/drivers/mock/instances_test.rb +236 -0
- data/tests/drivers/mock/realms_test.rb +93 -0
- data/tests/drivers/mock/setup.rb +3 -0
- data/tests/drivers/mock/url_for_test.rb +67 -0
- data/tests/drivers/rackspace/api_test.rb +41 -0
- data/tests/drivers/rackspace/hardware_profiles_test.rb +53 -0
- data/tests/drivers/rackspace/images_test.rb +40 -0
- data/tests/drivers/rackspace/instances_test.rb +161 -0
- data/tests/drivers/rackspace/realms_test.rb +36 -0
- data/tests/drivers/rackspace/setup.rb +14 -0
- data/tests/drivers/rhevm/api_test.rb +39 -0
- data/tests/drivers/rhevm/hardware_profiles_test.rb +53 -0
- data/tests/drivers/rhevm/images_test.rb +42 -0
- data/tests/drivers/rhevm/instances_test.rb +179 -0
- data/tests/drivers/rhevm/realms_test.rb +35 -0
- data/tests/drivers/rhevm/setup.rb +14 -0
- data/tests/rabbit_test.rb +52 -0
- data/views/api/show.html.haml +2 -5
- data/views/blobs/new.html.haml +17 -1
- data/views/blobs/show.html.haml +6 -0
- data/views/blobs/show.xml.haml +5 -1
- data/views/buckets/index.html.haml +1 -12
- data/views/buckets/index.xml.haml +3 -5
- data/views/docs/operation.html.haml +23 -11
- data/views/drivers/index.html.haml +15 -0
- data/views/drivers/index.xml.haml +7 -0
- data/views/drivers/show.html.haml +20 -0
- data/views/drivers/show.xml.haml +7 -0
- data/views/error.html.haml +31 -0
- data/views/errors/auth_exception.xml.haml +2 -1
- data/views/errors/backend_capability_failure.xml.haml +2 -1
- data/views/errors/backend_error.html.haml +3 -0
- data/views/errors/backend_error.xml.haml +2 -2
- data/views/errors/validation_failure.xml.haml +3 -2
- data/views/images/index.html.haml +1 -6
- data/views/images/index.xml.haml +2 -0
- data/views/images/new.html.haml +14 -0
- data/views/images/show.xml.haml +2 -0
- data/views/instances/index.html.haml +8 -6
- data/views/instances/index.xml.haml +4 -0
- data/views/instances/new.html.haml +40 -11
- data/views/instances/run.html.haml +9 -0
- data/views/instances/run.xml.haml +7 -0
- data/views/instances/run_command.html.haml +16 -0
- data/views/instances/show.html.haml +14 -0
- data/views/instances/show.xml.haml +12 -4
- data/views/layout.html.haml +7 -2
- data/views/load_balancers/index.html.haml +1 -1
- data/views/load_balancers/new.html.haml +2 -2
- data/views/load_balancers/show.html.haml +1 -1
- data/views/storage_snapshots/index.html.haml +3 -0
- data/views/storage_snapshots/new.html.haml +9 -0
- data/views/storage_volumes/attach.html.haml +20 -0
- data/views/storage_volumes/index.html.haml +16 -1
- data/views/storage_volumes/index.xml.haml +1 -10
- data/views/storage_volumes/new.html.haml +17 -0
- data/views/storage_volumes/show.html.haml +8 -0
- data/views/storage_volumes/show.xml.haml +25 -3
- metadata +197 -127
- data/lib/deltacloud/drivers/rackspace/rackspace_client.rb +0 -130
- data/parse.rb +0 -7
- data/test.rb +0 -3
- data/views/api/drivers.xml.haml +0 -6
@@ -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
|
-
|
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=
|
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
|
-
|
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
|
-
|
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:
|
8
|
+
:content: content of blob 1
|
@@ -1,5 +1,8 @@
|
|
1
|
-
|
2
|
-
:
|
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:
|
8
|
+
:content: <html><head></head><body>content of blob 2</body></html>
|