fog-ovirt 1.2.5 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +7 -0
  4. data/.rubocop_todo.yml +17 -5
  5. data/Gemfile +0 -1
  6. data/README.md +2 -6
  7. data/Rakefile +2 -8
  8. data/fog-ovirt.gemspec +3 -3
  9. data/lib/fog/ovirt/compute/v4.rb +4 -0
  10. data/lib/fog/ovirt/compute.rb +5 -29
  11. data/lib/fog/ovirt/models/compute/interface.rb +1 -0
  12. data/lib/fog/ovirt/requests/compute/v4/add_interface.rb +4 -8
  13. data/lib/fog/ovirt/requests/compute/v4/list_vnic_profiles.rb +25 -0
  14. data/lib/fog/ovirt/requests/compute/v4/mock_files/operating_systems.xml +4 -4
  15. data/lib/fog/ovirt/requests/compute/v4/mock_files/vnic_profiles.xml +42 -0
  16. data/lib/fog/ovirt/requests/compute/v4/storage_domains.rb +1 -1
  17. data/lib/fog/ovirt/requests/compute/v4/update_vm.rb +1 -1
  18. data/lib/fog/ovirt/version.rb +1 -1
  19. metadata +20 -98
  20. data/lib/fog/ovirt/compute/v3.rb +0 -136
  21. data/lib/fog/ovirt/requests/compute/v3/activate_volume.rb +0 -23
  22. data/lib/fog/ovirt/requests/compute/v3/add_interface.rb +0 -22
  23. data/lib/fog/ovirt/requests/compute/v3/add_to_affinity_group.rb +0 -23
  24. data/lib/fog/ovirt/requests/compute/v3/add_volume.rb +0 -23
  25. data/lib/fog/ovirt/requests/compute/v3/attach_volume.rb +0 -24
  26. data/lib/fog/ovirt/requests/compute/v3/create_affinity_group.rb +0 -20
  27. data/lib/fog/ovirt/requests/compute/v3/create_vm.rb +0 -20
  28. data/lib/fog/ovirt/requests/compute/v3/datacenters.rb +0 -22
  29. data/lib/fog/ovirt/requests/compute/v3/deactivate_volume.rb +0 -24
  30. data/lib/fog/ovirt/requests/compute/v3/destroy_affinity_group.rb +0 -21
  31. data/lib/fog/ovirt/requests/compute/v3/destroy_interface.rb +0 -24
  32. data/lib/fog/ovirt/requests/compute/v3/destroy_vm.rb +0 -21
  33. data/lib/fog/ovirt/requests/compute/v3/destroy_volume.rb +0 -24
  34. data/lib/fog/ovirt/requests/compute/v3/detach_volume.rb +0 -24
  35. data/lib/fog/ovirt/requests/compute/v3/get_affinity_group.rb +0 -20
  36. data/lib/fog/ovirt/requests/compute/v3/get_api_version.rb +0 -18
  37. data/lib/fog/ovirt/requests/compute/v3/get_cluster.rb +0 -19
  38. data/lib/fog/ovirt/requests/compute/v3/get_instance_type.rb +0 -19
  39. data/lib/fog/ovirt/requests/compute/v3/get_quota.rb +0 -19
  40. data/lib/fog/ovirt/requests/compute/v3/get_template.rb +0 -19
  41. data/lib/fog/ovirt/requests/compute/v3/get_virtual_machine.rb +0 -19
  42. data/lib/fog/ovirt/requests/compute/v3/get_volume.rb +0 -19
  43. data/lib/fog/ovirt/requests/compute/v3/list_affinity_group_vms.rb +0 -24
  44. data/lib/fog/ovirt/requests/compute/v3/list_affinity_groups.rb +0 -22
  45. data/lib/fog/ovirt/requests/compute/v3/list_clusters.rb +0 -21
  46. data/lib/fog/ovirt/requests/compute/v3/list_instance_types.rb +0 -21
  47. data/lib/fog/ovirt/requests/compute/v3/list_networks.rb +0 -18
  48. data/lib/fog/ovirt/requests/compute/v3/list_operating_systems.rb +0 -21
  49. data/lib/fog/ovirt/requests/compute/v3/list_quotas.rb +0 -21
  50. data/lib/fog/ovirt/requests/compute/v3/list_template_interfaces.rb +0 -21
  51. data/lib/fog/ovirt/requests/compute/v3/list_template_volumes.rb +0 -21
  52. data/lib/fog/ovirt/requests/compute/v3/list_templates.rb +0 -21
  53. data/lib/fog/ovirt/requests/compute/v3/list_virtual_machines.rb +0 -21
  54. data/lib/fog/ovirt/requests/compute/v3/list_vm_interfaces.rb +0 -21
  55. data/lib/fog/ovirt/requests/compute/v3/list_vm_volumes.rb +0 -21
  56. data/lib/fog/ovirt/requests/compute/v3/list_volumes.rb +0 -21
  57. data/lib/fog/ovirt/requests/compute/v3/mock_files/affinitygroup.xml +0 -8
  58. data/lib/fog/ovirt/requests/compute/v3/mock_files/affinitygroup_vms.xml +0 -9
  59. data/lib/fog/ovirt/requests/compute/v3/mock_files/affinitygroups.xml +0 -17
  60. data/lib/fog/ovirt/requests/compute/v3/mock_files/cluster.xml +0 -20
  61. data/lib/fog/ovirt/requests/compute/v3/mock_files/clusters.xml +0 -39
  62. data/lib/fog/ovirt/requests/compute/v3/mock_files/data_centers.xml +0 -17
  63. data/lib/fog/ovirt/requests/compute/v3/mock_files/disks.xml +0 -58
  64. data/lib/fog/ovirt/requests/compute/v3/mock_files/instance_type.xml +0 -42
  65. data/lib/fog/ovirt/requests/compute/v3/mock_files/instance_types.xml +0 -197
  66. data/lib/fog/ovirt/requests/compute/v3/mock_files/nics.xml +0 -10
  67. data/lib/fog/ovirt/requests/compute/v3/mock_files/operating_systems.xml +0 -10
  68. data/lib/fog/ovirt/requests/compute/v3/mock_files/quotas.xml +0 -7
  69. data/lib/fog/ovirt/requests/compute/v3/mock_files/storage_domains.xml +0 -36
  70. data/lib/fog/ovirt/requests/compute/v3/mock_files/template.xml +0 -39
  71. data/lib/fog/ovirt/requests/compute/v3/mock_files/templates.xml +0 -110
  72. data/lib/fog/ovirt/requests/compute/v3/mock_files/vm.xml +0 -52
  73. data/lib/fog/ovirt/requests/compute/v3/mock_files/vms.xml +0 -152
  74. data/lib/fog/ovirt/requests/compute/v3/mock_files/volume.xml +0 -21
  75. data/lib/fog/ovirt/requests/compute/v3/mock_files/volumes.xml +0 -40
  76. data/lib/fog/ovirt/requests/compute/v3/remove_from_affinity_group.rb +0 -23
  77. data/lib/fog/ovirt/requests/compute/v3/storage_domains.rb +0 -22
  78. data/lib/fog/ovirt/requests/compute/v3/update_interface.rb +0 -36
  79. data/lib/fog/ovirt/requests/compute/v3/update_vm.rb +0 -20
  80. data/lib/fog/ovirt/requests/compute/v3/update_volume.rb +0 -37
  81. data/lib/fog/ovirt/requests/compute/v3/vm_action.rb +0 -24
  82. data/lib/fog/ovirt/requests/compute/v3/vm_start_with_cloudinit.rb +0 -21
  83. data/lib/fog/ovirt/requests/compute/v3/vm_ticket.rb +0 -19
  84. data/tests/ovirt/requests/compute/v3/client_tests.rb +0 -31
  85. data/tests/ovirt/requests/compute/v3/create_vm_tests.rb +0 -17
  86. data/tests/ovirt/requests/compute/v3/destroy_vm_tests.rb +0 -14
  87. data/tests/ovirt/requests/compute/v3/list_datacenters_tests.rb +0 -11
  88. data/tests/ovirt/requests/compute/v3/list_quotas_tests.rb +0 -10
  89. data/tests/ovirt/requests/compute/v3/list_storage_domains_tests.rb +0 -11
  90. data/tests/ovirt/requests/compute/v3/update_vm_tests.rb +0 -14
  91. data/tests/ovirt/requests/compute/v3/update_volume_tests.rb +0 -15
