deltacloud-core 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/Rakefile +2 -2
  2. data/config/drivers/aruba.yaml +3 -3
  3. data/deltacloud-core.gemspec +2 -2
  4. data/lib/cimi/collections/address_templates.rb +1 -2
  5. data/lib/cimi/collections/addresses.rb +1 -2
  6. data/lib/cimi/collections/base.rb +1 -1
  7. data/lib/cimi/collections/credentials.rb +2 -3
  8. data/lib/cimi/collections/forwarding_group_templates.rb +1 -2
  9. data/lib/cimi/collections/forwarding_groups.rb +1 -2
  10. data/lib/cimi/collections/machine_configurations.rb +1 -2
  11. data/lib/cimi/collections/machine_images.rb +1 -2
  12. data/lib/cimi/collections/machines.rb +9 -9
  13. data/lib/cimi/collections/network_configurations.rb +1 -2
  14. data/lib/cimi/collections/network_port_configurations.rb +1 -2
  15. data/lib/cimi/collections/network_port_templates.rb +1 -2
  16. data/lib/cimi/collections/network_ports.rb +1 -2
  17. data/lib/cimi/collections/network_templates.rb +1 -2
  18. data/lib/cimi/collections/networks.rb +2 -3
  19. data/lib/cimi/collections/volume_configurations.rb +1 -2
  20. data/lib/cimi/collections/volume_images.rb +1 -2
  21. data/lib/cimi/collections/volumes.rb +3 -4
  22. data/lib/cimi/helpers/cimi_helper.rb +7 -2
  23. data/lib/cimi/models.rb +6 -10
  24. data/lib/cimi/models/base.rb +48 -35
  25. data/lib/cimi/models/cloud_entry_point.rb +22 -1
  26. data/lib/cimi/models/collection.rb +42 -5
  27. data/lib/cimi/models/credential.rb +1 -1
  28. data/lib/cimi/models/disk.rb +39 -10
  29. data/lib/cimi/models/machine.rb +39 -22
  30. data/lib/cimi/models/machine_configuration.rb +4 -5
  31. data/lib/cimi/models/machine_image.rb +1 -1
  32. data/lib/cimi/models/machine_volume.rb +1 -1
  33. data/lib/cimi/models/network.rb +6 -3
  34. data/lib/cimi/models/network_port.rb +13 -2
  35. data/lib/cimi/models/schema.rb +66 -5
  36. data/lib/cimi/models/volume.rb +17 -16
  37. data/lib/cimi/models/volume_configuration.rb +7 -10
  38. data/lib/cimi/models/volume_image.rb +1 -1
  39. data/lib/deltacloud/collections/base.rb +1 -1
  40. data/lib/deltacloud/collections/firewalls.rb +2 -2
  41. data/lib/deltacloud/collections/load_balancers.rb +8 -2
  42. data/lib/deltacloud/core_ext.rb +1 -0
  43. data/lib/deltacloud/core_ext/base.rb +30 -0
  44. data/lib/deltacloud/drivers.rb +1 -1
  45. data/lib/deltacloud/drivers/base_driver.rb +1 -1
  46. data/lib/deltacloud/drivers/condor/condor_driver.rb +1 -1
  47. data/lib/deltacloud/drivers/exceptions.rb +24 -14
  48. data/lib/deltacloud/drivers/features.rb +3 -3
  49. data/lib/deltacloud/drivers/fgcp/fgcp_driver.rb +163 -92
  50. data/lib/deltacloud/drivers/mock/data/images/img1.yml +1 -0
  51. data/lib/deltacloud/drivers/mock/data/images/img2.yml +1 -0
  52. data/lib/deltacloud/drivers/mock/data/images/img3.yml +1 -0
  53. data/lib/deltacloud/drivers/mock/mock_client.rb +4 -4
  54. data/lib/deltacloud/drivers/mock/mock_driver.rb +16 -16
  55. data/lib/deltacloud/drivers/openstack/openstack_driver.rb +25 -9
  56. data/lib/deltacloud/drivers/rhevm/rhevm_driver.rb +2 -1
  57. data/lib/deltacloud/drivers/terremark/terremark_driver.rb +1 -1
  58. data/lib/deltacloud/drivers/vsphere/vsphere_driver.rb +2 -0
  59. data/lib/deltacloud/helpers/deltacloud_helper.rb +29 -8
  60. data/lib/deltacloud/models/image.rb +1 -0
  61. data/lib/deltacloud/models/instance_profile.rb +4 -0
  62. data/lib/deltacloud/version.rb +1 -1
  63. data/lib/ec2/query_parser.rb +1 -1
  64. data/lib/sinatra/rack_accept.rb +5 -1
  65. data/lib/sinatra/rack_logger.rb +9 -2
  66. data/tests/cimi/collections/machine_images_test.rb +23 -6
  67. data/tests/cimi/collections/machines_test.rb +39 -0
  68. data/tests/cimi/model/collection_spec.rb +109 -0
  69. data/tests/cimi/{spec/cimi/model → model}/credential_spec.rb +1 -1
  70. data/tests/cimi/{spec/cimi/model → model}/machine_configuration_spec.rb +1 -1
  71. data/tests/cimi/{spec/cimi/model → model}/machine_image_spec.rb +1 -1
  72. data/tests/cimi/{spec/cimi/model → model}/machine_spec.rb +1 -1
  73. data/tests/cimi/{spec/cimi/model → model}/machine_template_spec.rb +1 -1
  74. data/tests/cimi/{spec/cimi/model → model}/schema_spec.rb +1 -1
  75. data/tests/cimi/{spec/cimi/model → model}/volume_configuration_spec.rb +1 -1
  76. data/tests/cimi/{spec/cimi/model → model}/volume_image_spec.rb +1 -1
  77. data/tests/cimi/{spec/cimi/model → model}/volume_spec.rb +1 -1
  78. data/tests/cimi/{spec/cimi/model → model}/volume_template_spec.rb +1 -1
  79. data/tests/cimi/{spec/spec_helper.rb → spec_helper.rb} +7 -4
  80. data/tests/drivers/base/exceptions_test.rb +8 -8
  81. data/tests/drivers/ec2/buckets_test.rb +1 -1
  82. data/tests/drivers/ec2/images_test.rb +1 -1
  83. data/tests/drivers/ec2/instance_test.rb +1 -1
  84. data/tests/drivers/ec2/keys_test.rb +2 -2
  85. data/tests/drivers/ec2/realms_test.rb +1 -1
  86. data/tests/drivers/ec2/storage_snapshots_test.rb +1 -1
  87. data/tests/drivers/gogrid/hardware_profiles_test.rb +1 -1
  88. data/tests/drivers/gogrid/images_test.rb +1 -1
  89. data/tests/drivers/gogrid/instances_test.rb +1 -1
  90. data/tests/drivers/gogrid/realms_test.rb +1 -1
  91. data/tests/drivers/mock/images_test.rb +7 -2
  92. data/tests/drivers/mock/instances_test.rb +1 -1
  93. data/tests/drivers/mock/keys_test.rb +2 -2
  94. data/tests/drivers/mock/realms_test.rb +1 -1
  95. data/tests/drivers/mock/storage_snapshots_test.rb +1 -1
  96. data/tests/drivers/mock/storage_volumes_test.rb +1 -1
  97. data/tests/drivers/openstack/hardware_profiles_test.rb +3 -3
  98. data/tests/drivers/openstack/images_test.rb +1 -1
  99. data/tests/drivers/openstack/instances_test.rb +1 -1
  100. data/tests/drivers/openstack/keys_test.rb +2 -2
  101. data/tests/drivers/openstack/realms_test.rb +1 -1
  102. data/tests/drivers/rhevm/common.rb +3 -3
  103. data/tests/drivers/rhevm/images_test.rb +13 -13
  104. data/tests/drivers/rhevm/instance_test.rb +22 -22
  105. data/tests/drivers/rhevm/provider_test.rb +3 -3
  106. data/tests/drivers/rhevm/realms_test.rb +7 -7
  107. data/tests/test_helper.rb +0 -5
  108. data/views/api/show.xml.haml +6 -3
  109. data/views/errors/401.html.haml +0 -16
  110. data/views/errors/404.html.haml +2 -3
  111. data/views/errors/500.html.haml +6 -5
  112. data/views/images/show.html.haml +5 -1
  113. data/views/images/show.xml.haml +8 -3
  114. data/views/instances/new.html.haml +1 -1
  115. data/views/instances/show.xml.haml +1 -1
  116. data/views/load_balancers/show.html.haml +1 -1
  117. metadata +761 -778
  118. data/lib/cimi/models/disk_collection.rb +0 -37
  119. data/lib/cimi/models/machine_volume_collection.rb +0 -34
  120. data/lib/cimi/models/network_port_collection.rb +0 -51
  121. data/lib/cimi/models/network_port_configuration_collection.rb +0 -35
  122. data/lib/cimi/models/network_port_template_collection.rb +0 -37
