deltacloud-core 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +176 -502
- data/Rakefile +21 -14
- data/deltacloud.rb +3 -0
- data/lib/deltacloud/base_driver.rb +12 -11
- data/lib/deltacloud/base_driver/base_driver.rb +22 -11
- data/lib/deltacloud/drivers/ec2/ec2_driver.rb +15 -12
- data/lib/deltacloud/drivers/gogrid/gogrid_driver.rb +16 -11
- data/lib/deltacloud/drivers/mock/data/images/img1.yml +3 -0
- data/lib/deltacloud/drivers/mock/data/images/img2.yml +3 -0
- data/lib/deltacloud/drivers/mock/data/images/img3.yml +3 -0
- data/lib/deltacloud/drivers/mock/data/instances/inst0.yml +16 -0
- data/lib/deltacloud/drivers/mock/data/instances/inst1.yml +9 -0
- data/lib/deltacloud/drivers/mock/data/instances/inst2.yml +9 -0
- data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap1.yml +4 -0
- data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap2.yml +4 -0
- data/lib/deltacloud/drivers/mock/data/storage_snapshots/snap3.yml +4 -0
- data/lib/deltacloud/drivers/mock/data/storage_volumes/vol1.yml +6 -0
- data/lib/deltacloud/drivers/mock/data/storage_volumes/vol2.yml +6 -0
- data/lib/deltacloud/drivers/mock/data/storage_volumes/vol3.yml +6 -0
- data/lib/deltacloud/drivers/mock/mock_driver.rb +13 -11
- data/lib/deltacloud/drivers/rackspace/rackspace_client.rb +12 -11
- data/lib/deltacloud/drivers/rackspace/rackspace_driver.rb +12 -11
- data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +12 -11
- data/lib/deltacloud/drivers/rimuhosting/rimuhosting_client.rb +12 -11
- data/lib/deltacloud/drivers/rimuhosting/rimuhosting_driver.rb +14 -12
- data/lib/deltacloud/drivers/terremark/terremark_driver.rb +12 -11
- data/lib/deltacloud/helpers/application_helper.rb +64 -11
- data/lib/deltacloud/helpers/conversion_helper.rb +12 -11
- data/lib/deltacloud/method_serializer.rb +12 -11
- data/lib/deltacloud/models/base_model.rb +12 -11
- data/lib/deltacloud/models/image.rb +12 -11
- data/lib/deltacloud/models/instance.rb +13 -12
- data/lib/deltacloud/models/instance_profile.rb +12 -11
- data/lib/deltacloud/models/realm.rb +12 -11
- data/lib/deltacloud/models/storage_snapshot.rb +12 -11
- data/lib/deltacloud/models/storage_volume.rb +12 -11
- data/lib/drivers.rb +12 -0
- data/lib/sinatra/rabbit.rb +1 -0
- data/lib/sinatra/respond_to.rb +3 -0
- data/server.rb +40 -80
- data/tests/api_test.rb +37 -0
- data/tests/hardware_profiles_test.rb +120 -0
- data/tests/images_test.rb +95 -78
- data/tests/instance_states_test.rb +52 -0
- data/tests/instances_test.rb +193 -110
- data/tests/realms_test.rb +66 -44
- data/views/errors/not_found.html.haml +6 -0
- data/views/errors/not_found.xml.haml +2 -0
- data/views/hardware_profiles/index.xml.haml +1 -1
- data/views/hardware_profiles/show.xml.haml +3 -2
- data/views/images/index.xml.haml +4 -3
- data/views/images/show.xml.haml +2 -2
- data/views/instances/index.xml.haml +6 -8
- data/views/instances/show.xml.haml +9 -10
- data/views/realms/index.xml.haml +1 -3
- data/views/realms/show.xml.haml +4 -5
- data/views/storage_snapshots/index.xml.haml +3 -5
- data/views/storage_snapshots/show.xml.haml +2 -4
- data/views/storage_volumes/index.xml.haml +7 -7
- data/views/storage_volumes/show.xml.haml +2 -4
- metadata +156 -81
- data/tests/deltacloud_test.rb +0 -60
- data/tests/storage_snapshots_test.rb +0 -48
- data/tests/storage_volumes_test.rb +0 -48
data/Rakefile
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
#
|
2
2
|
# Copyright (C) 2009 Red Hat, Inc.
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
4
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
5
|
+
# contributor license agreements. See the NOTICE file distributed with
|
6
|
+
# this work for additional information regarding copyright ownership. The
|
7
|
+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
8
|
+
# "License"); you may not use this file except in compliance with the
|
9
|
+
# License. You may obtain a copy of the License at
|
8
10
|
#
|
9
|
-
#
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
-
# Lesser General Public License for more details.
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
12
|
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
15
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
16
|
+
# License for the specific language governing permissions and limitations
|
17
|
+
# under the License.
|
17
18
|
|
18
19
|
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
19
20
|
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
@@ -22,16 +23,22 @@ require 'rake'
|
|
22
23
|
require 'rake/testtask'
|
23
24
|
require 'rake/gempackagetask'
|
24
25
|
|
26
|
+
begin
|
27
|
+
require 'ci/reporter/rake/test_unit'
|
28
|
+
rescue LoadError
|
29
|
+
end
|
30
|
+
|
25
31
|
desc "Run basic unit tests"
|
26
32
|
Rake::TestTask.new("test") { |t|
|
27
33
|
t.test_files = FileList[
|
34
|
+
'tests/api_test.rb',
|
35
|
+
'tests/hardware_profiles_test.rb',
|
28
36
|
'tests/realms_test.rb',
|
29
37
|
'tests/images_test.rb',
|
30
38
|
'tests/instances_test.rb',
|
31
|
-
'tests/
|
32
|
-
'tests/storage_snapshots_test.rb',
|
39
|
+
'tests/instance_states_test.rb',
|
33
40
|
]
|
34
|
-
t.verbose =
|
41
|
+
t.verbose = true
|
35
42
|
t.warning = false
|
36
43
|
}
|
37
44
|
|
data/deltacloud.rb
CHANGED
@@ -1,19 +1,20 @@
|
|
1
1
|
#
|
2
2
|
# Copyright (C) 2009 Red Hat, Inc.
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
4
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
5
|
+
# contributor license agreements. See the NOTICE file distributed with
|
6
|
+
# this work for additional information regarding copyright ownership. The
|
7
|
+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
8
|
+
# "License"); you may not use this file except in compliance with the
|
9
|
+
# License. You may obtain a copy of the License at
|
8
10
|
#
|
9
|
-
#
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
-
# Lesser General Public License for more details.
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
12
|
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
15
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
16
|
+
# License for the specific language governing permissions and limitations
|
17
|
+
# under the License.
|
17
18
|
|
18
19
|
require 'deltacloud/base_driver/base_driver'
|
19
20
|
require 'deltacloud/base_driver/features'
|
@@ -1,19 +1,20 @@
|
|
1
1
|
#
|
2
2
|
# Copyright (C) 2009 Red Hat, Inc.
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
4
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
5
|
+
# contributor license agreements. See the NOTICE file distributed with
|
6
|
+
# this work for additional information regarding copyright ownership. The
|
7
|
+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
8
|
+
# "License"); you may not use this file except in compliance with the
|
9
|
+
# License. You may obtain a copy of the License at
|
8
10
|
#
|
9
|
-
#
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
-
# Lesser General Public License for more details.
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
12
|
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
15
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
16
|
+
# License for the specific language governing permissions and limitations
|
17
|
+
# under the License.
|
17
18
|
|
18
19
|
module Deltacloud
|
19
20
|
|
@@ -184,6 +185,16 @@ module Deltacloud
|
|
184
185
|
return collection.select{|e| filter == e.send(attribute) }
|
185
186
|
end
|
186
187
|
end
|
188
|
+
|
189
|
+
def supported_collections
|
190
|
+
DEFAULT_COLLECTIONS
|
191
|
+
end
|
192
|
+
|
193
|
+
def has_collection?(collection)
|
194
|
+
return true if self.supported_collections.include?(collection)
|
195
|
+
return false
|
196
|
+
end
|
197
|
+
|
187
198
|
end
|
188
199
|
|
189
200
|
end
|
@@ -1,19 +1,20 @@
|
|
1
1
|
#
|
2
2
|
# Copyright (C) 2009 Red Hat, Inc.
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
4
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
5
|
+
# contributor license agreements. See the NOTICE file distributed with
|
6
|
+
# this work for additional information regarding copyright ownership. The
|
7
|
+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
8
|
+
# "License"); you may not use this file except in compliance with the
|
9
|
+
# License. You may obtain a copy of the License at
|
8
10
|
#
|
9
|
-
#
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
-
# Lesser General Public License for more details.
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
12
|
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
15
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
16
|
+
# License for the specific language governing permissions and limitations
|
17
|
+
# under the License.
|
17
18
|
|
18
19
|
|
19
20
|
require 'deltacloud/base_driver'
|
@@ -208,6 +209,7 @@ class EC2Driver < Deltacloud::BaseDriver
|
|
208
209
|
#
|
209
210
|
# Storage Volumes
|
210
211
|
#
|
212
|
+
|
211
213
|
def storage_volumes(credentials, opts=nil)
|
212
214
|
ec2 = new_client( credentials )
|
213
215
|
volumes = []
|
@@ -297,7 +299,8 @@ class EC2Driver < Deltacloud::BaseDriver
|
|
297
299
|
:private_addresses=>( ec2_instance['privateDnsName'] == '' ? [] : [ec2_instance['privateDnsName']] ),
|
298
300
|
:instance_profile =>InstanceProfile.new(hwp_name),
|
299
301
|
:actions=>instance_actions_for( state ),
|
300
|
-
:keyname => ec2_instance['keyName']
|
302
|
+
:keyname => ec2_instance['keyName'],
|
303
|
+
:launch_time => ec2_instance['launchTime']
|
301
304
|
} )
|
302
305
|
instance.authn_error = "Key not set for instance" unless ec2_instance['keyName']
|
303
306
|
return instance
|
@@ -1,19 +1,20 @@
|
|
1
1
|
#
|
2
2
|
# Copyright (C) 2009 Red Hat, Inc.
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
4
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
5
|
+
# contributor license agreements. See the NOTICE file distributed with
|
6
|
+
# this work for additional information regarding copyright ownership. The
|
7
|
+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
8
|
+
# "License"); you may not use this file except in compliance with the
|
9
|
+
# License. You may obtain a copy of the License at
|
8
10
|
#
|
9
|
-
#
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
-
# Lesser General Public License for more details.
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
12
|
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
15
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
16
|
+
# License for the specific language governing permissions and limitations
|
17
|
+
# under the License.
|
17
18
|
|
18
19
|
require 'deltacloud/base_driver'
|
19
20
|
require 'deltacloud/drivers/gogrid/gogrid_client'
|
@@ -42,6 +43,10 @@ class GogridDriver < Deltacloud::BaseDriver
|
|
42
43
|
storage 10
|
43
44
|
end
|
44
45
|
|
46
|
+
def supported_collections
|
47
|
+
DEFAULT_COLLECTIONS.reject { |c| [ :storage_volumes, :storage_snapshots ].include?(c) }
|
48
|
+
end
|
49
|
+
|
45
50
|
# The only valid option for flavors is server RAM for now
|
46
51
|
def flavors(credentials, opts=nil)
|
47
52
|
flavors = []
|
@@ -0,0 +1,16 @@
|
|
1
|
+
---
|
2
|
+
:realm_id: us
|
3
|
+
:public_addresses:
|
4
|
+
- img1.inst0.public.com
|
5
|
+
:state: RUNNING
|
6
|
+
:name: "Mock Instance With Profile Change"
|
7
|
+
:private_addresses:
|
8
|
+
- img1.inst0.private.com
|
9
|
+
:image_id: img1
|
10
|
+
:instance_profile: !ruby/object:InstanceProfile
|
11
|
+
id: m1-large
|
12
|
+
memory: "12288"
|
13
|
+
:owner_id: mockuser
|
14
|
+
:actions:
|
15
|
+
- :reboot
|
16
|
+
- :stop
|
@@ -1,22 +1,24 @@
|
|
1
1
|
#
|
2
2
|
# Copyright (C) 2009 Red Hat, Inc.
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
4
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
5
|
+
# contributor license agreements. See the NOTICE file distributed with
|
6
|
+
# this work for additional information regarding copyright ownership. The
|
7
|
+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
8
|
+
# "License"); you may not use this file except in compliance with the
|
9
|
+
# License. You may obtain a copy of the License at
|
8
10
|
#
|
9
|
-
#
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
-
# Lesser General Public License for more details.
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
12
|
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
15
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
16
|
+
# License for the specific language governing permissions and limitations
|
17
|
+
# under the License.
|
17
18
|
|
18
19
|
|
19
20
|
require 'deltacloud/base_driver'
|
21
|
+
require 'yaml'
|
20
22
|
|
21
23
|
module Deltacloud
|
22
24
|
module Drivers
|
@@ -1,19 +1,20 @@
|
|
1
1
|
#
|
2
2
|
# Copyright (C) 2009 Red Hat, Inc.
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
4
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
5
|
+
# contributor license agreements. See the NOTICE file distributed with
|
6
|
+
# this work for additional information regarding copyright ownership. The
|
7
|
+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
8
|
+
# "License"); you may not use this file except in compliance with the
|
9
|
+
# License. You may obtain a copy of the License at
|
8
10
|
#
|
9
|
-
#
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
-
# Lesser General Public License for more details.
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
12
|
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
15
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
16
|
+
# License for the specific language governing permissions and limitations
|
17
|
+
# under the License.
|
17
18
|
|
18
19
|
require "net/http"
|
19
20
|
require "net/https"
|
@@ -1,19 +1,20 @@
|
|
1
1
|
#
|
2
2
|
# Copyright (C) 2009 Red Hat, Inc.
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
4
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
5
|
+
# contributor license agreements. See the NOTICE file distributed with
|
6
|
+
# this work for additional information regarding copyright ownership. The
|
7
|
+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
8
|
+
# "License"); you may not use this file except in compliance with the
|
9
|
+
# License. You may obtain a copy of the License at
|
8
10
|
#
|
9
|
-
#
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
-
# Lesser General Public License for more details.
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
12
|
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
15
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
16
|
+
# License for the specific language governing permissions and limitations
|
17
|
+
# under the License.
|
17
18
|
|
18
19
|
require 'deltacloud/base_driver'
|
19
20
|
require 'deltacloud/drivers/rackspace/rackspace_client'
|
@@ -1,19 +1,20 @@
|
|
1
1
|
#
|
2
2
|
# Copyright (C) 2009 Red Hat, Inc.
|
3
3
|
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
4
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
5
|
+
# contributor license agreements. See the NOTICE file distributed with
|
6
|
+
# this work for additional information regarding copyright ownership. The
|
7
|
+
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
8
|
+
# "License"); you may not use this file except in compliance with the
|
9
|
+
# License. You may obtain a copy of the License at
|
8
10
|
#
|
9
|
-
#
|
10
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
-
# Lesser General Public License for more details.
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
12
|
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
15
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
16
|
+
# License for the specific language governing permissions and limitations
|
17
|
+
# under the License.
|
17
18
|
|
18
19
|
require 'deltacloud/base_driver'
|
19
20
|
require 'yaml'
|