deltacloud-core 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/deltacloud-core.gemspec +4 -7
- data/lib/cimi/collections/address_templates.rb +4 -42
- data/lib/cimi/collections/addresses.rb +5 -43
- data/lib/cimi/collections/base.rb +11 -3
- data/lib/cimi/collections/cloud_entry_point.rb +1 -1
- data/lib/cimi/collections/credentials.rb +4 -43
- data/lib/cimi/collections/forwarding_group_templates.rb +2 -20
- data/lib/cimi/collections/forwarding_groups.rb +2 -21
- data/lib/cimi/collections/machine_configurations.rb +2 -20
- data/lib/cimi/collections/machine_images.rb +4 -42
- data/lib/cimi/collections/machine_templates.rb +4 -42
- data/lib/cimi/collections/machines.rb +14 -64
- data/lib/cimi/collections/network_configurations.rb +2 -20
- data/lib/cimi/collections/network_port_configurations.rb +2 -21
- data/lib/cimi/collections/network_port_templates.rb +2 -23
- data/lib/cimi/collections/network_ports.rb +6 -46
- data/lib/cimi/collections/network_templates.rb +2 -21
- data/lib/cimi/collections/networks.rb +4 -40
- data/lib/cimi/collections/resource_metadata.rb +2 -21
- data/lib/cimi/collections/system_templates.rb +4 -45
- data/lib/cimi/collections/systems.rb +65 -82
- data/lib/cimi/collections/volume_configurations.rb +4 -45
- data/lib/cimi/collections/volume_images.rb +4 -42
- data/lib/cimi/collections/volume_templates.rb +5 -44
- data/lib/cimi/collections/volumes.rb +4 -48
- data/lib/cimi/helpers.rb +1 -0
- data/lib/cimi/helpers/cimi_helper.rb +1 -1
- data/lib/cimi/helpers/cimi_rabbit_helper.rb +113 -0
- data/lib/cimi/helpers/database_helper.rb +1 -2
- data/lib/cimi/models.rb +12 -11
- data/lib/cimi/models/action.rb +0 -4
- data/lib/cimi/models/address.rb +0 -38
- data/lib/cimi/models/address_create.rb +0 -31
- data/lib/cimi/models/address_template.rb +0 -47
- data/lib/cimi/models/address_template_create.rb +0 -16
- data/lib/cimi/models/base.rb +2 -74
- data/lib/cimi/models/cloud_entry_point.rb +2 -30
- data/lib/cimi/models/collection.rb +8 -25
- data/lib/cimi/models/credential.rb +0 -34
- data/lib/cimi/models/credential_create.rb +0 -26
- data/lib/cimi/models/credential_template.rb +0 -2
- data/lib/cimi/models/disk.rb +0 -56
- data/lib/cimi/models/forwarding_group.rb +0 -8
- data/lib/cimi/models/forwarding_group_template.rb +0 -8
- data/lib/cimi/models/machine.rb +4 -129
- data/lib/cimi/models/machine_configuration.rb +0 -31
- data/lib/cimi/models/machine_create.rb +1 -29
- data/lib/cimi/models/machine_image.rb +0 -28
- data/lib/cimi/models/machine_image_create.rb +0 -19
- data/lib/cimi/models/machine_template.rb +5 -39
- data/lib/cimi/models/machine_template_create.rb +0 -12
- data/lib/cimi/models/machine_volume.rb +0 -65
- data/lib/cimi/models/network.rb +0 -32
- data/lib/cimi/models/network_configuration.rb +0 -15
- data/lib/cimi/models/network_create.rb +0 -23
- data/lib/cimi/models/network_port.rb +0 -73
- data/lib/cimi/models/network_port_configuration.rb +0 -8
- data/lib/cimi/models/network_port_template.rb +0 -8
- data/lib/cimi/models/network_template.rb +2 -12
- data/lib/cimi/models/resource.rb +0 -6
- data/lib/cimi/models/resource_metadata.rb +1 -95
- data/lib/cimi/models/schema.rb +28 -32
- data/lib/cimi/models/system.rb +15 -39
- data/lib/cimi/models/system_address.rb +26 -0
- data/lib/cimi/models/system_create.rb +20 -0
- data/lib/cimi/models/system_credential.rb +26 -0
- data/lib/cimi/models/system_forwarding_group.rb +26 -0
- data/lib/cimi/models/system_machine.rb +26 -0
- data/lib/cimi/models/system_network.rb +26 -0
- data/lib/cimi/models/system_network_port.rb +26 -0
- data/lib/cimi/models/system_system.rb +26 -0
- data/lib/cimi/models/system_template.rb +15 -31
- data/lib/cimi/models/system_volume.rb +26 -0
- data/lib/cimi/models/volume.rb +0 -59
- data/lib/cimi/models/volume_configuration.rb +1 -64
- data/lib/cimi/models/volume_configuration_create.rb +22 -0
- data/lib/cimi/models/volume_create.rb +0 -38
- data/lib/cimi/models/volume_image.rb +0 -30
- data/lib/cimi/models/volume_image_create.rb +0 -25
- data/lib/cimi/models/volume_template.rb +2 -43
- data/lib/cimi/models/volume_template_create.rb +0 -12
- data/lib/cimi/service.rb +82 -0
- data/lib/cimi/service/action.rb +21 -0
- data/lib/cimi/service/address.rb +56 -0
- data/lib/cimi/service/address_create.rb +45 -0
- data/lib/cimi/service/address_template.rb +71 -0
- data/lib/cimi/service/address_template_create.rb +34 -0
- data/lib/cimi/service/base.rb +266 -0
- data/lib/cimi/service/cloud_entry_point.rb +53 -0
- data/lib/cimi/service/credential.rb +52 -0
- data/lib/cimi/service/credential_create.rb +38 -0
- data/lib/cimi/service/credential_template.rb +20 -0
- data/lib/cimi/service/disk.rb +75 -0
- data/lib/cimi/service/forwarding_group.rb +26 -0
- data/lib/cimi/service/forwarding_group_template.rb +26 -0
- data/lib/cimi/service/machine.rb +154 -0
- data/lib/cimi/service/machine_configuration.rb +54 -0
- data/lib/cimi/service/machine_create.rb +49 -0
- data/lib/cimi/service/machine_image.rb +47 -0
- data/lib/cimi/service/machine_image_create.rb +35 -0
- data/lib/cimi/service/machine_template.rb +61 -0
- data/lib/cimi/service/machine_template_create.rb +29 -0
- data/lib/cimi/service/machine_volume.rb +74 -0
- data/lib/cimi/service/network.rb +51 -0
- data/lib/cimi/service/network_configuration.rb +36 -0
- data/lib/cimi/service/network_create.rb +39 -0
- data/lib/cimi/service/network_port.rb +97 -0
- data/lib/cimi/service/network_port_configuration.rb +26 -0
- data/lib/cimi/service/network_port_template.rb +26 -0
- data/lib/cimi/service/network_template.rb +28 -0
- data/lib/cimi/service/resource_metadata.rb +44 -0
- data/lib/cimi/service/system.rb +45 -0
- data/lib/cimi/service/system_address.rb +34 -0
- data/lib/cimi/service/system_create.rb +39 -0
- data/lib/cimi/service/system_credential.rb +34 -0
- data/lib/cimi/service/system_forwarding_group.rb +34 -0
- data/lib/cimi/service/system_machine.rb +34 -0
- data/lib/cimi/service/system_network.rb +34 -0
- data/lib/cimi/service/system_network_port.rb +34 -0
- data/lib/cimi/service/system_system.rb +34 -0
- data/lib/cimi/service/system_template.rb +32 -0
- data/lib/cimi/service/system_volume.rb +34 -0
- data/lib/cimi/service/volume.rb +81 -0
- data/lib/cimi/service/volume_configuration.rb +92 -0
- data/lib/cimi/service/volume_configuration_create.rb +29 -0
- data/lib/cimi/service/volume_create.rb +47 -0
- data/lib/cimi/service/volume_image.rb +44 -0
- data/lib/cimi/service/volume_image_create.rb +42 -0
- data/lib/cimi/service/volume_template.rb +61 -0
- data/lib/cimi/service/volume_template_create.rb +29 -0
- data/lib/db/entity.rb +16 -1
- data/lib/deltacloud/collections/addresses.rb +2 -2
- data/lib/deltacloud/collections/buckets.rb +16 -18
- data/lib/deltacloud/collections/drivers.rb +4 -4
- data/lib/deltacloud/collections/firewalls.rb +5 -5
- data/lib/deltacloud/collections/images.rb +3 -3
- data/lib/deltacloud/collections/instance_states.rb +4 -4
- data/lib/deltacloud/collections/instances.rb +22 -13
- data/lib/deltacloud/collections/keys.rb +2 -2
- data/lib/deltacloud/collections/load_balancers.rb +16 -13
- data/lib/deltacloud/collections/storage_snapshots.rb +3 -3
- data/lib/deltacloud/collections/storage_volumes.rb +5 -5
- data/lib/deltacloud/core_ext/ordered_hash.rb +0 -4
- data/lib/deltacloud/drivers/fgcp/fgcp_client.rb +8 -0
- data/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +4 -3
- data/lib/deltacloud/drivers/fgcp/fgcp_driver_cimi_methods.rb +266 -19
- data/lib/deltacloud/drivers/google/google_driver.rb +6 -0
- data/lib/deltacloud/drivers/mock/mock_driver.rb +2 -2
- data/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb +166 -54
- data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +2 -0
- data/lib/deltacloud/helpers/blob_stream_helper.rb +0 -2
- data/lib/deltacloud/helpers/deltacloud_helper.rb +22 -22
- data/lib/deltacloud/helpers/driver_helper.rb +4 -7
- data/lib/deltacloud/helpers/rabbit_helper.rb +5 -0
- data/lib/deltacloud/server.rb +4 -4
- data/lib/deltacloud/version.rb +1 -1
- data/lib/deltacloud_rack.rb +6 -1
- data/lib/ec2/server.rb +6 -1
- data/tests/cimi/collections/common.rb +33 -0
- data/tests/cimi/collections/machines_test.rb +19 -0
- data/tests/cimi/collections/system_templates_test.rb +47 -0
- data/tests/cimi/collections/volumes_test.rb +42 -0
- data/tests/cimi/db/database_helper_test.rb +7 -4
- data/tests/deltacloud/drivers_test.rb +1 -1
- data/tests/drivers/ec2/common.rb +4 -1
- data/tests/drivers/fgcp/common.rb +1 -2
- data/tests/drivers/gogrid/common.rb +1 -2
- data/tests/drivers/google/common.rb +1 -1
- data/tests/drivers/models/address_test.rb +2 -2
- data/tests/drivers/models/base_test.rb +2 -2
- data/tests/drivers/models/blob_test.rb +2 -2
- data/tests/drivers/models/instance_address_test.rb +8 -8
- data/tests/drivers/models/instance_profile_test.rb +2 -2
- data/tests/drivers/models/keys_test.rb +4 -4
- data/tests/drivers/models/metrics_test.rb +3 -3
- data/tests/drivers/openstack/common.rb +1 -2
- data/views/addresses/_address.html.haml +3 -3
- data/views/addresses/associate.html.haml +3 -3
- data/views/addresses/index.html.haml +2 -2
- data/views/addresses/index.xml.haml +2 -2
- data/views/addresses/show.html.haml +7 -7
- data/views/addresses/show.xml.haml +9 -9
- data/views/api/show.html.haml +2 -2
- data/views/api/show.xml.haml +1 -1
- data/views/blobs/new.html.haml +1 -1
- data/views/blobs/show.html.haml +8 -8
- data/views/blobs/show.xml.haml +7 -7
- data/views/buckets/index.html.haml +1 -1
- data/views/buckets/index.xml.haml +2 -2
- data/views/buckets/show.html.haml +7 -7
- data/views/buckets/show.xml.haml +6 -6
- data/views/drivers/index.html.haml +1 -1
- data/views/drivers/index.xml.haml +1 -1
- data/views/drivers/show.html.haml +6 -6
- data/views/drivers/show.xml.haml +5 -5
- data/views/error.html.haml +2 -2
- data/views/errors/backend_capability_failure.xml.haml +3 -3
- data/views/errors/common.html.haml +7 -7
- data/views/errors/common.xml.haml +5 -5
- data/views/firewalls/index.html.haml +1 -1
- data/views/firewalls/index.xml.haml +1 -1
- data/views/firewalls/new_rule.html.haml +1 -1
- data/views/firewalls/show.html.haml +8 -8
- data/views/firewalls/show.xml.haml +9 -9
- data/views/hardware_profiles/index.html.haml +1 -1
- data/views/hardware_profiles/index.xml.haml +2 -2
- data/views/hardware_profiles/show.html.haml +3 -3
- data/views/hardware_profiles/show.xml.haml +4 -4
- data/views/images/index.html.haml +1 -1
- data/views/images/index.xml.haml +2 -2
- data/views/images/new.html.haml +2 -2
- data/views/images/show.html.haml +14 -14
- data/views/images/show.xml.haml +14 -14
- data/views/instance_states/show.html.haml +1 -1
- data/views/instance_states/show.png.erb +2 -2
- data/views/instance_states/show.xml.haml +1 -1
- data/views/instances/index.html.haml +1 -1
- data/views/instances/index.xml.haml +2 -2
- data/views/instances/new.html.haml +22 -14
- data/views/instances/run.html.haml +2 -2
- data/views/instances/run.xml.haml +3 -3
- data/views/instances/run_command.html.haml +4 -4
- data/views/instances/show.html.haml +27 -27
- data/views/instances/show.xml.haml +37 -37
- data/views/keys/index.html.haml +1 -1
- data/views/keys/index.xml.haml +2 -2
- data/views/keys/show.html.haml +10 -10
- data/views/keys/show.xml.haml +12 -12
- data/views/load_balancers/index.html.haml +1 -1
- data/views/load_balancers/index.xml.haml +2 -2
- data/views/load_balancers/new.html.haml +1 -8
- data/views/load_balancers/show.html.haml +10 -10
- data/views/load_balancers/show.xml.haml +9 -9
- data/views/metrics/index.html.haml +1 -1
- data/views/metrics/index.xml.haml +2 -2
- data/views/metrics/show.html.haml +2 -2
- data/views/metrics/show.xml.haml +3 -3
- data/views/realms/index.html.haml +1 -1
- data/views/realms/index.xml.haml +2 -2
- data/views/realms/show.html.haml +6 -6
- data/views/realms/show.xml.haml +5 -5
- data/views/storage_snapshots/index.html.haml +1 -1
- data/views/storage_snapshots/index.xml.haml +2 -2
- data/views/storage_snapshots/show.html.haml +6 -6
- data/views/storage_snapshots/show.xml.haml +4 -4
- data/views/storage_volumes/attach.html.haml +2 -2
- data/views/storage_volumes/index.html.haml +1 -1
- data/views/storage_volumes/index.xml.haml +2 -2
- data/views/storage_volumes/show.html.haml +19 -19
- data/views/storage_volumes/show.xml.haml +21 -21
- metadata +77 -65
- data/views/cimi/cloudEntryPoint/index.html.haml +0 -5
- data/views/cimi/cloudEntryPoint/index.xml.haml +0 -9
- data/views/cimi/collection/index.html.haml +0 -45
- data/views/cimi/collection/response.xml.haml +0 -3
- data/views/cimi/error.html.haml +0 -31
- data/views/cimi/errors/400.xml.haml +0 -3
- data/views/cimi/errors/401.xml.haml +0 -2
- data/views/cimi/errors/403.xml.haml +0 -2
- data/views/cimi/errors/404.xml.haml +0 -2
- data/views/cimi/errors/405.xml.haml +0 -5
- data/views/cimi/errors/500.xml.haml +0 -6
- data/views/cimi/errors/502.xml.haml +0 -7
- data/views/cimi/layout.html.haml +0 -32
- data/views/cimi/machine_configurations/show.html.haml +0 -159
- data/views/cimi/machine_configurations/show.xml.haml +0 -27
- data/views/cimi/machine_images/show.html.haml +0 -79
- data/views/cimi/machine_images/show.xml.haml +0 -17
- data/views/cimi/machines/show.html.haml +0 -177
- data/views/cimi/machines/show.xml.haml +0 -28
- data/views/cimi/volumes/show.html.haml +0 -68
- data/views/cimi/volumes/show.xml.haml +0 -17
- data/views/docs/collection.html.haml +0 -26
- data/views/docs/collection.xml.haml +0 -14
- data/views/docs/index.html.haml +0 -11
- data/views/docs/index.xml.haml +0 -5
- data/views/docs/operation.html.haml +0 -33
- data/views/docs/operation.xml.haml +0 -10
- data/views/root/index.html.haml +0 -4
data/lib/cimi/models/system.rb
CHANGED
@@ -17,51 +17,27 @@ class CIMI::Model::System < CIMI::Model::Base
|
|
17
17
|
|
18
18
|
acts_as_root_entity
|
19
19
|
|
20
|
-
text :state
|
20
|
+
text :state, :required => true
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
22
|
+
collection :systems, :class => CIMI::Model::SystemSystem
|
23
|
+
collection :machines, :class => CIMI::Model::SystemMachine
|
24
|
+
collection :credentials, :class => CIMI::Model::SystemCredential
|
25
|
+
collection :volumes, :class => CIMI::Model::SystemVolume
|
26
|
+
collection :networks, :class => CIMI::Model::SystemNetwork
|
27
|
+
collection :network_ports, :class => CIMI::Model::SystemNetworkPort
|
28
|
+
collection :addresses, :class => CIMI::Model::SystemAddress
|
29
|
+
collection :forwarding_groups, :class => CIMI::Model::SystemForwardingGroup
|
30
30
|
|
31
|
-
#
|
32
|
-
# scalar :href
|
33
|
-
# end
|
31
|
+
#TODO: implement the attributes commented out
|
34
32
|
|
35
|
-
#
|
33
|
+
# array :meters do
|
34
|
+
# scalar :href
|
35
|
+
# end
|
36
|
+
|
37
|
+
# href :event_log
|
36
38
|
|
37
39
|
array :operations do
|
38
40
|
scalar :rel, :href
|
39
41
|
end
|
40
42
|
|
41
|
-
def self.find(id, context)
|
42
|
-
if id == :all
|
43
|
-
systems = context.driver.systems(context.credentials, {:env=>context})
|
44
|
-
else
|
45
|
-
systems = context.driver.systems(context.credentials, {:env=>context, :id=>id})
|
46
|
-
raise CIMI::Model::NotFound unless systems.first
|
47
|
-
systems.first
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def perform(action, context, &block)
|
52
|
-
begin
|
53
|
-
if context.driver.send(:"#{action.name}_system", context.credentials, self.id.split("/").last)
|
54
|
-
block.callback :success
|
55
|
-
else
|
56
|
-
raise "Operation failed to execute on given System"
|
57
|
-
end
|
58
|
-
rescue => e
|
59
|
-
block.callback :failure, e.message
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def self.delete!(id, context)
|
64
|
-
context.driver.destroy_system(context.credentials, id)
|
65
|
-
end
|
66
|
-
|
67
43
|
end
|
@@ -0,0 +1,26 @@
|
|
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
|
+
class CIMI::Model::SystemAddress < CIMI::Model::Base
|
17
|
+
|
18
|
+
acts_as_root_entity
|
19
|
+
|
20
|
+
href :address
|
21
|
+
|
22
|
+
array :operations do
|
23
|
+
scalar :rel, :href
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,20 @@
|
|
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
|
+
class CIMI::Model::SystemCreate < CIMI::Model::Base
|
17
|
+
|
18
|
+
ref :system_template, :required => true
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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
|
+
class CIMI::Model::SystemCredential < CIMI::Model::Base
|
17
|
+
|
18
|
+
acts_as_root_entity
|
19
|
+
|
20
|
+
href :credential
|
21
|
+
|
22
|
+
array :operations do
|
23
|
+
scalar :rel, :href
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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
|
+
class CIMI::Model::SystemForwardingGroup < CIMI::Model::Base
|
17
|
+
|
18
|
+
acts_as_root_entity
|
19
|
+
|
20
|
+
href :forwarding_group
|
21
|
+
|
22
|
+
array :operations do
|
23
|
+
scalar :rel, :href
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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
|
+
class CIMI::Model::SystemMachine < CIMI::Model::Base
|
17
|
+
|
18
|
+
acts_as_root_entity
|
19
|
+
|
20
|
+
href :machine
|
21
|
+
|
22
|
+
array :operations do
|
23
|
+
scalar :rel, :href
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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
|
+
class CIMI::Model::SystemNetwork < CIMI::Model::Base
|
17
|
+
|
18
|
+
acts_as_root_entity
|
19
|
+
|
20
|
+
href :network
|
21
|
+
|
22
|
+
array :operations do
|
23
|
+
scalar :rel, :href
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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
|
+
class CIMI::Model::SystemNetworkPort < CIMI::Model::Base
|
17
|
+
|
18
|
+
acts_as_root_entity
|
19
|
+
|
20
|
+
href :network_port
|
21
|
+
|
22
|
+
array :operations do
|
23
|
+
scalar :rel, :href
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -0,0 +1,26 @@
|
|
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
|
+
class CIMI::Model::SystemSystem < CIMI::Model::Base
|
17
|
+
|
18
|
+
acts_as_root_entity
|
19
|
+
|
20
|
+
href :system
|
21
|
+
|
22
|
+
array :operations do
|
23
|
+
scalar :rel, :href
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
@@ -19,45 +19,29 @@ class CIMI::Model::SystemTemplate < CIMI::Model::Base
|
|
19
19
|
|
20
20
|
array :component_descriptors do
|
21
21
|
text :name, :description
|
22
|
-
|
23
|
-
text :type
|
22
|
+
hash_map :properties
|
23
|
+
text :type, :required => true
|
24
|
+
|
24
25
|
#component_template, comprises:
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
ref :machine_template, :class => CIMI::Model::MachineTemplate
|
27
|
+
ref :system_template, :class => CIMI::Model::SystemTemplate
|
28
|
+
ref :credential_template, :class => CIMI::Model::CredentialTemplate
|
29
|
+
ref :volume_template, :class => CIMI::Model::VolumeTemplate
|
30
|
+
ref :network_template, :class => CIMI::Model::NetworkTemplate
|
31
|
+
ref :network_port_template, :class => CIMI::Model::NetworkPortTemplate
|
32
|
+
ref :forwarding_group_template, :class => CIMI::Model::ForwardingGroupTemplate
|
33
|
+
ref :address_template, :class => CIMI::Model::AddressTemplate
|
33
34
|
text :quantity
|
34
35
|
end
|
35
36
|
|
36
|
-
# array :meter_templates do
|
37
|
-
# scalar :href
|
38
|
-
# end
|
37
|
+
# array :meter_templates do
|
38
|
+
# scalar :href
|
39
|
+
# end
|
39
40
|
|
40
|
-
# href :event_log_template
|
41
|
+
# href :event_log_template
|
41
42
|
|
42
43
|
array :operations do
|
43
44
|
scalar :rel, :href
|
44
45
|
end
|
45
46
|
|
46
|
-
class << self
|
47
|
-
def find(id, context)
|
48
|
-
if id == :all
|
49
|
-
templates = context.driver.system_templates(context.credentials, {:env=>context})
|
50
|
-
else
|
51
|
-
templates = context.driver.system_templates(context.credentials, {:env=>context, :id=>id})
|
52
|
-
raise CIMI::Model::NotFound unless templates.first
|
53
|
-
templates.first
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def delete!(id, context)
|
58
|
-
context.driver.destroy_system_template(context.credentials, id)
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
47
|
end
|
@@ -0,0 +1,26 @@
|
|
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
|
+
class CIMI::Model::SystemVolume < CIMI::Model::Base
|
17
|
+
|
18
|
+
acts_as_root_entity
|
19
|
+
|
20
|
+
href :volume
|
21
|
+
|
22
|
+
array :operations do
|
23
|
+
scalar :rel, :href
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
data/lib/cimi/models/volume.rb
CHANGED
@@ -37,63 +37,4 @@ class CIMI::Model::Volume < CIMI::Model::Base
|
|
37
37
|
scalar :rel, :href
|
38
38
|
end
|
39
39
|
|
40
|
-
def self.find(id, context)
|
41
|
-
creds = context.credentials
|
42
|
-
if id == :all
|
43
|
-
volumes = context.driver.storage_volumes(creds)
|
44
|
-
volumes.collect{ |volume| from_storage_volume(volume, context) }
|
45
|
-
else
|
46
|
-
volume = context.driver.storage_volumes(creds, :id => id).first
|
47
|
-
raise CIMI::Model::NotFound unless volume
|
48
|
-
from_storage_volume(volume, context)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def self.all(context); find(:all, context); end
|
53
|
-
|
54
|
-
def self.delete!(id, context)
|
55
|
-
context.driver.destroy_storage_volume(context.credentials, {:id=>id} )
|
56
|
-
new(:id => id).destroy
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.find_to_attach_from_json(json_in, context)
|
60
|
-
json = JSON.parse(json_in)
|
61
|
-
json["volumes"].map{|v| {:volume=>self.find(v["volume"]["href"].split("/volumes/").last, context),
|
62
|
-
:initial_location=>v["initialLocation"] }}
|
63
|
-
end
|
64
|
-
|
65
|
-
def self.find_to_attach_from_xml(xml_in, context)
|
66
|
-
xml = XmlSimple.xml_in(xml_in)
|
67
|
-
xml["volume"].map{|v| {:volume => self.find(v["href"].split("/volumes/").last, context),
|
68
|
-
:initial_location=>v["initialLocation"] }}
|
69
|
-
end
|
70
|
-
|
71
|
-
def self.from_storage_volume(volume, context)
|
72
|
-
self.new( { :name => volume.id,
|
73
|
-
:created => volume.created.nil? ? nil : Time.parse(volume.created).xmlschema,
|
74
|
-
:id => context.volume_url(volume.id),
|
75
|
-
:capacity => context.to_kibibyte(volume.capacity, 'GB'),
|
76
|
-
:bootable => "false", #fixme ... will vary... ec2 doesn't expose this
|
77
|
-
:snapshots => [], #fixme...
|
78
|
-
:type => 'http://schemas.dmtf.org/cimi/1/mapped',
|
79
|
-
:state => volume.state == 'IN-USE' ? 'AVAILABLE' : volume.state,
|
80
|
-
:meters => [],
|
81
|
-
:operations => [{:href=> context.volume_url(volume.id), :rel => "delete"}]
|
82
|
-
} )
|
83
|
-
end
|
84
|
-
|
85
|
-
def self.collection_for_instance(instance_id, context)
|
86
|
-
instance = context.driver.instance(context.credentials, :id => instance_id)
|
87
|
-
volumes = instance.storage_volumes.map do |mappings|
|
88
|
-
mappings.keys.map { |volume_id| from_storage_volume(context.driver.storage_volume(context.credentials, :id => volume_id), context) }
|
89
|
-
end.flatten
|
90
|
-
CIMI::Model::VolumeCollection.new(
|
91
|
-
:id => context.url("/machines/#{instance_id}/volumes"),
|
92
|
-
:name => 'default',
|
93
|
-
:count => volumes.size,
|
94
|
-
:description => "Volume collection for Machine #{instance_id}",
|
95
|
-
:entries => volumes
|
96
|
-
)
|
97
|
-
end
|
98
|
-
|
99
40
|
end
|
@@ -19,73 +19,10 @@ class CIMI::Model::VolumeConfiguration < CIMI::Model::Base
|
|
19
19
|
|
20
20
|
href :type
|
21
21
|
text :format
|
22
|
-
text :capacity
|
22
|
+
text :capacity
|
23
23
|
|
24
24
|
array :operations do
|
25
25
|
scalar :rel, :href
|
26
26
|
end
|
27
27
|
|
28
|
-
def self.create_from_json(body, context)
|
29
|
-
json = JSON.parse(body)
|
30
|
-
new_config = current_db.add_volume_configuration(
|
31
|
-
:name => json['name'],
|
32
|
-
:description => json['description'],
|
33
|
-
:format => json['format'],
|
34
|
-
:capacity => json['capacity'],
|
35
|
-
:ent_properties => (json['properties'] || {}).to_json
|
36
|
-
)
|
37
|
-
from_db(new_config, context)
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.create_from_xml(body, context)
|
41
|
-
xml = XmlSimple.xml_in(body)
|
42
|
-
xml['property'] ||= []
|
43
|
-
new_config = current_db.add_volume_configuration(
|
44
|
-
:name => xml['name'].first,
|
45
|
-
:description => xml['description'].first,
|
46
|
-
:format => xml['format'].first,
|
47
|
-
:capacity => xml['capacity'].first,
|
48
|
-
:ent_properties => JSON::dump((xml['property'] || {}).inject({}){ |r, p| r[p['key']]=p['content']; r })
|
49
|
-
)
|
50
|
-
from_db(new_config, context)
|
51
|
-
end
|
52
|
-
|
53
|
-
def self.delete!(id, context)
|
54
|
-
current_db.volume_configurations.first(:id => id).destroy
|
55
|
-
end
|
56
|
-
|
57
|
-
def self.find(id, context)
|
58
|
-
if id==:all
|
59
|
-
if context.driver.respond_to? :volume_configurations
|
60
|
-
context.driver.volume_configurations(context.credentials, {:env=>context})
|
61
|
-
else
|
62
|
-
current_db.volume_configurations.map { |t| from_db(t, context) }
|
63
|
-
end
|
64
|
-
else
|
65
|
-
if context.driver.respond_to? :volume_configuration
|
66
|
-
context.driver.volume_configuration(context.credentials, id, :env=>context)
|
67
|
-
else
|
68
|
-
config = current_db.volume_configurations_dataset.first(:id => id)
|
69
|
-
raise CIMI::Model::NotFound unless config
|
70
|
-
from_db(config, context)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
private
|
76
|
-
|
77
|
-
def self.from_db(model, context)
|
78
|
-
self.new(
|
79
|
-
:id => context.volume_configuration_url(model.id),
|
80
|
-
:name => model.name,
|
81
|
-
:description => model.description,
|
82
|
-
:format => model.format,
|
83
|
-
:capacity => context.to_kibibyte(model.capacity, "GB"),
|
84
|
-
:property => (model.ent_properties ? JSON::parse(model.ent_properties) : nil),
|
85
|
-
:operations => [
|
86
|
-
{ :href => context.destroy_volume_configuration_url(model.id), :rel => 'http://schemas.dmtf.org/cimi/1/action/delete' }
|
87
|
-
]
|
88
|
-
)
|
89
|
-
end
|
90
|
-
|
91
28
|
end
|