@@ -1,136 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3 < Fog::Service
5
- requires :ovirt_username, :ovirt_password
6
- recognizes :ovirt_url, :ovirt_server, :ovirt_port, :ovirt_api_path, :ovirt_datacenter,
7
- :ovirt_filtered_api, :public_key, :api_version,
8
- :ovirt_ca_cert_store, :ovirt_ca_cert_file, :ovirt_ca_no_verify
9
- request_path "fog/ovirt/requests/compute/v3"
10
-
11
- request :vm_action
12
- request :vm_start_with_cloudinit
13
- request :destroy_vm
14
- request :create_vm
15
- request :update_vm
16
- request :datacenters
17
- request :storage_domains
18
- request :list_virtual_machines
19
- request :get_virtual_machine
20
- request :list_templates
21
- request :get_template
22
- request :list_instance_types
23
- request :get_instance_type
24
- request :list_clusters
25
- request :get_cluster
26
- request :add_interface
27
- request :destroy_interface
28
- request :update_interface
29
- request :list_vm_interfaces
30
- request :list_template_interfaces
31
- request :list_networks
32
- request :vm_ticket
33
- request :list_vm_volumes
34
- request :list_template_volumes
35
- request :list_volumes
36
- request :add_volume
37
- request :get_volume
38
- request :destroy_volume
39
- request :update_volume
40
- request :attach_volume
41
- request :detach_volume
42
- request :activate_volume
43
- request :deactivate_volume
44
- request :get_api_version
45
- request :list_quotas
46
- request :get_quota
47
- request :list_affinity_groups
48
- request :get_affinity_group
49
- request :list_affinity_group_vms
50
- request :create_affinity_group
51
- request :destroy_affinity_group
52
- request :add_to_affinity_group
53
- request :remove_from_affinity_group
54
- request :list_operating_systems
55
-
56
- module Shared
57
- # converts an OVIRT object into an hash for fog to consume.
58
- def ovirt_attrs(obj)
59
- opts = { :raw => obj }
60
- obj.instance_variables.each do |v|
61
- key = v.to_s.delete("@").to_sym
62
- value = obj.instance_variable_get(v)
63
- # ignore nil values
64
- next if value.nil?
65
-
66
- opts[key] = case value
67
- when OVIRT::Link
68
- value.id
69
- when OVIRT::TemplateVersion
70
- value
71
- when Array
72
- value
73
- when Hash
74
- value
75
- else
76
- value.to_s.strip
77
- end
78
- end
79
- opts
80
- end
81
- end
82
-
83
- class Mock
84
- include Shared
85
-
86
- def initialize(_options = {})
87
- require "rbovirt"
88
- end
89
-
90
- private
91
-
92
- def client
93
- return @client if defined?(@client)
94
- end
95
-
96
- # read mocks xml
97
- def read_xml(file_name)
98
- file_path = File.join(__dir__, "../requests", "compute/v3", "mock_files", file_name)
99
- File.read(file_path)
100
- end
101
- end
102
-
103
- class Real
104
- include Shared
105
-
106
- def initialize(options = {})
107
- require "rbovirt"
108
- username = options[:ovirt_username]
109
- password = options[:ovirt_password]
110
- server = options[:ovirt_server]
111
- port = options[:ovirt_port] || 8080
112
- api_path = options[:ovirt_api_path] || "/api"
113
- url = options[:ovirt_url] || "#{@scheme}://#{server}:#{port}#{api_path}"
114
-
115
- connection_opts = {}
116
- connection_opts[:datacenter_id] = options[:ovirt_datacenter]
117
- connection_opts[:ca_cert_store] = options[:ovirt_ca_cert_store]
118
- connection_opts[:ca_cert_file] = options[:ovirt_ca_cert_file]
119
- connection_opts[:ca_no_verify] = options[:ovirt_ca_no_verify]
120
- connection_opts[:filtered_api] = options[:ovirt_filtered_api]
121
-
122
- @client = ExceptionWrapper.new(OVIRT::Client.new(username, password, url, connection_opts))
123
- end
124
-
125
- def api_version
126
- client.api_version
127
- end
128
-
129
- private
130
-
131
- attr_reader :client
132
- end
133
- end
134
- end
135
- end
136
- end
@@ -1,23 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def activate_volume(id, options)
7
- raise ArgumentError, "instance id is a required parameter" unless id
8
- raise ArgumentError, "volume id is a required parameter for activate-volume" unless options.key? :id
9
- client.activate_volume(id, options[:id])
10
- end
11
- end
12
-
13
- class Mock
14
- def activate_volume(id, options)
15
- raise ArgumentError, "instance id is a required parameter" unless id
16
- raise ArgumentError, "volume id is a required parameter for activate-volume" unless options.key? :id
17
- true
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,22 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def add_interface(id, options = {})
7
- raise ArgumentError, "instance id is a required parameter" unless id
8
-
9
- client.add_interface(id, options)
10
- end
11
- end
12
-
13
- class Mock
14
- def add_interface(id, _options = {})
15
- raise ArgumentError, "instance id is a required parameter" unless id
16
- true
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,23 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def add_to_affinity_group(id, options = {})
7
- raise ArgumentError, "instance id is a required parameter" unless id
8
- raise ArgumentError, "affinity group id is a required parameter for add-to-affinity-group" unless options.key? :id
9
- client.add_vm_to_affinity_group(options[:id], id)
10
- end
11
- end
12
-
13
- class Mock
14
- def add_to_affinity_group(id, options = {})
15
- raise ArgumentError, "instance id is a required parameter" unless id
16
- raise ArgumentError, "affinity group id is a required parameter for add-to-affinity-group" unless options.key? :id
17
- true
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,23 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- DISK_SIZE_TO_GB = 1_073_741_824
7
- def add_volume(id, options = {})
8
- raise ArgumentError, "instance id is a required parameter" unless id
9
- options[:size] = options[:size_gb].to_i * DISK_SIZE_TO_GB if options[:size_gb]
10
- client.add_volume(id, options)
11
- end
12
- end
13
-
14
- class Mock
15
- def add_volume(id, _options = {})
16
- raise ArgumentError, "instance id is a required parameter" unless id
17
- true
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,24 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def attach_volume(id, options)
7
- raise ArgumentError, "instance id is a required parameter" unless id
8
- raise ArgumentError, "volume id is a required parameter for attach-volume" unless options.key? :id
9
-
10
- client.attach_volume(id, options[:id])
11
- end
12
- end
13
-
14
- class Mock
15
- def attach_volume(id, options)
16
- raise ArgumentError, "instance id is a required parameter" unless id
17
- raise ArgumentError, "volume id is a required parameter for attach-volume" unless options.key? :id
18
- true
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,20 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def create_affinity_group(attrs)
7
- client.create_affinity_group(attrs)
8
- end
9
- end
10
-
11
- class Mock
12
- def create_affinity_group(_attrs)
13
- xml = read_xml("affinitygroup.xml")
14
- OVIRT::AffinityGroup.new(self, Nokogiri::XML(xml).root)
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,20 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def create_vm(attrs)
7
- client.create_vm(attrs)
8
- end
9
- end
10
-
11
- class Mock
12
- def create_vm(_attrs)
13
- xml = read_xml("vm.xml")
14
- OVIRT::VM.new(self, Nokogiri::XML(xml).root)
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,22 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def datacenters(filter = {})
7
- client.datacenters(filter).map { |ovirt_obj| ovirt_attrs ovirt_obj }
8
- end
9
- end
10
-
11
- class Mock
12
- def datacenters(_filters = {})
13
- xml = read_xml "data_centers.xml"
14
- Nokogiri::XML(xml).xpath("/data_centers/data_center").map do |dc|
15
- ovirt_attrs OVIRT::DataCenter.new(self, dc)
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
@@ -1,24 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def deactivate_volume(id, options)
7
- raise ArgumentError, "instance id is a required parameter" unless id
8
- raise ArgumentError, "volume id is a required parameter for deactivate-volume" unless options.key? :id
9
-
10
- client.deactivate_volume(id, options[:id])
11
- end
12
- end
13
-
14
- class Mock
15
- def deactivate_volume(id, options)
16
- raise ArgumentError, "instance id is a required parameter" unless id
17
- raise ArgumentError, "volume id is a required parameter for deactivate-volume" unless options.key? :id
18
- true
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,21 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def destroy_affinity_group(id)
7
- raise ArgumentError, "instance id is a required parameter" unless id
8
- client.destroy_affinity_group(id)
9
- end
10
- end
11
-
12
- class Mock
13
- def destroy_affinity_group(id)
14
- raise ArgumentError, "instance id is a required parameter" unless id
15
- true
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,24 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def destroy_interface(id, options)
7
- raise ArgumentError, "instance id is a required parameter" unless id
8
- raise ArgumentError, "interface id is a required parameter for destroy-interface" unless options.key? :id
9
-
10
- client.destroy_interface(id, options[:id])
11
- end
12
- end
13
-
14
- class Mock
15
- def destroy_interface(id, options)
16
- raise ArgumentError, "instance id is a required parameter" unless id
17
- raise ArgumentError, "interface id is a required parameter for destroy-interface" unless options.key? :id
18
- true
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,21 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def destroy_vm(options = {})
7
- raise ArgumentError, "instance id is a required parameter" unless options.key? :id
8
- client.destroy_vm(options[:id])
9
- end
10
- end
11
-
12
- class Mock
13
- def destroy_vm(options = {})
14
- raise ArgumentError, "instance id is a required parameter" unless options.key? :id
15
- true
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,24 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def destroy_volume(id, options)
7
- raise ArgumentError, "instance id is a required parameter" unless id
8
- raise ArgumentError, "volume id is a required parameter for destroy-volume" unless options.key? :id
9
-
10
- client.destroy_volume(id, options[:id])
11
- end
12
- end
13
-
14
- class Mock
15
- def destroy_volume(id, options)
16
- raise ArgumentError, "instance id is a required parameter" unless id
17
- raise ArgumentError, "volume id is a required parameter for destroy-volume" unless options.key? :id
18
- true
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,24 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def detach_volume(id, options)
7
- raise ArgumentError, "instance id is a required parameter" unless id
8
- raise ArgumentError, "volume id is a required parameter for detach-volume" unless options.key? :id
9
-
10
- client.detach_volume(id, options[:id])
11
- end
12
- end
13
-
14
- class Mock
15
- def detach_volume(id, options)
16
- raise ArgumentError, "instance id is a required parameter" unless id
17
- raise ArgumentError, "volume id is a required parameter for detach-volume" unless options.key? :id
18
- true
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,20 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def get_affinity_group(id)
7
- ovirt_attrs client.affinity_group(id)
8
- end
9
- end
10
-
11
- class Mock
12
- def get_affinity_group(_id)
13
- xml = read_xml("affinitygroup.xml")
14
- ovirt_attrs OVIRT::AffinityGroup.new(self, Nokogiri::XML(xml).root)
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,18 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def api_version
7
- client.api_version
8
- end
9
- end
10
- class Mock
11
- def api_version
12
- "3.1"
13
- end
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,19 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def get_cluster(id)
7
- ovirt_attrs client.cluster(id)
8
- end
9
- end
10
- class Mock
11
- def get_cluster(_id)
12
- xml = read_xml("cluster.xml")
13
- ovirt_attrs OVIRT::Cluster.new(self, Nokogiri::XML(xml).root)
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def get_instance_type(id)
7
- ovirt_attrs client.instance_type(id)
8
- end
9
- end
10
- class Mock
11
- def get_instance_type(_id)
12
- xml = read_xml "instance_type.xml"
13
- ovirt_attrs OVIRT::InstanceType.new(self, Nokogiri::XML(xml).root)
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def get_quota(id)
7
- ovirt_attrs client.quota(id)
8
- end
9
- end
10
- class Mock
11
- def get_quota(_id)
12
- xml = read_xml("quota.xml")
13
- ovirt_attrs OVIRT::Quota.new(self, Nokogiri::XML(xml).root)
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def get_template(id)
7
- ovirt_attrs client.template(id)
8
- end
9
- end
10
- class Mock
11
- def get_template(_id)
12
- xml = read_xml "template.xml"
13
- ovirt_attrs OVIRT::Template.new(self, Nokogiri::XML(xml).root)
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def get_virtual_machine(id)
7
- ovirt_attrs client.vm(id)
8
- end
9
- end
10
- class Mock
11
- def get_virtual_machine(_id)
12
- xml = read_xml "vm.xml"
13
- ovirt_attrs OVIRT::VM.new(self, Nokogiri::XML(xml).root)
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def get_volume(id)
7
- ovirt_attrs client.disk(id)
8
- end
9
- end
10
- class Mock
11
- def get_volume(_id)
12
- xml = read_xml("volume.xml")
13
- ovirt_attrs OVIRT::Volume.new(self, Nokogiri::XML(xml).root)
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,24 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def list_affinity_group_vms(id)
7
- client.affinity_group_vms(id).map { |vm| servers.get(vm.id) }
8
- end
9
- end
10
-
11
- class Mock
12
- def list_affinity_group_vms(_id)
13
- vms = []
14
- Nokogiri::XML(read_xml("affinitygroup_vms.xml")).xpath("/vms/vm/@id").each do |id|
15
- xml = Nokogiri::XML(read_xml("vms.xml")).xpath(format("/vms/vm[@id='%<id>s']", id.value)).first
16
- vms << ovirt_attrs(OVIRT::VM.new(self, xml))
17
- end
18
- vms
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,22 +0,0 @@
1
- module Fog
2
- module Ovirt
3
- class Compute
4
- class V3
5
- class Real
6
- def list_affinity_groups(filters = {})
7
- client.affinity_groups(filters).map { |ovirt_obj| ovirt_attrs ovirt_obj }
8
- end
9
- end
10
-
11
- class Mock
12
- def list_affinity_groups(_filters = {})
13
- xml = read_xml("affinitygroups.xml")
14
- Nokogiri::XML(xml).xpath("/affinity_groups/affinity_group").map do |ag|
15
- ovirt_attrs OVIRT::AffinityGroup.new(self, ag)
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end