opennebula 6.10.3 → 6.99.85.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cloud/CloudClient.rb +3 -3
  3. data/lib/models/role.rb +349 -823
  4. data/lib/models/service.rb +156 -80
  5. data/lib/models/vmrole.rb +703 -0
  6. data/lib/models/vrrole.rb +284 -0
  7. data/lib/models.rb +3 -1
  8. data/lib/opennebula/acl.rb +1 -1
  9. data/lib/opennebula/acl_pool.rb +1 -1
  10. data/lib/opennebula/backupjob.rb +1 -1
  11. data/lib/opennebula/backupjob_pool.rb +1 -1
  12. data/lib/opennebula/client.rb +1 -1
  13. data/lib/opennebula/cluster.rb +45 -2
  14. data/lib/opennebula/cluster_pool.rb +1 -1
  15. data/lib/opennebula/datastore.rb +1 -1
  16. data/lib/opennebula/datastore_pool.rb +1 -1
  17. data/lib/opennebula/document.rb +1 -1
  18. data/lib/opennebula/document_json.rb +1 -1
  19. data/lib/opennebula/document_pool.rb +1 -1
  20. data/lib/opennebula/document_pool_json.rb +1 -1
  21. data/lib/opennebula/error.rb +1 -1
  22. data/lib/opennebula/flow/grammar.rb +1 -1
  23. data/lib/opennebula/flow/service_pool.rb +1 -1
  24. data/lib/opennebula/flow/service_template.rb +353 -97
  25. data/lib/opennebula/flow/service_template_ext.rb +3 -3
  26. data/lib/opennebula/flow/service_template_pool.rb +1 -1
  27. data/lib/opennebula/flow/validator.rb +458 -410
  28. data/lib/opennebula/flow.rb +1 -1
  29. data/lib/opennebula/group.rb +1 -1
  30. data/lib/opennebula/group_pool.rb +1 -1
  31. data/lib/opennebula/hook.rb +1 -1
  32. data/lib/opennebula/hook_log.rb +1 -1
  33. data/lib/opennebula/hook_pool.rb +1 -1
  34. data/lib/opennebula/host.rb +1 -60
  35. data/lib/opennebula/host_pool.rb +1 -1
  36. data/lib/opennebula/image.rb +1 -1
  37. data/lib/opennebula/image_pool.rb +1 -1
  38. data/lib/opennebula/ldap_auth.rb +1 -1
  39. data/lib/opennebula/ldap_auth_spec.rb +1 -1
  40. data/lib/opennebula/lockable_ext.rb +1 -1
  41. data/lib/opennebula/marketplace.rb +1 -1
  42. data/lib/opennebula/marketplace_pool.rb +1 -1
  43. data/lib/opennebula/marketplaceapp.rb +1 -1
  44. data/lib/opennebula/marketplaceapp_ext.rb +14 -211
  45. data/lib/opennebula/marketplaceapp_pool.rb +1 -1
  46. data/lib/opennebula/oneflow_client.rb +11 -9
  47. data/lib/opennebula/pool.rb +1 -1
  48. data/lib/opennebula/pool_element.rb +1 -1
  49. data/lib/opennebula/security_group.rb +1 -1
  50. data/lib/opennebula/security_group_pool.rb +1 -1
  51. data/lib/opennebula/server_cipher_auth.rb +1 -1
  52. data/lib/opennebula/server_x509_auth.rb +1 -1
  53. data/lib/opennebula/ssh_auth.rb +1 -1
  54. data/lib/opennebula/system.rb +1 -1
  55. data/lib/opennebula/template.rb +1 -1
  56. data/lib/opennebula/template_ext.rb +1 -1
  57. data/lib/opennebula/template_pool.rb +1 -1
  58. data/lib/opennebula/user.rb +1 -1
  59. data/lib/opennebula/user_pool.rb +1 -1
  60. data/lib/opennebula/utils.rb +2 -2
  61. data/lib/opennebula/vdc.rb +1 -1
  62. data/lib/opennebula/vdc_pool.rb +1 -1
  63. data/lib/opennebula/virtual_machine.rb +3 -12
  64. data/lib/opennebula/virtual_machine_ext.rb +2 -31
  65. data/lib/opennebula/virtual_machine_pool.rb +1 -1
  66. data/lib/opennebula/virtual_network.rb +1 -1
  67. data/lib/opennebula/virtual_network_pool.rb +1 -1
  68. data/lib/opennebula/virtual_router.rb +1 -1
  69. data/lib/opennebula/virtual_router_pool.rb +1 -1
  70. data/lib/opennebula/vm_group.rb +1 -1
  71. data/lib/opennebula/vm_group_pool.rb +1 -1
  72. data/lib/opennebula/vntemplate.rb +1 -1
  73. data/lib/opennebula/vntemplate_pool.rb +1 -1
  74. data/lib/opennebula/wait_ext.rb +1 -1
  75. data/lib/opennebula/x509_auth.rb +1 -1
  76. data/lib/opennebula/xml_element.rb +2 -2
  77. data/lib/opennebula/xml_pool.rb +1 -1
  78. data/lib/opennebula/xml_utils.rb +1 -1
  79. data/lib/opennebula/zone.rb +1 -1
  80. data/lib/opennebula/zone_pool.rb +1 -1
  81. data/lib/opennebula.rb +2 -2
  82. metadata +6 -67
  83. data/lib/ActionManager.rb +0 -280
  84. data/lib/CommandManager.rb +0 -328
  85. data/lib/DriverExecHelper.rb +0 -213
  86. data/lib/HostSyncManager.rb +0 -111
  87. data/lib/OpenNebulaDriver.rb +0 -223
  88. data/lib/VirtualMachineDriver.rb +0 -404
  89. data/lib/datacenter.rb +0 -1319
  90. data/lib/datastore.rb +0 -1049
  91. data/lib/distributed_firewall.rb +0 -293
  92. data/lib/file_helper.rb +0 -374
  93. data/lib/host.rb +0 -1518
  94. data/lib/logical_port.rb +0 -50
  95. data/lib/logical_switch.rb +0 -77
  96. data/lib/memoize.rb +0 -74
  97. data/lib/network.rb +0 -705
  98. data/lib/nsx_client.rb +0 -157
  99. data/lib/nsx_component.rb +0 -28
  100. data/lib/nsx_constants.rb +0 -162
  101. data/lib/nsx_driver.rb +0 -91
  102. data/lib/nsx_error.rb +0 -77
  103. data/lib/nsx_rule.rb +0 -206
  104. data/lib/nsxt_client.rb +0 -189
  105. data/lib/nsxt_dfw.rb +0 -196
  106. data/lib/nsxt_logical_port.rb +0 -94
  107. data/lib/nsxt_rule.rb +0 -188
  108. data/lib/nsxt_tz.rb +0 -38
  109. data/lib/nsxv_client.rb +0 -189
  110. data/lib/nsxv_dfw.rb +0 -202
  111. data/lib/nsxv_logical_port.rb +0 -107
  112. data/lib/nsxv_rule.rb +0 -172
  113. data/lib/nsxv_tz.rb +0 -41
  114. data/lib/opaque_network.rb +0 -134
  115. data/lib/rest_client.rb +0 -191
  116. data/lib/scripts_common.rb +0 -176
  117. data/lib/transport_zone.rb +0 -43
  118. data/lib/vcenter_driver.rb +0 -152
  119. data/lib/vcenter_importer.rb +0 -626
  120. data/lib/vi_client.rb +0 -273
  121. data/lib/vi_helper.rb +0 -328
  122. data/lib/virtual_machine.rb +0 -3574
  123. data/lib/virtual_wire.rb +0 -158
  124. data/lib/vm_device.rb +0 -80
  125. data/lib/vm_disk.rb +0 -202
  126. data/lib/vm_folder.rb +0 -69
  127. data/lib/vm_helper.rb +0 -30
  128. data/lib/vm_monitor.rb +0 -305
  129. data/lib/vm_nic.rb +0 -70
  130. data/lib/vm_template.rb +0 -2112
  131. data/lib/vmm_importer.rb +0 -165