@@ -1,37 +0,0 @@
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
- class CIMI::Model::DiskCollection < CIMI::Model::Base
16
- text :count
17
-
18
- #add disks array:
19
- self << CIMI::Model::Disk
20
-
21
- array :operations do
22
- scalar :rel, :href
23
- end
24
-
25
- def self.default(instance_id, context)
26
- instance = context.driver.instance(context.credentials, :id=>instance_id)
27
- machine_conf = CIMI::Model::MachineConfiguration.find(instance.instance_profile.name, context)
28
- disks = CIMI::Model::Disk.find(instance, machine_conf, context, :all)
29
- self.new(
30
- :id => context.machine_url(instance_id)+"/disks",
31
- :description => "DiskCollection for Machine #{instance_id}",
32
- :created => instance.launch_time,
33
- :count => disks.size,
34
- :disks => disks
35
- )
36
- end
37
- end
@@ -1,34 +0,0 @@
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
- class CIMI::Model::MachineVolumeCollection < CIMI::Model::Base
16
-
17
- text :count
18
-
19
- self << CIMI::Model::MachineVolume
20
-
21
- array :operations do
22
- scalar :rel, :href
23
- end
24
-
25
- def self.default(instance_id, context)
26
- volumes = CIMI::Model::MachineVolume.find(instance_id, context)
27
- self.new(
28
- :id => context.machine_url(instance_id)+"/volumes",
29
- :description => "MachineVolumeCollection for Machine #{instance_id}",
30
- :count => volumes.size,
31
- :machine_volumes => volumes
32
- )
33
- end
34
- end
@@ -1,51 +0,0 @@
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::NetworkPortCollection < CIMI::Model::Base
17
-
18
- act_as_root_entity :network_port
19
-
20
- text :count
21
-
22
- #add member array:
23
- self << CIMI::Model::NetworkPort
24
-
25
- def self.default(context)
26
- network_ports = CIMI::Model::NetworkPort.all(context)
27
- self.new(
28
- :id => context.network_ports_url,
29
- :name => 'default',
30
- :created => Time.now,
31
- :description => "#{context.driver.name.capitalize} NetworkPortCollection",
32
- :count => network_ports.size,
33
- :network_ports => network_ports
34
- )
35
- end
36
-
37
- def self.for_network(network_id, context)
38
- net_url = context.network_url(network_id)
39
- network_ports = CIMI::Model::NetworkPort.all(context)
40
- ports_collection = network_ports.inject([]){|res, current| res << current if current.network.href == net_url ; res}
41
- self.new(
42
- :id => net_url+"/network_ports",
43
- :name => 'default',
44
- :created => Time.now,
45
- :description => "#{context.driver.name.capitalize} NetworkPortCollection",
46
- :count => ports_collection.size,
47
- :network_ports => ports_collection
48
- )
49
- end
50
-
51
- end
@@ -1,35 +0,0 @@
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
- class CIMI::Model::NetworkPortConfigurationCollection < CIMI::Model::Base
16
-
17
- act_as_root_entity :network_port_configuration
18
-
19
- text :count
20
-
21
- self << CIMI::Model::NetworkPortConfiguration
22
-
23
- def self.default(context)
24
- network_port_configurations = CIMI::Model::NetworkPortConfiguration.all(context)
25
- self.new(
26
- :id => context.network_port_configurations_url,
27
- :name => 'default',
28
- :created => Time.now,
29
- :description => "#{context.driver.name.capitalize} NetworkPortConfigurationCollection",
30
- :count => network_port_configurations.size,
31
- :network_port_configurations => network_port_configurations
32
- )
33
- end
34
-
35
- end
@@ -1,37 +0,0 @@
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::NetworkPortTemplateCollection < CIMI::Model::Base
17
-
18
- CIMI::Model.register_as_root_entity! "NetworkPortTemplates"
19
-
20
- text :count
21
-
22
- #add array of network_port_templates:
23
- self << CIMI::Model::NetworkPortTemplate
24
-
25
- def self.default(context)
26
- network_port_templates = CIMI::Model::NetworkPortTemplate.all(context)
27
- self.new(
28
- :id => context.network_port_templates_url,
29
- :name => 'default',
30
- :created => Time.now,
31
- :description => "#{context.driver.name.capitalize} NetworkPortTemplateCollection",
32
- :count => network_port_templates.size,
33
- :network_port_templates => network_port_templates
34
- )
35
- end
36
-
37
- end