data/lib/virtual_wire.rb DELETED
@@ -1,158 +0,0 @@
1
- # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2024, OpenNebula Project, OpenNebula Systems #
3
- # #
4
- # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
- # not use this file except in compliance with the License. You may obtain #
6
- # 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, #
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13
- # See the License for the specific language governing permissions and #
14
- # limitations under the License. #
15
- #--------------------------------------------------------------------------- #
16
- module NSXDriver
17
-
18
- # Class VirtualWire NSX-V Network
19
- class VirtualWire < LogicalSwitch
20
-
21
- # CONSTRUCTOR
22
- def initialize(nsx_client, ls_id = nil, tz_id = nil, ls_data = nil)
23
- super(nsx_client)
24
- if ls_id
25
- initialize_with_id(ls_id)
26
- else
27
- if tz_id && ls_data
28
- begin
29
- @ls_id = new_logical_switch(ls_data, tz_id)
30
- rescue NSXError::IncorrectResponseCodeError => e
31
- raise 'VirtualWire not created in NSX Manager: ' \
32
- "#{e.message}"
33
- end
34
- unless @ls_id
35
- raise 'Virtual Wire not created in NSX Manager: ' \
36
- 'generic error'
37
- end
38
-
39
- # Construct URL of the created logical switch
40
- @url_ls = NSXConstants::NSXV_LS_SECTION + @ls_id
41
- @ls_vni = ls_vni
42
- @ls_name = ls_name
43
- @tz_id = ls_tz
44
- @tenant_id = 'virtual wire tenant'
45
- @guest_vlan_allowed = false
46
- end
47
- end
48
- end
49
-
50
- # Creates a VirtualWire from its name
51
- def self.new_from_name(nsx_client, ls_name)
52
- virtualwire = new(nsx_client)
53
- ls_id = virtualwire.ls_id_from_name(nsx_client, ls_name)
54
- unless ls_id
55
- error_msg = "VirtualWire with name: #{ls_name} not found"
56
- error = NSXError::ObjectNotFound
57
- .new(error_msg)
58
- raise error
59
- end
60
-
61
- # initialize_with_id(@ls_id)
62
- virtualwire.initialize_with_id(ls_id)
63
- virtualwire
64
- end
65
-
66
- # Creates a VirtualWire from its id
67
- def initialize_with_id(ls_id)
68
- @ls_id = ls_id
69
- # Construct URL of the created logical switch
70
- @url_ls = NSXConstants::NSXV_LS_SECTION + \
71
- @ls_id
72
- # Raise an error if VirtualWire id doesn't exists
73
- unless ls?
74
- error_msg = "VirtualWire with id: #{ls_id} not found"
75
- error = NSXError::ObjectNotFound
76
- .new(error_msg)
77
- raise error
78
- end
79
-
80
- @ls_vni = ls_vni
81
- @ls_name = ls_name
82
- @tz_id = ls_tz
83
- @tenant_id = 'virtual wire tenant'
84
- @guest_vlan_allowed = false
85
- end
86
-
87
- # Get the logical switch id from its name
88
- def ls_id_from_name(nsx_client, name)
89
- url = NSXConstants::NSXV_LS_SECTION
90
- virtualwires = nsx_client
91
- .get(url)
92
- .xpath(NSXConstants::NSXV_LS_XPATH)
93
- virtualwires.each do |virtualwire|
94
- lsname_arr = name.split('-sid-')
95
- lsname = lsname_arr[-1].split('-', 2)[-1]
96
- lsid = lsname_arr[0].split(/vxw-dvs-\w.-/)[-1]
97
- if virtualwire.xpath('name').text == lsname &&
98
- virtualwire.xpath('objectId').text == lsid
99
- return virtualwire.xpath('objectId').text
100
- end
101
- end
102
- nil
103
- end
104
-
105
- # METHODS
106
-
107
- # Check if logical switch exists
108
- def ls?
109
- @nsx_client.get(@url_ls) ? true : false
110
- end
111
-
112
- # Get logical switch's name
113
- def ls_name
114
- @nsx_client.get(@url_ls)
115
- .xpath(NSXConstants::NSXV_LS_NAME_XPATH).text
116
- end
117
-
118
- # Get logical switch's vni
119
- def ls_vni
120
- @nsx_client.get(@url_ls)
121
- .xpath(NSXConstants::NSXV_LS_VNI_XPATH).text
122
- end
123
-
124
- # Get the Transport Zone of the logical switch
125
- def ls_tz
126
- @nsx_client.get(@url_ls)
127
- .xpath(NSXConstants::NSXV_TZ_XPATH).text
128
- end
129
-
130
- # Get the logical switch reference into vcenter
131
- def ls_vcenter_ref
132
- @nsx_client.get(@url_ls)
133
- .xpath(NSXConstants::NSXV_LS_BACKING_XPATH)
134
- .text
135
- end
136
-
137
- # Get the distributed virtual switch's ref associated to a LS
138
- def ls_dvs_ref
139
- @nsx_client.get(@url_ls)
140
- .xpath(NSXConstants::NSXV_LS_OBJECTID_XPATH)
141
- .text
142
- end
143
-
144
- # Create a new logical switch (NSX-V: virtualwire)
145
- def new_logical_switch(ls_data, tz_id)
146
- url = "#{NSXConstants::NSXV_TZ_SECTION}#{tz_id}" \
147
- '/virtualwires'
148
- @nsx_client.post(url, ls_data)
149
- end
150
-
151
- # Delete a logical switch
152
- def delete_logical_switch
153
- @nsx_client.delete(@url_ls)
154
- end
155
-
156
- end
157
-
158
- end
data/lib/vm_device.rb DELETED
@@ -1,80 +0,0 @@
1
- module VirtualMachineDevice
2
-
3
- ############################################################################
4
- # Device Classes
5
- ############################################################################
6
- # Device base class
7
- #
8
- # @param id [Integer] The OpenNebula resource id
9
- # @param one_res [XMLElement] The OpenNebula representation of the object
10
- # @param vc_res [vCenter_class_specific] vCenter object representation
11
- ############################################################################
12
- class Device
13
-
14
- def initialize(id, one_res, vc_res)
15
- @id = id
16
- @one_res = one_res
17
- @vc_res = vc_res
18
- end
19
-
20
- def id
21
- raise_if_no_exists_in_one
22
- @id
23
- end
24
-
25
- def one_item
26
- raise_if_no_exists_in_one
27
- @one_res
28
- end
29
-
30
- def vc_item
31
- raise_if_no_exists_in_vcenter
32
- @vc_res
33
- end
34
-
35
- def one?
36
- !@one_res.nil?
37
- end
38
-
39
- def exists?
40
- !@vc_res.nil?
41
- end
42
-
43
- # Fails if the device is not present in OpenNebula
44
- def raise_if_no_exists_in_one
45
- raise 'OpenNebula device does not exist at the moment' unless one?
46
- end
47
-
48
- # Fails if the device is not present in vCenter
49
- def raise_if_no_exists_in_vcenter
50
- raise 'vCenter device does not exist at the moment' unless exists?
51
- end
52
-
53
- def no_exists?
54
- !exists?
55
- end
56
-
57
- def synced?
58
- one? && exists?
59
- end
60
-
61
- def unsynced?
62
- !synced?
63
- end
64
-
65
- def detached?
66
- !one?
67
- end
68
-
69
- def managed?
70
- raise_if_no_exists_in_one
71
-
72
- return unless @one_res
73
-
74
- !(@one_res['OPENNEBULA_MANAGED'] &&
75
- @one_res['OPENNEBULA_MANAGED'].downcase == 'no')
76
- end
77
-
78
- end
79
-
80
- end
data/lib/vm_disk.rb DELETED
@@ -1,202 +0,0 @@
1
- # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2024, OpenNebula Project, OpenNebula Systems #
3
- # #
4
- # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
- # not use this file except in compliance with the License. You may obtain #
6
- # 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, #
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13
- # See the License for the specific language governing permissions and #
14
- # limitations under the License. #
15
- #--------------------------------------------------------------------------- #
16
- module VirtualMachineDevice
17
-
18
- # Disk class
19
- class Disk < Device
20
-
21
- attr_reader :size
22
-
23
- # Create the OpenNebula disk representation
24
- # Allow us to create the class without vCenter representation
25
- # example: attached disks not synced with vCenter
26
- def self.one_disk(id, one_res)
27
- new(id, one_res, nil)
28
- end
29
-
30
- # Create the vCenter disk representation
31
- # Allow us to create the class without OpenNebula representation
32
- # example: detached disks that not exists in OpenNebula
33
- def self.vc_disk(vc_res)
34
- new(nil, nil, vc_res)
35
- end
36
-
37
- def storpod?
38
- raise_if_no_exists_in_one
39
- @one_res['VCENTER_DS_REF'].start_with?('group-')
40
- end
41
-
42
- def device
43
- raise_if_no_exists_in_vcenter
44
- @vc_res[:device]
45
- end
46
-
47
- def node
48
- raise_if_no_exists_in_vcenter
49
- @vc_res[:tag]
50
- end
51
-
52
- def path
53
- raise_if_no_exists_in_vcenter
54
- @vc_res[:path_wo_ds]
55
- end
56
-
57
- def ds
58
- raise_if_no_exists_in_vcenter
59
- @vc_res[:datastore]
60
- end
61
-
62
- def image_ds_ref
63
- raise_if_no_exists_in_one
64
- @one_res['VCENTER_DS_REF']
65
- end
66
-
67
- def key
68
- raise_if_no_exists_in_vcenter
69
- @vc_res[:key]
70
- end
71
-
72
- def prefix
73
- raise_if_no_exists_in_vcenter
74
- @vc_res[:prefix]
75
- end
76
-
77
- def type
78
- raise_if_no_exists_in_vcenter
79
- @vc_res[:type]
80
- end
81
-
82
- def file
83
- path.split('/').last
84
- end
85
-
86
- def cd?
87
- raise_if_no_exists_in_vcenter
88
- @vc_res[:type] == 'CDROM'
89
- end
90
-
91
- def config(action)
92
- raise_if_no_exists_in_vcenter
93
-
94
- config = {}
95
-
96
- case action
97
- when :delete
98
- if managed?
99
- key = "opennebula.mdisk.#{@id}"
100
- else
101
- key = "opennebula.disk.#{@id}"
102
- end
103
-
104
- config[:key] = key
105
- config[:value] = ''
106
- when :resize
107
- if new_size
108
- d = device
109
- d.capacityInKB = new_size
110
- config[:device] = d
111
- config[:operation] = :edit
112
- end
113
- when :attach
114
- puts 'not supported'
115
- end
116
-
117
- config
118
- end
119
-
120
- def persistent?
121
- raise_if_no_exists_in_one
122
- @one_res['PERSISTENT'] == 'YES'
123
- end
124
-
125
- def volatile?
126
- raise_if_no_exists_in_one
127
- @one_res['TYPE'] && @one_res['TYPE'].downcase == 'fs'
128
- end
129
-
130
- def cloned?
131
- raise_if_no_exists_in_one
132
- @one_res['SOURCE'] != @vc_res[:path_wo_ds]
133
- end
134
-
135
- def connected?
136
- raise_if_no_exists_in_vcenter
137
- @vc_res[:device].connectable.connected
138
- end
139
-
140
- def boot_dev
141
- if cd?
142
- RbVmomi::VIM.VirtualMachineBootOptionsBootableCdromDevice()
143
- else
144
- RbVmomi::VIM.VirtualMachineBootOptionsBootableDiskDevice(
145
- :deviceKey => device.key
146
- )
147
- end
148
- end
149
-
150
- def change_size(size)
151
- size = size.to_i
152
-
153
- if @one_res['ORIGINAL_SIZE'] &&
154
- @one_res['ORIGINAL_SIZE'].to_i >= size
155
- raise "'disk-resize' cannot decrease the disk's size"
156
- end
157
-
158
- @size = size
159
- end
160
-
161
- # Shrink not supported (nil). Size is in KB
162
- def new_size
163
- return @size * 1024 if @size
164
-
165
- return unless @one_res['ORIGINAL_SIZE']
166
-
167
- osize = @one_res['ORIGINAL_SIZE'].to_i
168
- nsize = @one_res['SIZE'].to_i
169
- nsize > osize ? nsize * 1024 : nil
170
- end
171
-
172
- def destroy
173
- return if cd?
174
-
175
- raise_if_no_exists_in_vcenter
176
-
177
- ds = VCenterDriver::Datastore.new(self.ds)
178
- img_path = path
179
-
180
- begin
181
- img_dir = File.dirname(img_path)
182
- search_params = ds.get_search_params(
183
- ds['name'],
184
- img_dir,
185
- File.basename(img_path)
186
- )
187
- search_task = ds['browser']
188
- .SearchDatastoreSubFolders_Task(search_params)
189
- search_task.wait_for_completion
190
- ds.delete_virtual_disk(img_path)
191
- ds.rm_directory(img_dir) if ds.dir_empty?(img_dir)
192
- rescue StandardError => e
193
- if !e.message.start_with?('FileNotFound')
194
- # Ignore FileNotFound
195
- raise e.message
196
- end
197
- end
198
- end
199
-
200
- end
201
-
202
- end
data/lib/vm_folder.rb DELETED
@@ -1,69 +0,0 @@
1
- # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2024, OpenNebula Project, OpenNebula Systems #
3
- # #
4
- # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
- # not use this file except in compliance with the License. You may obtain #
6
- # 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, #
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13
- # See the License for the specific language governing permissions and #
14
- # limitations under the License. #
15
- #--------------------------------------------------------------------------- #
16
-
17
- module VCenterDriver
18
-
19
- # VirtualMachineFolder class
20
- class VirtualMachineFolder
21
-
22
- attr_accessor :item, :items
23
-
24
- def initialize(item)
25
- @item = item
26
- check_item(@item, nil)
27
- @items = {}
28
- end
29
-
30
- ########################################################################
31
- # Builds a hash with Datastore-Ref / Datastore to be used as a cache
32
- # @return [Hash] in the form
33
- # { ds_ref [Symbol] => Datastore object }
34
- ########################################################################
35
-
36
- def fetch!
37
- VIClient.get_entities(@item, 'VirtualMachine').each do |item|
38
- item_name = item._ref
39
- @items[item_name.to_sym] = VirtualMachine.new_with_item(item)
40
- end
41
- end
42
-
43
- def fetch_templates!
44
- VIClient.get_entities(@item, 'VirtualMachine').each do |item|
45
- if item.config.template
46
- item_name = item._ref
47
- @items[item_name.to_sym] = Template.new(item)
48
- end
49
- end
50
- end
51
-
52
- ########################################################################
53
- # Returns a Datastore. Uses the cache if available.
54
- # @param ref [Symbol] the vcenter ref
55
- # @return Datastore
56
- ########################################################################
57
-
58
- def get(ref)
59
- if !@items[ref.to_sym]
60
- rbvmomi_dc = RbVmomi::VIM::Datastore.new(@item._connection, ref)
61
- @items[ref.to_sym] = Datastore.new(rbvmomi_dc)
62
- end
63
-
64
- @items[ref.to_sym]
65
- end
66
-
67
- end
68
-
69
- end
data/lib/vm_helper.rb DELETED
@@ -1,30 +0,0 @@
1
- # -------------------------------------------------------------------------- #
2
- # Copyright 2002-2024, OpenNebula Project, OpenNebula Systems #
3
- # #
4
- # Licensed under the Apache License, Version 2.0 (the "License"); you may #
5
- # not use this file except in compliance with the License. You may obtain #
6
- # 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, #
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
13
- # See the License for the specific language governing permissions and #
14
- # limitations under the License. #
15
- #--------------------------------------------------------------------------- #
16
- module VirtualMachineHelper
17
-
18
- # This method raises an exception if the timeout is reached
19
- # The exception needs to be handled in the VMM drivers and any
20
- # process that uses this method
21
- def wait_timeout(action, timeout = 300)
22
- time_start = Time.now
23
- until send(action)
24
- sleep(1)
25
- condition = (Time.now - time_start).to_i >= timeout
26
- raise 'Reached deploy timeout' if condition
27
- end
28
- end
29
-
30
- end